Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

(jeffa) Re: Deepcopy of complex structures.

by jeffa (Bishop)
on Jan 21, 2003 at 01:52 UTC ( [id://228558]=note: print w/replies, xml ) Need Help??


in reply to Deepcopy of complex structures.

How about Clone?

UPDATE: some code
use strict; use warnings; use Clone qw(clone); use Data::Dumper; my $str; $str .= "{ $_ => " for 'a'..'z'; $str .= '}' x 26; my $orig = { nested_hash => eval $str, code_ref => sub { my $foo = 'bar'; sub{$foo} }, }; my $clone = clone($orig); print Dumper $clone->{nested_hash}; print $clone->{code_ref}->()->(), $/;

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)

Replies are listed 'Best First'.
Re: (jeffa) Re: Deepcopy of complex structures.
by BrowserUk (Patriarch) on Jan 21, 2003 at 02:11 UTC

    Unfortunately it uses XS. Despite nearly a week of trying, I have yet to succeed in building Perl myself, and PPM/PPM3 both stopped working (with no indication as to why) some time ago.:(

    If I could work out were AS keep the modules (as opposed to the PPD's) I might have a go at manual install... I've been successful with other modules from Dada's site amongst others, but googling didn't turn up the right stuff. I will have to hack my way through the PPM source to work out where PPM looks for the files:(


    Examine what is said, not who speaks.

    The 7th Rule of perl club is -- pearl clubs are easily damaged. Use a diamond club instead.

      http://ppm.activestate.com/PPMPackages/zips/6xx-builds-only/Clone.zip seems to have the stuff to install on Windows... but no makefile.

      I think all PPM does is copy these files to the right place, so maybe you can download the zip file and do the same thing my (working) PPM 2 did:

      C:\>ppm PPM interactive shell (2.1.5) - type 'help' for available commands. PPM> install Clone Install package 'Clone?' (y/N): y Installing package 'Clone'... Bytes transferred: 5252 Installing D:\Perl\site\lib\auto\Clone\Clone.bs Installing D:\Perl\site\lib\auto\Clone\Clone.dll Installing D:\Perl\site\lib\auto\Clone\Clone.exp Installing D:\Perl\site\lib\auto\Clone\Clone.lib Installing D:\Perl\site\lib\Clone.pm Installing D:\Perl\site\lib\auto\Clone\autosplit.ix Writing D:\Perl\site\lib\auto\Clone\.packlist
      Note: I've never actually tried this.

        I'm pretty sure you're right - finding the zip file on ActiveState's site, downloading it, unpacking it and manually copying the files to \Perl\Site\lib will almost certainly work.

        However, dash2's suggestion to use Storable (first response) was a good answer and Storable is bundled with ActivePerl.

      Finding out where the libs/files are is just a case of doing:
      perl -V
      isn't it? Or did I misunderstand something? (Have no space for AS perl on my Windows machines..)

      C.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://228558]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2024-04-25 19:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found