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)

Replies are listed 'Best First'.
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?
[Corion]: marto: I used Padre for some time but then switched to Notepad++, since all the funky features I wanted to put into Padre couldn't be made to work, and/or I lost interest :)
[Discipulus]: indeed marto I dunno. I tested once and many years ago. But I'm not the programmer yardstick. I try to install Padre via cpan now just to add a line about it in the issue. Strawberryperl all life long!
[marto]: yeah, when I worked on Windows I did use Np++ all the time

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (11)
As of 2018-06-25 08:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?



    Results (126 votes). Check out past polls.

    Notices?