woozy has asked for the wisdom of the Perl Monks concerning the following question:

so if I try
use CGI; $letter = param('letter');
I get a "undefined subroutine &main::param" error but if I try
use CGI; $letter = CGI::param('letter');
all is well. ????HUH????? is it my binaries? (windows) or ... what????

Replies are listed 'Best First'.
Re: "use" acting like "require" (not importing????)
by NetWallah (Canon) on Mar 09, 2004 at 19:20 UTC
    You need to explicitly import the method names.
    use CGI qw(:cgi);
    Will import the minimum.
Re: "use" acting like "require" (not importing????)
by Wonko the sane (Curate) on Mar 09, 2004 at 19:20 UTC
    Hello,

    The param method is not exported by Default. You must request it.

    Try:

    use CGI qw( :all ); # Import Everything

    Wonko

      Thanks. (:all) fixed it (and I assume (:cgi) would too) so thanks to you all.

      I'm not sure, but I think I can remember I've learned to use 'use CGI qw( :standard );'
      
      my $native_language = "Dutch";
      my $code = !$tested unless defined $otherwise;
      
Re: "use" acting like "require" (not importing????)
by neniro (Priest) on Mar 09, 2004 at 20:24 UTC
    you can alternatively use CGI.pm in the OO-way:
    use CGI; my $q = new CGI; my $letter = $q->param('letter') || 'default';
    best regards,
    neniro