WebDyne-Install-Lighttpd

 view release on metacpan or  search on metacpan

lib/WebDyne/Install/Lighttpd.pm  view on Meta::CPAN

    #
    unless ($Uninstall_fg) {


        #  Get template we want to include in the config file
        #
        $template_fn=File::Spec->catfile(
            $class_dn, $class[-1], $FILE_LIGHTTPD_CONF_TEMPLATE);


        #  Open it as a template
        #
        $template_or=Text::Template->new(

            type    =>  'FILE',
            source  =>  $template_fn,

           ) || return err("unable to open template $template_fn, $!");


        #  Fill in with out self ref as a hash
        #
        my $lighttpd_conf=$template_or->fill_in(

            HASH	=> $config_hr,
            DELIMITERS  => [ '<!--', '-->' ], 

           ) || return err("unable to fill in template $template_fn, $Text::Template::ERROR");


        #  Splice in now, but write out at end of block
        #
        splice(@lighttpd_conf, $lineno, undef, $lighttpd_conf);


    }


    #  Re-open httpd.conf for write out, unless uninstall and delims not found, which
    #  means nothing was changed.
    #
    unless ($Uninstall_fg && ($delim[0] == $delim[1])) {
        $lighttpd_conf_fh=IO::File->new($lighttpd_conf_fn, O_TRUNC|O_WRONLY) ||
            return err("unable to open file $lighttpd_conf_fn, $!");
        print $lighttpd_conf_fh join('', @lighttpd_conf);
        $lighttpd_conf_fh->close();
        message "Lighttpd config file '$lighttpd_conf_fn' updated.";
    }


    #  Almost done ..
    #
    unless ($Uninstall_fg) {

	#  Chown cache dir unless it is the system temp dir - then don't mess with it
	#
	if ($cache_dn) {
	    unless ($cache_dn eq File::Spec->tmpdir()) {
		message
		    "Granting Lighttpd ($LIGHTTPD_UNAME.$LIGHTTPD_GNAME) write access to cache directory '$cache_dn'.";
		chown($LIGHTTPD_UID, $LIGHTTPD_GID, $cache_dn) ||
		    return err("unable to chown $cache_dn to $LIGHTTPD_UNAME.$LIGHTTPD_GNAME");

		# Done
		#
		message "install completed.";

	    }
	}
    }
    else {

	message "uninstall completed";

    };


    #  Finished
    message;
    return \undef;


}

__END__

=head1 Name

WebDyne::Install::Lighttpd - WebDyne installer for the Lighttpd web server.

=head1 Synopsis

B<wdlighttpd> B<[options]>

=head1 Description

WebDyne::Install::Lighttpd is an installer for the Lighttpd web server which will configure it to process WebDyne psp
files.

=head1 Documentation

Information on configuration and usage is availeble from the WebDyne site, http://webdyne.org/ - or from a snapshot of
current documentation in PDF format available in the WebDyne source /doc directory.

=head1 Copyright and License

WebDyne::Install::Lighttpd is Copyright (C) 2006-2010 Andrew Speer. WebDyne::Install::Lighttpd is dual licensed. It is
released as free software released under the Gnu Public License (GPL), but is also available for commercial use under
a proprietary license - please contact the author for further information.

WebDyne::Install::Lighttpd is written in Perl and uses modules from CPAN[3] (the Comprehensive Perl Archive Network).
CPAN modules are Copyright (C) the owner/author, and are available in source from CPAN directly. All CPAN modules used
are covered by the Perl Artistic License

=head1 Author

Andrew Speer, andrew@webdyne.org

=head1 Bugs

Please report any bugs or feature requests to "bug-webdyne-install-lighttpd at rt.cpan.org", or via
http://rt.cpan.org/NoAuth/ReportBug.html?Queue=WebDyne-Install-Lighttpd



( run in 0.584 second using v1.01-cache-2.11-cpan-5511b514fd6 )