ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> modperl
modperl
Re: Using Constants from seperate file
by Ged Haywood other posts by this author
Jul 28 2002 11:17PM messages near this date
Re: Using Constants from seperate file | apache::ASP
Hi there,

On Sun, 28 Jul 2002, allan juul wrote:

>  i wish to use use constants defined in a seperate file. my problem is, that 
>  sometimes it works sometimes it doesn't. when failing, the error_log says 
>  Bareword is not allowed so i guess it sometimes never loads my constants file 
>  at all.
>  
>  this is my basic approach:
>  
>  
>  Package Foo:Bar;
>  
>  use strict;
>  
>  BEGIN {
>    require "Constants.lib";
>  }
>  
>  
>  sub handler {
>    my $r = shift;
>    ...
>  
>    my $sql = SQL_SELECT; # pull in constant value
>    ....
>  
>  }
>  
>  
>  is this a stupid approach,

Only under some circumstances.  Check out the mod_perl Guide.  If I
were debugging this I'd put a "PRINT STDERR 'something';" statement in
the BEGIN block.  Probably that will tell you what's happening...

73,
Ged.
Thread:
allan juul
Steve Piner
Ged Haywood

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved