1 |
– |
#!/usr/local/bin/perl5 |
2 |
– |
# |
1 |
|
# Switcher Module |
2 |
|
# |
3 |
|
# Look for elements given in input has in a string |
6 |
|
# processed. |
7 |
|
|
8 |
|
package Switcher; |
9 |
+ |
require 5.001; |
10 |
|
require Exporter; |
11 |
|
use Carp; |
12 |
|
@ISA = qw(Exporter); |
15 |
|
my $class=shift; |
16 |
|
my $hash=shift; |
17 |
|
my $file=shift; |
18 |
+ |
my $objectname=shift; |
19 |
|
my $self = {}; |
20 |
+ |
$self->{allw}=$objectname; |
21 |
|
bless $self, $class; |
22 |
|
$self->_initialise($hash,$file); |
23 |
|
return $self; |
120 |
|
# Do we call the tag init routine? |
121 |
|
if ( ( defined ( ${$self->{labelhash}}{$rtname} )) && |
122 |
|
( ! ( ${$self->{labelhash}}{$rtname}=~/none/i )) ) { |
123 |
< |
&{${$self->{labelhash}}{$rtname}}( $temp, |
124 |
< |
@{$self->{tagblock}}); |
123 |
> |
&{${$self->{labelhash}}{$rtname}}( $self->{allw}, |
124 |
> |
$temp, @{$self->{tagblock}}); |
125 |
|
} |
126 |
|
$self->_flipcontext($temp); |
127 |
|
$#{$self->{tagblock}}= -1; |
226 |
|
( ! ( ${$self->{labelhash}}{${$self->{lastcon}}[$#{$self->{lastcon}}]} |
227 |
|
=~/none/i )) ) { |
228 |
|
&{ ${$self->{labelhash}}{${$self->{lastcon}}[$#{$self->{lastcon}}]}}( |
229 |
< |
${$self->{lastcon}}[$#{$self->{lastcon}}], @{$self->{tagblock}}); |
229 |
> |
$self->{allw}, ${$self->{lastcon}}[$#{$self->{lastcon}}], @{$self->{tagblock}}); |
230 |
|
} |
231 |
|
} |
232 |
|
} |
238 |
|
my $key=shift; |
239 |
|
|
240 |
|
if ( ! defined $$hashref{$key} ) { |
241 |
< |
print "BootParser: Badly formed $name tag -". |
241 |
> |
print "Switcher: Badly formed $name tag -". |
242 |
|
" undefined $key parameter\n"; |
243 |
|
exit 1; |
244 |
|
} |
245 |
|
$$hashref{$key}=~s/["']//; |
246 |
|
} |
247 |
|
|
248 |
+ |
# |
249 |
+ |
# return the current line number |
250 |
+ |
# |
251 |
+ |
sub line { |
252 |
+ |
return $self->{linecount}; |
253 |
+ |
} |