perl-docs-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject cvs commit: modperl-docs/src/docs/1.0/guide Changes.pod porting.pod
Date Mon, 15 Apr 2002 06:56:40 GMT
stas        02/04/14 23:56:39

  Modified:    src/docs/1.0/guide Changes.pod porting.pod
  Log:
  add a new section presenting a hackish solution for libraries
  collision, via do() or %INC mangling.
  
  Revision  Changes    Path
  1.9       +5 -0      modperl-docs/src/docs/1.0/guide/Changes.pod
  
  Index: Changes.pod
  ===================================================================
  RCS file: /home/cvs/modperl-docs/src/docs/1.0/guide/Changes.pod,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Changes.pod	13 Apr 2002 18:45:59 -0000	1.8
  +++ Changes.pod	15 Apr 2002 06:56:39 -0000	1.9
  @@ -11,6 +11,11 @@
   
   =head1 ??? ver 1.32
   
  +* guide::porting
  +
  +  o add a new section presenting a hackish solution for libraries
  +    collision, via do() or %INC mangling.
  +
   * guide::troubleshooting
   
     o solution to the 'readdir()/opendir() not working' problem (Louis
  
  
  
  1.6       +52 -0     modperl-docs/src/docs/1.0/guide/porting.pod
  
  Index: porting.pod
  ===================================================================
  RCS file: /home/cvs/modperl-docs/src/docs/1.0/guide/porting.pod,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- porting.pod	4 Apr 2002 02:24:28 -0000	1.5
  +++ porting.pod	15 Apr 2002 06:56:39 -0000	1.6
  @@ -1855,6 +1855,58 @@
   module names in package declarations, as explained above, you cover
   the first two as well.
   
  +=item A Hack
  +
  +The following solution should be used only as a short term
  +bandaid. You can force reloading of the modules by either fiddling
  +with C<%INC> or replacing use() and require() calls with do().
  +
  +If you delete the module entry from the C<%INC> hash, before calling
  +require() or use() the module will be loaded and compiled again. For
  +example:
  +
  +  ./project/runA.pl
  +  -----------------
  +  BEGIN {
  +      delete $INC{"MyConfig.pm"};
  +  }
  +  use lib qw(.);
  +  use MyConfig;
  +  print "Content-type: text/plain\n\n";
  +  print "Script A\n";
  +  print "Inside project: ", project_name();
  +
  +Apply the same fix to I<runB.pl>.
  +
  +Another alternative is to force module reload via do():
  +
  +  ./project/runA.pl
  +  -----------------
  +  use lib qw(.);
  +  do "MyConfig.pm";
  +  print "Content-type: text/plain\n\n";
  +  print "Script B\n";
  +  print "Inside project: ", project_name();
  +
  +Apply the same fix to I<runB.pl>.
  +
  +If you needed to import() something from the loaded module, call the
  +import() method explicitly. For example if you had:
  +
  +  use MyConfig qw(foo bar);
  +
  +now the code will look as:
  +
  +  do "MyConfig.pm";
  +  MyConfig->import(qw(foo bar));
  +
  +Both presented solutions are ineffective, since the modules in
  +question will be reloaded on each request, slowing down the response
  +times. Therefore use these only when a very quick fix is needed and
  +provide one of the more robust solutions discussed in the previous
  +sections.
  +
  +
   =back
   
   See also the C<perlmodlib> and C<perlmod> manpages.
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: docs-cvs-unsubscribe@perl.apache.org
For additional commands, e-mail: docs-cvs-help@perl.apache.org


Mime
View raw message