Hi Dave,

> Von: Dave Rolsky <auta...@urth.org>
> Gesendet: Freitag, 17. November 2023 23:29
> An: Zacharias, Norbert <norbert.zachar...@ul.com>
> Cc: datetime@perl.org
> Betreff: Re: Missing *pm files for DateTime::Locale

> Hi Norbert,

> The way the locale data is packaged changed a while back in the 1.00 release 
> in
> 2015. There's no longer a `.pm` file per locale. If you want to preload locale
> data, you should just call `DateTime::Locale->load($locale)`.

Thanks for this information.

> I'm guessing you have some `Storable`-serialized `DateTime` objects that
> included pre-1.00 locales. The only way to thaw them is probably to install an
> older `DateTime-Locale` release.

I have made a small test script

use Storable qw(nstore retrieve);
my $storfile ='./teststorable.dat';

my %testh=(
'eins' => 1,
'zwei' => 2);

nstore(\%testh,$storfile);

my $tref = retrieve($storfile);
print join("\n",keys %$tref);

which worked without any problems!

Then I tried to retrieve an file which was produced some time before and get 
the know error.

Investigating the dat file yields:

00000180  07 52 53 44 46 69 46 6f  14 13 42 13 02 17 44 61  |.RSDFiFo..B...Da|
00000190  74 65 54 69 6d 65 3a 3a  4c 6f 63 61 6c 65 3a 3a  |teTime::Locale::|
000001a0  65 6e 5f 55 53 05 65 6e  5f 55 53 42 13 02 1c 44  |en_US.en_USB...D|
000001b0  61 74 65 54 69 6d 65 3a  3a 54 69 6d 65 5a 6f 6e  |ateTime::TimeZon|
000001c0  65 3a 3a 46 6c 6f 61 74  69 6e 67 08 66 6c 6f 61  |e::Floating.floa|
000001d0  74 69 6e 67 42 05 82 08  44 61 74 65 54 69 6d 65  |tingB...DateTime|
000001e0  3f 75 74 63 5f 72 64 5f  64 61 79 73 3a 37 33 38  |?utc_rd_days:738|
000001f0  31 39 33 7c 75 74 63 5f  72 64 5f 73 65 63 73 3a  |193|utc_rd_secs:|
00000200  35 31 30 30 30 7c 72 64  5f 6e 61 6e 6f 73 65 63  |51000|rd_nanosec|
00000210  73 3a 30 7c 76 65 72 73  69 6f 6e 3a 31 2e 32 30  |s:0|version:1.20|
00000220  03 00 00 00 14 00 00 00  15 00 00 00 16 00 00 00  |................|
00000230  0c 4d 65 61 73 49 6e 74  53 74 61 72 74 0a 11 4e  |.MeasIntStart..N|
00000240  6f 72 62 65 72 74 20 5a  61 63 68 61 72 69 61 73  |orbert Zacharias|
00000250  00 00 00 0a 41 75 74 68  6f 72 4e 61 6d 65 0a 05  |....AuthorName..|

This supports your theory.


> Longer-term, I'd suggest _not_ using `Storable` to serialize data. It 
> generates
> data that is too tied together with the internals of the libraries that 
> produced
> the objects.

Do you have a suggestion for an alternative?
Also I have to check how to migrate all the old storable files to the new 
version.
If anyone has an idea how this could work, please let me know!

Thanks a lot

Have fun
Norbert




This e-mail may contain privileged or confidential information. If you are not 
the intended recipient: (1) you may not disclose, use, distribute, copy or rely 
upon this message or attachment(s); and (2) please notify the sender by reply 
e-mail, and then delete this message and its attachment(s). Underwriters 
Laboratories Inc. and its affiliates disclaim all liability for any errors, 
omissions, corruption or virus in this message or any attachments.

Reply via email to