[BEGINNER]Storable::dclone question
soup_or_power_at_yahoo.com
Date: 03/25/05
- Previous message: Dima: "Why not work POSIX::RT:Semaphore"
- Next in thread: Jim Gibson: "Re: [BEGINNER]Storable::dclone question"
- Reply: Jim Gibson: "Re: [BEGINNER]Storable::dclone question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 25 Mar 2005 14:46:35 -0800
Can someone explain this code especially what it is doing with
Storable::dclone? Thanks in advance
sub new {
my ($self, $hash) = @_;
# ------------------------------------------------------
# Create new hash ref/obj ref (Copy Constructor)
# ------------------------------------------------------
my $type = ref($self) || $self;
my $obj = ( ref $self ) ? &Storable::dclone( $self ) : { };
my $new = bless $obj, $type;
# ------------------------------------------------------
# Initialize properties (copy $hash into $new)
# ------------------------------------------------------
if ($hash && ref $hash) {
while ( my ($key, $value) = each %$hash ) {
$new->{$key} = $value if ! ref $value;
}
}
return $new;
}
- Previous message: Dima: "Why not work POSIX::RT:Semaphore"
- Next in thread: Jim Gibson: "Re: [BEGINNER]Storable::dclone question"
- Reply: Jim Gibson: "Re: [BEGINNER]Storable::dclone question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]