Be slightly more verbose in error messages.

This commit is contained in:
ian%hixie.ch 2002-10-10 21:42:44 +00:00
Родитель 88e3091e81
Коммит bac308d0b4
1 изменённых файлов: 6 добавлений и 6 удалений

Просмотреть файл

@ -135,28 +135,28 @@ sub newline {
sub define {
my $self = shift;
my($variable, $value) = @_;
die "not a valid variable name\n" if $variable =~ m/\W/;
die "not a valid variable name: '$variable'\n" if $variable =~ m/\W/;
$self->{'variables'}->{$variable} = $value;
}
sub defined {
my $self = shift;
my($variable) = @_;
die "not a valid variable name\n" if $variable =~ m/\W/;
die "not a valid variable name: '$variable'\n" if $variable =~ m/\W/;
return defined($self->{'variables'}->{$variable});
}
sub undefine {
my $self = shift;
my($variable) = @_;
die "not a valid variable name\n" if $variable =~ m/\W/;
die "not a valid variable name: '$variable'\n" if $variable =~ m/\W/;
delete($self->{'variables'}->{$variable});
}
sub get {
my $self = shift;
my($variable) = @_;
die "not a valid variable name\n" if $variable =~ m/\W/;
die "not a valid variable name: '$variable'\n" if $variable =~ m/\W/;
my $value = $self->{'variables'}->{$variable};
if (defined($value)) {
return $value;
@ -206,7 +206,7 @@ sub define {
/^(\w+)$/os && do {
return $stack->define($1, 1);
};
die "invalid argument\n";
die "invalid argument: '$_'\n";
}
}
@ -250,7 +250,7 @@ sub if {
# false value
return $stack->push(not $stack->get($1));
};
die "invalid argument\n";
die "invalid argument: '$_'\n";
}
}