Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Well Perl OK.
When dealing with Class::DBI I find I do the same things over and over. So I overide the base class methods and do it my way. For example I want Class::DBI to do the following:
What I'm asking is, well ... Do I get it? Or is this increadably dumb? Should I submit it to CPAN and wait for the royalty checks and parades? or is it just tooooo trivial? Its really quite simple - but it seems usefull.$id = $obj->create({id =>999, number_of_days_on_the_job=>3, number_of_people_shot=>12}); $error_string = $id unless $id == 999; # overide default die behavour and # return the error message if it fails constraints # for HTML::Template to 'associate' with $obj->param('number_of_people_shot'); print "The known fields are ".$obj->param()."\n"; %errors = $obj->set( number_of_days_on_the_job => 4, number_of_people_shot => 27); # or more to the point %errors = $obj->set( $CGI->Vars ); # i.e. don't die! also # don't update any of the values if there are any errors. # and collect errors in hash for each error. print $error{number_of_people_shot} if $error{number_of_people_shot} exists; ($dead, $x, $days) = $obj->get( number_of_days_on_the_job, x, number_of_people_shot); # NOTE x is not in the table print $x # prints some nonsense about that it - 'cant get nothing'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Trivial CPAN module?
by friedo (Prior) on Dec 11, 2005 at 00:15 UTC | |
|
Re: Trivial CPAN module?
by Perl Mouse (Chaplain) on Dec 10, 2005 at 23:55 UTC | |
|
Re: Trivial CPAN module?
by perrin (Chancellor) on Dec 11, 2005 at 17:49 UTC | |
by Anonymous Monk on Dec 11, 2005 at 22:11 UTC | |
by perrin (Chancellor) on Dec 12, 2005 at 04:10 UTC |