> > This is really a general perl question, but I'm hitting it because of > DBIx::Recordset's use of typeglobs. > > In general I want to use "use strict;" in my code. However if I do > that, then this gets me in trouble. > > sub foo { > local(*set) = DBIx::Recordset... > print $set{bar} > > What is the preferred solution? I could declare a "my (%set)" before > the local. I could temporarily turn off the strict settings. Is > there anything better? What I'd really like is to tell "use strict" > that I want strict vars, but not to let me use local.
A variable declared with local is actual a global. The only thing that is different from a global is that Perl saves the value of the variable when the local occurs and automaticly restores it at the end of the scape. So you have to add a use vars qw{%set @set $set} ; to your source. Alternativly you can also use DBIx::Recordset with my (this should be better mentioned in the docs; any wants to write a patch :-). In this case you always have a reference: sub foo { my $set = DBIx::Recordset... print $set -> {bar} ; while ($rec = $$set -> Next) { .... Gerald ------------------------------------------------------------- Gerald Richter ecos electronic communication services gmbh Internetconnect * Webserver/-design/-datenbanken * Consulting Post: Tulpenstrasse 5 D-55276 Dienheim b. Mainz E-Mail: [EMAIL PROTECTED] Voice: +49 6133 925131 WWW: http://www.ecos.de Fax: +49 6133 925152 ------------------------------------------------------------- --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]