From 48da68f614a9da1b7f91b50a3e4c6655009e211e Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Tue, 1 Mar 2011 21:48:13 +0100 Subject: Move -v/-h logic from App::Dthumb to bin/dthumb --- bin/dthumb | 13 +++++++++++-- lib/App/Dthumb.pm | 21 --------------------- lib/App/Dthumb/Data.pm.PL | 2 +- 3 files changed, 12 insertions(+), 24 deletions(-) diff --git a/bin/dthumb b/bin/dthumb index bd27f5c..c39280a 100755 --- a/bin/dthumb +++ b/bin/dthumb @@ -4,6 +4,7 @@ # You just DO WHAT THE FUCK YOU WANT TO use strict; use warnings; +use 5.010; use autodie; use App::Dthumb; @@ -33,8 +34,16 @@ GetOptions( my $dthumb = App::Dthumb->new(%{$opt}); my $timer = Time::Progress->new(); +if ($opt->{version}) { + say "dthumb version " . $dthumb->version(); + exit 0; +} +if ($opt->{help}) { + exec('perldoc', '-F', $0); + die("Please see 'perldoc -F $0' or 'man dthumb'\n"); +} + -$dthumb->check_cmd_flags(); $dthumb->read_directories(); $dthumb->create_files(); $dthumb->delete_old_thumbnails(); @@ -69,7 +78,7 @@ B [I] =head1 VERSION -This manual documents B version 0.1 +This manual documents B version 0.2 =head1 DESCRIPTION diff --git a/lib/App/Dthumb.pm b/lib/App/Dthumb.pm index ecde021..fc21059 100755 --- a/lib/App/Dthumb.pm +++ b/lib/App/Dthumb.pm @@ -149,27 +149,6 @@ external scripts. This documentation is only for people working on B itself. All of them are object-oriented, so need to be called as $dthumb->something(). -=head2 check_cmd_flags - -Check if version/help flags in the config are set. If so, print the -corresponding text to STDOUT and quit. - -=cut - - -sub check_cmd_flags { - my ($self) = @_; - - if ($self->{config}->{version}) { - say "dthumb version ${VERSION}"; - exit 0; - } - if ($self->{config}->{help}) { - say "Please refer to perldoc -F $0 (or man dthumb)"; - exit 0; - } -} - =head2 read_directories diff --git a/lib/App/Dthumb/Data.pm.PL b/lib/App/Dthumb/Data.pm.PL index ba99c82..c430c0a 100644 --- a/lib/App/Dthumb/Data.pm.PL +++ b/lib/App/Dthumb/Data.pm.PL @@ -46,7 +46,7 @@ use Data::Section -setup; use MIME::Base64 qw(decode_base64); our @EXPORT_OK = (); -our $VERSION = '0.1'; +our $VERSION = '0.2'; sub new { my ($obj) = @_; -- cgit v1.2.3