One idea is to just implement this with Config::Tiny. This is a module to fiddle with .ini files. This is a simple critter with no installation dependencies. So no fancy install is required, you could just put it in same directory as your new improved script.
Anyway this thing implements HOH, for you to use as you see fit. Some very simple app code is attached.
Update: OOps for posting at wrong level (the tidied up version instead of the original node..Ooops). Using a hash table may be overkill for just keeping track of "name => date/time", the idea BrowserUk would serve that purpose fine. I think there are other tied hash modules, but this was the simplest one that I could think of and avoids any potential installation hassles.
#!/usr/bin/perl -w use strict; use Config::Tiny; use Data::Dumper; # Open the config my $Config = Config::Tiny->read( 'status.ini' ) or die "could not open config.ini file"; #just to see what this looks like internally: print Dumper $Config; ##add new parameter (or would modify) $Config->{_}->{'newJOB'} = 'failed some stuff X'; #to discover and print the root names and their values: print "\nDiscover and print all rootnames (like Dumper does)\n"; my @jobs; foreach my $root_name (keys %{$Config->{_}}) { push (@jobs, $root_name); print " $root_name => $Config->{_}->{$root_name}\n"; } my $job2del = shift @jobs; print "deleting $job2del\n"; delete $Config->{_}->{$job2del}; $Config->write( 'status.ini' ); __END__ ***status.ini initial state: job4=fail date/time stampB newJOB=failed some stuff X job3=fail some time stuff AAAA ***program output: $VAR1 = bless( { '_' => { 'job3' => 'fail some time stuff AAAA', 'job4' => 'fail date/time stampB', 'newJOB' => 'failed some stuff X' } }, 'Config::Tiny' ); Discover and print all rootnames (like Dumper does) job3 => fail some time stuff AAAA job4 => fail date/time stampB newJOB => failed some stuff X deleting job3 ***status.ini final state job4=fail date/time stampB newJOB=failed some stuff X
In reply to Re^2: Fast Recall
by Marshall
in thread Fast Recall
by sans-clue
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |