PageRenderTime 41ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

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

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