line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!perl -w |
2
|
|
|
|
|
|
|
package Mac::Comm::OT_PPP; |
3
|
|
|
|
|
|
|
require 5.00201; |
4
|
1
|
|
|
1
|
|
1043
|
use vars qw($VERSION @ISA @EXPORT $AUTOLOAD); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
302
|
|
5
|
1
|
|
|
1
|
|
8
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
979
|
|
6
|
1
|
|
|
1
|
|
1382
|
use AutoLoader; |
|
1
|
|
|
|
|
2016
|
|
|
1
|
|
|
|
|
7
|
|
7
|
1
|
|
|
1
|
|
633
|
use Exporter; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
67
|
|
8
|
1
|
|
|
1
|
|
7
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
122
|
|
9
|
1
|
|
|
1
|
|
4100
|
use Mac::AppleEvents; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
@ISA = qw(Exporter); |
11
|
|
|
|
|
|
|
@EXPORT = (); |
12
|
|
|
|
|
|
|
$VERSION = sprintf("%d.%02d", q$Revision: 1.20 $ =~ /(\d+)\.(\d+)/); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
#================================================================= |
15
|
|
|
|
|
|
|
# Stuff |
16
|
|
|
|
|
|
|
#================================================================= |
17
|
|
|
|
|
|
|
sub new { |
18
|
|
|
|
|
|
|
my $self = shift; |
19
|
|
|
|
|
|
|
return bless{}, $self; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
#----------------------------------------------------------------- |
22
|
|
|
|
|
|
|
sub PPPconnect { |
23
|
|
|
|
|
|
|
my($self,$user,$pass,$adrs,$diag,$be,$rp,$at); |
24
|
|
|
|
|
|
|
$self = shift; |
25
|
|
|
|
|
|
|
$user = shift || croak "username left blank\n"; |
26
|
|
|
|
|
|
|
$pass = shift || croak "password left blank\n"; |
27
|
|
|
|
|
|
|
$adrs = shift || croak "phone # left blank\n"; |
28
|
|
|
|
|
|
|
$be = AEBuildAppleEvent('netw','RAco',typeApplSignature,'MACS',0,0,'') || croak $^E; |
29
|
|
|
|
|
|
|
AEPutParam($be,'RAun','TEXT',$user); |
30
|
|
|
|
|
|
|
AEPutParam($be,'RApw','TEXT',$pass); |
31
|
|
|
|
|
|
|
AEPutParam($be,'RAad','TEXT',$adrs); |
32
|
|
|
|
|
|
|
$rp = AESend($be, kAEWaitReply) || croak $^E; |
33
|
|
|
|
|
|
|
$at = AEGetParamDesc($rp,'errn'); |
34
|
|
|
|
|
|
|
AEDisposeDesc $be; |
35
|
|
|
|
|
|
|
AEDisposeDesc $rp; |
36
|
|
|
|
|
|
|
return AEPrint($at) if ($at); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
#----------------------------------------------------------------- |
39
|
|
|
|
|
|
|
sub PPPdisconnect { |
40
|
|
|
|
|
|
|
my($be,$rp,$at); |
41
|
|
|
|
|
|
|
$be = AEBuildAppleEvent('netw','RAdc',typeApplSignature,'MACS',0,0,'') || croak $^E; |
42
|
|
|
|
|
|
|
$rp = AESend($be, kAEWaitReply) || croak $^E; |
43
|
|
|
|
|
|
|
$at = AEGetParamDesc($rp,'errn'); |
44
|
|
|
|
|
|
|
AEDisposeDesc $be; |
45
|
|
|
|
|
|
|
AEDisposeDesc $rp; |
46
|
|
|
|
|
|
|
return AEPrint($at) if ($at); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
#----------------------------------------------------------------- |
49
|
|
|
|
|
|
|
sub PPPstatus { |
50
|
|
|
|
|
|
|
my($be,$rp,$aq,$at,@ar,$ar,%ar); |
51
|
|
|
|
|
|
|
$be = AEBuildAppleEvent('netw','RAst',typeApplSignature,'MACS',0,0,'') || croak $^E; |
52
|
|
|
|
|
|
|
$rp = AESend($be, kAEWaitReply) || croak $^E; |
53
|
|
|
|
|
|
|
$at = AEGetParamDesc($rp,'errn'); |
54
|
|
|
|
|
|
|
return AEPrint($at) if ($at); |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
$aq = AEGetParamDesc($rp,'----'); |
57
|
|
|
|
|
|
|
@ar = qw(RAsb RAsc RAun RAsn RAms RAsp RAbm RAbi RAbo RAsr); |
58
|
|
|
|
|
|
|
foreach $ar(@ar) { |
59
|
|
|
|
|
|
|
if ($at = AEGetParamDesc($aq,$ar)) { |
60
|
|
|
|
|
|
|
($ar{$ar} = AEPrint($at)) =~ s/^Ò(.*)Ó$/$1/s; |
61
|
|
|
|
|
|
|
delete $ar{$ar} if ($ar{$ar} eq q{'TEXT'()}); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
AEDisposeDesc $be; |
66
|
|
|
|
|
|
|
AEDisposeDesc $rp; |
67
|
|
|
|
|
|
|
return AEPrint($ar{'errn'}) if ($ar{'errn'}); |
68
|
|
|
|
|
|
|
return \%ar; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
#----------------------------------------------------------------- |
71
|
|
|
|
|
|
|
sub PPPsavelog { |
72
|
|
|
|
|
|
|
my($self,$file,$be,$rp,$at); |
73
|
|
|
|
|
|
|
$self = shift; |
74
|
|
|
|
|
|
|
$file = shift || croak "filename left blank\n"; |
75
|
|
|
|
|
|
|
$be = AEBuildAppleEvent('netw','RAsl',typeApplSignature,'MACS',0,0,'') || croak $^E; |
76
|
|
|
|
|
|
|
AEPutParam($be,'RAlf','TEXT',$file) if ($file); |
77
|
|
|
|
|
|
|
$rp = AESend($be, kAEWaitReply) || croak $^E; |
78
|
|
|
|
|
|
|
$at = AEGetParamDesc($rp,'errn'); |
79
|
|
|
|
|
|
|
AEDisposeDesc $be; |
80
|
|
|
|
|
|
|
AEDisposeDesc $rp; |
81
|
|
|
|
|
|
|
return AEPrint($at) if ($at); |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
#-----------------------------------------------------------------# |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
__END__ |