On Mon, Aug 09, 1999 at 06:18:32PM -0700, Bruce Van Allen wrote: > At 10:42 AM -0600 8/9/99, Brenda Cannon wrote: > >I have the following snippet of code at the beginning of one of my > >scripts: > > > >#!/usr/local/bin/perl -w > >#use strict > > > >use constant FALSE => 0; > >use constant TRUE => 1; > > > >use Getopt::Long; > >use Config; > > > >require "shellwords.pl"; > >require "GUSI.ph"; > > > > > >The problem is that when I actually tried making a runtime version of > >this script it saved it with no errors/warnings, but then when I > >actually try to run it on the other machine I get the error that it > >cannot locate constant.pm in @INC. Can anyone tell me what is going on > >here? > > The statement > > use constant whatever > > is not Perl. :-) > > As the Camel says: "The use declaration imports some semantics into > the current package from the named module..." > > So Perl expects a module named 'constant' (constant.pm, really). You > got no warnings because it's plausible that there would be such a > module. Only when the script executes would it actually not find the > module constant.pm. Maybe your installation of Perl won't find the constant.pm module, but mine certainly will. MacPerl:lib:constant.pm > What can be confusing here is that there is a Perl Standard Library > module called 'vars' whose purpose is to pre-declare names for global > variables, so you see statements like > > use vars '$a', '@blah', '%doodah'; # OK. > use vars qw($a @blah %doodah); # Same, easier to type. > > Because it's part of the Standard Library, it's in virtually every > Perl installation. constant.pm is also part of the standard library, and is in virtually every Perl installation. > On a related topic: it looks like what you're doing is setting true & > false variables or constants, and that's not the way it works in Perl > either ... :-) That's true. Setting constants for TRUE and FALSE is just silly. Ronald ===== Want to unsubscribe from this list? ===== Send mail with body "unsubscribe" to macperl-request@macperl.org