Pugs::Doc::Run is a tutorial about how to run pugs.
SYNOPSYS
pugs [ -h ] [ -v ] [ -V[:configvar] ] [ -c [file] ] [ -Cbackend [file] ] [ -Bbackend [file] ] [ -Mmodule ] [ --external [file] ] [ -e program ]
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.
-e program
causes Pugs to not look for any program files in the command line options, but instead run the one-line program specified. Multiple -e commands work too.
-n
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...
}
-p
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;
}
-c
causes Pugs to not run the program, but merely check its syntax.
Note that BEGIN {...} and CHECK {...} blocks, as well as use 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.
-Bbackend
causes Pugs to execute the program using backend. Currently, valid backends are PIR (execution via Parrot), JS (JavaScript), and Pugs.
To start the interactive shell of a backend, run pugs -Bbackend, 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.
-Cbackend
causes Pugs to compile the program using backend. Currently, valid backends are Pugs, PIR, GHC, JS, and various variants of PIL: PIL1, PIL1-Binary, PIL1-JSON, PIL1-Perl5 (and PIL2-...).
Note that, as with -c, BEGIN {...} and CHECK {...} blocks, as well as use Module statements, are still executed. So don't try to compile potentially unsafe code!
-Mmodule
causes Pugs to load module before executing your program:
use module;
...your code here...
-h or --help
displays a short summary of the available command line options. No programs are executed.
-V
displays the version of Pugs you're running and long configuration information.
-V:item
displays short configuration information for item.
$ pugs -V:pugs_versnum
pugs_versnum: 6.2.6
-v or --version
displays the version of Pugs you're running.
-l, -d, and -w
are ignored for compatibility with Perl 5.
Product's homepage
Requirements:
· Perl