line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Part of get-flash-videos. See get_flash_videos for copyright. |
2
|
|
|
|
|
|
|
package FlashVideo::VideoPreferences::Account; |
3
|
|
|
|
|
|
|
|
4
|
2
|
|
|
2
|
|
10
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
611
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub new { |
7
|
0
|
|
|
0
|
0
|
|
my($class, $site, $prompt) = @_; |
8
|
|
|
|
|
|
|
|
9
|
0
|
|
|
|
|
|
require Net::Netrc; # Core since 5.8 |
10
|
|
|
|
|
|
|
|
11
|
0
|
|
|
|
|
|
my $record = Net::Netrc->lookup($site); |
12
|
0
|
0
|
|
|
|
|
my($user, $pass) = $record ? $record->lpa : (); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# Allow only setting user in .netrc if wanted |
15
|
|
|
|
|
|
|
|
16
|
0
|
0
|
|
|
|
|
if(!$user) { |
17
|
0
|
|
|
|
|
|
print $prompt; |
18
|
|
|
|
|
|
|
|
19
|
0
|
|
|
|
|
|
print "Username: "; |
20
|
0
|
|
|
|
|
|
chomp($user = ); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
0
|
0
|
|
|
|
|
if(!$pass) { |
24
|
0
|
|
|
|
|
|
print "Ok, need your password"; |
25
|
0
|
0
|
|
|
|
|
if(eval { require Term::ReadKey }) { |
|
0
|
|
|
|
|
|
|
26
|
0
|
|
|
|
|
|
print ": "; |
27
|
0
|
|
|
|
|
|
Term::ReadKey::ReadMode(2); |
28
|
0
|
|
|
|
|
|
chomp($pass = ); |
29
|
0
|
|
|
|
|
|
Term::ReadKey::ReadMode(0); |
30
|
0
|
|
|
|
|
|
print "\n"; |
31
|
|
|
|
|
|
|
} else { |
32
|
0
|
|
|
|
|
|
print " (will be displayed): "; |
33
|
0
|
|
|
|
|
|
chomp($pass = ); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
0
|
|
|
|
|
|
return bless { |
38
|
|
|
|
|
|
|
username => $user, |
39
|
|
|
|
|
|
|
password => $pass, |
40
|
|
|
|
|
|
|
}, $class; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub username { |
44
|
0
|
|
|
0
|
0
|
|
my($self) = @_; |
45
|
0
|
|
|
|
|
|
return $self->{username}; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub password { |
49
|
0
|
|
|
0
|
0
|
|
my($self) = @_; |
50
|
0
|
|
|
|
|
|
return $self->{password}; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
1; |