File: build.pl-getopt-long.patch

package info (click to toggle)
libbio-primerdesigner-perl 0.07-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 252 kB
  • ctags: 69
  • sloc: perl: 1,378; makefile: 84
file content (100 lines) | stat: -rw-r--r-- 2,428 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
Description: Use of Getopt::Long was breaking the Build.PL interface 
 for passing Module::Build long options (for example --installdirs).
 Refactor Build.PL to use the built-in args() method.
Origin: vendor
Bug-Debian: http://bugs.debian.org/718056
Forwarded: not-yet
Author: gregor herrmann <gregoa@debian.org>
Last-Update: 2013-07-29

--- a/Build.PL
+++ b/Build.PL
@@ -4,7 +4,6 @@
 use warnings;
 use Cwd;
 use Data::Dumper;
-use Getopt::Long;
 use Pod::Usage;
 use File::Spec::Functions 'catfile';
 
@@ -14,36 +13,6 @@
     exit(0);
 }
 
-my $help = '';
-my $url  = '';
-GetOptions(
-    'h|help' => \$help,
-    'url:s'  => \$url,
-);
-
-if ( $help ) {
-    pod2usage({ -exitval => 0 });
-}
-
-#
-# Write any local config info to the Config file
-#
-if ( $url && $url !~ m{^http://} ) {
-    $url = 'http://' . $url;
-}
-
-my $cwd       = cwd;
-my $tmpl_file = catfile( $cwd, 'templates', 'Config.pm' );
-open my $in_fh, '<', $tmpl_file or die "Can't read $tmpl_file: $!\n";
-my $tmpl      = join('', <$in_fh>);
-my $config    = sprintf( $tmpl, "  local_url => '$url'," );
-close $in_fh;
-
-my $config_pm = catfile( cwd(), 'lib', 'Bio', 'PrimerDesigner', 'Config.pm' );
-open my $out_fh, '>', $config_pm or die "Can't write '$config': $!\n";
-print $out_fh $config;
-close $out_fh;
-
 # 
 # Here we make the Build script
 # 
@@ -70,6 +39,34 @@
     },
 );
 
+my %args = $builder->args;
+
+my $help = exists $args{help};
+my $url  = $args{url};
+
+if ( $help ) {
+    pod2usage({ -exitval => 0 });
+}
+
+#
+# Write any local config info to the Config file
+#
+if ( $url && $url !~ m{^http://} ) {
+    $url = 'http://' . $url;
+}
+
+my $cwd       = cwd;
+my $tmpl_file = catfile( $cwd, 'templates', 'Config.pm' );
+open my $in_fh, '<', $tmpl_file or die "Can't read $tmpl_file: $!\n";
+my $tmpl      = join('', <$in_fh>);
+my $config    = sprintf( $tmpl, "  local_url => '$url'," );
+close $in_fh;
+
+my $config_pm = catfile( cwd(), 'lib', 'Bio', 'PrimerDesigner', 'Config.pm' );
+open my $out_fh, '>', $config_pm or die "Can't write '$config': $!\n";
+print $out_fh $config;
+close $out_fh;
+
 my $tarball = $builder->dist_dir . '.tar.gz';
 
 $builder->add_to_cleanup( $tarball, 'lib/Bio/PrimerDesigner/Config.pm' );
@@ -94,7 +91,7 @@
 
 Options:
 
-  -h|--help   Show usage
+  --help      Show usage
   --url       The URL to use for remote program access, e.g.,
               http://my.org/cgi-bin/primer_designer.cgi