diff options
| author | Paul Buetow <paul@buetow.org> | 2012-04-21 12:30:58 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2012-04-21 12:30:58 +0200 |
| commit | e682c81a46d1f96e9f44a742e8f949d5935e5f79 (patch) | |
| tree | d5cbc6490e0c6a728e281c991f829b16ef25ebcb /lib/Loadbars/Utils.pm | |
| parent | 109b41b1368b44377f1d6228659bf920718cadf0 (diff) | |
version number is not hard coded anymore
Diffstat (limited to 'lib/Loadbars/Utils.pm')
| -rw-r--r-- | lib/Loadbars/Utils.pm | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/Loadbars/Utils.pm b/lib/Loadbars/Utils.pm index bfb8027..df5e0f7 100644 --- a/lib/Loadbars/Utils.pm +++ b/lib/Loadbars/Utils.pm @@ -18,6 +18,7 @@ our @EXPORT = qw ( say sum trim + get_version ); sub say (@) { print "$_\n" for @_; return undef } @@ -38,4 +39,21 @@ sub display_info_no_nl ($) { print "==> " . (shift) . ' ' } sub display_info ($) { say "==> " . shift } sub display_warn ($) { say "!!! " . shift } +sub get_version () { + my $versionfile = do { + if ( -f '.version' ) { + '.version'; + } + else { + '/usr/share/loadbars/version'; + } + }; + + open my $fh, $versionfile or error("$!: $versionfile"); + my $version = <$fh>; + close $fh; + + return $version; +} + 1; |
