develooper Front page | perl.perl5.porters | Postings from March 2019

[perl #133961] Documentation patch for -M

From:
Philippe 'BooK' Bruhat
Date:
March 28, 2019 04:42
Subject:
[perl #133961] Documentation patch for -M
Message ID:
rt-4.0.24-19884-1553677014-1395.133961-75-0@perl.org
# New Ticket Created by  Philippe 'BooK' Bruhat 
# Please include the string:  [perl #133961]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=133961 >


Here's a tiny documentation patch for -M.

I found this while and reading `perlrun` and exploring the possibilities
of `-M5;some-code` as a way to insert code before the loop when used in
combination with -n and -p (https://github.com/book/perlsecret/pull/16).

    $ perl -MO=Deparse '-M5;insert_code_here()' -pe 1
    sub BEGIN {
        require 5;
        ()
    }
    insert_code_here();
    LINE: while (defined($_ = readline ARGV)) {
        '???';
    }
    continue {
        die "-p destination: $!\n" unless print $_;
    }
    -e syntax OK

Feel free to reword it as needed.

-- 
 Philippe Bruhat (BooK)

 Destroy the little and you destroy the large.
                                    (Moral from Groo The Wanderer #55 (Epic))



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About