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