I decided not to be as thorough as above, but that was good info for me to keep squirelled away. I did couple google searches and ran across Getopt and did the following:
use Utils; use Getopt::Long; my $conf_file = ''; GetOptions ('conf=s' => \$conf_file); if ( length($conf_file) == 0) { print "\nUsage: loadSMSC -conf=/path/to/config.properties\n"; exit; } %props = getProperties("$conf_file"); $node_name = $props{"node"}; $machine = $props{"machine"}; $username = $props{"username"}; $passwd = $props{"passwd"}; $directory = $props{"directory"}; $localpath = $props{"localpath"}; $log_name = $props{"log.name"}; $numRows = $props{"rows"};
getProperties is in Utils.pm and goes a little something like:
sub getProperties($) { my ($propfile) = @_; my (%props); # Return value: a hash of property values. my ($ln,$name,$value,@nv); open(PROPFILE,"$propfile") or die "Unable to open $propfile"; while ($ln = <PROPFILE>) { chomp $ln; $ln =~ s/#(.*$)//; # Remove line comments in the properties + file. @nv = split /s*=/,$ln,2; $value = pop @nv; $value =~ s/^\s*=?\s*//; $value =~ s/\s*$//; $name = pop @nv; $name =~ s/^\s*//; $name =~ s/\s*$//; if ($name ne "") { $props{$name} = $value; } } close(PROPFILE); return %props; } sub dumpProperties { my (%props) = @_; foreach $prop (keys %props) { #print "\t\t$prop\n"; print "\t\t$prop:$props{$prop}\n"; } 1; }
Thanks for the input!

Jimbus

A sniveling Jimbus advices, "Never moon a werewolf!"

In reply to Re^2: Of crontab and paths by jimbus
in thread Of crontab and paths by jimbus

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.