Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Insane (?) Regexp-based jpeg (JFIF) extractor...

by ikegami (Patriarch)
on Oct 31, 2008 at 09:15 UTC ( [id://720656]=note: print w/replies, xml ) Need Help??


in reply to Insane (?) Regexp-based jpeg (JFIF) extractor...

use open IO => ':raw'; doesn't affect <> so this won't work on Windows.

Replies are listed 'Best First'.
Re^2: Insane (?) Regexp-based jpeg (JFIF) extractor...
by blazar (Canon) on Oct 31, 2008 at 10:17 UTC

    I personally believe that you were very kind to let me know. But at the same time I must say that I have actually tested it several times (well, three files, actually) under Windows and it worked as expected: was I just lucky?

    So... I used open because it seemed the quickest and cleanest WTDI, but what do you propose as a workaround or solution? (Short of manually open()ing the files of course...)

    Update: I just actually checked with one single jpeg image and found an actual example that supports your claim. Incidentally, I would say that open.pm's docs do not make it clear enough that it won't work with <>.

    --
    If you can't understand the incipit, then please check the IPB Campaign.
      By the way, I found open doesn't work on open(my $fh, '-') either.

        I personally believe this is too bad. In principle it's such a wonderful pragma! Perhaps you should file a bug report. As far as open not affecting *ARGV is concerned, I would still consider that a bug too, since the documentation clearly says:

        The open pragma serves as one of the interfaces to declare default "layers" (also known as "disciplines") for all I/O.

        (Additional emphasis is mine.)

        OTOH, it also says:

        Any two-argument open(), readpipe() (aka qx//) and similar operators found within the lexical scope of this pragma will use the declared defaults. Even three-argument opens may be affected by this pragma when they don't specify IO layers in MODE.

        (Additional emphasis is mine.)

        Here, it is to be noticed that:

        • it talks of "two-argument open(), readpipe() (aka qx//) and similar operators found [...]" which may be interpreted to exclude implicit "versions" of the same functions/operators;
        • that emphasized "may" is at most ambiguous and I would like to know which is the actual behaviour.

        As far as the second point is concerned, I also think that it would be more reasonable to have three-argument opens always alway affected by the pragma, since it just "declares default "layers" for all I/O" and IMHO if they specify IO layers in MODE, then the latter ones should be simply stacked over the default ones.

        --
        If you can't understand the incipit, then please check the IPB Campaign.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://720656]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (5)
As of 2024-04-19 12:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found