Board: DXpress Project

Subject

Scoping Question

Author

Tim Pizey

Status

Date

13/09/1998 02:08

Message

William,
I am getting on well with your code.
I have written my first object, if you don't count StyleSheet,
for the Rule as in 'rule_above' and 'rule_below'.
I am having a little difficulty with attribOutput:
<code>
sub attribOutput {
my ($self, $attrib, $abstractVal) = @_;
my $tag = undef;
my $attribTag = $attrib . 'Tag';
eval {
local $SIG<a href='/paneris/cgi-bin/create_page.pl?__DIE__'>__DIE__</a> = 'IGNORE'; # else will get [CGI::Carp]ed at
$tag = $self->$attribTag();
};
my $output = undef;
if (defined $tag) {
my $val;
my $attribValue = $attrib . 'Value';
eval {
local $SIG<a href='/paneris/cgi-bin/create_page.pl?__DIE__'>__DIE__</a> = 'IGNORE'; # else will get [CGI::Carp]ed at
$val = $self->$attribValue($abstractVal);
};
$@ eq '' or $val = $abstractVal;
if (defined $val) {
$output = $self->taggedValueOutput($tag, $val);
}
}
else {
my $attribOutput = $attrib . 'Output';
#HELP How come $val is in scope?
eval {
$output = $self->$attribOutput($val);
};
}
$output;
}
</code>
If $val is scoped within the if block, won't it be
undefined in the else block?
yours
TimP

DXpress Project Board

 

Post Follow-up

Search This Board

 



Home -  News -  Reference Sites -  Members -  Partners -  Guidelines -  Philosophy -  Your Details -  Logout