No, the difference here is that you make this call $dbh->connect_cached() so that instead of just storing your object - you revivify it automatically as needed. I think of this as important for something that will be long running - I'd just go with a plain stored value otherwise.
sub main::dbh { # for daemons and long running code - reconnect as needed DBI->connect_cached( ... ) } sub main::dbh { # initialize the connection or re-use. $::DBH ||= DBI->connect( ... ) }
In reply to Re^5: Does there exist a CPAN module for lazily initialized variables?
by diotalevi
in thread Does there exist a CPAN module for lazily initialized variables?
by jryan
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |