Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 301
  • Last Modified:

Clear precompiled includes

A cgi page of mine gas a 'require global.pl' clause to include the global.pl file... I found out that this file (global.pl) is compiled to p-code the first time it is used and then only this cached p-code is used. So now when I change somehting in this file, I cannot get the changes reflected and working... It still uses the old precompiled file...

How do I get to clean this p-code cache and get my changes working???

I am using Perl 5.005
0
polygon
Asked:
polygon
1 Solution
 
maneshrCommented:
ploygon,

"..s compiled to p-code the first time i..."

What is p-code? Since Perl is an interpreter language, how are you compiling your code?
Are you using a 3rd party Perl compier?

"..So now when I change somehting in this file, I cannot get the changes reflected and working... ..."

How can you say that for sure? Are you testing from a web browser based interface?
Can you please post that URL here?

This will help you get a more accurate answer, faster.
0
 
Kim RyanIT ConsultantCommented:
Are you using some type of web server extension such as FastCGI or mod_perl (for Apache). If so, the web server should have a command to reset it's cahce of precompiled scripts.
0
 
christopher sagayamCommented:
This might help..

Upload the main script as a different name plus change the name of the global.pl

once you get it working delete the old ones
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
SapaCommented:
polygon,

you should use

do "global.pl";

instead of

require "global.pl";

if you want to read and execute this file many times.
Keyword 'requere' is specially for modules, which
should be read once even if several other modules
require it. The alternative (but not ideologically
correct) way is delete corresponding record from
%main::INC, for example:

delete %main::INC{'global.pl'};
require 'global.pl';

Andrey

P.S. to maneshr:

> What is p-code? Since Perl is an interpreter language, how are you compiling your code?

P-Code is an alternative name for Byte-Code. Perl5 interpreter is not 'clear interpreter'. It execute perl
code in two steps, parsing and precompilation into internal byte-code representation, and bytecode execution.
It allows to execute repetitive code (loops, or subroutines) much faster, because thir bodies compiled only once. It also makes easy to implement 'call forward'
like:

hello('world');

sub hello {
  print 'Hello, ', @_;
}

although it's a bad style. Classical, one pass interpreter just know nothing about 'hello' function during call, because it does not read it's body yet.

Read 'perldoc perlcompile' for more detail info.

0
 
polygonAuthor Commented:
Sapa, you have been just great in answering my questions...

Thanks
0
 
maneshrCommented:
Sapa,

Thanks for taking the time to explain about p-code.
0
 
maneshrCommented:
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now