File: cmp_expr.t

package info (click to toggle)
libhtml-template-pro-perl 0.9502-1%2Bsqueeze1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 1,584 kB
  • ctags: 860
  • sloc: ansic: 1,814; perl: 1,442; yacc: 410; pascal: 118; makefile: 5
file content (32 lines) | stat: -rw-r--r-- 809 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/perl -w

use HTML::Template;
use HTML::Template::Expr;
use HTML::Template::Pro;

my @arglist;
while (@ARGV) {
    push @arglist, split /=/, shift @ARGV;
}
print "Arguments: ".join(' ',@arglist),"\n" if @arglist; 

while (<>) {
	chomp;
	my $tmplline='<tmpl_var expr="'.$_.'">';
	print 'tmpl:',$tmplline,"\n";
	eval {
	    print 'Pro:',"\n";
	    my $tmpl=HTML::Template::Pro->new(scalarref => \$tmplline, die_on_bad_params=>0);
	    $tmpl->param(@arglist);
	    print 'Output:',$tmpl->output(),"\n";
	};
	print 'Pro: failed with:',"\n",$@,"\n" if $@;
	eval {
	    print 'Expr:',"\n";
	    my $tmpl=HTML::Template::Expr->new(scalarref => \$tmplline, die_on_bad_params=>0);
	    $tmpl->param(@arglist);
	    print 'Output:',$tmpl->output(),"\n";
	};
	print 'Expr: failed with:',"\n",$@,"\n" if $@;
}