In article <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] (Etienne Marcotte) wrote:
> I have:
>
> my $q = new CGI;
> $q->import_names('IN');
>
> my $ID = lib::auth_user($IN::UsrName,$IN::UsrPass);
>
> sub auth_user returns a session ID kind of data.
>
> $IN::UsrName and $IN::UsrPass are used only once and gives warnings.
>
> Etienne
>
I noticed that and used something like this to get around that.
# set up major input/output variables in such a way that it supresses
# "used only once" warnings for the variables brought in via the
# import_names() sub, but also keep some main-only vars separate from
# the dupes to cut down on memory usage.
BEGIN {
@main::globals =
qw($mapname $author $author_first $author_nick $author_last
$version $release_date $filename
$last_update $email $website_url $website_name $credits
$other_levels_by_author $gametype $bot_able $single_player
$teamplay $difficulty_settings $new_sounds $new_textures
$mutators $mods $construction_base $build_time $editors_used
$ext_description $known_bugs $mod_type $mod_description
$authors_notes $game $weapons $power_ups $new_music
$num_playerstarts
);
}
# this takes advantage of the fact that use vars is looking for
# list context
use vars @main::globals,
qw($internal_comment1 $style $namefill $output_path $htmlout
$textout @htmldata @textdata $current_date);
# the namespace used will be ' import_names("UT"); ' later in the script
package UT; # slip into the package
# and slide in our 'globals' that get imported to that namespace
use vars @main::globals;
package main; # then slide back out to main again.
a semi-slick workaround for a semi-ugly problem. supresses all those
'used only once' warnings quite nicely though.
--
Scott R. Godin | e-mail : [EMAIL PROTECTED]
Laughing Dragon Services | web : http://www.webdragon.net/
It is not necessary to cc: me via e-mail unless you mean to speak off-group.
I read these via nntp.perl.org, so as to get the stuff OUT of my mailbox. :-)
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]