Practical mod_perl / HTML Book /



previous page: 6.3.3.1. A first faulty scenario
  
page up: HTML Version of the book
  
next page: 6.3.3.3. A quick but ineffective hackish solution

6.3.3.2. A second faulty scenario


Now consider the following scenario:

project/MyConfig.pm
project/runA.pl
project/runB.pl

Now there is a single project with two scripts, runA.pl and runB.pl, both trying to load the same module, MyConfig.pm, as shown in Examples Example 6-12.

Example 6-10. project/MyConfig.pm

sub project_name { return 'Super Project'; }
1;

Example 6-11. project/runA.pl

use lib qw(.);
use MyConfig;
print "Content-type: text/plain\n\n";
print "Script A\n";
print "Inside project: ", project_name( );

Example 6-12. project/runB.pl

use lib qw(.);
use MyConfig;
print "Content-type: text/plain\n\n";
print "Script B\n";
print "Inside project: ", project_name( );

This scenario suffers from the same problem as the previous two-project scenario: only the first script to run will work correctly, and the second will fail. The problem occurs because there is no package declaration here.

We'll now explore some of the ways we can solve these problems.

 

Continue to:

  • prev: 6.3.3.1. A first faulty scenario
  • Table of Contents
  • next: 6.3.3.3. A quick but ineffective hackish solution







TOP
previous page: 6.3.3.1. A first faulty scenario
  
page up: HTML Version of the book
  
next page: 6.3.3.3. A quick but ineffective hackish solution


Menu

  • HTML Book
  • PDF Book
  • Download Code
  • Table of Contents
  • Errata
  • mod_perl2 User's Guide
  • Sitemap

Search


Add to Google




Creative Commons License


Written by
Eric Cholet (Logilune) and
Stas Bekman (StasoSphere & Free Books).


[ Privacy Policy | Terms of Use | About Us | Search ]

© 2007 StasoSphere.com