Control.pm

filter: Statementstmt 93.3% 42 / 45 Branchbran 50.0% 5 / 10 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 9 / 9 Podpod n/a totaltotal 85.0% 57 / 67 CC 7 SCAR 14.7
CC
7
Cov
84%
AUTOLOAD
8.2
BEGIN
1.0
BEGIN
1.0
CRAP 4.4
↑ Summary winampctl.pl »
1 # Author: Murat Uenalan (muenalan@cpan.org)
2 #
3 # Copyright (c) 2002 Murat Uenalan. All rights reserved.
4 #
5 # Note: This program is free software; you can redistribute
6 #
7 # it and/or modify it under the same terms as Perl itself.
8
9 1 ▶use 5.006; use warnings; use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
10
11 package Winamp::Control;
12
13 1 ▶use Class::Maker;
Subroutine BEGIN: called CC=1 SCAR=0.0
14
15 1 ▶use LWP::Simple;
Subroutine BEGIN: called CC=1 SCAR=0.0
16
17 1 ▶use URI;
Subroutine BEGIN: called CC=1 SCAR=0.0
18
19 1 ▶use vars qw($AUTOLOAD $VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
20
21 1 our $VERSION = '0.2.1';
22
23 1 Class::Maker::class
24 {
25 public =>
26 {
27 string => [qw(host passwd)],
28
29 integer => [qw(port)],
30 },
31 };
32
33 sub _preinit
34 1 ▶{
Subroutine _preinit: called CC=1 SCAR=0.0
35 1 my $this = shift;
36
37 1 $this->host( 'localhost' );
38
39 1 $this->port( 4800 );
40 }
41
42 2 ▶sub AUTOLOAD : method
Subroutine AUTOLOAD: called CC=7 SCAR=21.0
43 {
44 2 ▶ my $this = shift || return undef;
Condition50%1/2
shift() || (return undef)
l!l
20
MC/DC0%0/1
shift() || (return undef)
shift()
Truth table50%1/2
A
A= shift()
Aresult
11
00
45
46 2 my @args;
47
48 2 ▶ @args = ( p => $this->passwd ) if defined $this->passwd;
Branch: 1 branch
BranchTrueFalseTotal
if defined $this->passwd 0 2 2
49
50 2 push @args, @_;
51
52 2 my $func = $AUTOLOAD;
53
54 2 $func =~ s/.*:://;
55
56 2 ▶ return if $func eq 'DESTROY';
Branch: 1 branch
BranchTrueFalseTotal
if $func eq "DESTROY" 1 1 2
57
58 1 my $uri = URI->new;
59
60 1 $uri->scheme( 'http' );
61
62 1 $uri->host( $this->host );
63
64 1 $uri->port( $this->port );
65
66 1 $uri->path( $func );
67
68 1 $uri->query_form( @args );
69
70 #$uri->userinfo( 'user:pw' );
71
72 1 ▶ warn $uri->as_string, "\n" if $main::opts{debug};
Branch: 1 branch
BranchTrueFalseTotal
if $main::opts{"debug"} 0 1 1
73
74 1 my $result = get( $uri->as_string );
75
76 1 ▶ return undef unless $result;
Branch: 1 branch
BranchTrueFalseTotal
unless $result 1 0 1
77
78 0 my @array = ();
79
80 0 @array = split( '<br>', $result );
81
82 0 ▶return wantarray ? @array : $array[0];
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
83 }
84
85 1 1;
86
87 __END__
↑ Summary winampctl.pl »