#!/usr/bin/env perl
#------------------------------------------------------------------------
#
# Name: resource_OWL.pl
#
# Description: (may NOT be really used..leaving it here for now)
#
# 07/02/2012 71663 Heller   first version
#
#------------------------------------------------------------------------------
use strict;

unshift @INC;
#$num_arg = scalar @ARGV;
  print "hi\n";
  my $hash_ref = Resource("/jwdmsdevvm1/data1/heller/ops/owl20121-120131/definitions/unix/hrmngr.resource");
  while( my ($k, $v) = each %$hash_ref ) {
    print "$k = $v\n";
  }
  exit(0);

  sub Resource ($$)
  {
      my ($inpFileName) = @_;
      my %kywdValue=();
      open INFILE, "<$inpFileName";
      while ( my $line = <INFILE> ) {

         chop $line;              # Remove trailing newline
         # Skip lines that aren't in the form 'keyword = value'
         next if $line !~ /[\w\-]+\s*=/;
         

         # Get the keyword and value, removing leading and trailing spaces
         my ( $kywd, $value ) = split( /= /, $line, 2 );
         $kywd =~ s/\s+$//;

         # Strip off spaces and quotes
         $value =~ s/''/"/g;              # Change '' to " (for next step)
         $value =~ s/'([^']+)'.*/$1/;     # Get things between single quotes
         $value =~ s/"/'/g;               # Put single quote back
         $value =~ s/ \! .*$//;           # Strip off comments starting with /
         $value =~ s/^\s+//;              # Remove leading spaces
         $value =~ s/\s+$//;              # Remove trailing spaces
         # Empty values should be replaces with ~ to avoid a perl false ('').
         $value = '~' if $value eq '';
         print "$kywd = $value \n";
         $kywdValue{$kywd} = $value;
      }
      # Close the input file
      close INFILE;
      return (\%kywdValue);

  }
