in reply to Re: strange prob--print RE& then use-says not set??
in thread strange prob--print RE& then use-says not set??

I can glean the package we are in from the tracing output in the first code-section where it is showing program output.

First a func in main is called, then package URL::Fetchable's new then URL::Cacheable's new (they used to all be called new, but I didn't trust the right ones would get called so they pretty much all have per-package names, the debug output still says 'new'... as that is there essential function..)..Then it calls URL::new -- though the pointer passed to it was blessed in main (which is why it says package main there)...i.e. that's the package the object is being blessed into at this point).

Each of those classes are derived from the one above it (except Parseable::new is part of main now). Once inside URL::new we see the setting of the storage path (a param passed down in the argument hash that is passed down), then we see URL::new exit. (the <URL::new), so right above it, in the call chain, is URL::Cacheable, where this 'action' takes place.

There output from P (like printf, but does a bit more -- in CPAN), shows pkg_host...(I put the (code:)(output:) tags in the output -- also the ### are added as commentary. Then comes the code pkg_host_base = ($p->host =~ m{(..mask)}[0].

Which I gather you mean that because I had the () inside the mask expression, I likely wouldn't want them on the outside as well.. yes.. you are right... I guess I'll just have to require that the host_mask include it's own set of parens...didn't want to rely on that (even though the end-audience may only end up being me...)..

I fixed that and still get the error... though I would note that the double parens would have prevented a match because the $ was inside the outer set of parens.

*Sigh* (this code used to download several objects before crashing -- (by causing a segfault in Perl), but in recoding/factoring... whole pile of code thrown up in the air, and comes down in different places...oi).

Anyway, that's statement 385...where that nested parens was... but as you probably guessed, that didn't fix it.

After that -- is just the unwind code from the error -- does a traceback from ... so you can see there as well that host_base was part of URL::Cacheable... then some unwinding in Cacheable where it was parsing it's params, then back out the top.

So it is in package Cacheable... as to why it prints out the full varname-- I'm guessing it's because it is a package variable (declared with 'our')...

I think I answered all your questions.. unfortunately, not much further along that was before 'cept for preventing a future SoPW... ;-)....so thanks for that... but my head is still hurting over the original problem...*owie*.

  • Comment on Re^2: strange prob--print RE& then use-says not set??

Replies are listed 'Best First'.
Re^3: strange prob--print RE& then use-says not set??
by perl-diddler (Chaplain) on May 15, 2013 at 06:52 UTC
    Just a bit more fodder ... I changed sub host_mask to print it's value if it was already set and as it returns it. And instead of referencing the package var directly in host_path -- am going through sub-host_mask:
    sub host_mask (;$) { my $p = shift; if ($pkg_host_mask) { P "(hostmask pre-set to %s)", $pkg_host_mask; return $pkg_host_mask; } $pkg_host_mask = $_[0] if @_; $pkg_host_mask }
    Now the output seems to even more clearly show weirdness:
    >Parseable::new, pckg= 'main{}' >URL::Fetchable::new >URL::Cacheable::new >URL::new, pkg='main' (SET) storage_path="cache" storage_path=cache <URL::new (hostmask pre-set to (?-ims:([a-zA-Z][-a-zA-Z0-9]*\.[a-zA-Z]+)$)) (hostmask pre-set to (?-ims:([a-zA-Z][-a-zA-Z0-9]*\.[a-zA-Z]+)$)) host_mask="(?-ims:([a-z...", charset="UTF-8", (hostmask pre-set to (?-ims:([a-zA-Z][-a-zA-Z0-9]*\.[a-zA-Z]+)$)) (hostmask pre-set to (?-ims:([a-zA-Z][-a-zA-Z0-9]*\.[a-zA-Z]+)$)) $p->host_mask=(?-ims:([a-zA-Z][-a-zA-Z0-9]*\.[a-zA-Z]+)$), host= (hostmask pre-set to (?-ims:([a-zA-Z][-a-zA-Z0-9]*\.[a-zA-Z]+)$)) Use of uninitialized value $host_mask in regexp compilation at ./crawl +.pl line 400. at ./crawl.pl line 400. URL::Cacheable::host_path('main=HASH(0x168f338)') called at ./ +crawl.pl line 409 ...
    I mean how much more 'confidence' do I need to know host_mask really is set!!... yet still... the regexp compilation tosses it's cookies....!#$%~@#!*)&()+!
    Oops, sorry, my fingers slipped must have slipped..