in reply to Re: Re: Re: Are array based objects fixed length?
in thread Are array based objects fixed length?
We stick with Pixie::ObjectInfo, because we only need these scary tricks when the object isn't a hash. And we wouldn't need them if Perl did DESTROYs properly and called *all* the DESTROYs in an objects hierarchy, one could just stick the stuff you need in UNIVERSAL (or a superclass of UNIVERSAL if you're feeling Damianesque), and perl would call them automatically. Bah. This will break horribly if someone reblesses. Unless they either bless back, or knew exactly what they were doing...my $anon_class = $self->get_anon_class; eval "package $anon_class; use base qw/$target_class Pixie::Inner/"; $anon_class->object_info(Pixie::ObjectInfo->new(object_id => $oid); bless $fetched_obj, $anon_class; Pixie::Inner::object_info = sub { my $proto = shift; my $class = ref($proto) || $proto; no strict 'refs'; ${$class . "::object_info"} = shift if @_; return ${$class . "::object_info"}; } Pixie::Inner::DESTROY { my $self = shift; my $class = ref $self; my $super_dest = $class . "::DESTROY"; $self->$super_dest(); # Why doesn't UNIVERSAL::DESTROY exist alrea +dy? $self->object_info(undef); delete $::{$class . "::"} }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: Re: Are array based objects fixed length?
by Felonious (Chaplain) on Jul 28, 2002 at 20:53 UTC | |
by pdcawley (Hermit) on Jul 29, 2002 at 11:42 UTC |