blib/lib/Net/Twitter/RandomUpdate.pm

filter: Statementstmt 59.2% 16 / 27 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 37.5% 3 / 8 Podpod 100% 5 / 5 totaltotal 51.0% 24 / 47 CC 3 SCAR 11.9
CC
3
Cov
50%
new
6.0
tweet
6.0
username
2.0
CRAP 3.3
↑ Summary
1 package Net::Twitter::RandomUpdate;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use Net::Twitter;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 our $VERSION = join( '.', 1, map{ $_ - 53 } ( '$Rev: 59 $' =~ /(\d+)/g ) );
9  
10 1 my $quotes = [
11 'How to store your baby walker: First, remove baby.',
12 'I get to go to lots of overseas places, like Canada.',
13 'The team has come along slow but fast.',
14 'Most cars on our roads have only one occupant, usually the driver.',
15 'Football players win football games.',
16 'Most lies about blondes are false.',
17 'I love California, I practically grew up in Phoenix.',
18 'Strangely, in slow motion replay, the ball seemed to hang in the air for even longer.',
19 'We\'re just physically not physical enough.',
20 'The world is more like it is now then it ever has before.',
21 'I cannot tell you how grateful I am -- I am filled with humidity.',
22 'I have a God-given talent. I got it from my dad.',
23 'Traditionally, most of Australia\'s imports come from overseas.',
24 ];
25  
26 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
Pod documented
27 0 my ( $class, $notes ) = @_;
28  
29 0 ▶ return bless( $notes || $quotes, $class );
Condition0%0/3
$notes || $quotes
l!l&&r!l&&!r
000
MC/DC0%0/2
$notes || $quotes
$notes $quotes
Truth table0%0/3
A || B
A= $notesB= $quotes
ABresult
1X1
011
000
30 }
31  
32 {
33 1 my $user;
34 0 ▶ sub username {
Subroutine username: not called CC=1 SCAR=6.9
Pod documented
35 0 return $user = pop;
36 }
37  
38 my $pass;
39 0 ▶ sub password {
Subroutine password: not called CC=1 SCAR=6.9
Pod documented
40 0 return $pass = pop;
41 }
42  
43 1 my $reg = .05;
44 0 ▶ sub regularity {
Subroutine regularity: not called CC=1 SCAR=6.9
Pod documented
45 0 return $reg = pop;
46 }
47  
48 0 ▶ sub tweet {
Subroutine tweet: not called CC=2 SCAR=17.9
Pod documented
49 0 ▶ return if ( rand() > $reg );
Branch: 1 branch
BranchTrueFalseTotal
if rand() > $reg 0 0 0
50 0 my ($self) = @_;
51  
52 0 my $tweet = Net::Twitter->new(
53 'username' => $user,
54 'password' => $pass,
55 'source' => 'randomupdate',
56 );
57  
58 0 my @tweets = @$self;
59 0 $tweet->update( $tweets[ int( rand( @tweets ) ) ] );
60  
61 0 return;
62 }
63 }
64  
65 1 1;
66  
67 __END__
↑ Summary