I'm going to develop a module that includes Variables in Strings. They must come from different files, because permissions are important. I wanted to use the ref in @INC mechanism, because I want the power of perl. But I must restrict it to the user. So the module makes checks on the source. But it fails with a mysterious ^P in the source. Only if I use -Dt on the Interpreter it doesn't fail. Here is a patch archive:
diff -uP null/com xxx/com --- null/com Thu Jan 1 01:00:00 1970 +++ xxx/com Sun Mar 2 18:51:51 2003 @@ -0,0 +1,12 @@ + 507 debugperl -DptT -we 'require "t.pl"' -Mwr=t.pl 2>&1|cat >ptT + 508 debugperl -DpT -we 'require "t.pl"' -Mwr=t.pl 2>&1|cat >pT + 509 grep -v '^\(' ptT|less + 510 grep -v '^(' ptT|less + 511 less pT + 512 grep -v '^(' ptT|diff - pT|less + 513 grep -v '^(' ptT|diff pT - |less + 514 man diff + 515 grep -v '^(' ptT|diff -yu pT - |less + 516 grep -v '^(' ptT|diff -y pT - |less + 517 grep -v '^(' ptT|diff -y pT - |less>err + 518 history>com diff -uP null/t.pl xxx/t.pl --- null/t.pl Thu Jan 1 01:00:00 1970 +++ xxx/t.pl Fri Feb 28 10:10:03 2003 @@ -0,0 +1,11 @@ +'dudu' +<HTML> +<HEAD> + <TITLE>Testseite</TITLE> +</HEAD> +<BODY> + TesT!!Test!TEST!!${u} +</BODY> +$@; +</HTML> +</HTML> diff -uP null/wr.pm xxx/wr.pm --- null/wr.pm Thu Jan 1 01:00:00 1970 +++ xxx/wr.pm Fri Feb 28 13:36:06 2003 @@ -0,0 +1,66 @@ +package wr; +sub import{ + shift; + my $sub=shift; + if(ref$sub){ + $@='@'; + print $sub->()."</HTML>\n"; + }else{ + unshift @::INC,($sub=[sub{ + #print @_; + my $me=shift;#print @$me; + my $file=shift; + return if $file ne $me->[1]; + my $ret=""; + for my $p (@::INC){ + $ret=1,next if$p eq$me; + next unless $ret; + my$et; + open $et,"<","$p/$file" and $ret=$et,last;#print "$p/$file$! +\n"; + }#print"---$!",$ret; + return unless ref$ret;#print "+++$file"; + return(sub{ + my $m=$_[1]; + return 0 unless defined $m->[1]; + my$c=3; + while(length($_=$m->[1])||$c--){ + my $n=$_[0]; + my $r=$m->[3]->($m->[4]); + if($n){ + if($n<=length){ + $n=substr$_,0,$n; + $_=substr$_,length$n; + ($_,$n)=($n,$_); + $m->[1]=$n;print"§"; + return length; + } + }else{ + if($n=1+index($_,"\n")){ + $n=substr$_,0,$n; + $_=substr$_,length$n; + ($_,$n)=($n,$_); + $m->[1]=$n;print; + return length; + } + } + undef$m->[0]unless ref$r; + $m->[2]=~s/($r)//; + $m->[1].=$1; + next if length $1; + return 0 unless$n=$m->[0]; + $m->[2].=<$n>; + } + return 0; + },[$ret,'use '.__PACKAGE__. + ' sub{package al;<<"</HTML>"},','',$me->[2]]) + },$sub,sub{local$;='$;';s{^(</HTML>)$}{$1\n;return$;;\n}#and retu +rn'${' + ;return qr/([^\\\$@]|[a]|\$([@"]|\{[a-zA-Z0-9]+\}))*/m +s;}]); + return $sub; + } +} +1; + + + + +
By the way: I use the perl of the debian woody distribution.

In reply to ref in @INC and debugging by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.