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 we cannot
10 compile an XS version of the module, you could use this simplistic
11 stub:
12
13 use inc::Module::Install;
14
15 name 'Foo';
16 all_from 'lib/Foo.pm';
17
18 # Which CPAN directory do we fetch binaries from?
19 par_base 'SMUELLER';
20
21 unless ( can_xs ) {
22 my $okay = extract_par( fetch_par );
23 if (not $okay) {
24 die "No compiler and no binary package found. Aborting.\n";
25 }
26 }
27
28 WriteAll;
29
31 This module adds a couple of directives to Module::Install related to
32 installing and creating PAR::Dist distributions.
33
34 par_base
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
43 distribution name, its version, your platform name and your perl
44 version concatenated with dashes.
45
46 The directive, however, takes an optional second argument which
47 specifies the name of the file to fetch. (Though "par_base" does not
48 fetch 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 Fetches the .par file previously referenced in the documentation of the
64 "par_base" directive.
65
66 "fetch_par" can be used without arguments given the "par_base"
67 directive was used before. It will return the name of the file it
68 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 available, yada yada yada, is printed. You can turn this
79 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 Takes the name of a PAR::Dist archive file as first argument. The
87 'blib/' directory of this archive is extracted and the 'pm_to_blib' is
88 created.
89
90 Typical shorthand usage:
91
92 extract_par( fetch_par ) or die "Could not install PAR::Dist archive.";
93
94 make_par
95 This directive requires PAR::Dist (version 0.03 or up) on your system.
96 (And checks that it is available before continuing.)
97
98 Creates a PAR::Dist archive from the 'blib/' subdirectory.
99
100 First argument must be the name of the PAR::Dist archive to create.
101
102 If your Makefile.PL has a "par_base" directive, the "make par" make
103 target will be available. It uses this "make_par" directive internally,
104 so on your development system, you can do this to create a .par binary
105 archive for your platform:
106
107 perl Makefile.PL
108 make
109 make par
110
112 Audrey Tang <cpan@audreyt.org>
113
114 With documentation from Steffen Mueller <smueller@cpan.org>
115
117 Copyright (c) 2006. Audrey Tang.
118
119 This program is free software; you can redistribute it and/or modify it
120 under the same terms as Perl itself.
121
122 See <http://www.perl.com/perl/misc/Artistic.html>
123
124
125
126perl v5.34.0 2021-07-22 Module::Install::PAR(3)