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