Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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?

In reply to Re (tilly) 2: Tie::Static by tilly
in thread Tie::Static by tilly

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • 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.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2024-04-19 12:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found