The reason for the extra layer of indirection is that
when I wrote it I was thinking that you would tie to
the type of the variable. So you would tie to
Tie::Static::Hash, etc. In fact I am still unsure whether
it is better to always tie to Tie::Static, or to tie to
the actual package that you are blessed into. There is
something to be said for a consistent interface. There
is also something to be said for not violating expectations
about what
tied is.
As for the examples you offer of broken ties, read the first
paragraph of "bugs". While it does not offer your examples,
it is clear about the fact that the heuristic uses
package, filename, and line number. Do you think it is
clear enough to warn people away from that map trick?
Personally I am inclined to believe that someone who wants
many tied variables will generally just tie a hash. Do
you think that is wrong? Would it make sense to offer a
function that takes a list of variables and ties them?
Something like this?
sub static {
my $called = join ":", caller();
tie ($_[$_], 'Tie::Static', $called, $_) for 0..$#_;
}
Then people can just call:
static my ($foo, $bar, $baz);
Yes? No? Maybe?
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.