Let's pretend I have something like this (forgive the bad perl style - this is Someone Else's Perl.)
#!/usr/bin/perl
my $config_dir = '/var/config';
my $status_file = 'last_update.status';
my $host = shift;
chomp($host);
unless ( $host ) { die "Usage: $0 <hostname>\n"; }
open(STATUS,">$config_dir/$host/$status_file") or die "Could not open $config_dir/$host/$status_file for writing. Aborting...\n";
print STATUS time() . "\n";
close(STATUS);
It's invoked via commandline like so update_status.pl foo
.
What I expect to happen: /var/config/foo/last_update.status contains a current timestamp.
What actually happens: /var/config/foo/last_update.status contains an old timestamp.
Now, the script doesn't die; it completes successfully and returns exit code 0 to bash. This is a Debian Linux box running perl 5.10.1.
So my question is: how can I inspect STATUS
? Data::Dumper is not helpful at all.
Thanks.