in reply to Sending Storable strings over http

Regarding Storable specifically, make sure you use network order.

That means nstore_fd instead of store_fd. You may get away not doing this if the clients are always the same architechture, but this is good practice and when you next have to port, e.g., to a Mac, you will have one less thing to puzzle about.

(Despite the name "network order", this advice is also applicable to applications that serialize data to disk. Sometimes you want to move a store to another machine too.)

Replies are listed 'Best First'.
Re^2: Sending Storable strings over http
by cormanaz (Deacon) on Dec 05, 2005 at 00:28 UTC
    I have indeed developed byte order problems, but am not sure how to fix. The windoze client gets the blob, which was generated with freeze rather than store, and sends it using SOAP. The SOAP server gets this and stores it OK, but when I try to retrieve and thaw the blob, I get error "Byte order is not compatible at blib/lib/Storable.pm"

    Is this fixable by transforming the frozen blob before sending?

      Can you nstore/retreive rather than freeze/thaw? Seems likely a protocol designed for memory use won't tansport well (freeze/thaw).


      DWIM is Perl's answer to Gödel
        Well existing stuff in the database is frozen. I guess I could thaw, then nstore, then send. But if I were going to thaw the blob, I guess I would just send the thawed structure via SOAP, re-freeze it on the remote system, and store it. I'm hoping there is some way to transfer it directly without all that transformation.