/usr/lib/x86_64-linux-gnu/perl5/5.22/Embperl/Syntax/ASP.pm is in libembperl-perl 2.5.0-6.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 | ###################################################################################
#
# Embperl - Copyright (c) 1997-2008 Gerald Richter / ecos gmbh www.ecos.de
# Embperl - Copyright (c) 2008-2014 Gerald Richter
#
# You may distribute under the terms of either the GNU General Public
# License or the Artistic License, as specified in the Perl README file.
#
# THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
# WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
# $Id: ASP.pm 1578075 2014-03-16 14:01:14Z richter $
#
###################################################################################
package Embperl::Syntax::ASP ;
use Embperl::Syntax qw{:types} ;
use Embperl::Syntax::HTML ;
use strict ;
use vars qw{@ISA %Cmds %CmdsOutput %CmdsOutputLink} ;
@ISA = qw(Embperl::Syntax::HTML) ;
###################################################################################
#
# Methods
#
###################################################################################
# ---------------------------------------------------------------------------------
#
# Create new Syntax Object
#
# ---------------------------------------------------------------------------------
sub new
{
my $class = shift ;
my $self = Embperl::Syntax::HTML::new ($class) ;
if (!$self -> {-aspInit})
{
$self -> {-aspInit} = 1 ;
Init ($self) ;
}
return $self ;
}
###################################################################################
#
# Definitions for ASP HTML tags
#
###################################################################################
sub Init
{
my ($self) = @_ ;
$self -> {-aspCmds} = $self -> CloneHash ({ %Cmds, %CmdsOutput }) ;
$self -> {-aspCmdsLink} = $self -> CloneHash ({ %Cmds, %CmdsOutputLink }, { 'unescape' => 2 }) ;
$self -> AddToRoot ($self -> {-aspCmds}) ;
$self -> AddToRoot ({
'ASP Syntax' => {
'text' => '<%?syntax',
'end' => '?%>',
'procinfo' => {
embperl => {
compiletimeperlcode => '$_[0] -> Syntax (Embperl::Syntax::GetSyntax(%#\'0%, $_[0] -> SyntaxName));',
parsetimeperlcode => '$_[0] -> Syntax (Embperl::Syntax::GetSyntax(\'%%\', $_[0] -> SyntaxName)) ;',
removenode => 3,
}
}
}
}) ;
}
# ---------------------------------------------------------------------------------
#
# Add new simple html tag (override to add asp commands inside html tags)
#
# ---------------------------------------------------------------------------------
sub AddTag
{
my $self = shift ;
my $tag = $self -> Embperl::Syntax::HTML::AddTag (@_) ;
#### add the ASP cmd inside the new HTML Tag ####
$tag -> {inside} ||= {} ;
my $inside = $tag -> {inside} ;
while (my ($k, $v) = each (%{$self -> {-aspCmds}}))
{
$inside -> {$k} = $v ;
}
if (!$self -> {-aspHTMLInit})
{
#### if not already done add the ASP cmds inside the HTML Attributes ####
$self -> {-aspHTMLInit} = 1 ;
my $unescape = 0 ;
foreach ('', 'Link')
{
my $attr = $self -> {"-htmlAssignAttr$_"} ;
my $blocks = $self -> {"-aspCmds$_"} ;
while (my ($k1, $v1) = each %$attr)
{
if (!($k1 =~ /^-/) && ref ($v1) eq 'HASH')
{
my $follow = $v1 -> {follow} ;
if (ref($follow) eq 'HASH')
{
while (my ($k2, $v2) = each %$follow)
{
if (ref($v2) eq 'HASH')
{
$v2 -> {inside} ||= {} ;
my $inside = $v2 -> {inside} ;
while (my ($k, $v) = each (%$blocks))
{
$inside -> {$k} = $v ;
}
}
}
}
}
}
}
my $quotes = $self -> {"-htmlQuotes"} ;
my $blocks = $self -> {"-aspCmds"} ;
while (my ($k2, $v2) = each %$quotes)
{
if (ref($v2) eq 'HASH')
{
$v2 -> {inside} ||= {} ;
my $inside = $v2 -> {inside} ;
while (my ($k, $v) = each (%$blocks))
{
$inside -> {$k} = $v ;
}
}
}
}
return $tag ;
}
###################################################################################
#
# ASP Implementation
#
###################################################################################
%Cmds = (
'-lsearch' => 1,
'ASP Code' => {
'text' => '<%',
'end' => '%>',
'procinfo' =>
{
embperl =>
{
perlcode => '%$c%%#0%',
removenode => 3,
mayjump => 1,
compilechilds => 0,
},
},
}
) ;
%CmdsOutput = (
'ASP Output' => {
'text' => '<%=',
'end' => '%>',
'procinfo' => {
embperl => {
perlcode =>
[
'if (!defined (_ep_rp(%$x%,scalar(%#~0:$col%)))) %#~-0:$row% { if ($col == 0) { _ep_dcp (%$t%,%^*htmltable%) ; last l%^*htmltable% ; } else { _ep_dcp (%$t%,%^*htmlrow%) ; last l%^*htmlrow% ; }}',
'if (!defined (_ep_rp(%$x%,scalar(%#~0:$col%)))) { _ep_dcp (%$t%,%^*htmlrow%) ; last l%^*htmlrow% ; }',
'if (!defined (_ep_rp(%$x%,scalar(%#~0:$row%)))) { _ep_dcp (%$t%,%^*htmltable%) ; last l%^*htmltable% ; }',
'_ep_rp(%$x%,scalar(%#0%));',
],
removenode => 4,
mayjump => '%#~0:$col|$row|$cnt% %?*htmlrow% %?*htmltable%',
compilechilds => 0,
}
}
}
) ;
%CmdsOutputLink = (
'ASP Output Link' => {
'text' => '<%=',
'end' => '%>',
'nodename' => '<%=url',
'unescape' => 2,
'procinfo' => {
embperl => {
perlcode =>
[
'if (!defined (_ep_rpurl(%$x%,scalar(%#~0:$col%)))) %#~-0:$row% { if ($col == 0) { _ep_dcp (%$t%,%^*htmltable%) ; last l%^*htmltable% ; } else { _ep_dcp (%$t%,%^*htmlrow%) ; last l%^*htmlrow% ; }}',
'if (!defined (_ep_rpurl(%$x%,scalar(%#~0:$col%)))) { _ep_dcp (%$t%,%^*htmlrow%) ; last l%^*htmlrow% ; }',
'if (!defined (_ep_rpurl(%$x%,scalar(%#~0:$row%)))) { _ep_dcp (%$t%,%^*htmltable%) ; last l%^*htmltable% ; }',
'_ep_rpurl(%$x%,scalar(%#0%));',
],
removenode => 4,
mayjump => '%#~0:$col|$row|$cnt% %?*htmlrow% %?*htmltable%',
compilechilds => 0,
}
}
}
) ;
1;
__END__
=pod
=head1 NAME
Embperl::Syntax::ASP - ASP syntax module for Embperl
=head1 SYNOPSIS
[$syntax ASP $]
<% $a = 1 ; %>
<table>
<% foreach (1..5) { %>
<tr>
<td><%= $_ %></td>
<td><%= $a += 2 %></td>
</tr>
<% } %>
</table>
=head1 DESCRIPTION
The module add the ASP syntax to Embperl. That mean when you select ASP as
syntax, Embperl understand the two following tags:
=over 4
=item <% %>
Between <% and %> you can put any Perl code that should be executed.
=item <%= %>
Between <%= and %> you can place a valid Perl expression and the result of
the expression is inserted instead of the <%= %> block.
=back
=head1 Author
Gerald Richter <richter at embperl dot org>
=head1 See Also
Embperl::Syntax
|