Solved

Clear precompiled includes

Posted on 2002-03-26
7
299 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Technology Partners: 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!

 
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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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 …
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Suggested Courses

636 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