Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

force storable downgrade usage

by b888 (Beadle)
on Dec 14, 2004 at 15:55 UTC ( [id://414738]=perlquestion: print w/replies, xml ) Need Help??

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

Greetings to all.

I've started using storable object some time ago and faced one problem - incompatibility of it's versions. Means data stored by on version often can be read by another. The problem is that i'm using storable on differnet servers (and i have no install/upgrade perms there) wich have diff versions of storable installed. So when i try to restore data on server diff from on which it was saved - i fail.

The question is: can i somehow use fixed version of storable (put in local dir)? If yes, which changes/files i need?

P.S. All topics about storable object on perlmnoks forum i've read :) No need to redirect me to topics like storable error

Replies are listed 'Best First'.
Re: force storable downgrade usage
by BUU (Prior) on Dec 14, 2004 at 21:20 UTC
    Storable produces binary data that can only be ready by the same version of Storable as you used to produce this. I'm pretty sure this is your problem. You have two solutions: The best is to ensure that everywhere you need to restore the data uses same version of storable. The second solution is to use a module which doesn't use a binary, version incompatible way to store data, such as Data::Dump, or even XML::Simple or a YAML module should do what you need. This way you can be sure of always being able to read the data.
Re: force storable downgrade usage
by mpeters (Chaplain) on Dec 14, 2004 at 18:12 UTC
    I don't know if you have tried this or not, but Storable has a method nfreeze that creates data that can be shared between machines. From the pod:
        If you wish to send out the frozen scalar to another machine, use nfreeze instead to get a portable image.
    
Re: force storable downgrade usage
by osunderdog (Deacon) on Dec 14, 2004 at 16:18 UTC

    you can add a use lib qw|mydir|; to the beginning of the script. This will add a directory at the beginning of the @INC array.

    perldoc lib

    "Look, Shiny Things!" is not a better business strategy than compatibility and reuse.


    OSUnderdog
      I've already tried to. It doesn't help since storable seems needs some binaries.

        Just to get some assumptions out of the way... Have you retrieved the CPAN Storable package, built it and installed it in the local directory? If you're just trying to tweak a .pm and there it has an XS layer then it probably won't work.

        An quick alternative to use lib qw{mydir yourdir}; is to use the command line parameter:

        perl -Imydir -Iyourdir

        If you have installed the package locally you should be able to differentiate between the two versions:

        $perl -MStorable -e" print \$Storable::VERSION" 2.13

        and

        $perl -I./lib -MStorable -e" print \$Storable::VERSION" ?.??

        "Look, Shiny Things!" is not a better business strategy than compatibility and reuse.


        OSUnderdog

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2024-04-25 22:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found