man pugs::run () - How to run Pugs

NAME

pugs::run - How to run Pugs

SYNOPSYS

pugs [ -h ] [ -v ] [ -V[:configvar] ] [ -c [file] ] [ -Cbackend [file] ] [ -Bbackend [file] ] [ -Mmodule ] [ --external [file] ] [ -e program ]

DESCRIPTION

The normal way to run a Perl program is by making it directly executable, or else by passing the name of the source file as an argument on the command line. An interactive Pugs environment is also available when pugs is started with no program source. Upon startup, Pugs looks for your program in one of the following places:

WRITEME

Command line options

You can pass various command line options to Pugs. causes Pugs to not look for any program files in the command line options, but instead run the one-line program specified. Multiple CW-e commands work too. causes Pugs to assume the following loop around your program, which makes it iterate over filename arguments somewhat like sed -n or awk:

    while =<> {
        ...your program here...
    }
causes Pugs to assume the following loop around your program, which makes it iterate over filename arguments somewhat like sed:
    while =<> {
        ...your program here...
        say;
    }
causes Pugs to not run the program, but merely check its syntax. Note that CWBEGIN {...} and CWCHECK {...} blocks, as well as CWuse Module, are still executed, because these might change the grammar or create new operators, etc. So the following is not safe:
    pugs -c 'BEGIN { system "evil command" }'
If you want to run a potentially unsafe program safely, see the safemode Pugs provides. causes Pugs to execute the program using CWCIbackendCW. Currently, valid backends are CWParrot, CWPIR, CWPerl5, and CWJS. To start the interactive shell of a backend, run CWpugs -BCIbackendCW, but note that currently only the Perl 5 and JavaScript backends provide interactive shells. The normal runcore supports more features than the other runcores, the Parrot backend is quite fast, the JavaScript backend is good on binding and references, and Perl 6 on Perl 5 offers excellent support for laziness. causes Pugs to compile the program using CWCIbackendCW. Currently, valid backends are CWPugs, CWParrot, CWPIR, CWHaskell, CWJS, and CWPIL with its variants CWPerl5, CWJSON, and CWBinary. Note that, as with CW-c, CWBEGIN {...} and CWCHECK {...} blocks, as well as CWuse Module statements, are still executed. So don't try to compile potentially unsafe code! causes Pugs to load CWCImoduleCW before executing your program:
    use module;
    ...your code here...
displays a short summary of the available command line options. No programs are executed. displays the version of Pugs you're running and long configuration information. displays short configuration information for CWCIitemCW.
    $ pugs -V:pugs_version
    pugs_versnum: 6.2.6
displays the version of Pugs you're running. are ignored for compatibility with Perl 5.

ENVIRONMENT

The Pugs runtime environment is affected by several environment variables.

The build environment is likewise controlled by several environment variables; since Pugs is still in heavy development, they are listed here as well. This does not affect CWpugs itself at all. When building Pugs from source, the Perl 5 test system should be instructed to use your copy of Pugs. If you use CWmake test or CWmake smoke, you should not need to set this manually; but if you want to use CWprove, set it to CW./pugs (just CWpugs.exe on Windows). A list of directories in which to look for Perl library files before looking in the standard library and the current directory. Any architecture-specific directories under the specified locations are automatically included if they exist. If CWPERL6LIB is not defined, CWPERLLIB is used. Directories are separated (as in CWPATH) by a colon on unixish platforms and by a semicolon on Windows (the proper path separator being given by the command CWpugs -V:path_sep). When building your own pugs, set CWPERL6LIB to CWblib6/lib to make tests use the correct version of the libraries. CWmake test and CWmake smoke should do this for you. A list of directories in which to look for Perl library files before looking in the standard library and the current directory. Not consulted if CWPERL6LIB is defined. See CWPERL6LIB for details on paths. Many Perl subroutines are provided to Pugs by a library called the Standard Prelude, which is inlined into the pugs executable and loaded by default on each startup of pugs. If CWPUGS_BYPASS_PRELUDE is set to anything except CW"" or CW"0", then pugs will not load the Prelude automatically. This gives a minor speedup on startup, as well as allowing you to load your alternate version of Prelude.pm like this:

    # In this example, Prelude.pm will be searched for in @*INC
    $ env PUGS_BYPASS_PRELUDE=1 pugs -MPrelude -e '...'
By default, the Prelude is not compiled in when compiling a Perl program instead of running it. If you set CWPUGS_COMPILE_PRELUDE to CWtrue, you override this default and the Prelude will be compiled along with your code. This is normally not needed, as the prelude should already be provided as part of the target runtime environment. Pugs provides a global safe mode which makes many operations that are deemed unsafe e.g. operations which use IO unavailable to a Perl program.
    $ env PUGS_SAFEMODE=1 pugs -e 'unlink "foo"'
    *** No compatible subroutine found: "&unlink"
        at -e line 1, column 1-13
If you haven't embedded Parrot in your Pugs build, Pugs will start an external Parrot if needed. You can set additional options Pugs should pass to parrot:
    $ env PUGS_PARROT_OPTS="-j" pugs -e 'eval("...", :lang<PIR>)'
    # Use JIT
If CWPUGS_PARROT_OPTS is not set, CW-C will be passed to parrot, selecting the computed goto core. If set, util/run-smoke.pl (CWmake smoke) uses this to upload your smoke tests results automatically. Set this to a command to run, e.g.
    rsync -avz smoke.html perlcabal.org:public_html
Smoke tests can take quite some time to complete. If you have a multiprocessor machine, you can set this to a small integer value, and util/yaml_harness.pl will run that amount of tests in parallel. On a single-processor, HyperThreaded machine that is otherwise unused, CW2 is a good value. On real multiprocessor machines, one more than the CPU count is suggested. This is equivalent to running CWutil/yaml_harness.pl -j CInumberCW. (Has no effect on Windows.) If set, the file specified in CWPUGS_BUILD_CONFIG will be used as configuration file. The default is config.yml.

SEE ALSO

Perl6::Pugs, pugs::hack

CETTE PAGE DOCUMENTE AUSSI :