Cody Pendant has asked for the wisdom of the Perl Monks concerning the following question:

I'm experimenting with persistence.

I've got Storable.pm installed, but it keeps giving fatal errors because it can't find Log::Agent.

For some reason I can't install Log::Agent on the OS X machine I'm working with.

So I tried to use Tie::Persistent, but same problem, because T::P uses Storable too.

But, wait, it says it uses Storable "optionally", so I should be OK?

Only I can't figure out how to not use Storable. There's a config variable which if set to "true" uses Data::Dumper instead of Storable for, er, something, but that doesn't seem to make any difference, it still dies because it can't use Log:::Agent.

I'm confused.

Assuming someone can't help me install Log::Agent on OS X (but that would be nice) can you help me to store my Hash of Arrays in any other way?
--

“Every bit of code is either naturally related to the problem at hand, or else it's an accidental side effect of the fact that you happened to solve the problem using a digital computer.”
M-J D

Replies are listed 'Best First'.
Re: Can't Use Storable on OS X?
by edan (Curate) on Jun 17, 2003 at 08:29 UTC

    Well, looking at the source for Storable (2.07) on cpan, it seems to me that Log::Agent is optional, as is evidenced by the following code taken from Storable.pm:

    # # Use of Log::Agent is optional # eval "use Log::Agent";

    So either you're using a different version of Storable, in which Log::Agent is required (I find that hard to believe), or there's a bug in Storable, or something else is going on. Can you provide some sample code, and perhaps actual error messages that you're getting, something more informative than 'it keeps giving fatal errors because it can't find Log::Agent'?

    I hope you can get Storable to work for you, since it's a great module, but as a fall-back plan, you could try storing your Hash of Arrays using Data::Dumper itself, printing the dump to a file, then evaling it back in...

    --
    3dan
      I'm a bit confused now.

      Are you saying I can just comment out that 'eval' statement and not get the error?

      More details -- I get:

      Agent.pm: Can't locate Log/Agent.pm in @INC (@INC contains: /System/Li +brary/Perl/darwin /System/Library/Perl /Library/Perl/darwin /Library/ +Perl /Library/Perl /Network/Library/Perl/darwin /Network/Library/Perl + /Network/Library/Perl .) at (eval 3) line 2. BEGIN failed--compilati +on aborted at (eval 3) line 2.

      Update: OK commenting out the eval statement didn't make any difference, but in hindsight that was a bit stupid.

      But I'm more confused than ever.

      If I don't use Carp's fatalsToBrowser, then everything works fine, as far as I can see. So something, somewhere, has a fatal error, but it's not fatal to my script, it's fatal to one of the modules?

      So I should turn off fatalsToBrowser before I use Storable, and turn it back on after?

      Also, this is a broader definition of "fatal" than I was expecting. Obviously I don't understand the "exception paradigm" mentioned in the Storable docs.



      “Every bit of code is either naturally related to the problem at hand, or else it's an accidental side effect of the fact that you happened to solve the problem using a digital computer.”
      M-J D

        (Sorry it has taken me a while to reply, but I don't have much to offer - just didn't want to leave you hanging)

        I'm confused by that error message, too. Do you have your own module Agent.pm in which you have a 'use Log::Agent'? Wait, that doesn't make sense, because the error says it's coming from within an eval... um, sorry I can't be of much help, unless you want to try posting your actual code to your scratchpad, or something... good luck!

        --
        3dan