File Coverage

blib/lib/Net/DSLProvider.pm
Criterion Covered Total %
statement 12 24 50.0
branch 0 8 0.0
condition 0 3 0.0
subroutine 4 5 80.0
pod n/a
total 16 40 40.0


line stmt bran cond sub pod time code
1             package Net::DSLProvider;
2 3     3   45771 use warnings;
  3         6  
  3         105  
3 3     3   17 use strict;
  3         7  
  3         124  
4 3     3   16 use base 'Class::Accessor';
  3         11  
  3         4378  
5 3     3   10686 use Carp qw/croak/;
  3         8  
  3         1658  
6             our $VERSION = '0.03';
7             __PACKAGE__->mk_accessors(qw/user pass debug testing/);
8              
9             =head1 NAME
10              
11             Net::DSLProvider - Standardized interface to various DSL providers
12              
13             =head1 SYNOPSIS
14              
15             use Net::DSLProvider;
16             my $p = Net::DSLProvider::SomeISP->new(user => $u, pass => $p);
17             ...
18              
19             =head1 DESCRIPTION
20              
21             This class doesn't do much - please see the individual
22             Net::DSLProvider::* modules instead.
23              
24             =cut
25              
26             my %sigs;
27              
28             sub _check_params {
29 0     0     my ($self, $args, @additional) = @_;
30 0           my $method = ((caller(1))[3]);
31 0           $method =~ s/.*:://;
32 0 0         my @signature = @{$sigs{$method}} if $sigs{$method};
  0            
33 0           for (@signature, @additional) {
34 0           my $ok = 0;
35 0           my @poss = split /\|/, $_;
36 0 0         for (@poss) { $ok=1 if $args->{$_} };
  0            
37 0 0 0       croak "You must supply the $poss[0] parameter" if !$ok and @poss==1;
38 0 0         croak "You must supply at least one of the following parameters: @poss"
39             if !$ok;
40             }
41             }
42              
43             =head1 METHODS
44            
45             =head1 INFORMATIONAL METHODS
46            
47             These methods tell you things.
48            
49             =head2 services_available
50            
51             Takes a phone number or a postcode and returns a list of services
52             that the provider can deliver to the given line.
53            
54             Parameters:
55            
56             cli / postcode (Required)
57             mac (Optional)
58            
59             Output is an array of hash references. Each hash reference may contain
60             the following keys:
61            
62             first_date
63             max_speed
64             product_name
65             product_id (Required)
66            
67             =cut
68            
69             $sigs{services_available} = ["cli|postcode"];
70              
71             $sigs{verify_mac} = [qw/cli mac/];
72              
73             $sigs{service_view} = ["ref|telephone|username|service-id"];
74             $sigs{service_details} = ["ref|telephone|username|service-id"];
75              
76             $sigs{usage_summary} = [qw/year month/];
77              
78             $sigs{auth_log} = ["ref|telephone|username|service-id"];
79              
80              
81             =head1 EXECUTIVE METHODS
82              
83             These methods do things
84              
85             =cut
86              
87             $sigs{order} = [qw/prod-id forename surname street city postcode
88             cli client-ref prod-id crd/];
89              
90             $sigs{regrade} = ["ref|telephone|username|service-id", "prod-id"];
91              
92             $sigs{care_level} = ["ref|telephone|username|service-id", "care-level"];
93              
94             $sigs{request_mac} = ["ref|telephone|username|service-id"];
95              
96             $sigs{cease} = ["ref|telephone|username|service-id", "crd"];
97              
98             $sigs{change_password} = [qw/ref|telephone|username|service-id password/];
99              
100             =head1 AUTHOR
101              
102             Simon Cozens, C<< >>
103             Jason Clifford C<< >>
104              
105             =head1 BUGS
106              
107             Please report any bugs or feature requests to C, or through
108             the web interface at L. I will be notified, and then you'll
109             automatically be notified of progress on your bug as I make changes.
110              
111             =head1 SUPPORT
112              
113             You can find documentation for this module with the perldoc command.
114              
115             perldoc Net::DSLProvider
116              
117              
118             You can also look for information at:
119              
120             =over 4
121              
122             =item * RT: CPAN's request tracker
123              
124             L
125              
126             =item * AnnoCPAN: Annotated CPAN documentation
127              
128             L
129              
130             =item * CPAN Ratings
131              
132             L
133              
134             =item * Search CPAN
135              
136             L
137              
138             =back
139              
140              
141             =head1 ACKNOWLEDGEMENTS
142              
143             Thanks to the UK Free Software Network (http://www.ukfsn.org/) for their
144             support of this module's development. For free-software-friendly hosting
145             and other Internet services, try UKFSN.
146              
147             =head1 COPYRIGHT & LICENSE
148              
149             Copyright 2009-2012 Simon Cozens & Jason Clifford
150              
151             This program is free software; you can redistribute it and/or modify it
152             under the terms of either: version 2 of the GNU General Public License
153             as published by the Free Software Foundation; or the Artistic License.
154              
155             See http://dev.perl.org/licenses/ for more information.
156              
157              
158             =cut
159              
160             1; # End of Net::DSLProvider