7
Add a --version argument to your program, eg
9
use XMLTV::Version '$Id: Version.pm,v 1.2 2006/11/30 19:13:37 mattiasholmlund Exp $';
11
If a --version parameter is supplied on the command-line, it will
12
be caught already by the "use" statement, a message will be printed
13
to STDOUT and the program will exit.
15
It is best to put the use XMLTV::Version statement before other module
16
imports, so that even if they fail --version will still work.
24
package XMLTV::Version;
26
my $opt = '--version';
28
die "usage: use $_[0] <version-string>" if @_ != 2;
31
# This doesn't handle abbreviations in the GNU style.
34
$seen++ && warn "seen '$opt' twice\n";
41
print "XMLTV module version $XMLTV::VERSION\n";
43
print "could not load XMLTV module, xmltv is not properly installed\n"
46
if (m!\$Id: ([^,]+),v (\S+) ([0-9/: -]+)!) {
47
print "This is $1 version $2, $3\n";
50
print "This program version $_\n";