Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Storable::dclone breaking compiled regular expressions

by aufflick (Deacon)
on Nov 01, 2005 at 04:31 UTC ( #504486=perlquestion: print w/ replies, xml ) Need Help??
aufflick has asked for the wisdom of the Perl Monks concerning the following question:

What the title says - anyone hit this before? The Storable docs (perl 5.8.5) don't say anything about it.

psh% print Dumper $foo $VAR1 = { 'bar' => qr/(?-xism:bar)/ }; psh% $foo2 = Storable::dclone $foo psh% print Dumper $foo2 $VAR1 = { 'bar' => qr/Regexp=SCALAR(0x8df0b40)/ };
The main store/restore functionality works fine with compiled regexes - I would have thought that dclone uses the same code? How does anyone else do deep cloning of hashes?

Comment on Storable::dclone breaking compiled regular expressions
Download Code
Re: Storable::dclone breaking compiled regular expressions
by BrowserUk (Pope) on Nov 01, 2005 at 04:56 UTC

    Try Clone, it doesn't appear to exhibit the same limitation:

    P:\test>p1 perl> use Clone qw[clone];; perl> $foo = { bar => qr[bar] };; perl> print Dumper $foo;; $VAR1 = { 'bar' => qr/(?-xism:bar)/ }; perl> $foo2 = clone $foo;; perl> print Dumper $foo2;; $VAR1 = { 'bar' => qr/(?-xism:bar)/ };

    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (9)
As of 2014-07-13 16:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (250 votes), past polls