[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Problem w/making runtime version of script



At 9:43 PM -0400 8/9/99, schinder@pobox.com corrected me:
>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

[snip]

>} >use constant FALSE => 0;
>} >use constant TRUE => 1;

>} >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.  :-)
>
>Sure it is:
>
>linux% perl
>use constant;
>linux% man constant
>constant(3)      Perl Programmers Reference Guide     constant(3)
>
>NAME
>       constant - Perl pragma to declare constants
>
>SYNOPSIS
>           use constant BUFFER_SIZE    => 4096;
>           use constant ONE_YEAR       => 365.2425 * 24 * 60 * 60;
>           use constant PI             => 4 * atan2 1, 1;
>etc.
>
>linux% perl -V
>Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration:
>  Platform:
>    osname=linux, osvers=2.2.10, archname=ppc-linux
>
>It's even there under MacPerl, which is 5.004, so it's been around at
>least that long:
>
>linux% ls /The_Black_Pits/Applications/MacPerl\ :c4/lib/constant.pm
>/The_Black_Pits/Applications/MacPerl :c4/lib/constant.pm
>
>
>[snip]
>}
>} 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 ... :-)
>
>Before writing about how Perl works, it's best to make sure how Perl
>works.
>

Thanks, you got me. I saw the poster's error message saying Perl 
couldn't locate constant.pm, so I looked it up -- and found nothing 
about constant.pm (nor about read-only variables) in:

- Programming Perl (2nd ed.)
- Advanced Perl Programming
- Perl Cookbook
- MacPerl Power and Ease
- Effective Perl Programming

So, it appeared to me that the poster was bringing in syntax from 
some other language, not an uncommon thing on this list.

Now I see a 3-line mention of constant.pm in Perl in a Nutshell, with 
no mention of how to use it. But as you point out, here it was right 
under my nose in MacPerl's installation on my machine. And of course 
I didn't _try_ it...

On the other hand, besides being ignorant of a relatively new module, 
I think  what I said was correct -- Perl couldn't find a module. And 
what I said about true/false is what I've learned from the wizards of 
this list -- don't bother with variables for TRUE or FALSE.  Finally, 
what _is_ the answer to the poster's question, if not a missing 
module? Perhaps a better reply would have been to ask the poster to 
check their Perl installation...

Thanks again.

1;




- Bruce

__Bruce_Van_Allen___bva@cruzio.com__831_429_1688_V__
__PO_Box_839__Santa_Cruz_CA__95061__831_426_2474_W__


===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org