File Coverage

blib/lib/Purple.pm
Criterion Covered Total %
statement 14 14 100.0
branch 4 4 100.0
condition 2 3 66.6
subroutine 3 3 100.0
pod 1 1 100.0
total 24 25 96.0


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