2 # This file is part of App::CPAN2Pkg.
3 # Copyright (c) 2009 Jerome Quelin, all rights reserved.
5 # This program is free software; you can redistribute it and/or modify
6 # it under the same terms as Perl itself.
10 package App
::CPAN2Pkg
;
15 use App
::CPAN2Pkg
::Module
;
18 our $VERSION = '0.2.0';
21 my ($class, $opts) = @_;
23 my $session = POE
::Session
->create(
26 upstream_status
=> \
&upstream_status
,
27 install_status
=> \
&install_status
,
28 module_spawned
=> \
&module_spawned
,
32 _stop
=> sub { warn "stop"; },
45 # if ( not available in cooker ) is_in_dist
47 # compute dependencies find_prereqs
48 # repeat with each dep
50 # install local install_from_local
51 # while ( not available locally ) is_installed
53 # prompt user to fix manually
55 # import import_local_to_dist
56 # submit (included above)
57 # ack available (manual?)
60 # urpmi --auto perl(module::to::install) install_from_dist
66 my ($k, $module, $is_available) = @_[KERNEL
, ARG0
, ARG1
];
67 my $event = $is_available ?
'install_from_dist' : 'find_prereqs';
68 $k->post($module, $event);
72 my ($k, $module, $installed) = @_[KERNEL
, ARG0
, ARG1
];
74 if ( not $installed ) {
75 $k->post($module, 'is_in_dist');
83 my ($k, $module) = @_[KERNEL
, ARG0
];
84 $k->post($module, 'is_installed');
88 my ($k, $module) = @_[KERNEL
, ARG0
];
89 App
::CPAN2Pkg
::Module
->spawn($module);
93 # -- poe inline states
96 my ($k, $opts) = @_[KERNEL
, ARG0
];
99 # start packaging some modules
100 my $modules = $opts->{modules
};
101 $k->yield('package', $_) for @
$modules;
110 App::CPAN2Pkg - generating native linux packages from cpan
117 $ cpan2pkg Module::Foo Module::Bar ...
123 Don't use this module directly, refer to the C<cpan2pkg> script instead.
125 C<App::CPAN2Pkg> is the controller for the C<cpan2pkg> application. It
126 implements a POE session, responsible to schedule and advance module
129 It is spawned by the poe session responsible for the user interface.
133 =head1 PUBLIC PACKAGE METHODS
135 =head2 my $id = App::CPAN2Pkg->spawn( \%params )
137 This method will create a POE session responsible for coordinating the
140 It will return the POE id of the session newly created.
142 You can tune the session by passing some arguments as a hash
143 reference, where the hash keys are:
147 =item * modules => \@list_of_modules
149 A list of modules to start packaging.
156 =head1 PUBLIC EVENTS ACCEPTED
158 The following events are the module's API.
161 =head2 install_status( $module, $is_installed )
163 Sent when C<$module> knows whether it is installed locally (C<$is_installed>
167 =head2 module_spawned( $module )
169 Sent when C<$module> has been spawned successfully.
172 =head2 package( $module )
174 Request the application to package (if needed) the perl C<$module>. Note
175 that the module can be either the top-most module of a distribution or
176 deep inside said distribution.
179 =head2 upstream_status( $module, $is_available )
181 Sent when C<$module> knows whether it is available upstream (C<$is_available>
188 Please report any bugs or feature requests to C<app-cpan2pkg at
189 rt.cpan.org>, or through the web interface at
190 L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=App-CPAN2Pkg>. I will
191 be notified, and then you'll automatically be notified of progress on
192 your bug as I make changes.
198 Our git repository is located at L<git://repo.or.cz/app-cpan2pkg.git>,
199 and can be browsed at L<http://repo.or.cz/w/app-cpan2pkg.git>.
202 You can also look for information on this module at:
206 =item * AnnoCPAN: Annotated CPAN documentation
208 L<http://annocpan.org/dist/App-CPAN2Pkg>
212 L<http://cpanratings.perl.org/d/App-CPAN2Pkg>
216 L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=App-CPAN2Pkg>
224 Jerome Quelin, C<< <jquelin@cpan.org> >>
228 =head1 COPYRIGHT & LICENSE
230 Copyright (c) 2009 Jerome Quelin, all rights reserved.
232 This program is free software; you can redistribute it and/or modify
233 it under the same terms as Perl itself.