blib/lib/LWP/UserAgent/Keychain.pm

filter: Statementstmt 75.0% 6 / 8 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 81.8% 9 / 11 CC 1 SCAR 0.9
CC
1
Cov
75%
BEGIN
1.3
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
↑ Summary
1 package LWP::UserAgent::Keychain;
2  
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use 5.8.1;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 our $VERSION = '0.01';
6  
7 0 ▶use Mac::Glue ':all';
Subroutine BEGIN: called CC=1 SCAR=2.6
8 use base qw( LWP::UserAgent );
9  
10 my $keychain = Mac::Glue->new("Keychain Scripting");
11  
12 sub get_basic_credentials {
13 my($self, $realm, $uri, $isproxy) = @_;
14  
15 for my $key ($keychain->obj(keys => keychain => "Login.keychain")->get) {
16 if ($key->prop('class')->get eq 'cint' and
17 $key->prop('server')->get eq $uri->host and
18 $key->prop('protocol')->get eq $uri->scheme) {
19  
20 my $username = $key->prop('account')->get;
21 my $password = $key->prop('password')->get;
22 return ($username, $password);
23 }
24 }
25  
26 return (undef, undef);
27 }
28  
29 1;
30 __END__
↑ Summary