On 5 Dec 2006 at 10:32, John Siracusa wrote:
> >> sub generate_invoice_number
> >> {
> >> my $class = shift;
> >> my $db = My::DB->new; # Rose::DB subclass
> >
> > Why not just use the default here?
>
> What default?
The one that is inherited from my common base class (I followed the tutorial
[1] except that I don't
have separate manager classes) through init_db.
> >> my $nums =
> >> $class->get_numbers(db => $db,
> >> query => [ year => $year ]);
> >
> > Well, here actually.
>
> See above about using the same db to lock/unlock and to do the other work.
Is it ok then to just define init_db once in the base class and never add a
'db' parameter in special
purpose methods? I thought if no 'db' is given, the one from init_db is used in
every search.
Or is this a new one on every call so that I don't have the needed same db for
all the work?
[1] http://search.cpan.org/~jsiracusa/Rose-DB-Object-
0.758/lib/Rose/DB/Object/Tutorial.pod#Setting_up_your_own_base_class
Cheers,
Michael
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Rose-db-object mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rose-db-object