On Thu, 29 Jan 2009, Marilyn Burgess wrote:
> I really like this example too, though it lacks a class
> method example:
>
> if(DOG::number_of_dogs_in_the_pound() > 1){
>     foreach my $dog (@Pound){
>         if($dog->is_male()){
>             print "I though so";
>         }
>     }
> }
>
> Sorry, I couldn't resist after that female comment.
>
> Marilyn

Hrmm.

 my $kennel = Kennel->new('spca-1');
 $_->bark for grep $_->gender eq 'male', $kennel->get_dogs;

Michael Peters wrote:
> And of course, if your system is only every going to have
> 1 Dog then you don't need to ever have instances, right?

IMHO, project managers tend to tell you things like that,
and then then tell you they have another dog.  I find it a
generally good idea to start with object models from the
beginning.  And if your objects need to be persistent and
have storage associated with them, start with DBIx::Class
from the beginning, don't try to add that later after you've
written "simple" data getters/setters.  ;-)

Mark

Reply via email to