Apache-PSP

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

  - updated %COOKIE hash code to handle url-encoded cookies properly

0.82  22 Apr 2003
  - special non-CGI::Minimal version for Charles Cowdrick

0.91  25 Sep 2003
  - incorporated site-custom changes into CPAN version
  - Template::PSP now clears cookies before each request

1.00  19 Mar 2004
  - <output> and <pspescape> tags handle extra end tags more gracefully
  - initial support for <autoloop> and autoforms
  - finally deemed Out Of Beta(tm)

lib/Template/PSP.pm  view on Meta::CPAN

# $outputflag - process '$' variables
# $perlflag   - perl code
# $package    - template is being placed in $package
# %tagdata    - data associated with tag being created
# %Cache      - file time stamps for loaded psp pages
# %Handler    - pointers to subroutines for psp pages
# %type       - subroutines for handling output types

use vars qw (%tags %global_tags $page $parsefile $frags $outputflag $perlflag
	     $handlerflag $package %tagdata %Cache %Handler %type $lineno
	     $top_package $escapeflag $space
	    );

use vars qw(%QUERY %CGI %FILENAMES %AUTH %COOKIE);

%tags = map {$_ => 1} 
	( "tag", "loop", "if", "else", "elseif", "perl", "fetch", "output", 
	"handler", "return", "include", "pspescape" );

sub cleanup
{
  no strict 'refs';
  push(@{$top_package . "::cleanup_handler"}, shift);
}

sub cleanup_handler
{
  my $handlers = shift(@_);

lib/Template/PSP.pm  view on Meta::CPAN

sub start
{
  my $tagname = lc(shift);
  my $attr = shift;
  my $text = shift;

  no strict 'refs';

  default($text);

  if ($escapeflag || $tagname eq $tagdata{name} || $perlflag)
  {
    text($space . $text);
    $space = "";
    return;
  }

  # start tag
  if ($tags{$tagname})
  {
    no strict 'refs';

lib/Template/PSP.pm  view on Meta::CPAN

  return;
}

sub end
{
  my $tagname = lc(shift);
  my $text = shift;

  default($text);

  if (($escapeflag && $tagname ne "pspescape") ||
      ($tagname eq $tagdata{name}) ||
      ($handlerflag && $tagname ne "handler") ||
      (!$handlerflag && $perlflag && $tagname ne "perl"))
  {
    text($space . $text);
    $space = "";
    return;
  }

  if ($tags{$tagname})

lib/Template/PSP.pm  view on Meta::CPAN

{
  my ($text) = @_;
  $lineno += count_lines($text);
}

# handles all text that is read by the parser
sub text
{
  my ($text) = @_;

  if (!$escapeflag && $text =~ /^\s*$/s)
  {
    $space = $text;
    return;
  }
  if ($perlflag)
  {
    append_page($text);
  }
  elsif ($outputflag)
  {

lib/Template/PSP.pm  view on Meta::CPAN

{
    $outputflag++;
}

sub output_ 
{
  $outputflag--;
  $outputflag = 0 if $outputflag < 0;  
}

sub pspescape 
{
  $escapeflag++;
}

sub pspescape_ 
{
  $escapeflag--;
  $escapeflag = 0 if $escapeflag < 0;  
}

sub include 
{
  my ($attr) = @_;
 
  my $file     = eval qq{"$attr->{file}"};
  $file = abs_path($file);

  if (! -f $file) 

lib/Template/PSP/autoform.psp  view on Meta::CPAN

  <autotextarea name="explain" rows="5" cols="30" wrap="virtual" />

=cut

print "\n";
my $af = getpvar('autofill_data');

# set the value
my $value = $af->{'field'}{$name};

# escape any HTML-like characters
$value =~ s/&/&amp;/g;
$value =~ s/</&lt;/g;

print qq{<textarea name="$name" rows="$rows" cols="$cols">$value</textarea>\n};

</perl>
</tag>

<tag name="autoradio" body="1" global="1" 
     accepts="name, lookup, sortby">



( run in 0.722 second using v1.01-cache-2.11-cpan-c21f80fb71c )