lib/Lemplate/Parser.pm - lemplate

Data types defined

Source code

  1. package Lemplate::Parser;
  2. use strict;
  3. use warnings;
  4. use base 'Template::Parser';

  5. # VERSION

  6. use Lemplate::Grammar;
  7. use Lemplate::Directive;

  8. sub new {
  9.     my $class = shift;
  10.     my $parser = $class->SUPER::new(
  11.         GRAMMAR => Lemplate::Grammar->new(),
  12.         FACTORY => 'Lemplate::Directive',
  13.         @_,
  14.     );

  15.     # flags passed from Lemplate object
  16.     my %args = @_;

  17.     # eval-javascript is default "on"
  18.     $parser->{EVAL_JAVASCRIPT} = exists $args{EVAL_JAVASCRIPT}
  19.       ? $args{EVAL_JAVASCRIPT} : 1;

  20.     # tie the parser state-variable to the global Directive var
  21.     $parser->{INJAVASCRIPT} = \$Lemplate::Directive::INJAVASCRIPT;

  22.     return $parser;
  23. }

  24. 1;

  25. __END__

  26. =encoding UTF-8

  27. =head1 NAME

  28. Lemplate::Parser - Lemplate Parser Subclass

  29. =head1 SYNOPSIS

  30.     use Lemplate::Parser;

  31. =head1 DESCRIPTION

  32. Lemplate::Parser is a simple subclass of Template::Parser. Not much
  33. to see here.

  34. =head1 AUTHOR

  35. Ingy döt Net <ingy@cpan.org>

  36. =head1 COPYRIGHT

  37. Copyright (c) 2006-2014. Ingy döt Net. All rights reserved.

  38. This program is free software; you can redistribute it and/or modify it
  39. under the same terms as Perl itself.

  40. See L<http://www.perl.com/perl/misc/Artistic.html>

  41. =cut