| 1 | #!/usr/bin/env perl | ||
| 2 | # Copyright (c) 2016 by Weigang Qiu Lab | ||
| 3 | |||
| 4 | package Bio::BPWrapper; | ||
| 5 | |||
| 6 | our $VERSION = '1.10'; | ||
| 7 | use strict; use warnings; | ||
| 8 | use 5.010; | ||
| 9 | |||
| 10 | use constant PROGRAM => 'Bio::BPWrapper'; | ||
| 11 | |||
| 12 | =pod | ||
| 13 | |||
| 14 | =head2 Common Subroutines | ||
| 15 | |||
| 16 | =head3 print_version $program_name | ||
| 17 | |||
| 18 | Show program name and version and exit | ||
| 19 | |||
| 20 | =cut | ||
| 21 | |||
| 22 | |||
| 23 | sub print_version($) | ||
| 24 | { | ||
| 25 | my $program = shift; | ||
| 26 | say "${program}, version $Bio::BPWrapper::VERSION"; | ||
| 27 | exit; | ||
| 28 | } | ||
| 29 | |||
| 30 | use Pod::Usage; | ||
| 31 | |||
| 32 | =head3 common_opts $opts | ||
| 33 | |||
| 34 | Handle some common options: | ||
| 35 | |||
| 36 | =over 4 | ||
| 37 | |||
| 38 | =item C<--help>, C<-h> | ||
| 39 | |||
| 40 | Show usage help | ||
| 41 | |||
| 42 | =item C<--man> | ||
| 43 | |||
| 44 | Show a manual page via L<Pod::Usage> | ||
| 45 | |||
| 46 | =back | ||
| 47 | |||
| 48 | =cut | ||
| 49 | |||
| 50 | sub common_opts($) | ||
| 51 | { | ||
| 52 | my $opts = shift; | ||
| 53 | pod2usage(1) if $opts->{"help"}; | ||
| 54 | pod2usage(-exitstatus => 0, -verbose => 2) if $opts->{"man"}; | ||
| 55 | } | ||
| 56 | |||
| 57 | |||
| 58 | unless (caller) { | ||
| 59 | print "Pssst... this is a module. Invoke via bioaln, bioseq, biopop, or biotree.\n"; | ||
| 60 | } | ||
| 61 | 1; |