Move CPANPLUS from lib/ to ext/
[p5sagit/p5-mst-13.2.git] / ext / CPANPLUS / lib / CPANPLUS / Module / Author / Fake.pm
CommitLineData
6aaee015 1package CPANPLUS::Module::Author::Fake;
2
3
4use CPANPLUS::Module::Author;
5use CPANPLUS::Internals;
6use CPANPLUS::Error;
7
8use strict;
9use vars qw[@ISA];
10use 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
20CPANPLUS::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
33A class for creating fake author objects, for shortcut use internally
34by CPANPLUS.
35
36Inherits from C<CPANPLUS::Module::Author>.
37
38=head1 METHODS
39
40=head2 new( _id => DIGIT )
41
42Creates a dummy author object. It can take the same options as
43C<< CPANPLUS::Module::Author->new >>, but will fill in default ones
44if none are provided. Only the _id key is required.
45
46=cut
47
48sub 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
721;
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: