/usr/share/perl5/RoPkg/Simba/Command.pm is in simba 0.8.4-4.3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 | ############################################################################
## Copyright (C) 2005 Subredu Manuel <diablo@iasi.roedu.net>. #
## #
## This program is free software; you can redistribute it and/or modify #
## it under the terms of the GNU General Public License v2 as published by #
## the Free Software Foundation. #
## #
## This program is distributed in the hope that it will be useful, #
## but WITHOUT ANY WARRANTY; without even the implied warranty of #
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
## GNU General Public License for more details. #
## #
## You should have received a copy of the GNU General Public License #
## along with this program; if not, write to the Free Software #
## Foundation, Inc., 59 Temple Place - Suite 330, Boston, #
## MA 02111-1307,USA. #
############################################################################
package RoPkg::Simba::Command;
use strict;
use warnings;
use Scalar::Util qw(blessed);
use RoPkg::DBObject;
use RoPkg::Exceptions;
use vars qw($table $VERSION);
$VERSION='0.1.2';
my $table='Commands';
use base qw(RoPkg::DBObject);
my $pf = {
id => q{-},
Path => q{-},
Args => q{-},
};
sub new {
my ($class, %opt) = @_;
my $self;
$opt{methods} = $pf;
$self = $class->SUPER::new(%opt);
$self->{_sql_table} = $table;
return $self;
}
sub table {
my ($self) = @_;
return $table;
}
##################################
### Database functions - BEGIN ###
##################################
sub Add {
my ($self) = @_;
if (!blessed($self)) {
OutsideClass->throw('Called from outside class');
}
return $self->SQL_Insert();
}
sub Delete {
my ($self) = @_;
if ( !blessed($self) ) {
OutsideClass->throw('Called from outside class');
}
$self->chkp(qw(id));
return $self->SQL_Delete(qw(id));
}
sub Update {
my ($self) = @_;
if ( !blessed($self) ) {
OutsideClass->throw('Called from outside class');
}
$self->chkp(qw(id));
return $self->SQL_Update(qw(id));
}
sub Load {
my ($self) = @_;
if ( !blessed($self) ) {
OutsideClass->throw('Called from outside class');
}
$self->chkp(qw(id));
return $self->SQL_Select(qw(id));
}
##################################
### Database functions - END ###
##################################
1;
__END__
=head1 NAME
RoPkg::Simba::Command
=head1 VERSION
0.1.2
=head1 DESCRIPTION
RoPkg::Simba::Command is the class used by simba to manipulate a
command. It has the basic sql methods (inherited from RoPkg::DBObject).
=head1 SYNOPSIS
!#/usr/bin/perl
use RoPkg::DB;
use RoPkg::Simba::Command;
sub main {
my $dbp = new RoPkg::DB();
$dbp->Add('dbi:mysql:database=mysql;host=localhost',
'root',
'',
'local');
my $c = new RoPkg::Simba::Command(db => $dbp, db_method => 'db_local');
$c->id(1);
$c->Load();
}
main();
=head1 SUBROUTINES/METHODS
All methods (besides new) raise OutsideClass exception when
called outside class instance. Also, some methods may rise
diferent exceptions. Please read the section in which the
method is described to find out more information about exceptions.
=head2 new()
The class constructor. At this moment, it just calls
RoPkg::DBObject->new() . Please read the RoPkg::DBObject
manual page for more information about the new() parameters.
=head2 table()
Returns the name of the commands database table.
The following methods are get/set methods for
all fields of a mirror.
=over 3
=item *) id
=item *) Path
=item *) Args
=back
=head2 Add()
Adds the mirror to the database. This method is a
wrapper for RoPkg::DBObject::SQL_Insert . On success
0 is returned. On error, DBI exception is raised.
=head2 Delete()
Deletes the current command from the database. Before
calling this method, you should set the B<id> of the
command . If you don't set the B<id> Param::Missing
exception is raised. On database operation success,
0 is returned. On database error, DBI exception is
raised.
=head2 Update()
Update the current command object with the database. Before
calling this method, you should set the B<id> of the
command . If you don't set the B<id> Param::Missing
exception is raised. On database operation success,
0 is returned. On database error, DBI exception is
raised.
=head2 Load()
Load the command from the database, into
the current object. Before calling this method
you should have set B<id>. If id or
is not set, then Param::Missing is raised.
On database operation success 0 is returned. On
database error, DBI exception is raised.
=head1 DIAGNOSTICS
This module comes with his own tests. To run the tests, unpack
the source, and use 'make test' commmand
=head1 CONFIGURATION AND ENVIRONMENT
This module doesn't use configuration files and environment
variables.
=head1 DEPENDENCIES
RoPkg::DBObject and RoPkg::Exceptions
=head1 INCOMPATIBILITIES
None known to the author
=head1 BUGS AND LIMITATIONS
None known to the author
=head1 PERL CRITIC
The code is perl critic level 2 compliant (with one exception)
=head1 SEE ALSO
L<RoPkg::Simba::Commands> L<RoPkg::Exceptions> L<RoPkg::Object>
=head1 AUTHOR
Subredu Manuel <diablo@iasi.roedu.net>
=head1 LICENSE AND COPYRIGHT
Copyright (C) 2005 Subredu Manuel. All Rights Reserved.
This module is free software; you can redistribute it
and/or modify it under the same terms as Perl itself.
The LICENSE file contains the full text of the license.
=cut
|