diff options
author | Tom Feist <shabble@metavore.org> | 2011-05-05 03:56:49 +0000 |
---|---|---|
committer | Tom Feist <shabble@metavore.org> | 2011-05-05 03:56:49 +0000 |
commit | f67652377e1fff94536dd1c18ce33b43b86e84eb (patch) | |
tree | 5bdf042b588b703bdbc83deff67f1fa00bbb7be3 /changed_update.pl | |
parent | added script to auto-updated "changed" field of %IRSSI hash when called on a ... (diff) | |
download | irssi-scripts-f67652377e1fff94536dd1c18ce33b43b86e84eb.tar.gz irssi-scripts-f67652377e1fff94536dd1c18ce33b43b86e84eb.zip |
sorted otu pre-commit hook, I hope
Diffstat (limited to '')
-rwxr-xr-x[-rw-r--r--] | changed_update.pl | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/changed_update.pl b/changed_update.pl index 2e6b733..15f6667 100644..100755 --- a/changed_update.pl +++ b/changed_update.pl @@ -6,8 +6,7 @@ use warnings; use feature qw/say/; use DateTime; -my $infile = $ARGV[0] // 'feature-tests/template.pl.copy'; - +my $infile = $ARGV[0] // die "No File provided"; #'feature-tests/template.pl.copy'; my $transform = PPI::Transform::UpdateTimestamp->new ( updated => DateTime->now, @@ -17,7 +16,10 @@ my $transform = PPI::Transform::UpdateTimestamp->new my $ret = $transform->file($infile); -say "Return value: " . defined $ret && $ret ? 'success' : 'failure'; +#say "Return value: " . + +exit (defined $ret && $ret ? 0 : 1); + package PPI::Transform::UpdateTimestamp; @@ -28,6 +30,7 @@ use warnings; use PPI; use PPI::Dumper; use DateTime; +use Carp qw/carp/; use base 'PPI::Transform'; @@ -43,7 +46,7 @@ sub new { unless ( exists ($self->{updated}) ) { #PPI::Exception->throw("Did not provide a valid updated timestamp."); my $now = DateTime->now(); - carp "No updated value provided, using $now"; + carp("No updated value provided, using $now"); $self->set_updated($now); } @@ -105,7 +108,7 @@ sub examine_struct { if ($val->content eq $self->updated) { $ret = 1; } - + say "Thingie: " . $t->content unless $self->quiet; say "value set to: " . $val->content unless $self->quiet; } |