CHips L MINI SHELL

CHips L pro

Current Path : /proc/self/root/proc/2/root/usr/local/rvglobalsoft/rvglobalsoft/lib/RVL/
Upload File :
Current File : //proc/self/root/proc/2/root/usr/local/rvglobalsoft/rvglobalsoft/lib/RVL/Registry.pm

#!/usr/bin/perl
package RVL::Registry;
##LICENSE##
use strict;
use warnings;
use Class::Std::Utils;
{
    # class attribute
    my ($aProps);
    
    sub new {
        my ($class, $opt) = @_;
        my (%hash);
        my ($newClass) = bless( \%hash, $class);
        $newClass->{aProps} = {};
        return $newClass;
    }
    
=help
  Returns a singleton Registry instance.
=cut
    sub singleton {
        my ($class) = __PACKAGE__;
        if (!defined $RVL::INSTANCE{$class}) {
            $RVL::INSTANCE{$class} = $class->new();
        }
        return $RVL::INSTANCE{$class}
    }

=help
  Get registry data.
=cut
    sub get {
        my ($this, $key) = @_;
        if (defined $this->{aProps}->{$key}) {
            return $this->{aProps}->{$key};
        } else {
            return '';
        }
    }
    
=help
  Add or modify registry data.
=cut
    sub set {
        my ($this, $key, $value) = @_;
        $this->{aProps}->{$key} = $value;
    }
    
=help
  Add or modify request registry data.
=cut
    sub setRequest {
        my ($this, $reg) = @_;
        $this->set('request', $reg);
    }

=help
  Get request registry data.
=cut
    sub getRequest {
        my ($this, $reg) = @_;
        $this->get('request');
    }
    
    sub getConfig {
        my ($this, $reg) = @_;
        my ($c) = RVL::Config::singleton();
        return $c->getAll();
    }
    
    sub aggregate {
        my ($this, $output) = @_;

        foreach my $key (keys %{$this}) {
            ${$output}->{$key} = $this->{$key};
        }
        
        foreach my $key (keys %{ ${$output}->{aProps} }) {
            ${$output}->{$key} = ${$output}->{aProps}->{$key};
        }
        delete ${$output}->{aProps};
    }
}
1;

Copyright 2K16 - 2K18 Indonesian Hacker Rulez