Mail::Toaster::Perl

- NAME
- SYNOPSIS
- DESCRIPTION
- METHODS

- new
- module_install
- module_load
- check
- perl_install

- AUTHOR
- BUGS
- TODO
- SEE ALSO
- COPYRIGHT

# NAME

Mail::Toaster::Perl

# SYNOPSIS

Perl functions for working with perl and loading modules.

# DESCRIPTION

Mail::Toaster::Perl is a few frequently used functions that make dealing with perl and perl modules a little more managable. The following methods are available:

            check       - checks perl version
            install     - installs perl
            module_load - loads a perl module (attempts to install if missing)

See the description for each method below.

# METHODS

## new

To use a a method in this class, you must first request a Mail::Toaster::Perl object:

      use Mail::Toaster::Perl;
      my $perl = Mail::Toaster::Perl->new();

You can then call subsequent methods with $perl->method();

## module_install

Downloads and installs a perl module.

        $perl->module_install($vals, $conf);

$vals is a hashref with the following values:

        module  - module name          (CGI)
        archive - archived module name (CGI-1.35.tar.gz)
        site    - site to download from
        url     - path to downloads on site

The values get concatenated to a url like this: $site/$url/$module.tar.gz

$conf is toaster-watcher.conf settings and is optional.

Once downloaded, we expand the archive and do a make, make test, and finally, make install if everything goes well. After install, we clean up the sources and exit. The module install builds from sources only. Compare to module_load which will attempt to build from FreeBSD ports, CPAN, and then finally resort to sources if all else fails.

returns 1 for success, 0 for failure.

## module_load

        $perl->module_load( $hashref );

Loads a required Perl module. If the load fails, we attempt to install the required module (rather than failing gracelessly).

Input is a hashref which uses the following values:

        module      - the name of the module: (ie. LWP::UserAgent)
        ports_name  - is the name of the FreeBSD port
        ports_group - is is the ports group ( "ls /usr/ports" to see groups)
        warn        - if set, we warn instead of dying upon failure
        timer       - how long (in seconds) to wait for user input (default 60)
        site        - site to download sources from
        url         - url at site (see module_install)
        archive     - downloadable archive name (module-1.03.tar.gz)

returns 1 for success, 0 for failure.

## check

Checks perl to make sure the version is higher than a minimum (supplied) value.

       $perl->check($vals);

Input is a hashref with at least the following values set: min. If min is unset, it defaults to 5.6.1 (5.006001).

       $perl->check( {min=>5.006001} );

returns 1 for success, 0 for failure.

## perl_install

        $perl->perl_install( {version=>"perl-5.8.5"} );

currently only works on FreeBSD and Darwin (Mac OS X)

input is a hashref with the following values:

        version - perl version to install
        options - compile flags to set (comma separated list)

On FreeBSD, version is the directory name such as ``perl5.8'' derived from /usr/ports/lang/perl5.8. Ex: $perl->perl_install( {version=>``perl5.8''} );

On Darwin, it's the directory name of the port in Darwin Ports. Ex: $perl->perl_install( {version=>``perl-5.8''} ) because perl is installed from /usr/ports/dports/lang/perl5.8. Otherwise, it's the exact version to download and install, ex: ``perl-5.8.5''.

Example with option:

$perl->perl_install( {version=>``perl-5.8.5'', options=>``ENABLE_SUIDPERL''} );

# AUTHOR

Matt Simerson <matt@tnpi.biz>

# BUGS

None known. Report any to author.

# TODO

# SEE ALSO

Mail::Toaster - http://www.tnpi.biz/internet/mail/toaster/

# COPYRIGHT

Copyright (c) 2003-2004, The Network People, Inc. All Rights Reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

Neither the name of the The Network People, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.