# This file contains action definitions and variables for Perl Diver.  Please
# see the "Extending PerlDiver" section of the documentation before editing.

# Global actions

$actions = {
    10 =>  {
            'name' => 'Main',
            'subr' => \&main,
            'show' => 1,
            'desc' => 'Basic paths and information'
           },
    20 =>  {
            'name' => 'Environment Variables',
            'subr' => \&environ_vars,
            'show' => 1,
            'desc' => 'All of the environment variables available on this machine.'
           },
    30 =>  {
            'name' => 'Perl Default Values',
            'subr' => \&default_vals,
            'show' => 1,
            'desc' => "Perl's Default values",
           },
    40 =>  {
            'name' => 'Perl Config - Summary',
            'subr' => \&config_summary,
            'show' => 1,
            'desc' => 'Short version of the configuration used to install Perl on this machine.'
           },
    50 =>  {
            'name' => 'Perl Config - Full',
            'subr' => \&config_full,
            'show' => 1,
            'desc' => 'Long version of the configuration used to install Perl on this machine.'
           },
    60 =>  {
            'name' => 'Installed Modules',
            'subr' => \&installed_mods,
            'show' => 1,
            'desc' => 'A list of Perl modules installed on this machine.  Each module links to further information about the module.
            	      The following paths have been searched: ' .
            		blockquote( join( br(), @INC ) ),
           },
    65 =>  {
            'name' => 'List Directory',
            'subr' => sub { Tr( td( pre( `ls -la`) ) ) },
            'show' => 1,
            'desc' => 'Just a sample of extending Perl Diver with command output.'
           },
    66 =>  {
            'name' => 'uptime',
            'subr' => sub { Tr( td( pre( `uptime`) ) ) },
            'show' => 1,
            'desc' => 'Just a sample of extending Perl Diver with command output.'
           },
# do not change this number!
    2000 =>  {
            'name' => 'Docs',
            'subr' => \&help_extend,
            'show' => 1,
            'desc' => 'How to add your own options to PerlDiver.'
           },
# do not change this number!
    2010 => {
            'name' => 'Module Documentation',
            'subr' => \&module_pod,
            'show' => 0,
            'desc' => <<MODPOD,
            Details and documentation about a specific module, including version and documentation (if available).
            Note that while links to <A HREF="http://perldoc.com" TARGET="_blank">perldoc.com</A> and
            <http://search.cpan.org" TARGET="_blank">search.cpan.org</A> are provided, the module may be part of a
            larger distribution.  If you reach a File Not Found page on either site, please try the parent module.
            
MODPOD
           },
# do not change this number!
    2020 => {
            'name' => 'Module Detail',
            'subr' => \&module_detail,
            'show' => 0,
            'desc' => ''
           },
};



# main page

    $main_page = {
        '10' => {
                 'desc' => 'Perl Executable',
                 'val'  => $^X
                },
        '20' => {
                 'desc' => 'Perl version',
                 'val'  => $]
                },
        '30' => {
                 'desc' => 'Operating System Name',
                 'val'  => $^O
                },
        '40' => {
                 'desc' => 'GID (If not blank, you are on a machine that supports membership in multiple groups simultaneously)',
                 'val'  => $<
                },
        '50' => {
                 'desc' => 'Path to Perl',
                 'val'  => join( br, split( ' ', `whereis perl` ) )
                },
        '60' => {
                 'desc' => 'Path to sendmail',
                 'val'  => join( br, split( ' ', `whereis sendmail` ) )
                },
        '70' => {
                 'desc' => 'Directories searched for perl modules',
                 'val'  => join( br, @INC)
                },
    };



# other variable settings.
$vars = {

    'main_id'          => 10,

    'perldoc_base_url' => 'http://www.perldoc.com/perl5.6.1/lib',

    'cpan_base_url'    => 'http://search.cpan.org/search?mode=module&query=',

    'script_name'      => 'perldiver.cgi',

    'style'            => <<STYLE,
        body      {
                    background: "#FFFFF";
                    scrollbar-face-color: "#FFCC66";
                    scrollbar-shadow-color: "#FF6600";
                    scrollbar-highlight-color: "#FFCC66";
                    scrollbar-3dlight-color: "#FFFFFF";
                    scrollbar-darkshadow-color: "#000000";
                    scrollbar-track-color: "#E2DAD1";
                    scrollbar-arrow-color: "#000000";
                    font-size: "x-small";
                    font-family: "arial,helvetica,sans-serif"
        }
        A:hover   {
                    background: "#ffcc66";
                    color: "#336699";
                    text-decoration: "overline"
        }
        A:link    {
                    color: "#BF0425"
        }
        A:visited {
                    color: "#336699"
        }
        th,td,p   {
                    font-size: "x-small"
        }
        .label    {
                    font-family: "Geneva, Helvetica, sans serif";
                    font-size: "x-small";
                    font-weight: bold
        }
        .HL       {
                    font-size:	"20pt";
                    letter-spacing:	".5pt";
                    font-family: "geneva, arial, sans-serif";
                    background: "#FDB900";
        }
        .heading  {
                    font-size: "x-large";
                    letter-spacing:	".5pt"
        }
        .a1       {
                    background: wheat
        }
        .a2       {
                    background: linen
        }
        .a3       {
                    background: blanchedalmond
        }
        .progname {
                    color: #bf0425;
                    font-size: xx-large;
        }
        code,pre  {
                    font-face: "Courier New", mono;
                    font-size: 11pt;
                  }

STYLE
};


##########
# Perl Defaults


    # whitespace types
    $types = {
        "\r\n"	  => 'Win32 Hard Return',
        "\r"	  => 'Hard Return',
        "\n"	  => 'New Line',
        "\t"	  => 'Tab',
        "\f"	  => 'Form Feed',
        " "	  => 'Space',
        "\e"	  => 'Escape',
        ''        => 'Null',
    };

    # debugging support.  key represents value of $^P
    $debug = {
        0 => 'Enable subroutine enter/exit debugging',
        1 => 'Enable line-by-line debugging',
        2 => 'Switch off optimizations for debugging purposes',
        3 => 'Preserve data for interactive inspection',
        4 => 'Preserve source line information on which a sub is defined',
        5 => 'Start session with single-stepping turned on',
    };


my $ors = $\ || 'null';
my $ofs = $, || 'null';

    # misc default settings
    $defaults = {
        10 => [
                'Input Record Separator',
                '$/',
                $types->{$/}	||= pre( $/ )
              ],
        20 => [
                'Output Record Separator',
                '$\\',
                $types->{ $ors } ||= $ors
              ],
        30 => [
                'List Record Separator',
                '$"',
                $types->{$"}	||= code( $" )
              ],
        40 => [
                'Output Field Separator',
                '$,',
                $types->{ $ofs } ||= $ofs
              ],
        50 => [
                'Subscript Separator',
                '$;',
                $types->{$;} ||= code( $; )
              ],
        60 => [
                'Emergency Memory Buffer',
                '$^M;',
                $^M ? 'Enabled' : 'Not Enabled'
              ],
        70 => [
                'List of Signal Handlers Supported by this System',
                ' ',
                join( ', ', split( / /, $Config{ 'sig_name' } ) )
              ],
        80 => [
                'Maximum System File Descriptor',
                '$^F',
                $^F
              ],
        90 => [
                'Current Debugging Support',
                '$^P',
                $debug->{$^P}
              ]
    };

