=head1 NAME Pugs::Doc::Run - How to run Pugs =head1 SYNOPSYS B S<[ B<-h> ]> S<[ B<-v> ]> S<[ B<-V>[:I] ]> S<[ B<-c> [I] ]> S<[ B<-C>I [I] ]> S<[ B<-B>I [I] ]> S<[ B<-M>I ]> S<[ B<--external> [I] ] > S<[ B<-e> I ]> =head1 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 B is started with no program source. Upon startup, Pugs looks for your program in one of the following places: WRITEME =head2 Command line options You can pass various command line options to Pugs. =over =item C<-e I> causes Pugs to not look for any program files in the command line options, but instead run the one-line program specified. Multiple C<-e> commands work too. =item C<-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... } =item C<-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; } =item C<-c> causes Pugs to not run the program, but merely check its syntax. Note that C and C blocks, as well as C, are still executed, because these might change the grammar or create new operators, etc. So the following is B safe: pugs -c 'BEGIN { system "evil command" }' If you want to run a potentially unsafe program safely, see the safemode Pugs provides. =item C<-BI> causes Pugs to execute the program using C>. Currently, valid backends are C (execution via Parrot), C (JavaScript), and C. To start the interactive shell of a backend, run C>, 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. =item C<-CI> causes Pugs to compile the program using C>. Currently, valid backends are C, C, C, C, and various variants of PIL: C, C, C, C (and C). Note that, as with C<-c>, C and C blocks, as well as C statements, are still executed. So don't try to compile potentially unsafe code! =item C<-MI> causes Pugs to load C> before executing your program: use module; ...your code here... =item C<-h> or C<--help> displays a short summary of the available command line options. No programs are executed. =item C<-V> displays the version of Pugs you're running and long configuration information. =item C<-V:I> displays short configuration information for C>. $ pugs -V:pugs_versnum pugs_versnum: 6.2.6 =item C<-v> or C<--version> displays the version of Pugs you're running. =item C<-l>, C<-d>, and C<-w> are ignored for compatibility with Perl 5. =back =head1 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. =over =item C [BUILD] This does not affect C 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 C or C, you should not need to set this manually; but if you want to use C, set it to C<./pugs> (or C on Windows). =item C 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 C is not defined, C is used. Directories are separated (as in C) by a colon on unixish platforms and by a semicolon on Windows (the proper path separator being given by the command C). When building your own pugs, set C to C to make tests use the correct version of the libraries. C and C should do this for you. =item C 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 C is defined. See C for details on paths. =item C 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 C is set to anything except C<""> or C<"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 F like this: # In this example, Prelude.pm will be searched for in @*INC $ env PUGS_BYPASS_PRELUDE=1 pugs -MPrelude -e '...' =item C By default, the Prelude is not compiled in when compiling a Perl program instead of running it. If you set C to C, 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. =item C 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 =item C 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)' # Use JIT If C is not set, C<-C> will be passed to parrot, selecting the computed goto core. =item C [BUILD] If set, F (C) 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 You may alternatively set the C option in C to have smokes uploaded to the public smokeserver automatically. =item C [BUILD] 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 F will run that amount of tests in parallel. On a single-processor, HyperThreaded machine that is otherwise unused, C<2> is a good value. On real multiprocessor machines, one more than the CPU count is suggested. This is equivalent to running C<< util/yaml_harness.pl -j I >>. (Has no effect on Windows.) =item C [BUILD] If set, the file specified in C will be used as configuration file. The default is F. =back =head1 SEE ALSO L, L