#!/usr/bin/perl
package RVL::Error;
##LICENSE##
use strict;
use warnings;
use Class::Std::Utils;
{
sub new {
my ($class) = @_;
my (%hash);
my ($this) = bless( \%hash, $class);
return $this;
}
sub singleton {
my ($class) = __PACKAGE__;
if (!defined $RVL::INSTANCE{$class}) {
$RVL::INSTANCE{$class} = $class->new();
}
return $RVL::INSTANCE{$class}
}
sub count {
my ($this) = @_;
return (defined $RVL::GLOBALS{'_RVL'}{'ERRORS'})
? @{$RVL::GLOBALS{'_RVL'}{'ERRORS'}}
: 0;
}
sub isError {
my ($this) = @_;
if(defined $RVL::GLOBALS{'_RVL'}{'ERRORS'} && @{$RVL::GLOBALS{'_RVL'}{'ERRORS'}} > 0) {
return 1;
} else {
return 0;
}
}
sub push {
my ($this, $error) = @_;
return push(@{$RVL::GLOBALS{'_RVL'}{'ERRORS'}}, $error);
}
sub pop {
my ($this) = @_;
return pop(@{$RVL::GLOBALS{'_RVL'}{'ERRORS'}});
}
sub getAll {
my ($this) = @_;
return $RVL::GLOBALS{'_RVL'}{'ERRORS'};
}
sub shift {
my ($this) = @_;
return shift(@{$RVL::GLOBALS{'_RVL'}{'ERRORS'}});
}
sub getLast {
my ($this) = @_;
# return obj ErrorHandle
my ($count) = @{$RVL::GLOBALS{'_RVL'}{'ERRORS'}};
if ($count gt 0) {
$count = $count -1;
return @{$RVL::GLOBALS{'_RVL'}{'ERRORS'}}[$count];
} else {
return '';
}
}
sub reset {
my ($this, $error) = @_;
$RVL::GLOBALS{'_RVL'}{'ERRORS'} = '';
return 1;
}
sub toString {
my ($this, $error) = @_;
}
}
1;
Copyright 2K16 - 2K18 Indonesian Hacker Rulez