Re: Object persistence



On Jul 13, Jeff 'japhy' Pinyan said:

 # Subscriber::DB::get_greeting
 sub get_greeting {
   my ($self) = @_;
   my $id = $self->{_id};

   $greeting_sql->bind_columns(
     \$self->{_salutation},
     \$self->{_firstname},
     \$self->{_lastname},
   );
   $greeting_sql->execute($id);

It turns out I had these in the wrong order -- you should execute() FIRST, and then bind_columns().


   # now here is the magic!
   return $self->SUPER::get_greeting;
 }

If you want to hear more, I can give you more. Let me know if this has gone over your head though. I have a system in mind that would greatly reduce the amount of code in each of Subscriber::DB's methods that link to Subscriber's methods.

I've written the code I mentioned just above. It seems (to me, at least) to be pretty stream-lined. I will produce it if requested. I use a couple tricks throughout, so I'll explain them, of course.


--
Jeff "japhy" Pinyan         %  How can we ever be the sold short or
RPI Acacia Brother #734     %  the cheated, we who for every service
http://japhy.perlmonk.org/  %  have long ago been overpaid?
http://www.perlmonks.org/   %    -- Meister Eckhart
.