Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^3: One liner with globs on Windows to parse .srt files

by haukex (Bishop)
on May 14, 2021 at 11:28 UTC ( #11132579=note: print w/replies, xml ) Need Help??


in reply to Re^2: One liner with globs on Windows to parse .srt files (update)
in thread One liner with globs on Windows to parse .srt files

Yeah, that's basically the same idea, but a bit longish for a one-liner, don't you think?

Dunno, seemed like the most straightforward answer to your question - just copy Win32\Autoglob.pm to wglob.pm ;-)

("'-M5;@ARGV=<*.srt>' -e'...'" actually doesn't save any characters over "-e'BEGIN{@ARGV=<*.srt>}...'")

Update: Regarding PERL5OPT, sure!

Replies are listed 'Best First'.
Re^4: One liner with globs on Windows to parse .srt files
by LanX (Sage) on May 14, 2021 at 11:42 UTC
    > '-M5;@ARGV=<*.srt>'

    nice, I didn't know that trick to add "normal" code after the import; part of use 5 =)

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery

      nice, I didn't know that trick to add "normal" code after the import; part of use 5 =)

      Note unfortunately it doesn't end up inside the BEGIN:

      $ perl -MO=Deparse '-M5;print "Hello"' -e 'print "World"' sub BEGIN { require 5; () } print 'Hello'; print 'World';

      The trick was added to perlsecret as the "Maori Farewell" by Discipulus after I posted about it here.

        This is substantially the same logic quirk as the old "ShellShock" bug in bash. Both of these take an expected "data" value (although here the "data" is the name of a module to import instead of the body of a shell function) and then execute code given after that value in the same string.

        The best argument against calling this a security issue is that it must be either given on the command line or in $PERL5OPT — and you have bigger problems if either of those is within an attacker's control.

        > Note unfortunately it doesn't end up inside the BEGIN:

        not with version pragmas, but anything which allows import-list will also execute code inside

        d:\>perl "-MData::Dumper print ${^GLOBAL_PHASE}" -e1 START d:\>

        Cheers Rolf
        (addicted to the Perl Programming Language :)
        Wikisyntax for the Monastery

        Well you know PERL5OPT doesn't allow -e and this most probably for security reasons.

        But this is a backdoor to do it nevertheless.

        Not sure if this must be reported.

        Cheers Rolf
        (addicted to the Perl Programming Language :)
        Wikisyntax for the Monastery

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (1)
As of 2021-09-16 20:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?