File: Build.PL

package info (click to toggle)
libbio-primerdesigner-perl 0.07-5
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 320 kB
  • ctags: 83
  • sloc: perl: 1,378; makefile: 85
file content (102 lines) | stat: -rw-r--r-- 2,433 bytes parent folder | download | duplicates (4)
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
101
102
# $Id: Build.PL 26 2008-11-10 20:36:37Z kyclark $

use strict;
use warnings;
use Cwd;
use Data::Dumper;
use Pod::Usage;
use File::Spec::Functions 'catfile';

eval { require Module::Build };
if ( $@ =~ /Can\'t locate/ ) {
    print qq[Please install "Module::Build" before continuing.\n];
    exit(0);
}

# 
# Here we make the Build script
# 
my $builder = Module::Build->new(
    create_readme        => 1,
    dist_name            => 'Bio-PrimerDesigner',
    dist_abstract        => 'Design PCR primers using primer3 and epcr',
    dist_author          => 'Sheldon McKay <mckays@cshl.edu>; Ken Youens-Clark <kclark@cshl.edu>',
    module_name          => 'Bio::PrimerDesigner',
    dist_version         => 0.04,
    license              => 'gpl',
    script_files         => [ 'scripts/primer_designer' ],
    requires             => {
        'Class::Base'         => 0,
        'HTTP::Request'       => 0,
        'HTTP::Response'      => 0,
        'LWP::UserAgent'      => 0,
        'Readonly'            => 0,
    },
    test_requires        => {
        'Test::More'          => 0,
        'Test::Pod::Coverage' => 0,
        'Test::Pod'           => 0,
    },
);

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' );

$builder->create_build_script;

print "Now run './Build' and './Build install'\n";

exit 0;

__END__

=pod

=head1 NAME

Build.PL - Installer for Bio::PrimerDesigner

=head1 SYNOPSIS

  perl Build.PL [options]

Options:

  --help      Show usage
  --url       The URL to use for remote program access, e.g.,
              http://my.org/cgi-bin/primer_designer.cgi

=head1 AUTHOR

Ken Youens-Clark E<lt>kclark@cpan.orgE<gt>.

=cut