« Twilio/AuthStrategy/TokenAuthStrategy.pm
↑ Summary
Twilio/CredentialProvider/ClientCredentialProvider.pm »
| 1 | package Twilio; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 20 | ▶ | use 5.016; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 20 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||
| 6 | 20 | our $VERSION = '2.001'; | |||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | # 1.x took named arguments; passed to the 2.x constructor they would become the | ||||||||||||||||||||||||||||||||||||||||||
| 9 | # credentials and fail only at the first request, as a 401 from Twilio. | ||||||||||||||||||||||||||||||||||||||||||
| 10 | 20 | my %IS_V1_ARGUMENT = map { $_ => 1 } qw(sid token trace debug use_threads); | |||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | # The client is loaded here, not at compile time, so that "use Twilio" stays cheap. | ||||||||||||||||||||||||||||||||||||||||||
| 13 | 24 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 14 | 24 | my ($class, @arguments) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 15 | 24 | ▶ | if (@arguments && defined $arguments[0] && $IS_V1_ARGUMENT{ $arguments[0] }) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
@arguments and defined $arguments[0] and $IS_V1_ARGUMENT{$arguments[0]}
@arguments and defined $arguments[0]
MC/DC66%2/3
@arguments and defined $arguments[0] and $IS_V1_ARGUMENT{$arguments[0]}
@arguments
defined $arguments[0]
$IS_V1_ARGUMENT{$arguments[0]}
Truth table75%3/4
A and B and C
A= @argumentsB= defined $arguments[0]C= $IS_V1_ARGUMENT{$arguments[0]}
| |||||||||||||||||||||||||||||||||||||||||||
| 16 | 5 | require Twilio::Exceptions::ConfigurationException; | |||||||||||||||||||||||||||||||||||||||||
| 17 | 5 | Twilio::Exceptions::ConfigurationException->throw( | |||||||||||||||||||||||||||||||||||||||||
| 18 | "Twilio->new($arguments[0] => ...) is the 1.x interface; " | ||||||||||||||||||||||||||||||||||||||||||
| 19 | . 'since 2.0 it takes ($username, $password, \%options), like Twilio::Rest::Client->new'); | ||||||||||||||||||||||||||||||||||||||||||
| 20 | } | ||||||||||||||||||||||||||||||||||||||||||
| 21 | 19 | require Twilio::Rest::Client; | |||||||||||||||||||||||||||||||||||||||||
| 22 | 19 | return Twilio::Rest::Client->new(@arguments); | |||||||||||||||||||||||||||||||||||||||||
| 23 | } | ||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||
| 25 | 20 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||
| 27 | __END__ | ||||||||||||||||||||||||||||||||||||||||||