Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > How to declare global constants?

Reply
Thread Tools

How to declare global constants?

 
 
Louis
Guest
Posts: n/a
 
      04-30-2007
I would like to declare a constant in a module (.pm), so other perl
scripts can use the module and the constant it contains.

I tried
use constant BASEDIR => 'path_name';
in the module.

But when I use this module, perl complains that BASEDIR is a bareword.

How do you make this work?

Really appreciate your comment.
 
Reply With Quote
 
 
 
 
Jim Gibson
Guest
Posts: n/a
 
      04-30-2007
In article <zyeZh.8362$Dq6.6529@edtnps82>, Louis <>
wrote:

> I would like to declare a constant in a module (.pm), so other perl
> scripts can use the module and the constant it contains.
>
> I tried
> use constant BASEDIR => 'path_name';
> in the module.
>
> But when I use this module, perl complains that BASEDIR is a bareword.
>
> How do you make this work?
>
> Really appreciate your comment.


You should post a complete, minimal program that demonstrates the
problem. Otherwise, we are just guessing at the cause.

One guess: are you referring to BASEDIR in the program that uses the
module or the actual name <module>::BASEDIR?

This group is defunct. Try comp.lang.perl.misc in the future.

Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
 
Reply With Quote
 
 
 
 
Louis
Guest
Posts: n/a
 
      04-30-2007
Jim Gibson wrote:
> You should post a complete, minimal program that demonstrates the
> problem. Otherwise, we are just guessing at the cause.
>
> One guess: are you referring to BASEDIR in the program that uses the
> module or the actual name <module>::BASEDIR?
>
> This group is defunct. Try comp.lang.perl.misc in the future.
>

Thanks Jim,

I forgot about the prefix <module>::
Thank you.

I will use the other group.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
FWSM/PIX and Dynamic PAT using global IP range vs. global interface vs. global IP Hoffa Cisco 1 10-25-2006 06:50 PM
FWSM/PIX and Dynamic PAT using global IP range vs. global interface vs. global IP Hoffa Cisco 0 10-25-2006 01:04 PM
How to declare a variable in the global scope? Miguel Dias Moura ASP .Net 41 12-27-2004 05:56 PM
how to declare session variable in global.asax file khawar ASP .Net 1 07-10-2003 08:03 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57