home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 May / Chip_2000-05_cd1.bin / zkuste / Perl / ActivePerl-5.6.0.613.msi / 䆊䌷䈹䈙䏵-䞅䞆䞀㡆䞃䄦䠥 / _8f9ff1b6d581ee851f5f7705c617a942 < prev    next >
Text File  |  2000-03-23  |  4KB  |  105 lines

  1.  
  2. <HTML>
  3. <HEAD>
  4. <TITLE>O - Generic interface to Perl Compiler backends</TITLE>
  5. <LINK REL="stylesheet" HREF="../Active.css" TYPE="text/css">
  6. <LINK REV="made" HREF="mailto:">
  7. </HEAD>
  8.  
  9. <BODY>
  10. <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
  11. <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
  12. <STRONG><P CLASS=block> O - Generic interface to Perl Compiler backends</P></STRONG>
  13. </TD></TR>
  14. </TABLE>
  15.  
  16. <A NAME="__index__"></A>
  17. <!-- INDEX BEGIN -->
  18.  
  19. <UL>
  20.  
  21.     <LI><A HREF="#name">NAME</A></LI><LI><A HREF="#supportedplatforms">SUPPORTED PLATFORMS</A></LI>
  22.  
  23.     <LI><A HREF="#synopsis">SYNOPSIS</A></LI>
  24.     <LI><A HREF="#description">DESCRIPTION</A></LI>
  25.     <LI><A HREF="#conventions">CONVENTIONS</A></LI>
  26.     <LI><A HREF="#implementation">IMPLEMENTATION</A></LI>
  27.     <LI><A HREF="#author">AUTHOR</A></LI>
  28. </UL>
  29. <!-- INDEX END -->
  30.  
  31. <HR>
  32. <P>
  33. <H1><A NAME="name">NAME</A></H1>
  34. <P>O - Generic interface to Perl Compiler backends</P>
  35. <P>
  36. <HR>
  37. <H1><A NAME="supportedplatforms">SUPPORTED PLATFORMS</A></H1>
  38. <UL>
  39. <LI>Linux</LI>
  40. <LI>Solaris</LI>
  41. <LI>Windows</LI>
  42. </UL>
  43. <HR>
  44. <H1><A NAME="synopsis">SYNOPSIS</A></H1>
  45. <PRE>
  46.         perl -MO=Backend[,OPTIONS] foo.pl</PRE>
  47. <P>
  48. <HR>
  49. <H1><A NAME="description">DESCRIPTION</A></H1>
  50. <P>This is the module that is used as a frontend to the Perl Compiler.</P>
  51. <P>
  52. <HR>
  53. <H1><A NAME="conventions">CONVENTIONS</A></H1>
  54. <P>Most compiler backends use the following conventions: OPTIONS
  55. consists of a comma-separated list of words (no white-space).
  56. The <CODE>-v</CODE> option usually puts the backend into verbose mode.
  57. The <CODE>-ofile</CODE> option generates output to <STRONG>file</STRONG> instead of
  58. stdout. The <CODE>-D</CODE> option followed by various letters turns on
  59. various internal debugging flags. See the documentation for the
  60. desired backend (named <CODE>B::Backend</CODE> for the example above) to
  61. find out about that backend.</P>
  62. <P>
  63. <HR>
  64. <H1><A NAME="implementation">IMPLEMENTATION</A></H1>
  65. <P>This section is only necessary for those who want to write a
  66. compiler backend module that can be used via this module.</P>
  67. <P>The command-line mentioned in the SYNOPSIS section corresponds to
  68. the Perl code</P>
  69. <PRE>
  70.     use O ("Backend", OPTIONS);</PRE>
  71. <P>The <A HREF="../lib/Pod/perlfunc.html#item_import"><CODE>import</CODE></A> function which that calls loads in the appropriate
  72. <CODE>B::Backend</CODE> module and calls the <CODE>compile</CODE> function in that
  73. package, passing it OPTIONS. That function is expected to return
  74. a sub reference which we'll call CALLBACK. Next, the ``compile-only''
  75. flag is switched on (equivalent to the command-line option <CODE>-c</CODE>)
  76. and a CHECK block is registered which calls CALLBACK. Thus the main
  77. Perl program mentioned on the command-line is read in, parsed and
  78. compiled into internal syntax tree form. Since the <CODE>-c</CODE> flag is
  79. set, the program does not start running (excepting BEGIN blocks of
  80. course) but the CALLBACK function registered by the compiler
  81. backend is called.</P>
  82. <P>In summary, a compiler backend module should be called ``B::Foo''
  83. for some foo and live in the appropriate directory for that name.
  84. It should define a function called <CODE>compile</CODE>. When the user types</P>
  85. <PRE>
  86.     perl -MO=Foo,OPTIONS foo.pl</PRE>
  87. <P>that function is called and is passed those OPTIONS (split on
  88. commas). It should return a sub ref to the main compilation function.
  89. After the user's program is loaded and parsed, that returned sub ref
  90. is invoked which can then go ahead and do the compilation, usually by
  91. making use of the <CODE>B</CODE> module's functionality.</P>
  92. <P>
  93. <HR>
  94. <H1><A NAME="author">AUTHOR</A></H1>
  95. <P>Malcolm Beattie, <CODE>mbeattie@sable.ox.ac.uk</CODE></P>
  96. <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
  97. <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
  98. <STRONG><P CLASS=block> O - Generic interface to Perl Compiler backends</P></STRONG>
  99. </TD></TR>
  100. </TABLE>
  101.  
  102. </BODY>
  103.  
  104. </HTML>
  105.