package Lady_EZDB; use strict; ################################################# # Sub new # ################################################# ################################################# # PUBLIC Subroutine # ################################################# sub new ($;$){ my $class = shift; my $self = {}; bless $self, ref $class || $class; $self->{index_path} = undef; $self->{sep} = undef; $self->{lady_time} = undef; $self->{header} = undef; $self->{data} = undef; $self->{TABLE} = {}; $self->init(@_); return $self; } sub init($;$){ my $self = shift; $self->{index_path} = shift; if ($_[0]){$self->{sep}= shift;}else{$self->{sep}="|";} use Lady::Lady_DATE; my $TIME = new Lady_DATE; $self->{lady_time} = $TIME->lady_time(); return; } ################################################# # Sub get_EZDB_table # ################################################# ################################################# # PUBLIC Subroutine # ################################################# sub get_EZDB_table (){ my $self = shift; open(INDEXFILE, "$self->{index_path}") || $self->file_open_error("$self->{index_path}","Read Index",__FILE__,__LINE__); $self->{header} = ; #READ first line. $self->{data} = ; #READ data line. close(INDEXFILE); my $sep = $self->{sep}; # OOP BUGFIX my @keys = split(/\$sep/,$self->{header}); my @values = split(/\$sep/,$self->{data}); my $x = 0; foreach $_ (@keys){ $self->{TABLE}{$_} = $values[$x]; $x++; } return $self->{TABLE}; } ################################################# # Sub file_open_error # ################################################# ################################################# # PRIVATE Subroutine # ################################################# sub file_open_error($$$$){ my $self = shift; my $bad_file = shift; my $script_section = shift; my $this_file = shift; my $line_number = shift; use CGI_lib; my $CGI = new CGI_lib(); $CGI->CgiDie ("I am sorry, but I was not able to access $bad_file in the $script_section routine of $this_file at line number $line_number. Would you please make sure the path is correctly defined in SETUP_dB and that the permissions are correct. $!") } # End of Sub "file_open_error" 1;