use Exporter qw(import);
use Fcntl qw(:flock);
+our $VERSION = '1.00';
our @EXPORT = qw/Entity DecodeURI EncodeURI Include include PLP_END
AddCookie ReadFile WriteFile AutoURL Counter exit/;
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];
}