| 1 | package AmberDB::Tools; | ||
| 2 | |||
| 3 | use 5.016; | ||
| 4 | use warnings; | ||
| 5 | use strict; | ||
| 6 | use Carp qw(croak cluck); | ||
| 7 | use File::Spec; | ||
| 8 | |||
| 9 | use AmberDB::Tools::Index; | ||
| 10 | use AmberDB::Tools::Maintain; | ||
| 11 | use AmberDB::Tools::Update; | ||
| 12 | |||
| 13 | use parent qw( | ||
| 14 | AmberDB::Tools::Index | ||
| 15 | AmberDB::Tools::Maintain | ||
| 16 | AmberDB::Tools::Update | ||
| 17 | ); | ||
| 18 | |||
| 19 | our $VERSION = '5.26.6'; | ||
| 20 | my $CREATED = '2018-10-08'; | ||
| 21 | |||
| 22 | # Constructor | ||
| 23 | # my $tools = AmberDB::Tools->new($adb, %options); | ||
| 24 | # my $tools = AmberDB::Tools->new(%options); # creates a new AmberDB instance | ||
| 25 | # ------------------------------------------------ | ||
| 26 | sub new { | ||
| 27 | |||
| 28 | my $class = shift; | ||
| 29 | my $self = {}; | ||
| 30 | |||
| 31 | require AmberDB; | ||
| 32 | |||
| 33 | my ( $adb, %inputs ); | ||
| 34 | |||
| 35 | if ( ref( $_[0] ) ) { | ||
| 36 | $adb = shift; | ||
| 37 | %inputs = @_; | ||
| 38 | } | ||
| 39 | else { | ||
| 40 | %inputs = @_; | ||
| 41 | $adb = AmberDB->new(%inputs); | ||
| 42 | } | ||
| 43 | |||
| 44 | $self->{_adb} = $adb; | ||
| 45 | |||
| 46 | foreach my $in ( keys %inputs ) { | ||
| 47 | $self->{ uc($in) } = $inputs{$in}; | ||
| 48 | } | ||
| 49 | $self->{say} = ""; | ||
| 50 | |||
| 51 | bless $self, $class; | ||
| 52 | return $self; | ||
| 53 | } | ||
| 54 | |||
| 55 | 1; | ||
| 56 | |||
| 57 | __END__ |