Solved

Clear precompiled includes

Posted on 2002-03-26
7
291 Views
Last Modified: 2013-11-18
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
Comment
Question by:polygon
7 Comments
 
LVL 16

Expert Comment

by:maneshr
ID: 6897877
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
 
LVL 19

Expert Comment

by:Kim Ryan
ID: 6897909
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
 
LVL 6

Expert Comment

by:christopher sagayam
ID: 6898342
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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 5

Accepted Solution

by:
Sapa earned 300 total points
ID: 6898947
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
 
LVL 2

Author Comment

by:polygon
ID: 6899551
Sapa, you have been just great in answering my questions...

Thanks
0
 
LVL 16

Expert Comment

by:maneshr
ID: 6899885
Sapa,

Thanks for taking the time to explain about p-code.
0
 
LVL 16

Expert Comment

by:maneshr
ID: 6900496
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now