vr has asked for the wisdom of the Perl Monks concerning the following question:
use strict; use warnings; use feature 'say'; use Sereal qw/ encode_sereal decode_sereal /; use Storable qw/ freeze thaw /; say 'Storable: ', ${ thaw freeze \substr 'abc', 0 }; say 'Sereal: ', ${ decode_sereal encode_sereal \substr 'abc', 0 }; __END__ >perl 180524.pl Use of uninitialized value in say at 180524.pl line 8. Storable: Sereal: abc
I was passing lists of string references to mce_map for parallel processing. Because strings are substrings of larger strings, I thought to take shortcut by not creating temporary scalars, but to pass references of substr return values directly. Rather, refs are collected in large array (why whould I store duplicates?), then this array becomes parameter for mce_map. I should have known they are not references to scalars, but to lvalues, though.
Everything works fine until it doesn't, on a particular machine -- without, it turns out, Sereal installed. Storable, used by MCE in lieu of Sereal, treats these lvalue refs differently.
I didn't find anything googling for "Perl Storable lvalue", etc. Apart from my sloppy coding, I'm not even sure, if it's Storable issue, Sereal issue, or something else (maybe, MCE should check these?). Kind of, Sereal can be faster drop-in replacement for Storable. Except, it looks, not always. Any thoughts?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Subtle(?) issue(?) with lvalues and serialization
by Eily (Monsignor) on May 24, 2018 at 16:40 UTC | |
by Veltro (Hermit) on May 24, 2018 at 22:01 UTC | |
by vr (Curate) on May 25, 2018 at 18:11 UTC | |
|
Re: Subtle(?) issue(?) with lvalues and serialization
by BrowserUk (Patriarch) on May 24, 2018 at 19:54 UTC | |
|
Re: Subtle(?) issue(?) with lvalues and serialization
by Veltro (Hermit) on May 24, 2018 at 15:06 UTC |