| 1 | package CPANPLUS::Module::Author::Fake; | ||||||||||
| 2 | |||||||||||
| 3 | |||||||||||
| 4 | 16 | ▶ | use CPANPLUS::Module::Author; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 16 | ▶ | use CPANPLUS::Internals; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 16 | ▶ | use CPANPLUS::Error; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 16 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 16 | ▶ | use vars qw[@ISA $VERSION]; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 16 | ▶ | use Params::Check qw[check]; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | |||||||||||
| 12 | 16 | $VERSION = "0.9914"; | |||||||||
| 13 | |||||||||||
| 14 | 16 | @ISA = qw[CPANPLUS::Module::Author]; | |||||||||
| 15 | |||||||||||
| 16 | 16 | $Params::Check::VERBOSE = 1; | |||||||||
| 17 | |||||||||||
| 18 | =pod | ||||||||||
| 19 | |||||||||||
| 20 | =head1 NAME | ||||||||||
| 21 | |||||||||||
| 22 | CPANPLUS::Module::Author::Fake - dummy author object for CPANPLUS | ||||||||||
| 23 | |||||||||||
| 24 | =head1 SYNOPSIS | ||||||||||
| 25 | |||||||||||
| 26 | my $auth = CPANPLUS::Module::Author::Fake->new( | ||||||||||
| 27 | author => 'Foo Bar', | ||||||||||
| 28 | email => 'luser@foo.com', | ||||||||||
| 29 | cpanid => 'FOO', | ||||||||||
| 30 | _id => $cpan->id, | ||||||||||
| 31 | ); | ||||||||||
| 32 | |||||||||||
| 33 | =head1 DESCRIPTION | ||||||||||
| 34 | |||||||||||
| 35 | A class for creating fake author objects, for shortcut use internally | ||||||||||
| 36 | by CPANPLUS. | ||||||||||
| 37 | |||||||||||
| 38 | Inherits from C<CPANPLUS::Module::Author>. | ||||||||||
| 39 | |||||||||||
| 40 | =head1 METHODS | ||||||||||
| 41 | |||||||||||
| 42 | =head2 new( _id => DIGIT ) | ||||||||||
| 43 | |||||||||||
| 44 | Creates a dummy author object. It can take the same options as | ||||||||||
| 45 | C<< CPANPLUS::Module::Author->new >>, but will fill in default ones | ||||||||||
| 46 | if none are provided. Only the _id key is required. | ||||||||||
| 47 | |||||||||||
| 48 | =cut | ||||||||||
| 49 | |||||||||||
| 50 | sub new { | ||||||||||
| 51 | 100 | ▶ | my $class = shift; | ||||||||
|
Subroutine
new: called CC=4 SCAR=15.2
Pod
documented
| |||||||||||
| 52 | 100 | my %hash = @_; | |||||||||
| 53 | |||||||||||
| 54 | 100 | my $tmpl = { | |||||||||
| 55 | author => { default => 'CPANPLUS Internals' }, | ||||||||||
| 56 | email => { default => 'cpanplus-info@lists.sf.net' }, | ||||||||||
| 57 | cpanid => { default => 'CPANPLUS' }, | ||||||||||
| 58 | _id => { default => CPANPLUS::Internals->_last_id }, | ||||||||||
| 59 | }; | ||||||||||
| 60 | |||||||||||
| 61 | 100 | ▶ | my $args = check( $tmpl, \%hash ) or return; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 62 | |||||||||||
| 63 | 100 | ▶ | my $obj = CPANPLUS::Module::Author->new( %$args ) or return; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 64 | |||||||||||
| 65 | 100 | ▶ | unless( $obj->_id ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 66 | 0 | error(loc("No '%1' specified -- No CPANPLUS object associated!",'_id')); | |||||||||
| 67 | 0 | return; | |||||||||
| 68 | } | ||||||||||
| 69 | |||||||||||
| 70 | ### rebless object ### | ||||||||||
| 71 | 100 | return bless $obj, $class; | |||||||||
| 72 | } | ||||||||||
| 73 | |||||||||||
| 74 | 16 | 1; | |||||||||
| 75 | |||||||||||
| 76 | |||||||||||
| 77 | # Local variables: | ||||||||||
| 78 | # c-indentation-style: bsd | ||||||||||
| 79 | # c-basic-offset: 4 | ||||||||||
| 80 | # indent-tabs-mode: nil | ||||||||||
| 81 | # End: | ||||||||||
| 82 | # vim: expandtab shiftwidth=4: | ||||||||||