in reply to Re: Inline::Files bug?
in thread Inline::Files bug?

Well, that (half) explains that bit. Thanks.

Problem is, in the sample (pod) code,

I freely admit to still being a newbie to this stuff, but to implicitly use the name of an undeclared, uninitialised global variable, with the same name as a supplied filehandle, to supply the name of the virtual file to open.....(phew)...seems...erm...a little confusing?

Replies are listed 'Best First'.
Re: Inline::Files bug?
by Abigail-II (Bishop) on Aug 01, 2002 at 12:41 UTC
    Of course $CACHE is given a value, even if grepping for CACHE didn't reveal it.

    I don't know Inline::Files myself, but one minute browsing of the module and I found:

    my (%symbols, $source); foreach my $vfile (vf_load($file, $SOVFM_pat)) { my $symbol = vf_marker($vfile); $symbol =~ s/^__|__\n//g; push @{$symbols{$symbol}}, $vfile; } foreach my $symbol (keys %symbols) { no strict 'refs'; my $fq_symbol = "${package}::${symbol}"; @$fq_symbol = @{$symbols{$symbol}}; $$fq_symbol = $symbols{$symbol}[0]; my $impl = tie *$fq_symbol, $class, $fq_symbol, -w $file; tie %$fq_symbol, $class."::Data", $impl; }
    I think I can guess what that does.

    Abigail

      Ok, I admit it. No matter how much I look at that code, even my guesses at its function read like mental line-noise. :)

      Then again, I've spent several days (trying) to work out how some (most) of your regex code works (this has been a permenant resident in my editor for two weeks now>). I guess I'm gonna need rather more than my current 8-weeks association with Perl to achieve that level of understanding.

      I'm afraid my feelings re: this implicit use of the name of a filehandle to give a value to an autoloaded, global variable of the same name, is that it is at best, unintuative, and at worst, wholey redundant.

      Maybe if I had experienced Perl 4 (or earlier) where this sort of thing was the norm, it would be less so. For now, I can only rely on the good ministrations of the more experienced, as yourself, to set me straight when I err.

      Thanks again.

        Of course it's redundant. Many things in Perl are redundant, but that's why we all love Perl.

        If you don't like redundant things, pack your things and go to http://www.python.org. ;-)

        Abigail

Re: Re: Re: Inline::Files bug?
by dada (Chaplain) on Aug 01, 2002 at 12:29 UTC
    BrowserUk wrote:

    $CACHE is used, but never given any value

    have you tried print $INLINE in your program? it prints for me:

    P:/dada/test.pl(00000000000000000259)

    so it *has* a value. it all happens behind your shoulders, but it happens indeed.

    <hint>remember, you're using a module written by </code>TheDamian</hint>

    cheers,
    Aldo

    __END__ $_=q,just perl,,s, , another ,,s,$, hacker,,print;