Asterisk-LCR
view release on metacpan or search on metacpan
lib/Asterisk/LCR/Route.pm view on Meta::CPAN
XPD => 'Palladium Ounces',
XPF => 'Comptoirs Français du Pacifique Francs',
XPT => 'Platinum, Ounces',
YER => 'Yemen, Rials',
ZAR => 'South Africa, Rand',
ZMK => 'Zambia, Kwacha',
ZWD => 'Zimbabwe, Zimbabwe Dollars',
);
=head2 $self->validate();
Validates this object to avoid constructing objects which are
in an inconsistent state.
returns 1 if the object validates, 0 otherwise.
=cut
sub validate
{
my $self = shift;
my $res = eval {
$self->validate_connection_fee() &
$self->validate_first_increment() &
$self->validate_increment() &
$self->validate_currency() &
$self->validate_rate() &
$self->validate_provider() &
$self->validate_label() &
$self->validate_prefix()
};
$@ and do {
print $@ . "\n\n";
use Data::Dumper;
die Dumper ($self);
};
return $res;
}
=head2 $self->validate_connection_fee();
Validate this object's 'connection_fee' attribute.
returns 1 if the attribute validates, 0 otherwise.
=cut
sub validate_connection_fee
{
my $self = shift;
my $val = $self->connection_fee();
defined $val or do {
die 'asterisk/lcr/rate/connection_fee/undefined';
return 0;
};
is_number ($val) or do {
die "asterisk/lcr/rate/connection_fee/not_a_number : $val";
return 0;
};
return 1;
}
=head2 $self->set_connection_fee ($fee);
Sets the current object's 'connection_fee' attribute.
=cut
sub set_connection_fee
{
my $self = shift;
$self->{connection_fee} = shift;
}
=head2 $self->connection_fee();
Returns the current object's 'connection_fee' attribute.
=cut
sub connection_fee
{
my $self = shift;
return $self->{connection_fee};
}
=head2 $self->validate_first_increment();
Validate this object's 'first_increment' attribute.
Returns 1 if the attribute validates, 0 otherwise.
=cut
sub validate_first_increment
{
my $self = shift;
my $val = $self->first_increment();
defined $val or do {
die 'asterisk/lcr/rate/first_increment/undefined';
return 0;
};
is_number ($val) or do {
die 'asterisk/lcr/rate/first_increment/not_a_number';
return 0;
};
return 1;
}
=head2 $self->set_first_increment ($fee);
Sets the current object's 'first_increment' attribute.
=cut
sub set_first_increment
{
my $self = shift;
$self->{first_increment} = shift;
}
=head2 $self->first_increment();
Returns the current object's 'first_increment' attribute.
=cut
sub first_increment
{
my $self = shift;
return $self->{first_increment};
}
=head2 $self->validate_increment();
Validate this object's 'increment' attribute.
Returns 1 if the attribute validates, 0 otherwise.
=cut
sub validate_increment
{
my $self = shift;
my $val = $self->increment();
defined $val or do {
die 'asterisk/lcr/rate/increment/undefined';
return 0;
};
is_number ($val) or do {
die 'asterisk/lcr/rate/increment/not_a_number';
return 0;
};
return 1;
}
=head2 $self->set_increment ($fee);
Sets the current object's 'increment' attribute.
=cut
sub set_increment
{
my $self = shift;
$self->{increment} = shift;
}
=head2 $self->increment();
Returns the current object's 'increment' attribute.
=cut
sub increment
{
my $self = shift;
return $self->{increment};
}
=head2 $self->validate_rate();
Validate this object's 'rate' attribute.
Returns 1 if the attribute validates, 0 otherwise.
=cut
sub validate_rate
{
my $self = shift;
my $val = $self->rate();
defined $val or do {
die 'asterisk/lcr/rate/rate/undefined';
return 0;
};
is_number ($val) or do {
die 'asterisk/lcr/rate/rate/not_a_number';
return 0;
};
return 1;
}
=head2 $self->set_rate ($fee);
Sets the current object's 'rate' attribute.
=cut
sub set_rate
{
my $self = shift;
$self->{rate} = shift;
}
=head2 $self->rate();
Returns the current object's 'rate' attribute.
=cut
sub rate
{
my $self = shift;
return $self->{rate};
}
=head2 $self->validate_currency();
Validate this object's 'currency' attribute.
Returns 1 if the attribute validates, 0 otherwise.
=cut
sub validate_currency
{
my $self = shift;
my $val = $self->currency();
defined $val or do {
die 'asterisk/lcr/rate/currency/undefined';
return 0;
};
$CURRENCY{$val} or do {
die 'asterisk/lcr/rate/currency/unknown';
return 0;
};
return 1;
}
=head2 $self->set_currency ($fee);
( run in 2.299 seconds using v1.01-cache-2.11-cpan-5c0b1e786e0 )