File Coverage

blib/lib/Purple/Server.pm
Criterion Covered Total %
statement 15 15 100.0
branch 2 4 50.0
condition 1 3 33.3
subroutine 3 3 100.0
pod 1 1 100.0
total 22 26 84.6


line stmt bran cond sub pod time code
1             package Purple::Server;
2              
3 1     1   105336 use warnings;
  1         5  
  1         42  
4 1     1   6 use strict;
  1         2  
  1         195  
5             our $VERSION = '0.9';
6              
7             my $DEFAULT_SERVER = 'REST';
8              
9             sub new {
10 1     1 1 686 my $class = shift;
11 1         6 my %p = @_;
12              
13 1   33     10 $p{type} ||= $DEFAULT_SERVER;
14              
15 1         3 my $real_class = 'Purple::Server::' . $p{type};
16 1 50       13 unless ( $real_class->can('_New') ) {
17 1         86 eval "require $real_class";
18 1 50       10 die "Unable to load $real_class: $@" if $@;
19             }
20 1         3 delete $p{type};
21              
22 1         6 return $real_class->_New(%p);
23             }
24              
25             =head1 NAME
26              
27             Purple::Server - Factory class for generating servers for Purple Numbers
28              
29             =head1 VERSION
30              
31             Version 0.9
32              
33             =head1 SYNOPSIS
34              
35             See the default implementation L.
36              
37             =head1 METHODS
38              
39             =head2 new(%options)
40              
41             You can specify an alternative server by passing:
42              
43             type => 'server'
44              
45             where 'server' is the name of the server type. If you don't pass this
46             parameter, it will default to REST.
47              
48             =head1 AUTHOR
49              
50             Chris Dent, Ecdent@burningchrome.comE
51              
52             Eugene Eric Kim, Eeekim@blueoxen.comE
53              
54             =head1 BUGS
55              
56             Please report any bugs or feature requests to
57             C, or through the web interface at
58             L.
59             I will be notified, and then you'll automatically be notified of progress on
60             your bug as I make changes.
61              
62             =head1 ACKNOWLEDGEMENTS
63              
64             =head1 COPYRIGHT & LICENSE
65              
66             (C) Copyright 2006 Blue Oxen Associates. All rights reserved.
67              
68             This program is free software; you can redistribute it and/or modify it
69             under the same terms as Perl itself.
70              
71             =cut
72              
73             1; # End of Purple