line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::FreeDB2; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# Copyright 2002, Vincenzo Zocca. |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# See LICENSE section for usage and distribution rights. |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
require 5.005_62; |
8
|
1
|
|
|
1
|
|
647
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
28
|
|
9
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
30
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
require Exporter; |
12
|
1
|
|
|
1
|
|
1847
|
use AutoLoader qw(AUTOLOAD); |
|
1
|
|
|
|
|
1670
|
|
|
1
|
|
|
|
|
6
|
|
13
|
1
|
|
|
1
|
|
1231
|
use Error qw (:try); |
|
1
|
|
|
|
|
6343
|
|
|
1
|
|
|
|
|
7
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# Items to export into callers namespace by default. Note: do not export |
18
|
|
|
|
|
|
|
# names by default without a very good reason. Use EXPORT_OK instead. |
19
|
|
|
|
|
|
|
# Do not simply export all your public functions/methods/constants. |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# This allows declaration use Net::FreeDB2 ':all'; |
22
|
|
|
|
|
|
|
# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK |
23
|
|
|
|
|
|
|
# will save memory. |
24
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( 'all' => [ qw( |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
) ] ); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
our @EXPORT = qw( |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
our ( $VERSION ) = '$Revision: 0.8.2.6 $ ' =~ /\$Revision:\s+([^\s]+)/; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub connection { |
36
|
|
|
|
|
|
|
# Allow both styles Net::FreeDB2->connection and Net::FreeDB2::connection |
37
|
0
|
0
|
|
0
|
1
|
|
$_[0] eq 'Net::FreeDB2' && shift; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
# Get options |
40
|
0
|
|
|
|
|
|
my $opt; |
41
|
0
|
0
|
|
|
|
|
if (ref ($_[0]) eq 'HASH') { |
42
|
0
|
|
|
|
|
|
$opt = shift; |
43
|
|
|
|
|
|
|
} else { |
44
|
0
|
|
|
|
|
|
$opt = {}; |
45
|
0
|
|
|
|
|
|
foreach my $av (split (/\s*;+\s*/, shift)) { |
46
|
0
|
|
|
|
|
|
my ($a, $v) = split (/\s*=\s*/, $av); |
47
|
0
|
0
|
0
|
|
|
|
$a && $v || next; |
48
|
0
|
|
|
|
|
|
$opt->{$a} = $v; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
0
|
0
|
0
|
|
|
|
if (defined ($opt->{protocol}) && $opt->{protocol} eq 'CDDBP') { |
53
|
0
|
|
|
|
|
|
require Net::FreeDB2::Connection::CDDBP; |
54
|
0
|
|
|
|
|
|
import Net::FreeDB2::Connection::CDDBP; |
55
|
0
|
|
|
|
|
|
return (Net::FreeDB2::Connection::CDDBP->new ($opt)); |
56
|
|
|
|
|
|
|
} else { |
57
|
0
|
|
|
|
|
|
require Net::FreeDB2::Connection::HTTP; |
58
|
0
|
|
|
|
|
|
import Net::FreeDB2::Connection::HTTP; |
59
|
0
|
|
|
|
|
|
return (Net::FreeDB2::Connection::HTTP->new ($opt)); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
1; |
65
|
|
|
|
|
|
|
__END__ |