3 # Not to be used without the CGI script;
15 print STDOUT "Content-Type: text/plain\n\n" if $DEBUG & 2;
16 print STDOUT map("$_: $PLP::Script::header{$_}\n", keys %PLP::Script::header), "\n";
20 my ($path, $level) = @_;
22 (my $file = $path) =~ s[.*/][];
24 ? qq/\cQ;\n#line 1 "$file"\nprint q\cQ/
25 : qq/\n#line 1 "$file"\nprint q\cQ/;
28 open SOURCE, $path or return $level
29 ? qq{\cQ; die qq[Can't open "\Q$path\E" (\Q$!\E)]; print q\cQ}
30 : qq{\ndie qq[Can't open "\Q$path\e" (\Q$!\E)];};
31 LINE: while (defined (my $line = <SOURCE>)) {
35 \G # Begin where left off
37 | <:=? | :> # PLP tags <:=? ... :>
38 | <\(.*?\)> # Include tags <(...)>
39 | <[^:(][^<:]* # Normal text
40 | :[^>][^<:]* # Normal text
41 | [^<:]* # Normal text
44 next LINE unless length $1;
46 if ($part eq '<:=' and not $inA || $inB) {
49 } elsif ($part eq '<:' and not $inA || $inB) {
52 } elsif ($part eq ':>' and $inA) {
55 } elsif ($part eq ':>' and $inB) {
57 $source .= "; print q\cQ";
58 } elsif ($part =~ /^<\((.*?)\)>\z/ and not $inA || $inB) {
59 $source .= source($1, $level + 1) .
60 qq/\cQ, \n#line $linenr "$file"\nq\cQ/;
62 $part =~ s/\\/\\\\/ if not $inA || $inB;
67 $source .= "\cQ" unless $level;