Questions tagged [storable]

46 questions
9
votes
2 answers

Storable.pm - corrupt when saving to non-truncated file

In my production environment we have had what we believe to be a corrupt storable hash, created by Storable.pm. I am unable to replicate the behaviour in Dev, which has made it hard to diagnose exactly. The code has been working for a long time,…
Brock
  • 160
  • 7
7
votes
2 answers

Store a Moose object that has a PDL as an attribute

I am new to Moose and doing quite well until I have hit a snag using a PDL as a property. I want to be able to write an object to a file (I have been using use MooseX::Storage; with Storage('io' => 'StorableFile');, and this object has a PDL as a…
Joel Berger
  • 20,180
  • 5
  • 49
  • 104
6
votes
2 answers

How can I use 32-bit Perl to thaw something frozen with 64-bit Storable?

I'm trying to thaw a database BLOB that was frozen using Storable on a 64-bit Solaris (production) machine. When I try to thaw on a 32-bit Windows (development) PC I receive "Byte order is not compatible error". perl -v (on solaris) This is perl,…
uxnow
  • 315
  • 2
  • 9
5
votes
2 answers

Optimization suggestions when writing storable vector definition for union struct

I wrote a storable vector instance for the data type below (original question here): data Atoms = I GHC.Int.Int32 | S GHC.Int.Int16 The code for defining those instances for Storable vector is below. While I am getting very good performance with…
Sal
  • 4,312
  • 1
  • 17
  • 26
5
votes
1 answer

Haskell FFI: Wrapping a C struct containing a separately allocated string (char*)

Suppose you have a C-struct typedef struct { uint32_t num; char* str; } MyStruct; and a function f that does some operation on it, void f(MyStruct* p); The C API demands that the char* be allocated a sufficient buffer before calling…
mcmayer
  • 1,931
  • 12
  • 22
5
votes
2 answers

Perl error: not a reference

I recently migrated some Perl code from SunSolaris to a Linux(Ubuntu) box of 64 bit. After the migration Storable.pm is breaking with the following error: Byte order is not compatible at /usr/lib/perl/5.18/Storable.pm, at /home/VD/Cache.pm line…
Darko1991
  • 83
  • 1
  • 6
4
votes
1 answer

Writing storable instance for CString with O(1) function to get total byte length

I am trying to write a storable vector instance for CString (null-terminated C chars in my case). The storable instance will store the pointers that the CString is (Ptr CChar). So, length of the vector is the number of CString pointers. Now, the…
Sal
  • 4,312
  • 1
  • 17
  • 26
4
votes
1 answer

Would it be possible to derive Data.Vector.Unbox via GHC's generic deriving?

It's possible to derive Storable via GHC's generic deriving mechanism: http://hackage.haskell.org/package/derive-storable (and https://hackage.haskell.org/package/derive-storable-plugin for performance). The only library I can find for deriving…
LogicChains
  • 4,332
  • 2
  • 18
  • 27
4
votes
3 answers

Converting between Storable and Unbox

Due to the answer to this question, I'd like to be able to construct instances of Foreign.Storable.Storable from instances of Data.Vector.Unboxed.Unbox (and vice versa). Is this possible? The closest thing I'm aware of is vector-th-unbox, but this…
Mike Izbicki
  • 6,286
  • 1
  • 23
  • 53
3
votes
2 answers

What is the Storable module used for?

I am having a hard time understanding what Storable does. I know that it "stores" a variable into your disk, but why would I need to do that? What would I use this module for, and how would I do it?
Dynamic
  • 921
  • 1
  • 12
  • 31
3
votes
3 answers

How to store data from hash in file and use it for another hash

I'm new in the Perl's world and I need help regarding the save data from a hash in a file and after that use it in another hash. This is а short example of my code: #!/usr/local/bin/perl use FileHandle; use File::Copy; use Data::Dumper…
Supreme
  • 109
  • 7
3
votes
4 answers

Can a PHP script unserialize a Storable file created with Perl?

Can a PHP script unserialize a Storable file created with Perl?
Rakesh
  • 5,793
  • 8
  • 36
  • 37
3
votes
2 answers

Alternatives to storing Moose object using Apache::Session with CODE references

I have a Moose class that i would like to store using Apache::Session::File. However, Apache::Session::File by default will not store it and instead i get the error message: (in cleanup) Can't store CODE items at blib\lib\Storable.pm (autosplit…
3
votes
4 answers

Can Storable store to the DATA filehandle?

I was curious if using Storable's store_fd and fd_retrieve would allow me to store a data structure into a program's own DATA filehandle. I realize this isn't Best Practice, I'm just curious if it'd work, my quick attempts to try it don't seem to…
Danny
  • 13,194
  • 4
  • 31
  • 36
3
votes
2 answers

Where do I put objects frozen with Storable to use them as mock input in a unit test in Perl?

I am writing a unit test where I need to mock a function that is returning a Class::Std::Storable object. There is no normal way to serialize these using Data::Dumper and such. Instead, I can do it as follows: use Storable; my $serialized =…
simbabque
  • 53,749
  • 8
  • 73
  • 136
1
2 3 4