The whole program? I'm willing to paste it in, but I think people's eyes might pop.
The error and contextual lines I'll put here, but if you want the full thing, I've no problems posting it...(terror though it may be!)
The error happens on the 2nd run (cuz it only fetches 1 page at a time at this point). So showing the 1st and 2nd runs:
Ishtar:/Torrents/home/law/info/images> crawl.pl
Loop...
No more pages
0 pages parsed in 4.21 seconds
0 items from cache, 1 new pages fetched, 1 new items fetched.
0 pages in Page queue, 0 items in requisite queue
Ishtar:/Torrents/home/law/info/images> crawl.pl
Loop...
Start Dump:
Modification of a read-only value attempted at /Torrents/home/law/bin/
+crawl.pl line 1729.
Close with partial character at /Torrents/home/law/bin/crawl.pl line 7
+90.
The code is in my "dumpfromstart" routine that's called during a program "fault" ... so the program is in the process of dying from an error already, ...OH FRACK...
I just found it...BUT, I still am not sure why it's dying with a readonly-only error there.
I was staring at the place where I got the 2nd error (+ the 'partial string' routine):
#line 33
sub partial_string($$) {
my ($string,$maxlen) = @_;
my $len=$string?length $string:0;
my $remainder=sprintf "..(%d more chars)...", $len - $maxlen;
sprintf "%.*s%s",$maxlen,$string//"",$len>$maxlen ? $remainder:""
+;
}
#line 40
...
#line 1159
sub _get_Nth_framep {
$_=$_[0]->{Parseable_PerTag_Space};
$_->[$_[1]];
}
#line 1163
....
#line 1708 (tabs should display @ 2 spaces for best readability)
sub dumpfromstart { #line 1709
if ($fault) {
$SIG{__WARN__} = $SIG{__DIE__} = undef;
confess "Double Fault\n";
}
lock $fault;
++$fault;
print "Start Dump:\n";
#line 1717
#truncate excessive output
foreach my $pg ($page, $startpage) {
last unless $pg;
$pg->{content} = partial_string($pg->{content},32)
if $pg && $startpage->{content};
$pg->{tagprint} = [];
for (my $i=0; $i <= $#{$pg->{Parseable_PerTag_Space}}; ++$i) {
alias my ($open_tag, $tag_output) = $pg->_get_Nth_framep($
+i); #line 1726
$tag_output = partial_string($tag_output,32) if $tag_o
+utput; #line 1727
}
}
my $d;
if ($page and $startpage != $page) {
$d = Data::Dumper->new([ $startpage, $page ], [qw(startpage pa
+ge)]);
} else {
$d = Data::Dumper->new([ $startpage, $PageQueue::PageQueue ],
[ 'startpage', ]);
}
print $d->Dump;
--$fault;
}
But the problem was before it ever got here in the actual error catch routine where I disabled the error handler before it ever called dumpfromstart:
if ($Devel) {
$SIG{__WARN__} = $SIG{__DIE__} = sub {
$Carp::CarpLevel = 1 if defined $^S && !$^S;
$SIG{__WARN__} = $SIG{__DIE__} = undef;
&dumpfromstart if defined $^S;
confess $_[0] if defined $^S;
die "exiting\n";
}
}
Sigh....
It still doesn't really tell me why it's dying from a read-only assignment there, since the place where it's dying should be "on the stack" -- OR possibly undefined -- but if it was undefined, it wouldn't /shouldn't the assignment "auto-vivify" the undef?
I'm not sure how that statement would ever die from an assignment to a readonly var... Maybe "alias" creates a condition where auto-vivify doesn't happen?
...hmmmm
P.S. -- you can see the start of the bit of the other problem I mentioned right after this one (chronologically).... I.e. utf8 routines are complaining about binary output not looking right...
|