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} = <INDEXFILE>; #READ first line. $self->{data} = <INDEXFILE>; #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 i +n SETUP_dB and that the permissions are correct. $!") } # End of Sub "file_open_error" 1;

In reply to Lady_EZDB by Steeeeeve

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.