Class-Persist
view release on metacpan or search on metacpan
lib/Class/Persist/Proxy.pm view on Meta::CPAN
if (my $object = $tracker->object) {
$self->_duplicate_from($object);
bless $self => ref($object);
return $self;
}
}
return $self->record('Class::Persist::Error::DB::NotFound', "Could not load $class for $self", 1)
}
$self->_duplicate_from( $obj );
bless $self => $class;
}
=head2 proxy( $obj )
Replace object by proxy
=cut
sub proxy {
lib/Class/Persist/Proxy.pm view on Meta::CPAN
$obj->isa('Class::Persist') or Class::Persist::Error::InvalidParameters->throw(text => "object to proxy should be a Class::Persist");
$class->loadModule( ref $obj ) or return;
my $self = $class->new();
$self->class( ref $obj );
if ($owner) {
$self->owner( $owner );
}
$self->real_id( $obj->oid );
$obj->_duplicate_from( $self );
bless $obj => $class;
}
sub AUTOLOAD {
my $self = shift;
$self = $self->load() or return; # die "Can't find in DB from ".(caller)[0]." line ".(caller)[2];
my $meth = substr($AUTOLOAD, rindex($AUTOLOAD, ':') + 1);
my $can = $self->can($meth) or EO::Error::Method::NotFound->throw(text => "Method $meth unknownin class ".ref($self));
$can->($self, @_);
}
( run in 1.331 second using v1.01-cache-2.11-cpan-a9ef4e587e4 )