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

Re^6: Does there exist a CPAN module for lazily initialized variables?

by jryan (Vicar)
on Jul 14, 2004 at 20:45 UTC ( [id://374437]=note: print w/replies, xml ) Need Help??


in reply to Re^5: Does there exist a CPAN module for lazily initialized variables?
in thread Does there exist a CPAN module for lazily initialized variables?

Wouldn't that be something to change in the callback sub that you'd pass to the tie call?

  • Comment on Re^6: Does there exist a CPAN module for lazily initialized variables?

Replies are listed 'Best First'.
Re^7: Does there exist a CPAN module for lazily initialized variables?
by diotalevi (Canon) on Jul 14, 2004 at 20:53 UTC
    Sure you could, but I wouldn't bother tying it at this point. You have to have one globally accessible symbol by which to reach this connection. Either it happens explicitly through &::dbh() or implicitly through tied $::dbh. I'd generally prefer to leave off with the tying to avoid excessive cuteness.

      *shrug*. I don't think the purpose of the tie here is cuteness, but to actually separate the initialization details from the code. (Also, I'm not using globals, but package-scoped lexicals declared with my). I guess I could write a module that supported either interface (tied or functional). Hell, most of the code for both cases is already written in this very thread!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://374437]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2024-04-24 02:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found