# Unit Test: programlistingco.001

$Id: programlistingco.001.xml 5258 2005-10-12 14:35:03Z xmldoc $
Norman Walsh

    ndw@nwalsh.com

    @rem = '--*-Perl-*--
    @echo off
    perl.exe %_batchname %$
    goto endofperl
    @rem ';

    # Compress mail...

    require 'n:/home/nwalsh/lib/cygnus.pl';
    require 'timelocal.pl';
    use Cwd;

    select (STDERR); $| = 1;
    select (STDOUT); $| = 1;

    @DIRS = ("/home/nwalsh/Mail");
    while (@DIRS) {
        $dir = shift @DIRS;
        opendir (DIR, $dir);
        while ($fname = readdir(DIR)) {
            $file = "$dir/$fname";
            next if ! -d $file;
            next if $fname =~ /^\.\.?$/;

            print "$file\n";
            push (@DIRS, $file);
            &compress ($file);
        }
    }

    exit;

The prologue handles embedding a Perl script in a DOS batch file.

The `goto` statement, interpreted by the DOS batch file interpreter, skips over the body of the Perl script. (Note that this callout has an “id” attribute that is referenced by a “linkends” attribute on the callout bug for line 4 above.)

The `require` statement sources in external program fragments.

The `use` statement is similar, but has additional utility. It is a Perl5 function. (Note that this callout area specifies both a line and a column.)

This is a user subroutine call.