473,412 Members | 5,361 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,412 software developers and data experts.

Tricky AUTOLOAD behavior

Here is some sample code that uses inherited class methods:
package parseHTML ;

sub parseHTML::docomment {
my $comment = shift ;
print $comment, "\n" ;
}
package parseASP ;

sub parseASP::AUTOLOAD {
use vars qw( $AUTOLOAD ) ;

my $key = $AUTOLOAD ;
my $package = __PACKAGE__ ;
$key =~ s/^${package}::// ;

eval "parseHTML::$key( \@_ )" ;
}

sub parseASP::doParse () {
...
local $/ = undef ;
$content = []
$buf = <HTMLFILE> ;
$buf =~ s|<!--(.*?)-->|'<!-- '.&docomment( $1, $comments ).'-->'|seig
...
}

sub parseASP::docomment {
my $comment = shift ;
print $comment, "\n" ;
}

&parseASP::doParse() ;
The code listed above works fine, outputting each comment of an HTML file.

If I delete the last function, parseASP::docomment(), then the inherited
function parseHTML::docomment() should behave identically. However, this
time, the code outputs a bunch of blank lines.

My best theory is that the first argument, $1, is passed as a reference to a
local special variable that goes out of scope. But common sense tells me that
anything that goes on the stack should still be there when I pull it off.
Having lost my mind trying to figure this out, any insight or explanation
would be greatly appreciated.

-Jim
Jul 19 '05 #1
1 3102
js*******@tqis.com (Jim Schueler) writes exactly the same thing he
wrote 4 days ago....
Here is some sample code that uses inherited class methods:


No, that code didn't use class methods or inhertitance 4 days ago and
it still doesn't.

This newsgroup didn't exist 4 days ago and still doesn't exist (still
see FAQ). Please don't start threads here.
Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: joebob | last post by:
The following script if run in Internet Explorer should display a thumbview of a webpage that you point it to. To test it, replace test.htm with a valid html file. The problem I'm having is that...
25
by: PyPK | last post by:
What possible tricky areas/questions could be asked in Python based Technical Interviews?
4
by: CompGeek | last post by:
Hi there, I am trying to load a file with 1729 records into a DB2 UDB EEE 7.1 DataBase (on AIX 4.3) which is across two partitions. The partitioning key is BI_INSTITUTIONAL_KEY which is a BIGINT...
13
by: Steve Jorgensen | last post by:
== On Error Resume next, and Err.Number == If you want to call one of your procedures from another procedure, and check for errors afterward, you mayimagine that you should write code something...
6
by: ccwork | last post by:
p = p->next = q; Why it is undefined? operator "=" is right-associative i.e. "p = p->next = q;" is equivalent to "p = (p->next = q); And I think another interpretation of sequence point is:...
27
by: onkar | last post by:
#include<stdio.h> int main(void){ char a="abcde"; char *p=a; p++; p++; p='z'; printf("%s\n",p); return 0; }
11
by: onkar | last post by:
Program 1: #include<stdio.h> int main(void){ int *p; p=(int *)malloc(sizeof(int)); *p=12; printf("%d %p\n",*p,p); return 0; }
1
by: Bill | last post by:
These two server variables should ALWAYS return the domain name of the host: - Request.ServerVariables("SERVER_NAME") - Request.ServerVariables("HTTP_HOST") Under what circumstances can those...
6
code green
by: code green | last post by:
A while ago I decided I like the idea of __autoload or what seems to be better spl_autoload_register(), so now all my projects use this. But a major problem arises using third party classes...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.