PageRenderTime 28ms CodeModel.GetById 17ms app.highlight 8ms RepoModel.GetById 1ms app.codeStats 0ms

/libs/perl/Choicetool/Base/Program.pm

#
Perl | 78 lines | 45 code | 13 blank | 20 comment | 1 complexity | 2cf3a342dbea6a60f6ea39818df62da5 MD5 | raw file
 1# -*- perl -*-
 2
 3#
 4# Program.pm
 5#
 6# Copyright (C) 2008, 2009 Francesco Salvestrini
 7#
 8# This program is free software; you can redistribute it and/or modify
 9# it under the terms of the GNU General Public License as published by
10# the Free Software Foundation; either version 2 of the License, or
11# (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16# GNU General Public License for more details.
17#
18# You should have received a copy of the GNU General Public License along
19# with this program; if not, write to the Free Software Foundation, Inc.,
20# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21#
22
23package Choicetool::Base::Program;
24
25use 5.8.0;
26
27use warnings;
28use strict;
29use diagnostics;
30
31use Choicetool::Autoconfig;
32use Choicetool::Base::Debug;
33
34BEGIN {
35    use Exporter ();
36    our ($VERSION, @ISA, @EXPORT);
37
38    @ISA    = qw(Exporter);
39    @EXPORT = qw(&version
40                 &hint
41                 &program_name_set);
42}
43
44sub program_name_set ($)
45{
46}
47
48sub version ()
49{
50    assert(defined($::PROGRAM_NAME));
51    assert($::PROGRAM_NAME ne "");
52
53    print $::PROGRAM_NAME .
54        " (" . $Choicetool::Autoconfig::PACKAGE_NAME . ") " .
55        $Choicetool::Autoconfig::PACKAGE_VERSION . "\n";
56    print "\n";
57    print "Copyright (C) 2008, 2009 Francesco Salvestrini\n";
58    print "\n";
59    print "This is free software.  You may redistribute copies of it under " .
60        "the terms of\n";
61    print "the GNU General Public License " .
62        "<http://www.gnu.org/licenses/gpl.html>.\n";
63    print "There is NO WARRANTY, to the extent permitted by law.\n";
64}
65
66sub hint ($)
67{
68    my $string = shift;
69
70    if (defined($string)) {
71        assert($string ne "");
72
73        print $::PROGRAM_NAME . ": " . $string . "\n";
74    }
75    print "Try \`" . $::PROGRAM_NAME . " -h' for more information.\n";
76}
77
781;