###
### Copyright 2000-2007 University of Illinois Board of Trustees
### All rights reserved.
###
### PSGConf::Data::ConfigError - data obj class for signalling config errors
###
### Campus Information Technologies and Educational Services
### University of Illinois at Urbana-Champaign
###
package PSGConf::Data::ConfigError;
use strict;
use PSGConf::Data;
our @ISA = qw(PSGConf::Data);
###############################################################################
### set method
###############################################################################
sub set
{
my ($self, $value) = @_;
if ($self->{fatal})
{
die $value;
}
else
{
warn $value;
}
}
###############################################################################
### documentation
###############################################################################
1;
__END__
=head1 NAME
PSGConf::Data::ConfigError - psgconf data obj class for signalling config errors
=head1 SYNOPSIS
use PSGConf::Data::ConfigError;
$psgconf->register_data(
'die' => PSGConf::Data::ConfigError->new(
fatal => 1
),
'warn' => PSGConf::Data::ConfigError->new()
);
=head1 DESCRIPTION
The B<PSGConf::Data::ConfigError> module provides a class that can
be used to signal configuration errors from within the B<PSGConf>
data store(s). Although it uses the Data object interface, it does not
actually encapsulate a value.
The B<PSGConf::Data::ConfigError> class is derived from the
B<PSGConf::Data> class, but it defines/overrides the following methods:
=over 4
=item set()
Generates an error using the specified value as the error message.
If the object was created with the I<fatal> attribute set to a true
value, then the error message is generated using the Perl die() builtin.
Otherwise, it is generated using the warn() builtin.
=back
=head1 SEE ALSO
L<perl>
L<PSGConf>
L<PSGConf::Data>
=cut
syntax highlighted by Code2HTML, v. 0.9.1