v3.05 release
[perl/plp/.git] / PLP / Functions.pm
index 9d7b33c1c5d3a1a229e50dd1aa08e8d234dbb359..080c61559e6b273ec3cfbb76970f75f89f317233 100644 (file)
@@ -8,10 +8,13 @@ our @EXPORT = qw/HiddenFields Entity DecodeURI EncodeURI Entity include
                  AddCookie ReadFile WriteFile AutoURL Counter Include/;
 
 sub Include ($) {
-    my ($file) = $_[0];
+    no strict;
+    $PLP::file = $_[0];
     $PLP::inA = 0;
     $PLP::inB = 0;
-    eval PLP::source($file, 0);
+    local $@;
+    eval 'package PLP::Script; ' . PLP::source($PLP::file, 0, join ' ', (caller)[2,1]);
+    PLP::error($@, 1) if $@;
 }
 
 sub include ($) {
@@ -119,8 +122,8 @@ sub WriteFile ($$) {
 sub Counter ($) {
     local *COUNTER;
     local $/ = undef;
-    open           COUNTER, "+<$_[0]" or
-    open          COUNTER, ">$_[0]"  or return undef;
+    open           COUNTER, '+<', $_[0] or
+    open          COUNTER, '>',  $_[0] or return undef;
     flock          COUNTER, 2;
     seek           COUNTER, 0, 0;
     my $counter = <COUNTER>;