use strict;
use warnings;
-use Exporter qw(import);
+use base 'Exporter';
use Fcntl qw(:flock);
+our $VERSION = '1.00';
our @EXPORT = qw/Entity DecodeURI EncodeURI Include include PLP_END
AddCookie ReadFile WriteFile AutoURL Counter exit/;
$PLP::inA = 0;
$PLP::inB = 0;
local $@;
- eval 'package PLP::Script; ' . PLP::source($PLP::file, 0, join ' ', (caller)[2,1]);
+ eval 'package PLP::Script; no warnings; ' . PLP::source($PLP::file, 0, join ' ', (caller)[2,1]);
if ($@) {
PLP::Functions::exit() if $@ =~ /\cS\cT\cO\cP/;
PLP::error($@, 1);
sub Entity (@) {
my $ref = defined wantarray ? [@_] : \@_;
for (@$ref) {
+ defined or next;
eval {
s/&/&/g;
s/"/"/g;
sub DecodeURI (@) {
my $ref = defined wantarray ? [@_] : \@_;
for (@$ref) {
+ defined or next;
eval {
tr/+/ /; # Browsers do tr/ /+/ - I don't care about RFCs, but
# I do care about real-life situations.
sub EncodeURI (@) {
my $ref = defined wantarray ? [@_] : \@_;
for (@$ref) {
+ defined or next;
eval {
s{([^A-Za-z0-9\-_.!~*'()/?:@\$,])}{sprintf("%%%02x", ord $1)}ge;
};
sub AddCookie ($) {
if ($PLP::Script::header{'Set-Cookie'}) {
- $PLP::Script::header{'Set-Cookie'} .= "\nSet-Cookie: $_[0]";
+ $PLP::Script::header{'Set-Cookie'} .= "\n" . $_[0];
} else {
$PLP::Script::header{'Set-Cookie'} = $_[0];
}