Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

SprintUS syntax fixes

  • Loading branch information...
commit a67c1bbaf6e8f678d2fe2551489777d8ba8a01f9 1 parent 462de6c
authored August 31, 2011
1  lib/Courriel/MMS.pm
@@ -14,6 +14,7 @@ my @subclasses = qw(
14 14
 Courriel::MMS::MymtsRu
15 15
 Courriel::MMS::TmobileUK
16 16
 Courriel::MMS::TmobileUS
  17
+Courriel::MMS::SprintUS
17 18
 );
18 19
 
19 20
 # --- Attributes ---
11  lib/Courriel/MMS/SprintUS.pm
... ...
@@ -1,7 +1,7 @@
1 1
 use strict;
2 2
 use warnings;
3 3
 
4  
-package Courriel::MMS::TmobileUK;
  4
+package Courriel::MMS::SprintUS;
5 5
 use namespace::autoclean;
6 6
 use Moose;
7 7
 use WWW::Mechanize;
@@ -16,7 +16,7 @@ sub match {
16 16
     my $class = shift;
17 17
     my $email = shift;
18 18
 
19  
-    return 1 if $email->from =~ /pm\.sprint\.com//;
  19
+    return 1 if $email->from =~ /pm\.sprint\.com/;
20 20
     return;
21 21
 }
22 22
 
@@ -74,14 +74,11 @@ override 'get_mms_images' => sub {
74 74
        $mech->get( $image_url ); # get the actual picture (can't use mechanize's follow_link stuff since the image is in a popup)
75 75
  
76 76
        if( $mech->success && $mech->ct =~ m#^image/jpe?g# ) {
77  
-          push @images [ 'image.jpg' => $mech->content ];
  77
+          push @images, [ 'image.jpg' => $mech->content ];
78 78
        }
79 79
     }
80 80
  
81 81
     return @images;
82  
-}
83  
-
84  
-
85 82
 };
86 83
 
87 84
 __PACKAGE__->meta()->make_immutable();
@@ -94,7 +91,7 @@ __END__
94 91
 
95 92
 =head1 NAME
96 93
 
97  
-Courriel::MMS::TmobileUK - L<Courriel> extension for dealing with MMS messages from T-mobile UK
  94
+Courriel::MMS::SprintUS - L<Courriel> extension for dealing with MMS messages from Sprint US.
98 95
 
99 96
 =head1 SYNOPSIS
100 97
 
2  lib/Courriel/MMS/TmobileUS.pm
@@ -37,7 +37,7 @@ __END__
37 37
 
38 38
 =head1 NAME
39 39
 
40  
-Courriel::MMS::TmobileUK - L<Courriel> extension for dealing with MMS messages from T-mobile UK
  40
+Courriel::MMS::TmobileUS - L<Courriel> extension for dealing with MMS messages from T-mobile US
41 41
 
42 42
 =head1 SYNOPSIS
43 43
 
13  t/test.t
@@ -16,18 +16,27 @@ is( scalar( @images ), 1, 'Logo filtered out' );
16 16
 
17 17
 ok( $email->create_random_image_name( 'image/jpeg' ) =~ /\.jpg$/, 'random image extension' );
18 18
 
19  
-$email = build_email(
  19
+my $c_email = build_email(
20 20
     subject('aaa'),
21 21
     from('aaa@tmomail.net'),
22 22
     to( 'example@example.com' ),
23 23
     plain_body( 'test' ),
24 24
     attach( file => 't/data/cool.gif', filename => 'masthead.gif' ),
25 25
 );
26  
-$email = Courriel::MMS->parse( text => $email->as_string );
  26
+$email = Courriel::MMS->parse( text => $c_email->as_string );
27 27
 isa_ok( $email, 'Courriel::MMS::TmobileUS', 'MMS from tmomail.net' );
28 28
 @images = $email->get_mms_images;
29 29
 is( scalar( @images ), 0, 'Logo filtered out' );
30 30
 
  31
+$c_email = build_email(
  32
+    subject('aaa'),
  33
+    from( 'aaa@pm.sprint.com' ),
  34
+    to( 'example@example.com' ),
  35
+    plain_body( 'test' ),
  36
+);
  37
+$email = Courriel::MMS->parse( text => $c_email->as_string );
  38
+isa_ok( $email, 'Courriel::MMS::SprintUS', 'MMS from sprint' );
  39
+
31 40
 
32 41
 
33 42
 done_testing();

0 notes on commit a67c1bb

Please sign in to comment.
Something went wrong with that request. Please try again.