Jeff 'japhy' Pinyan wrote:
On Jul 13, Scott R. Godin said:
The first thing you need to do is figure out the mapping from the old
methods to the new methods.
I'm not quite certain what you're getting at, here. You mean, which
methods will get re-mapped to do things slightly differently for the
DB version?
Right. What needs to be done in the DB methods? And I sort of answered
that: update a local copy of the object from the DB, and then call the
parent method.
there will actually need to be a number of things handled by the
database module, but primarily I need to wrap my brain around how I'm
intending to handle the whole picture. I'm getting closer now, (thanks!)
but still can't 'visualize' the whole thing, yet.
I also added an $obj->set() method (again slightly different from the
above so you'd get warnings about unbalanced pairs) for handling
multiple field/value pairs which again checks to make sure the fields
are allowed and accessible. I'm pondering whether I should be doing
the same thing twice (in new() and set()), and whether it makes any
sense to have new call (a slightly different variant of) set.
I don't see why not.
sub new {
my $class = shift;
my $self = bless {}, $class;
$self->set(@_);
return $self;
}
true but this way, one doesn't get the initializing behaviour that new()
currently has which presets undef values to "" instead. (which is why I
was pondering this change moreso than usual :) I don't want to
re-_init() all the fields when merely settting one or two differently,
nor do I want to have it such that there are undef values in the object.
Tricky, but not impossible. Works fine now, I just don't know whether
the concept merits refactoring now that I have a separate set() method.
There's no need for that '%' prototype on your set() function, by the
way. Methods don't pay attention to prototypes, anyway.
oops, I left that in when I was testing it -- I'd forgotten something,
and couldn't figure out why it wasn't working like I expected..
I had done
my ($self, %_args);
instead of
my ($self, %_args) = @_;
eep =8)
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>