1CPANPLUS::Dist::Base(3)User Contributed Perl DocumentatioCnPANPLUS::Dist::Base(3)
2
3
4
6 CPANPLUS::Dist::Base - Base class for custom distribution classes
7
9 package CPANPLUS::Dist::MY_IMPLEMENTATION
10
11 use base 'CPANPLUS::Dist::Base';
12
13 sub prepare {
14 my $dist = shift;
15
16 ### do the 'standard' things
17 $dist->SUPER::prepare( @_ ) or return;
18
19 ### do MY_IMPLEMENTATION specific things
20 ...
21
22 ### don't forget to set the status!
23 return $dist->status->prepared( $SUCCESS ? 1 : 0 );
24 }
25
27 CPANPLUS::Dist::Base functions as a base class for all custom distribu‐
28 tion implementations. It does all the mundane work CPANPLUS would have
29 done without a custom distribution, so you can override just the parts
30 you need to make your own implementation work.
31
33 Below is a brief outline when and in which order methods in this class
34 are called:
35
36 $Class->format_available; # can we use this class on this system?
37
38 $dist->init; # set up custom accessors, etc
39 $dist->prepare; # find/write meta information
40 $dist->create; # write the distribution file
41 $dist->install; # install the distribution file
42
43 $dist->uninstall; # remove the distribution (OPTIONAL)
44
46 $bool = $Class->format_available
47
48 This method is called when someone requests a module to be installed
49 via the superclass. This gives you the opportunity to check if all the
50 needed requirements to build and install this distribution have been
51 met.
52
53 For example, you might need a command line program, or a certain perl
54 module installed to do your job. Now is the time to check.
55
56 Simply return true if the request can proceed and false if it can not.
57
58 The "CPANPLUS::Dist::Base" implementation always returns true.
59
60 $bool = $dist->init
61
62 This method is called just after the new dist object is set up and
63 before the "prepare" method is called. This is the time to set up the
64 object so it can be used with your class.
65
66 For example, you might want to add extra accessors to the "status"
67 object, which you might do as follows:
68
69 $dist->status->mk_accessors( qw[my_implementation_accessor] );
70
71 The "status" object is implemented as an instance of the
72 "Object::Accessor" class. Please refer to it's documentation for
73 details.
74
75 Return true if the initialization was successul, and false if it was
76 not.
77
78 The "CPANPLUS::Dist::Base" implementation does not alter your object
79 and always returns true.
80
81 $bool = $dist->prepare
82
83 This runs the preparation step of your distribution. This step is meant
84 to set up the environment so the "create" step can create the actual
85 distribution(file). A "prepare" call in the standard "ExtUtils::Make‐
86 Maker" distribution would, for example, run "perl Makefile.PL" to find
87 the dependencies for a distribution. For a "debian" distribution, this
88 is where you would write all the metafiles required for the "dpkg-*"
89 tools.
90
91 The "CPANPLUS::Dist::Base" implementation simply calls the underlying
92 distribution class (Typically "CPANPLUS::Dist::MM" or "CPAN‐
93 PLUS::Dist::Build").
94
95 Sets "$dist->status->prepared" to the return value of this function.
96 If you override this method, you should make sure to set this value.
97
98 $bool = $dist->create
99
100 This runs the creation step of your distribution. This step is meant to
101 follow up on the "prepare" call, that set up your environment so the
102 "create" step can create the actual distribution(file). A "create"
103 call in the standard "ExtUtils::MakeMaker" distribution would, for
104 example, run "make" and "make test" to build and test a distribution.
105 For a "debian" distribution, this is where you would create the actual
106 ".deb" file using "dpkg".
107
108 The "CPANPLUS::Dist::Base" implementation simply calls the underlying
109 distribution class (Typically "CPANPLUS::Dist::MM" or "CPAN‐
110 PLUS::Dist::Build").
111
112 Sets "$dist->status->dist" to the location of the created distribution.
113 If you override this method, you should make sure to set this value.
114
115 Sets "$dist->status->created" to the return value of this function. If
116 you override this method, you should make sure to set this value.
117
118 $bool = $dist->install
119
120 This runs the install step of your distribution. This step is meant to
121 follow up on the "create" call, which prepared a distribution(file) to
122 install. A "create" call in the standard "ExtUtils::MakeMaker" distri‐
123 bution would, for example, run "make install" to copy the distribution
124 files to their final destination. For a "debian" distribution, this is
125 where you would run "dpkg --install" on the created ".deb" file.
126
127 The "CPANPLUS::Dist::Base" implementation simply calls the underlying
128 distribution class (Typically "CPANPLUS::Dist::MM" or "CPAN‐
129 PLUS::Dist::Build").
130
131 Sets "$dist->status->installed" to the return value of this function.
132 If you override this method, you should make sure to set this value.
133
134 $bool = $dist->uninstall
135
136 This runs the uninstall step of your distribution. This step is meant
137 to remove the distribution from the file system. A "uninstall" call in
138 the standard "ExtUtils::MakeMaker" distribution would, for example, run
139 "make uninstall" to remove the distribution files the file system. For
140 a "debian" distribution, this is where you would run "dpkg --uninstall
141 PACKAGE".
142
143 The "CPANPLUS::Dist::Base" implementation simply calls the underlying
144 distribution class (Typically "CPANPLUS::Dist::MM" or "CPAN‐
145 PLUS::Dist::Build").
146
147 Sets "$dist->status->uninstalled" to the return value of this function.
148 If you override this method, you should make sure to set this value.
149
150
151
152perl v5.8.8 2007-03-31 CPANPLUS::Dist::Base(3)