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 com‐
10 piler 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
35 This directive sets the CPAN ID from whose CPAN directory to fetch
36 binaries from. For example, you can choose to download binaries from
37 http://www.cpan.org/authors/id/S/SM/SMUELLER/ or its ftp counterpart by
38 writing:
39
40 par_base 'SMUELLER';
41
42 By default, the name of the file to fetch is generated from the distri‐
43 bution name, its version, your platform name and your perl version con‐
44 catenated with dashes.
45
46 The directive, however, takes an optional second argument which speci‐
47 fies the name of the file to fetch. (Though "par_base" does not fetch
48 files itself, see below.)
49
50 par_base 'SMUELLER', 'foo';
51
52 Once "fetch_par" is called, the file 'foo' will be downloaded from
53 SMUELLER's CPAN directory. (It doesn't exist.)
54
55 The second argument could be used to fetch platform-agnostic binaries:
56
57 par_base 'SMUELLER', "Some-Distribution-0.01.par";
58
59 (Documentation TODO: Use the previously defined distribution name and
60 version in example.)
61
62 fetch_par
63
64 Fetches the .par file previously referenced in the documentation of the
65 "par_base" directive.
66
67 "fetch_par" can be used without arguments given the "par_base" direc‐
68 tive was used before. It will return the name of the file it fetched.
69
70 If the first argument is an URL or a CPAN user ID, the file is fetched
71 from that directory unless an URL has been previously set. (Read that
72 again.)
73
74 If the second argument is a file name it is used as the name of the
75 file to download.
76
77 If the file could not be fetched, a suitable error message about no
78 package being availlable, yada yada yada, is printed. You can turn
79 this off by specifying a true third argument.
80
81 # Try to fetch the package (see par_base) but
82 # don't be verbose about failures
83 my $file = fetch_par('', '', undef);
84
85 extract_par
86
87 Takes the name of a PAR::Dist archive file as first argument. The
88 'blib/' directory of this archive is extracted and the 'pm_to_blib' is
89 created.
90
91 Typical shorthand usage:
92
93 extract_par( fetch_par ) or die "Could not install PAR::Dist archive.";
94
95 make_par
96
97 This directive requires PAR::Dist (version 0.03 or up) on your system.
98 (And checks that it is availlable before continuing.)
99
100 Creates a PAR::Dist archive from the 'blib/' subdirectory.
101
102 First argument must be the name of the PAR::Dist archive to create.
103
104 If your Makefile.PL has a "par_base" directive, the "make par" make
105 target will be availlable. It uses this "make_par" directive inter‐
106 nally, so on your development system, you can do this to create a .par
107 binary archive for your platform:
108
109 perl Makefile.PL
110 make
111 make par
112
114 Audrey Tang <cpan@audreyt.org>
115
116 With documentation from Steffen Mueller <smueller@cpan.org>
117
119 Copyright (c) 2006. Audrey Tang. All rights reserved.
120
121 This program is free software; you can redistribute it and/or modify it
122 under the same terms as Perl itself.
123
124 See <http://www.perl.com/perl/misc/Artistic.html>
125
126
127
128perl v5.8.8 2007-03-05 Module::Install::PAR(3)