diff --git a/Changes b/Changes index 5a1d3f9..18599fb 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,9 @@ Revision history for Perl extension SMS::Send::Facilitamovel. +0.02 Tue Feb 8 19:00:00 2016 + - Fix tests + 0.01 Tue Feb 2 23:06:25 2016 - original version; created by h2xs 1.23 with options - -AX SMS::Send::Facilitamovel + -AX SMS::Send::BR::Facilitamovel diff --git a/Makefile.PL b/Makefile.PL index c54c34b..f78c950 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -1,12 +1,45 @@ use 5.018001; use ExtUtils::MakeMaker; -# See lib/ExtUtils/MakeMaker.pm for details of how to influence -# the contents of the Makefile that is written. -WriteMakefile( - NAME => 'SMS::Send::BR::Facilitamovel', - VERSION_FROM => 'lib/SMS/Send/BR/Facilitamovel.pm', # finds $VERSION - PREREQ_PM => {}, # e.g., Module::Name => 1.1 - ($] >= 5.005 ? ## Add these new keywords supported since 5.005 - (ABSTRACT_FROM => 'lib/SMS/Send/Facilitamovel.pm', # retrieve abstract from module - AUTHOR => 'Mario Celso Teixeira ') : ()), + +my %WriteMakefileArgs = ( + 'NAME' => 'SMS::Send::BR::Facilitamovel', + 'VERSION' => '0.02', + 'ABSTRACT' => 'SMS::Send driver for the Facilita Movel SMS service', + 'AUTHOR' => 'Mario Celso Teixeira ', + 'BUILD_REQUIRES' => { + 'English' => '0', + 'Carp' => '0', + 'HTTP::Tiny' => '0', + 'URI::Escape' => '0', + 'SMS::Send' => '0', + 'Test::More' => '0' + }, + 'CONFIGURE_REQUIRES' => { + 'ExtUtils::MakeMaker' => '6.31', + }, + 'PREREQ_PM' => { + 'SMS::Send::Driver' => '0', + }, + 'test' => { + 'TESTS' => 't/*.t' + } ); + +unless ( eval { ExtUtils::MakeMaker->VERSION(6.56) } ) { + my $br = delete $WriteMakefileArgs{BUILD_REQUIRES}; + my $pp = $WriteMakefileArgs{PREREQ_PM}; + for my $mod ( keys %$br ) { + if ( exists $pp->{$mod} ) { + $pp->{$mod} = $br->{$mod} if $br->{$mod} > $pp->{$mod}; + } + else { + $pp->{$mod} = $br->{$mod}; + } + } +} + +delete $WriteMakefileArgs{CONFIGURE_REQUIRES} + unless eval { ExtUtils::MakeMaker->VERSION(6.52) }; + +WriteMakefile(%WriteMakefileArgs); + diff --git a/README.pod b/README.pod index b08f461..812b0af 100644 --- a/README.pod +++ b/README.pod @@ -3,10 +3,6 @@ SMS::Send::BR::Facilitamovel - L driver for the Facilitamovel service -=head1 VERSION - -0.01 - =head1 SYNOPSIS use SMS::Send; @@ -40,10 +36,10 @@ To install this module type the following: This module requires these other modules and libraries: -Carp -HTTP::Tiny -URI::Escape -SMS::Send::Driver + Carp + HTTP::Tiny + URI::Escape + SMS::Send::Driver =head1 COPYRIGHT AND LICENCE @@ -53,4 +49,3 @@ This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.18.1 or, at your option, any later version of Perl 5 you may have available. - diff --git a/dist.ini b/dist.ini new file mode 100644 index 0000000..33ba4c8 --- /dev/null +++ b/dist.ini @@ -0,0 +1,9 @@ +name = SMS-Send-BR-Facilitamovel +author = Mario Celso Teixeira +license = Perl_5 +copyright_holder = Mario Celso Teixeira +copyright_year = 2016 + +version = 0.02 + +[@Basic] diff --git a/lib/SMS/Send/BR/Facilitamovel.pm b/lib/SMS/Send/BR/Facilitamovel.pm index e46862a..60fe4d3 100644 --- a/lib/SMS/Send/BR/Facilitamovel.pm +++ b/lib/SMS/Send/BR/Facilitamovel.pm @@ -3,10 +3,10 @@ use warnings; package SMS::Send::BR::Facilitamovel; -$SMS::Send::BR::Facilitamovel::VERSION = '0.001'; +$SMS::Send::BR::Facilitamovel::VERSION = '0.02'; + +# ABSTRACT: SMS::Send driver for the Facilita Movel SMS service -# ABSTRACT: SMS::Send driver for the Facilita Movel SMS service - use Carp; use HTTP::Tiny; use URI::Escape qw( uri_escape ); @@ -59,12 +59,12 @@ sub send_sms { die $response->{content} unless $response->{success}; - my $response_message = $response->{content}; + my @response_message = split /[;]+/, $response->{content}; return 1 - if $response_message->{statusCode} =~ /^6\d\d/; + if $response_message[0] != "6"; - $@ = $response_message; + $@ = @response_message; return 0; } diff --git a/t/00-compile.t b/t/00-compile.t new file mode 100644 index 0000000..e2d549f --- /dev/null +++ b/t/00-compile.t @@ -0,0 +1,51 @@ +use 5.006; +use strict; +use warnings; + +# this test was generated with Dist::Zilla::Plugin::Test::Compile 2.051 + +use Test::More; + +plan tests => 1 + ($ENV{AUTHOR_TESTING} ? 1 : 0); + +my @module_files = ( + 'SMS/Send/BR/Facilitamovel.pm' +); + + + +# no fake home requested + +my $inc_switch = -d 'blib' ? '-Mblib' : '-Ilib'; + +use File::Spec; +use IPC::Open3; +use IO::Handle; + +open my $stdin, '<', File::Spec->devnull or die "can't open devnull: $!"; + +my @warnings; +for my $lib (@module_files) +{ + # see L + my $stderr = IO::Handle->new; + + my $pid = open3($stdin, '>&STDERR', $stderr, $^X, $inc_switch, '-e', "require q[$lib]"); + binmode $stderr, ':crlf' if $^O eq 'MSWin32'; + my @_warnings = <$stderr>; + waitpid($pid, 0); + is($?, 0, "$lib loaded ok"); + + if (@_warnings) + { + warn @_warnings; + push @warnings, @_warnings; + } +} + + + +is(scalar(@warnings), 0, 'no warnings found') + or diag 'got warnings: ', ( Test::More->can('explain') ? Test::More::explain(\@warnings) : join("\n", '', @warnings) ) if $ENV{AUTHOR_TESTING}; + + diff --git a/t/SMS-Send-BR-Facilitamovel.t b/t/SMS-Send-BR-Facilitamovel.t deleted file mode 100644 index 96d5b2e..0000000 --- a/t/SMS-Send-BR-Facilitamovel.t +++ /dev/null @@ -1,33 +0,0 @@ -use strict; -use warnings; -use Test::More; -use Test::Exception; - -BEGIN { - use_ok( 'SMS::Send' ); - use_ok( 'SMS::Send::BR::Facilitamovel'); -} - -throws_ok sub { my $sender = SMS::Send->new('BR::Facilitamovel') }, - qr/_login missing/, - 'sender construction without _login and _password throws exception'; - -throws_ok sub { my $sender = SMS::Send->new('BR::Facilitamovel', - _login => 'foo' ) }, - qr/_password missing/, - 'sender construction without _password throws exception'; - -throws_ok sub { my $sender = SMS::Send->new('BR::Facilitamovel', - _password => 'foo' ) }, - qr/_login missing/, - 'sender construction without _login throws exception'; - -ok( - my $sender = SMS::Send->new('BR::Facilitamovel', - _login => 'foo', - _password => 'bar', - ), 'sender construction ok' -); - -done_testing; -