NAME End::Eval::FirstArg - Take code from first command-line argument, then eval it in END block VERSION This document describes version 0.003 of End::Eval::FirstArg (from Perl distribution End-Eval-FirstArg), released on 2022-02-05. SYNOPSIS On the command-line: % perl -MEnd::Eval::FirstArg `which some-perl-script.pl` 'use Data::Dump; dd \%INC' ... % PERL5OPT=-MEnd::Eval::FirstArg some-perl-script.pl 'use Data::Dump; dd \%INC' ... DESCRIPTION This module allows you to evaluate Perl code specified in the first command-line argument in the END block, basically for convenience in one-liners. The purpose of Begin::Eval::* and End::Eval::* modules is to allow you to evaluate some extra Perl code in addition to running your application, respectively at the beginning and at the end. The code can be supplied via one of these means: first command-line argument, environment variable(s). Previously there are Begin::Eval and End::Eval modules that accept code from import arguments, but the limited syntax provided by perl's "-M" switch diminishes the usefulness of the modules. Thus the modules are removed from CPAN. Use cases include: * printing \%INC at the start of your program run % perl -MBegin::Eval::FirstArg /path/to/your-script.pl 'print "$_\n" for sort keys %INC' script-arg1 ... % PERL_BEGIN_EVAL_END='print "$_\n" for sort keys %INC' perl -MBegin::Eval::Env /path/to/your-script.pl script-arg1 ... To know which modules are loaded before your program runs. * printing \%INC at the beginning of your program run To know all the modules that are loaded during your program run. * loading a module at the beginning of your program, with some initialization Alternatives to using these modules include using "do": % perl -E 'your-extra-code-before-running-program; do "/path/to/your/script.pl"; your-extra-code-after-running-program' FAQ ENVIRONMENT DEBUG Bool. Can be turned on to print the code to STDOUT before eval-ing it. HOMEPAGE Please visit the project's homepage at . SOURCE Source repository is at . SEE ALSO Other "End::Eval::*" modules, like End::Eval::Env. Other "End::*" modules. Other "Begin::Eval::*" modules. Other "Devel::End::*" modules (but this namespace is deprecated in favor of "End"). AUTHOR perlancar CONTRIBUTING To contribute, you can send patches by email/via RT, or send pull requests on GitHub. Most of the time, you don't need to build the distribution yourself. You can simply modify the code, then test via: % prove -l If you want to build the distribution (e.g. to try to install it locally on your system), you can install Dist::Zilla, Dist::Zilla::PluginBundle::Author::PERLANCAR, and sometimes one or two other Dist::Zilla plugin and/or Pod::Weaver::Plugin. Any additional steps required beyond that are considered a bug and can be reported to me. COPYRIGHT AND LICENSE This software is copyright (c) 2022 by perlancar . This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. BUGS Please report any bugs or feature requests on the bugtracker website When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.