]> git.donarmstrong.com Git - deb_pkgs/libstatistics-r-perl.git/blob - lib/Statistics/R/Legacy.pm
New upstream version 0.34
[deb_pkgs/libstatistics-r-perl.git] / lib / Statistics / R / Legacy.pm
1 package Statistics::R::Legacy;
2
3
4 use strict;
5 use warnings;
6
7 use base qw( Statistics::R );
8
9 use vars qw{@ISA @EXPORT};
10
11 BEGIN {
12    @ISA     = 'Exporter';
13    @EXPORT  = qw{
14       startR
15       stopR
16       restartR
17       Rbin
18       start_sharedR
19       start_shared
20       read
21       receive
22       is_blocked
23       is_locked
24       lock
25       unlock
26       send 
27       error
28       clean_up
29    };
30 }
31
32 =head1 NAME
33
34 Statistics::R::Legacy - Legacy methods for Statistics::R
35
36 =head1 DESCRIPTION
37
38 B<Do not use this module directly. Use L<Statistics::R> instead.>
39
40 This module contains legacy methods for I<Statistics::R>. They are provided
41 solely so that code that uses older versions of I<Statistics::R> does not crash
42 with recent version. Do not use these methods in new code!
43
44 Some of these legacy methods simply had their name changed, but some others were
45 changed to do nothing and return only single value because it did not make sense
46 to keep these methods as originally intended anymore.
47
48 =head1 METHODS
49
50 =over 4
51
52 =item startR()
53
54 This is the same thing as start().
55
56 =item stopR()
57
58 This is the same thing as stop().
59
60 =item restartR()
61
62 This is the same thing as restart().
63
64 =item Rbin()
65
66 This is the same thing as bin().
67
68 =item start_sharedR() / start_shared()
69
70 Use the shared option of new() instead.
71
72 =item send / read() / receive()
73
74 Use run() instead.
75
76 =item lock()
77
78 Does nothing anymore.
79
80 =item unlock()
81
82 Does nothing anymore.
83
84 =item is_blocked() / is_locked()
85
86 Return 0.
87
88 =item error()
89
90 Return the empty string.
91
92 =item clean_up()
93
94 Does nothing anymore.
95
96 =back
97
98 =head1 SEE ALSO
99
100 =over 4
101
102 =item * L<Statistics::R>
103
104 =back
105
106 =head1 AUTHORS
107
108 Florent Angly E<lt>florent.angly@gmail.comE<gt> (2011 rewrite)
109
110 Graciliano M. P. E<lt>gm@virtuasites.com.brE<gt> (original code)
111
112 =head1 MAINTAINERS
113
114 Florent Angly E<lt>florent.angly@gmail.comE<gt>
115
116 Brian Cassidy E<lt>bricas@cpan.orgE<gt>
117
118 =head1 COPYRIGHT & LICENSE
119
120 This program is free software; you can redistribute it and/or
121 modify it under the same terms as Perl itself.
122
123 =head1 BUGS
124
125 All complex software has bugs lurking in it, and this program is no exception.
126 If you find a bug, please report it on the CPAN Tracker of Statistics::R:
127 L<http://rt.cpan.org/Dist/Display.html?Name=Statistics-R>
128
129 Bug reports, suggestions and patches are welcome. The Statistics::R code is
130 developed on Github (L<http://github.com/bricas/statistics-r>) and is under Git
131 revision control. To get the latest revision, run:
132
133    git clone git@github.com:bricas/statistics-r.git
134
135 =cut
136
137
138 {
139    # Prevent "Name XXX used only once" warnings in this block
140    no warnings 'once';
141    *startR        = \&Statistics::R::start;
142    *stopR         = \&Statistics::R::stop;
143    *restartR      = \&Statistics::R::restart;
144    *Rbin          = \&Statistics::R::bin;
145    *receive       = \&Statistics::R::result;
146    *start_sharedR = \&start_shared;
147    *read          = \&receive;
148    *is_blocked    = \&is_locked;
149 }
150
151
152 sub start_shared {
153     my $self = shift;
154     $self->start( shared => 1 );
155 }
156
157
158 sub lock {
159     return 1;
160 }
161
162
163 sub unlock {
164     return 1;
165 }
166
167
168 sub is_locked {
169     return 0;
170 }
171
172
173 sub send {
174    # Send a command to R. Do not return the output.
175    my ($self, $cmd) = @_;
176    $self->run($cmd);
177    return 1;
178 }
179
180
181 sub error {
182     return '';
183 }
184
185
186 sub clean_up {
187    return 1;
188 }
189
190
191 1;