| 1 | package Module::Install::Mousse; | ||
| 2 | use strict; | ||
| 3 | use warnings; | ||
| 4 | |||
| 5 | use Module::Install::Base; | ||
| 6 | |||
| 7 | use vars qw(@ISA); | ||
| 8 | BEGIN { @ISA = 'Module::Install::Base' } | ||
| 9 | |||
| 10 | # Make from Mousse (as in Chocolate) | ||
| 11 | sub use_mousse { | ||
| 12 | my $self = shift; | ||
| 13 | return unless $self->is_admin; | ||
| 14 | my $module = shift | ||
| 15 | or die "use_mousse requires the name of a target module"; | ||
| 16 | my $output_path = $module; | ||
| 17 | $output_path =~ s/::/\//g; | ||
| 18 | $output_path = "lib/$output_path.pm"; | ||
| 19 | require Mousse::Maker; | ||
| 20 | Mousse::Maker::make_from_mousse($module, $output_path); | ||
| 21 | } | ||
| 22 | |||
| 23 | # Make from Mouse (as in Mickey) | ||
| 24 | sub use_mousse_dev { | ||
| 25 | my $self = shift; | ||
| 26 | return unless $self->is_admin; | ||
| 27 | my $module = shift | ||
| 28 | or die "use_mousse_dev requires the name of a target module"; | ||
| 29 | my $output_path = $module; | ||
| 30 | $output_path =~ s/::/\//g; | ||
| 31 | $output_path = "lib/$output_path.pm"; | ||
| 32 | require Mousse::Maker; | ||
| 33 | Mousse::Maker::make_from_mouse($module, $output_path); | ||
| 34 | } | ||
| 35 | |||
| 36 | 1; | ||
| 37 | |||
| 38 | =encoding utf8 | ||
| 39 | |||
| 40 | =head1 NAME | ||
| 41 | |||
| 42 | Module::Install::Mousse - Module::Install Support for Mousse | ||
| 43 | |||
| 44 | =head1 SYNOPSIS | ||
| 45 | |||
| 46 | use inc::Module::Install; | ||
| 47 | |||
| 48 | name 'Chocolate'; | ||
| 49 | all_from 'lib/Chocolate.pm'; | ||
| 50 | |||
| 51 | use_mousse 'Chocolate::Mousse'; | ||
| 52 | |||
| 53 | WriteAll; | ||
| 54 | |||
| 55 | =head1 DESCRIPTION | ||
| 56 | |||
| 57 | This module copies Mousse.pm as your module distibution's OO base module. | ||
| 58 | See L<Mousse> for full details. | ||
| 59 | |||
| 60 | Now you can get full Mousse OO support for your module with no external | ||
| 61 | dependency on Mousse. | ||
| 62 | |||
| 63 | Just add this line to your Makefile.PL: | ||
| 64 | |||
| 65 | use_mousse 'Your::Module::OO'; | ||
| 66 | |||
| 67 | That's it. Really. Now Mousse is bundled into your module under the | ||
| 68 | name C<Your::Module::OO>, there is no burden on the person installing | ||
| 69 | your module. | ||
| 70 | |||
| 71 | =head1 AUTHOR | ||
| 72 | |||
| 73 | Ingy döt Net <ingy@cpan.org> | ||
| 74 | |||
| 75 | =head1 COPYRIGHT | ||
| 76 | |||
| 77 | Copyright (c) 2010. Ingy döt Net. | ||
| 78 | |||
| 79 | This program is free software; you can redistribute it and/or modify it | ||
| 80 | under the same terms as Perl itself. | ||
| 81 | |||
| 82 | See L<http://www.perl.com/perl/misc/Artistic.html> | ||
| 83 | |||
| 84 | =cut |