PLP

 view release on metacpan or  search on metacpan

lib/PLP.pm  view on Meta::CPAN


Unless you're running as CGI, the interpreter won't exit after processing a page,
so C<END { }> blocks won't work properly.  You should use C<PLP_END { };> instead.
Note that this is a not a built-in construct, so it needs proper termination
with a semi-colon (as do C<eval> and C<do>).

When run persistently, modules are loaded only once. A good modular design can
improve performance because of this, but you will have to B<reload> the modules
yourself when there are newer versions. 

The special hashes are tied hashes and do not always behave the way you expect,
especially when mixed with modules that expect normal CGI environments, like
CGI.pm. Read L<PLP::Fields> for information more about this.

=head1 FAQ and HowTo

A lot of questions are asked often, so before asking yours, please read the 
FAQ at L<PLP::FAQ>. Some examples can be found at L<PLP::HowTo>.

=head1 AUTHORS

Currently maintained by Mischa POSLAWSKY <perl@shiar.org>

Originally by Juerd Waalboer <juerd@cpan.org>

=head1 LICENSE

Copyright (c) 2000-2002 Juerd Waalboer, 2005-2018 Mischa POSLAWSKY.
All rights reserved.

This software is free software;
you can redistribute and/or modify it under the terms of the MIT/X11 license.

=head1 SEE ALSO

L<PLP::Functions>, L<PLP::Fields>, L<PLP::FAQ>, L<PLP::HowTo>

=cut

### Garbage bin

# About the #S lines:
# I wanted to implement Safe.pm so that scripts were run inside a
# configurable compartment. This needed for XS modules to be pre-loaded,
# hence the PLPsafe_* Apache directives. However, $safe->reval() lets
# Apache segfault. End of fun. The lines are still here so that I can
# s/^#S //g to re-implement them whenever this has been fixed.

#S # For PLPsafe scripts
#S sub safe_eval {
#S     my ($r, $code) = @_;
#S     $r->send_http_header('text/plain');
#S     require Safe;
#S     unless ($PLP::safe) {
#S 	$PLP::safe = Safe->new('PLP::Script');
#S 	for ( map split, $r->dir_config->get('PLPsafe_module') ) {
#S 	    $PLP::safe->share('*' . $_ . '::');
#S 	    s!::!/!g;
#S 	    require $_ . '.pm';
#S 	}
#S 	$PLP::safe->permit(Opcode::full_opset());
#S 	$PLP::safe->deny(Opcode::opset(':dangerous'));
#S     }
#S     $PLP::safe->reval($code);
#S }
#S  my ($r) = @_;

# start()
#S 	if ($PLP::use_safe) {
#S 	    PLP::safe_eval($r, $PLP::code);
#S 	} else {
#	    eval qq{ package PLP::Script; $PLP::code; };
#S 	}
#	PLP::error($@, 1) if $@ and $@ !~ /\cS\cT\cO\cP/;
#S 	if ($PLP::use_safe) {
#S 	    PLP::safe_eval($r, '$_->() for reverse @PLP::END');
#S 	} else {
#	    eval   { package PLP::Script; $_->() for reverse @PLP::END };
#S 	}
#	PLP::error($@, 1) if $@ and $@ !~ /\cS\cT\cO\cP/;

###



( run in 1.150 second using v1.01-cache-2.11-cpan-71847e10f99 )