Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^2: Dereferencing %hash that does not exist. (conditional)

by perldarren (Novice)
on Sep 04, 2013 at 10:30 UTC ( #1052283=note: print w/ replies, xml ) Need Help??


in reply to Re: Dereferencing %hash that does not exist. (conditional)
in thread Dereferencing %hash that does not exist.

Cool problem solved, thanks very much

Never fails to amaze me how I sometimes just seem to have no grasp on something so fundamental :(

I keep on trying though !

Regards,
Darren


Comment on Re^2: Dereferencing %hash that does not exist. (conditional)
Re^3: Dereferencing %hash that does not exist. (conditional)
by perldarren (Novice) on Sep 04, 2013 at 18:15 UTC
    Ok, so I implemented the eval variant of this and it seems to work well, thank you guys.
    I now have a slightly different issue.

    my::module::exit_routine is also passed into a simple logging module that I put together like this:
    my $log = LogSimple->new(logdir => $logdir, logfile => $logfile, exit +=> \&my::module::exit_routine )
    In this particular script whenever my::module::exit_routine is called I need to pass the %modifier dispatch table so I need to setup the $log object like this:
    my $log = LogSimple->new(logdir => $logdir, logfile => $logfile, exit +=> \&my::module::exit_routine(\%modifier) )
    Except this does not work, the error is:
    Not a CODE reference at /usr/local/lib/perl5/site_perl/5.10.1/LogSimple.pm

    I have to admit that my OOP is really in it's infancy.

    Really not sure on this one so any help much appreciated.

    Cheers, Darren

      The expression  \&my::module::exit_routine is evaluated at compile time and so, of course, cannot 'take' an argument (although the LogSimple module, to which you offer no link and which doesn't appear on CPAN or MetaCPAN, may provide a way around this; see its documentation). A typical work-around would be something like (untested)
          exit => sub { return my::module::exit_routine(\%modifier); }

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (13)
As of 2014-07-22 14:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (115 votes), past polls