1CPANPLUS::Dist::Base(3)User Contributed Perl DocumentatioCnPANPLUS::Dist::Base(3)
2
3
4

NAME

6       CPANPLUS::Dist::Base - Base class for custom distribution classes
7

SYNOPSIS

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

DESCRIPTION

27       CPANPLUS::Dist::Base functions as a base class for all custom
28       distribution implementations. It does all the mundane work CPANPLUS
29       would have done without a custom distribution, so you can override just
30       the parts you need to make your own implementation work.
31

FLOW

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

METHODS

46   @subs = $Class->methods
47       Returns a list of methods that this class implements that you can
48       override.
49
50   $bool = $Class->format_available
51       This method is called when someone requests a module to be installed
52       via the superclass. This gives you the opportunity to check if all the
53       needed requirements to build and install this distribution have been
54       met.
55
56       For example, you might need a command line program, or a certain perl
57       module installed to do your job. Now is the time to check.
58
59       Simply return true if the request can proceed and false if it can not.
60
61       The "CPANPLUS::Dist::Base" implementation always returns true.
62
63   $bool = $dist->init
64       This method is called just after the new dist object is set up and
65       before the "prepare" method is called. This is the time to set up the
66       object so it can be used with your class.
67
68       For example, you might want to add extra accessors to the "status"
69       object, which you might do as follows:
70
71           $dist->status->mk_accessors( qw[my_implementation_accessor] );
72
73       The "status" object is implemented as an instance of the
74       "Object::Accessor" class. Please refer to its documentation for
75       details.
76
77       Return true if the initialization was successful, and false if it was
78       not.
79
80       The "CPANPLUS::Dist::Base" implementation does not alter your object
81       and always returns true.
82
83   $bool = $dist->prepare
84       This runs the preparation step of your distribution. This step is meant
85       to set up the environment so the "create" step can create the actual
86       distribution(file).  A "prepare" call in the standard
87       "ExtUtils::MakeMaker" distribution would, for example, run "perl
88       Makefile.PL" to find the dependencies for a distribution. For a
89       "debian" distribution, this is where you would write all the metafiles
90       required for the "dpkg-*" tools.
91
92       The "CPANPLUS::Dist::Base" implementation simply calls the underlying
93       distribution class (Typically "CPANPLUS::Dist::MM" or
94       "CPANPLUS::Dist::Build").
95
96       Sets "$dist->status->prepared" to the return value of this function.
97       If you override this method, you should make sure to set this value.
98
99   $bool = $dist->create
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
110       "CPANPLUS::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       This runs the install step of your distribution. This step is meant to
120       follow up on the "create" call, which prepared a distribution(file) to
121       install.  A "create" call in the standard "ExtUtils::MakeMaker"
122       distribution would, for example, run "make install" to copy the
123       distribution files to their final destination. For a "debian"
124       distribution, this is where you would run "dpkg --install" on the
125       created ".deb" file.
126
127       The "CPANPLUS::Dist::Base" implementation simply calls the underlying
128       distribution class (Typically "CPANPLUS::Dist::MM" or
129       "CPANPLUS::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       This runs the uninstall step of your distribution. This step is meant
136       to remove the distribution from the file system.  A "uninstall" call in
137       the standard "ExtUtils::MakeMaker" distribution would, for example, run
138       "make uninstall" to remove the distribution files the file system. For
139       a "debian" distribution, this is where you would run "dpkg --uninstall
140       PACKAGE".
141
142       The "CPANPLUS::Dist::Base" implementation simply calls the underlying
143       distribution class (Typically "CPANPLUS::Dist::MM" or
144       "CPANPLUS::Dist::Build").
145
146       Sets "$dist->status->uninstalled" to the return value of this function.
147       If you override this method, you should make sure to set this value.
148
149
150
151perl v5.36.0                      2022-07-22           CPANPLUS::Dist::Base(3)
Impressum