]>
iEval git - gruntmaster-data.git/blob - lib/Gruntmaster/App/Command/Set.pm
1 package Gruntmaster
::App
::Command
::Set
;
6 our $VERSION = '5999.000_004';
8 use Gruntmaster
::App
'-command';
11 use File
::Slurp qw
/read_file/;
14 ['file!', 'Use the contents of a file as value']
17 sub usage_desc
{ "%c [-cjpu] set id column value [column value ...]\n%c [-cjpu] set --file id column filename [column filename ...]" }
20 my ($self, $opt, $args) = @_;
22 $self->usage_error('No table selected') unless $self->app->table;
23 $self->usage_error('Not enough arguments provided') if @args < 3;
24 $self->usage_error('The number of arguments must be odd') unless @args % 2;
28 my ($self, $opt, $args) = @_;
29 my ($id, %values) = @
$args;
30 %values = map { $_ => scalar read_file
$values{$_} } keys %values if $opt->{file
};
31 db
->update($self->app->table, \
%values, {id
=> $id});
41 Gruntmaster::App::Command::Set - set a property of an object
45 gm -u set MGV name 'Marius Gavrilescu'
46 gm -p set aplusb level beginner
47 gm -c set test_ct 'This is a <b>test</b> contest.<br>Nothing to see here'
48 gm -j set 100 result_text Accepted
52 The set command takes three arguments: an object id, a property name,
53 and a value. It sets the given property of the given object to the
62 Marius Gavrilescu, E<lt>marius@ieval.roE<gt>
64 =head1 COPYRIGHT AND LICENSE
66 Copyright (C) 2014-2015 by Marius Gavrilescu
68 This library is free software; you can redistribute it and/or modify
69 it under the same terms as Perl itself, either Perl version 5.20.1 or,
70 at your option, any later version of Perl 5 you may have available.
This page took 0.060608 seconds and 5 git commands to generate.