[Dbix-class] minimalistic Moose / DBIC glue module

Octavian Rasnita octavian at fcc.ro
Sun Jun 27 07:26:05 GMT 2010


What do you think it is the preferable way of passing the parameters to the custom methods defined in the ResultSet class for other more complex methods like ->search(), update(), create(), update_or_create()...?
(as a list of parameters, or as a hash?)

->add($val1, $val2, $val3);

then in the ResultSet:

sub add {
  my ($self, $val1, $val2, $val3) = @_;
  $self->create(var1 => $val1, var2 => $val2, var3 => $val3);
}

or

->add(var1 => $val1, var2 => $val2, var3 => $val3);

then in the resultset:

sub add {
  my ($self, %params) = @_;
  $self->create(%params);
}

I am not sure which would be the most maintainable method yet...

Octavian

----- Original Message ----- 
From: "Eden Cardim" <edencardim at gmail.com>
To: "DBIx::Class user and developer list" <dbix-class at lists.scsys.co.uk>
Sent: Sunday, June 27, 2010 4:41 AM
Subject: Re: [Dbix-class] minimalistic Moose / DBIC glue module


>>>>>> "John" == John Napiorkowski <jjn1056 at yahoo.com> writes:
> 
>    John> I generally try to do this as well, however I find that doing
>    John> this for simple finds on primary keys gets a bit tedious, and
>    John> frankly I wonder if I'm not wasting time and adding to
>    John> complexity.  Would be interested in your thoughts.
> 
> Yes, letting ->find pass through is ok, since it isn't a very complex
> part of the DBIC API, things like ->next and ->all are ok too, as long
> as you remain agnostic about what underlying object is actually handling
> the methods.
> 
> _______________________________________________
> List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
> IRC: irc.perl.org#dbix-class
> SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
> Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk
>



More information about the DBIx-Class mailing list