books
Free Books / Computers / Practical mod_perl /

previous page: 6.3.3.1. A first faulty scenario
  
page up: Practical mod_perl | by Stas Bekman and Eric Cholet
  
next page: 6.3.3.3. A quick but ineffective hackish solution

6.3.3.2. A second faulty scenario




Description

This section is from the "Practical mod_perl" book, by Stas Bekman and Eric Cholet. Also available from Amazon: Practical mod_perl

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

Books by Stas Bekman:















TOP
previous page: 6.3.3.1. A first faulty scenario
  
page up: Practical mod_perl | by Stas Bekman and Eric Cholet
  
next page: 6.3.3.3. A quick but ineffective hackish solution

Topics

  • Animals
  • Architecture
  • Arts
  • Business
  • Computers
  • Crafts
  • Fairy Tales
  • Finance
  • Flora and Plants
  • Cooking
  • Gardening
  • Health and Healing
  • History
  • Home Improvements
  • Languages
  • New Age
  • Novels
  • Real Estate
  • Reference
  • Religion
  • Science
  • Society
  • Sports
  • Travel
  • Outdoors


Search

My Books

Headaches Begone! A Systemic Approach To Healing Your Headaches
Don't Let Your Bike Seat Ruin Your Sex Life Book

Discover

  • Answers FAQ

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

© 2007-2021 StasoSphere.com