Ah ha. Interesting. I did wonder about that after reading something in the goat book about similar behaviour from
badly written classes you couldn't inherit from.
Shame because the module is very good functionally, the author
Sherzod hasn't been around for a long time according to the logs, so looks like I'm on my own with a lovely opportunity to write a storable class from the top on my own at last :()
Thanks for your thoughts Simon. | [reply] |
sub Class::PObject::Template::__props {
my $self = shift;
my @isa = ref($self) || $self;
while ( scalar @isa ) {
my $target = shift @ISA;
no strict 'refs';
if ( my $props = ${ $target . '::props' } ) {
return $props;
} else {
push @isa, @{ $target . '::ISA' }
}
}
}
| [reply] [d/l] |
Updated - I've thought about it some more and realised I've actually had multiple errors.
For a moment there I was stright into Template.pm with CTRL+V at the ready, but realised what you gave me is to 'patch' to overload __props and will do it from anywhere.
:)
Anyway, I've been saying
myHuman->save();
and not,
$person->save();
Using the class and not the instance had me scratching my head. For a moment I though I solved it, but no.
About the patch. I guess it works, I can now call save on
classes derived using ISA. But there are complications, I can't see any of the column values anymore, they are not in the namespace now.
My thinking is that I will try and make a storable class, maybe looking at PObject is a nice place to start, or I might find something else approriate. Please don't feel I'm ungrateful about the patch, I'm amazed you
hooked in so quickly - the truth is that I don't fully understand it, or the PObject code I'm working with, and working with code I don't fully know makes me uncomfortable. The PObject class is very nice as a plugin, I've tested it in production
and its solid as a rock, but what I really want is actually quite simple, just a save() method for all my classes in the
tree which will serialise the thing to disk and let me restore it later. I can see complications with using too powerful a tool for slightly the wrong job, and so I'm going to try some othert ideas for a while.
Cheers,
Andy.
| [reply] [d/l] [select] |