O − Generic interface to Perl Compiler backends


        perl −MO=[−q,]Backend[,OPTIONS] foo.pl


This is the module that is used as a frontend to the Perl Compiler.

If you pass the "−q" option to the module, then the STDOUT filehandle will be redirected into the variable $O::BEGIN_output during compilation. This has the effect that any output printed to STDOUT by BEGIN blocks or use’d modules will be stored in this variable rather than printed. It’s useful with those backends which produce output themselves ("Deparse", "Concise" etc), so that their output is not confused with that generated by the code being compiled.

The "−qq" option behaves like "−q", except that it also closes STDERR after deparsing has finished. This suppresses the "Syntax OK" message normally produced by perl.


Most compiler backends use the following conventions: OPTIONS consists of a comma-separated list of words (no white-space). The "−v" option usually puts the backend into verbose mode. The "−ofile" option generates output to file instead of stdout. The "−D" option followed by various letters turns on various internal debugging flags. See the documentation for the desired backend (named "B::Backend" for the example above) to find out about that backend.


This section is only necessary for those who want to write a compiler backend module that can be used via this module.

The command-line mentioned in the SYNOPSIS section corresponds to the Perl code

       use O ("Backend", OPTIONS);

The "O::import" function loads the appropriate "B::Backend" module and calls its "compile" function, passing it OPTIONS. That function is expected to return a sub reference which we’ll call CALLBACK. Next, the "compile-only" flag is switched on (equivalent to the command-line option "−c") and a CHECK block is registered which calls CALLBACK. Thus the main Perl program mentioned on the command-line is read in, parsed and compiled into internal syntax tree form. Since the "−c" flag is set, the program does not start running (excepting BEGIN blocks of course) but the CALLBACK function registered by the compiler backend is called.

In summary, a compiler backend module should be called "B::Foo" for some foo and live in the appropriate directory for that name. It should define a function called "compile". When the user types

    perl −MO=Foo,OPTIONS foo.pl

that function is called and is passed those OPTIONS (split on commas). It should return a sub ref to the main compilation function. After the user’s program is loaded and parsed, that returned sub ref is invoked which can then go ahead and do the compilation, usually by making use of the "B" module’s functionality.


The "−q" and "−qq" options don’t work correctly if perl isn’t compiled with PerlIO support : STDOUT will be closed instead of being redirected to $O::BEGIN_output.


Malcolm Beattie, "mbeattie@sable.ox.ac.uk"

More Linux Commands

sigwait(3) - wait for a signal (Library - Linux man page)...
The sigwait() function suspends execution of the calling thread until one of the signals specified in the signal set set becomes pending. The function accepts t

irb.ruby2.1(1) Interactive Ruby Shell - Linux manual page...
irb is the REPL(read-eval-print loop) environment for Ruby programs. OPTIONS --version Prints the version of . -E external[]:internal --encoding external[]:inte

glutSetColor(3) - sets the color of a colormap entry in the
Sets the cell color index colormap entry of the current windows logical colormap for the layer in use with the color specified by red, green, and blue. The laye

gnutls_x509_crl_list_import(3) - API function (Man Page)....
gnutls_x509_crl_list_import.3 - This function will convert the given PEM encoded CRL list to the native gnutls_x509_crl_t format. The output will be stored in c

wc(1) - print newline, word, and byte counts for each file
Print newline, word, and byte counts for each FILE, and a total line if more than one FILE is specified. With no FILE, or when FILE is -, read standard input. A

who(1) - show who is logged on (Commands - Linux man page)
Print information about users who are currently logged in. -a, --all same as -b -d --login -p -r -t -T -u -b, --boot time of last system boot -d, --dead print d

XWMHints(3) - allocate window manager hints structure and se
The XAllocWMHints function allocates and returns a pointer to a XWMHints structure. Note that all fields in the XWMHints structure are initially set to zero. If

gettext(3) - translate message (Library - Linux man page)...
The gettext, dgettext and dcgettext functions attempt to translate a text string into the users native language, by looking up the translation in a message cata

gcc-4.6(1) - GNU project C and C++ compiler - Linux man page
When you invoke GCC , it normally does preprocessing, compilation, assembly and linking. The overall options allow you to stop this process at an intermediate s

tk_version(n) Variables used or set by Tk __________________
The following Tcl variables are either set or used by Tk at various times in its execution: tk_library This variable holds the file name for a directory contain

menu_win(3menu) - make and break menu window and subwindow a
Every menu has an associated pair of curses windows. The menu window displays any title and border associated with the window; the menu subwindow displays the i

iswgraph(3) - test for graphic wide character (Man Page)....
The iswgraph() function is the wide-character equivalent of the isgraph(3) function. It tests whether wc is a wide character belonging to the wide-character cla

We can't live, work or learn in freedom unless the software we use is free.