Exporting Constants in Perl

Devin Whalen devin-Gq53QDLGkWIleAitJ8REmdBPR1lH4CV8 at public.gmane.org
Fri Jun 17 16:19:53 UTC 2005


On Fri, 2005-06-17 at 10:40 -0400, Andrew Hammond wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> > I just tried it with "our" instead of "use subs" and it works...but why?
> > 
> > use subs @EXPORT_OK;
> > becomes
> > our @EXPORT_OK;
> > 
> > I assume the problem is that use subs only expects subs to be exported.
> > So should I always use our?  Does use subs offer any benefits over our?
> > Now my file works, but I just want to know what is the correct syntax
> > and why. 
> 
> Chapter 4 of the camel book will enlighten you.
> 

Well, not in my Programming Perl book.  However, I did find a copy of
the Third Edition on the web, and chapter 4 does have the info you are
talking about...guess I will have to get a new copy.  I now know that
the use subs @EXPORT_OK and our @EXPORT_OK; are completely unnecessary
for my purposes.  The problem was, I was updating a perl module that was
5 or 6 years old that someone else created.  Anyway, problem solved and
I learned a little more about Perl.  Thanks for the pointer.

Later


-- 
Devin Whalen
Programmer
Synaptic Vision Inc
Phone-(416) 539-0801
Fax- (416) 539-8280
543 Richmond Street West
Toronto, Ontario
Suite 223 M5V 1Y6
Box 105
Home-(416) 653-3982


Take back the Web with FireFox....a browser you can trust
www.getfirefox.com

   .-.
   /v\    L   I   N   U   X
  // \\  
 /(   )\
  ^^-^^   

--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list