Sorry to not lurk longer ( I just joined a few minutes ago ) and my
search if the mail archives hasn't been fruitful so I'm going to do the
newbie thing.
Using DBIx::Class via Catalyst I'm trying to optimize the number
database calls. Just because it's the right thing to do.
Currently the code I'm working on uses
$c->model( 'TheModel' )->find_or_create( ... );
But if the case is the record already exists ( find_ ) I don't need a
call to rebuild a list but if it doesn't exist ( _create ) I need to
make the call.
The POD says it returns the $obj. Is there elegant way to determine
if it is a found or created object? If not, does it make sense to have
the something_or_otherthing methods also return which of the two happened?
My alternative will be to enclose a '->create' in an eval and test [EMAIL
PROTECTED]
Not a problem but magic is good.
TIA,
Rod
--
_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/[email protected]/