Solved

Clear precompiled includes

Posted on 2002-03-26
7
297 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
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

I will show you how to create a ASP.NET Captcha control without using any HTTP HANDELRS or what so ever. you can easily plug it into your web pages. For Example a = 2 + 3 (where 2 and 3 are 2 random numbers) Session("Answer") = 5 then we…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

713 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