1Module::Install::PAR(3)User Contributed Perl DocumentatioMnodule::Install::PAR(3)
2
3
4
6 Module::Install::PAR - Module::Install Support for PAR::Dist packages
7
9 To offer your users the possibility to install binaries if no C
10 compiler was found, you could use this simplistic stub:
11
12 use inc::Module::Install;
13
14 name 'Foo';
15 all_from 'lib/Foo.pm';
16
17 # Which CPAN directory do we fetch binaries from?
18 par_base 'SMUELLER';
19
20 unless ( can_cc() ) {
21 my $okay = extract_par( fetch_par );
22 if (not $okay) {
23 die "No compiler and no binary package found. Aborting.\n";
24 }
25 }
26
27 WriteAll;
28
30 This module adds a couple of directives to Module::Install related to
31 installing and creating PAR::Dist distributions.
32
33 par_base
34 This directive sets the CPAN ID from whose CPAN directory to fetch
35 binaries from. For example, you can choose to download binaries from
36 http://www.cpan.org/authors/id/S/SM/SMUELLER/ or its ftp counterpart by
37 writing:
38
39 par_base 'SMUELLER';
40
41 By default, the name of the file to fetch is generated from the
42 distribution name, its version, your platform name and your perl
43 version concatenated with dashes.
44
45 The directive, however, takes an optional second argument which
46 specifies the name of the file to fetch. (Though "par_base" does not
47 fetch files itself, see below.)
48
49 par_base 'SMUELLER', 'foo';
50
51 Once "fetch_par" is called, the file 'foo' will be downloaded from
52 SMUELLER's CPAN directory. (It doesn't exist.)
53
54 The second argument could be used to fetch platform-agnostic binaries:
55
56 par_base 'SMUELLER', "Some-Distribution-0.01.par";
57
58 (Documentation TODO: Use the previously defined distribution name and
59 version in example.)
60
61 fetch_par
62 Fetches the .par file previously referenced in the documentation of the
63 "par_base" directive.
64
65 "fetch_par" can be used without arguments given the "par_base"
66 directive was used before. It will return the name of the file it
67 fetched.
68
69 If the first argument is an URL or a CPAN user ID, the file is fetched
70 from that directory unless an URL has been previously set. (Read that
71 again.)
72
73 If the second argument is a file name it is used as the name of the
74 file to download.
75
76 If the file could not be fetched, a suitable error message about no
77 package being available, yada yada yada, is printed. You can turn this
78 off by specifying a true third argument.
79
80 # Try to fetch the package (see par_base) but
81 # don't be verbose about failures
82 my $file = fetch_par('', '', undef);
83
84 extract_par
85 Takes the name of a PAR::Dist archive file as first argument. The
86 'blib/' directory of this archive is extracted and the 'pm_to_blib' is
87 created.
88
89 Typical shorthand usage:
90
91 extract_par( fetch_par ) or die "Could not install PAR::Dist archive.";
92
93 make_par
94 This directive requires PAR::Dist (version 0.03 or up) on your system.
95 (And checks that it is available before continuing.)
96
97 Creates a PAR::Dist archive from the 'blib/' subdirectory.
98
99 First argument must be the name of the PAR::Dist archive to create.
100
101 If your Makefile.PL has a "par_base" directive, the "make par" make
102 target will be available. It uses this "make_par" directive internally,
103 so on your development system, you can do this to create a .par binary
104 archive for your platform:
105
106 perl Makefile.PL
107 make
108 make par
109
111 Audrey Tang <cpan@audreyt.org>
112
113 With documentation from Steffen Mueller <smueller@cpan.org>
114
116 Copyright (c) 2006. Audrey Tang.
117
118 This program is free software; you can redistribute it and/or modify it
119 under the same terms as Perl itself.
120
121 See <http://www.perl.com/perl/misc/Artistic.html>
122
123
124
125perl v5.12.0 2010-03-10 Module::Install::PAR(3)