Michael G Schwern wrote:
> 
> In One Sentence
> ---------------
> 
> All code examples in the Perl docs can be at a minimum tested for syntax
> errors in an automated fashion.
> 

Damn you!  You stole my thunder for the next YAPC!  :(  I've got a book
that should be going into production RSN and the markup looks something
like this:

[will look really fucked up on an HTML-enabled mail reader]

<entry>
<mod>
# $Log: exit.txt,v $
# Revision 1.2  2000/07/04 19:50:21  clintp
# Fixed validation.
#
# Revision 1.1  2000/07/02 22:53:24  clintp
# Initial revision
#
# Revision 1.1  2000/06/25 19:41:22  clintp
# Initial revision
#
# $Id: exit.txt,v 1.2 2000/07/04 19:50:21 clintp Exp $
</mod>

<entryname>
exit
</entryname>
<usage>
exit <e>expression</e>
</usage>

<description>
The exit statement causes the running Perl program to <i>terminate</i>
with <e>expression</e> as its exit value.  If the <e>expression</e>
is omitted, the exit value of 0 is used.

The exit value from a Perl program is often used by the caller
(an operating system shell program, another program, etc...) to
determine
whether or not the Perl program performed successfully.  Traditionally,
an exit status of 0 indicates success and anything else indicates
failure.
Exit values are limited to 8 bits.

If the Perl program has an END block, that block will be run before the
program terminates.  Also, if there are any objects that have a
destructor,
those destructors will be called first.  It's possible to bypass these
mechanisms with the <s><i>POSIX:_exit</i></s> routine.
</description>

<examples>
<ex>
        if ($success) {
                exit;
        }
        # Indicate failure
        exit 1;
<exres>
        !/./;
</exres>
</ex>
</examples>

<seealso>
        <enm>POSIX</enm>
        <eni>die</eni>
        <eni>DESTROY</eni>
        <eni>END</eni>
</seealso>
<xref>perldoc -f exit</xref>

</entry>

The fun bits are the <ex> and <exres> sections.  <ex> contains an
example. The test harness runs the test code with stderr and stdout
captured into a single stream and then the expression in <exres> is
applied against it.  In this case, the snippet should produce absolutely
no output.  No errors, no stdout either.  I have other more complicated
examples of course elsewhere.

There's lots of other stuff in this documentation system as
well...Enough for a whole paper.  Darn!


-- 
    Clinton A. Pierce              Teach Yourself Perl in 24 Hours! 
  [EMAIL PROTECTED]         for details see http://www.geeksalad.org
"If you rush a Miracle Man, 
        you get rotten Miracles." --Miracle Max, The Princess Bride

Reply via email to