So, How could I be messing this up? I print it out immediately before. I've restructured routines around it (that lead into it). I even broke the setting of the host-base into it's own routine (was combined in another, "host_path", from which it is called. Arg, might be some help will toss in the few routines and commens so you can get an idea of what is going on :>Parseable::new, pckg= 'main{}' >URL::Fetchable::new ## >=entering function... >URL::Cacheable::new >URL::new, pkg='main' (SET) storage_path="cache" storage_path=cache <URL::new #finally starts to exit... host_mask="(?-ims:([a-z...", ##In Cachble:new..prints charset="UTF-8", ##parms being init'ed ## this next one is the prob: (code): P "pkg_host_mask=%s", $pkg_host_mask; (output): pkg_host_mask=(?-ims:([a-zA-Z][-a-zA-Z0-9]*\.[a-zA-Z]+)$) (code): $pkg_host_base = ($p->host =~ m{($pkg_host_mask)}) [0]; (output (death): Use of uninitialized value $URL::Cacheable::pkg_host_mask in regexp co +mpilation at ./crawl.pl line 385. at ./crawl.pl line 385. ### I print it out on the line before and it has the value shown -- a nice "regex"... then the next line a crash claiming it wasn't set?? HOW? FWIW, I also have printed out 'host' and it is it's expected sitename value. Rest of error is just unwinding the call stack which pretty much mirrors the ">" entrylines above. URL::Cacheable::host_base('main=HASH(0x1be4338)') called at ./ +crawl.pl line 397 URL::Cacheable::host_path('main=HASH(0x1be4338)') called at ./ +crawl.pl line 407 URL::Cacheable::save_path('main=HASH(0x1be4338)') called at ./ +crawl.pl line 440 URL::Cacheable::localized_link('main=HASH(0x1be4338)') called +at ./crawl.pl line 490 URL::Cacheable::new_URL_Cacheable('main=HASH(0x1be4338)', 'HAS +H(0x1be7b30)') called at ./crawl.pl line 666 URL::Fetchable::new_URL_Fetchable('main=HASH(0x1be4338)', 'HAS +H(0x1be7b30)') called at ./crawl.pl line 1235 Parseable::new_Parseable('main=HASH(0x1be4338)', 'HASH(0x1be7b +30)') called at ./crawl.pl line 1389
host_path is called from this level's "new" that calls $p->host_base, above where the error happens.# host_base set from 'host' when host_mask is set; Example: # if host_base==www.first.host & hostmask gets us "first.host" # i.e. hostmask would be only looking at the last 2 domainname-parts # in future matches, a host would first have the mask applied # (masking off a 3rd level sub-domain part), then match against # first_host .. resulting in a match if # that's subtracted from future relative saved paths. our ($pkg_host_mask, $pkg_host_base); our $items_from_cache=0; our $Cache_Control; sub host_mask (;$) { my $p = shift; return $pkg_host_mask if $pkg_host_mask; $pkg_host_mask = $_[0] if @_; $pkg_host_mask } sub host_base(;$) { my $p = shift; my $reset=1 if @_ && EhV shift, reset; return $pkg_host_base if $pkg_host_base && ! $reset; if (@_) { $pkg_host_base=$_[0]; } elsif ($p->host && $pkg_host_mask) { P "pkg_host_mask=%s, host=%s", $pkg_host_mask: $pkg_host_base = ($p->host =~ m{($pkg_host_mask)}) [0]; } return $pkg_host_base; } # returns empty-string if same site, or sitename+dir_sep if not; # caches result in {host_path} sub host_path { my $p = $_[0] or return undef; my ($host_base, $host_mask) = ($p->host_base, $p->host_mask); $host_base && $host_mask && $p->host or die P "Can't produce host_path w/o host_base( host(%s) & mask(%s) +)", $p->host, $host_mask. ( ($p->host =~ m{$host_mask/})[0] eq $host_base ) ? '' : $p->host; }
I have tossed in a ton of debugging... some new, some from when I first developed this almost 3 years ago...I knew I'd need a good debug structure up front, so that was designed in...
Ideas? Flamage? laughter? ( :-( *sigh*))... How could I print a value in 1 line and be null in the RE?
In reply to strange prob--print RE& then use-says not set?? by perl-diddler
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |