line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Astro::SkyX::sky6DirectGuide; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
13
|
use 5.006001; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
29
|
|
4
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
32
|
|
|
1
|
|
|
|
|
33
|
|
5
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
234
|
|
6
|
|
|
|
|
|
|
require IO::Socket; |
7
|
|
|
|
|
|
|
require Exporter; |
8
|
|
|
|
|
|
|
require Astro::SkyX; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
#use vars qw( $SkyXConnection $_count ); |
11
|
|
|
|
|
|
|
our @ISA = qw(Exporter ); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# Items to export into callers namespace by default. Note: do not export |
14
|
|
|
|
|
|
|
# names by default without a very good reason. Use EXPORT_OK instead. |
15
|
|
|
|
|
|
|
# Do not simply export all your public functions/methods/constants. |
16
|
|
|
|
|
|
|
our ($AUTOLOAD); |
17
|
|
|
|
|
|
|
# This allows declaration use SkyX ':all'; |
18
|
|
|
|
|
|
|
# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK |
19
|
|
|
|
|
|
|
# will save memory. |
20
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( 'all' => [ qw( |
21
|
|
|
|
|
|
|
new connect Send Get |
22
|
|
|
|
|
|
|
) ] ); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
our @EXPORT = qw( |
27
|
|
|
|
|
|
|
); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
our $VERSION = '0.03'; |
30
|
|
|
|
|
|
|
our @PROPERTIES = qw( Abort MoveTelescope ); |
31
|
|
|
|
|
|
|
our @READWRITEPROPS = qw( lAsynchronous lSpeedIndex ); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# Preloaded methods go here. |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
##---## |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub new { |
38
|
0
|
|
|
0
|
0
|
|
my ($caller, %arg) = @_; |
39
|
0
|
|
|
|
|
|
my $caller_is_obj = ref($caller); |
40
|
0
|
|
0
|
|
|
|
my $class = $caller_is_obj || $caller; |
41
|
|
|
|
|
|
|
|
42
|
0
|
|
|
|
|
|
my $self = bless { |
43
|
|
|
|
|
|
|
_debug => $_[1], |
44
|
|
|
|
|
|
|
}, $class; |
45
|
|
|
|
|
|
|
# Private count increment/decrement methods |
46
|
|
|
|
|
|
|
# $self->_incr_count(); |
47
|
0
|
|
|
|
|
|
return $self; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
# sub _incr_count { ++$_count } |
50
|
|
|
|
|
|
|
# sub _decr_count { --$_count } |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub AUTOLOAD ($;$) { |
53
|
1
|
|
|
1
|
|
4
|
no strict "refs"; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
415
|
|
54
|
0
|
|
|
0
|
|
|
my ($self, @newval) = @_; |
55
|
0
|
|
|
|
|
|
my $newtext = ''; |
56
|
0
|
|
|
|
|
|
my $js = "/* Java Script */ \r\n"; |
57
|
0
|
0
|
|
|
|
|
if ($AUTOLOAD =~ /.*::(.*::.*)/) { |
58
|
0
|
|
|
|
|
|
my $method = $1; |
59
|
|
|
|
|
|
|
# Let's build the javascript |
60
|
|
|
|
|
|
|
# $newtext = join ',', map{ qq/"$_"/ }@newval; |
61
|
0
|
0
|
|
|
|
|
$newtext = join ',', map{ /^[0-9.-]*$/ ? $_ : qq/'$_'/ }@newval; |
|
0
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
|
$method =~ tr/::/./s; |
63
|
|
|
|
|
|
|
|
64
|
0
|
|
|
|
|
|
my ($package, $propertyName) = $AUTOLOAD =~ m/^(.+::)(.+)$/; |
65
|
0
|
0
|
0
|
|
|
|
if(haveProperty($propertyName)){ |
|
|
0
|
|
|
|
|
|
66
|
0
|
|
|
|
|
|
$js .= $method . "(" . $newtext . ");\r\n"; |
67
|
|
|
|
|
|
|
} elsif(haveReadWriteProp($propertyName) and length($newtext) ){ |
68
|
|
|
|
|
|
|
|
69
|
0
|
|
|
|
|
|
$js .= $method . ' = ' . $newtext . ";\r\n"; |
70
|
|
|
|
|
|
|
} else { |
71
|
0
|
|
|
|
|
|
$js .= $method . ";\r\n"; |
72
|
|
|
|
|
|
|
} |
73
|
0
|
|
|
|
|
|
Astro::SkyX::Send($self,$js); |
74
|
0
|
|
|
|
|
|
return Astro::SkyX::Get($self); |
75
|
|
|
|
|
|
|
} |
76
|
0
|
|
|
|
|
|
die "No such method: $AUTOLOAD"; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub haveReadWriteProp{ |
80
|
0
|
|
|
0
|
0
|
|
my ($value) = @_; |
81
|
0
|
|
|
|
|
|
for my $property (@READWRITEPROPS){ |
82
|
0
|
0
|
|
|
|
|
if($property eq $value){ |
83
|
0
|
|
|
|
|
|
return "1"; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
} |
86
|
0
|
|
|
|
|
|
return undef; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub haveProperty{ |
90
|
0
|
|
|
0
|
0
|
|
my ($value) = @_; |
91
|
0
|
|
|
|
|
|
for my $property (@PROPERTIES){ |
92
|
0
|
0
|
|
|
|
|
if($property eq $value){ |
93
|
0
|
|
|
|
|
|
return "1"; |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
} |
96
|
0
|
|
|
|
|
|
return undef; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
0
|
|
|
0
|
|
|
sub DESTROY { |
100
|
|
|
|
|
|
|
# $_[0]->_decr_count(); |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
1; |
104
|
|
|
|
|
|
|
__END__ |