From: Marius Gavrilescu Date: Sun, 12 Apr 2015 20:03:45 +0000 (+0300) Subject: Use PerlX::Maybe for Add X-Git-Tag: 5999.000_014~22 X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=8bb80034f59b3370ce0940d48d0e418dd8e18993;p=gruntmaster-data.git Use PerlX::Maybe for Add --- diff --git a/lib/Gruntmaster/App/Command/Add.pm b/lib/Gruntmaster/App/Command/Add.pm index a830675..b161904 100644 --- a/lib/Gruntmaster/App/Command/Add.pm +++ b/lib/Gruntmaster/App/Command/Add.pm @@ -12,6 +12,7 @@ use Date::Parse qw/str2time/; use File::Slurp qw/read_file write_file/; use IO::Prompter [ -style => 'bold', '-stdio', '-verbatim' ]; use JSON::MaybeXS qw/encode_json/; +use PerlX::Maybe; use Term::ANSIColor qw/RED RESET/; use constant LEVEL_VALUES => { @@ -106,15 +107,15 @@ sub add_problem { runner => $runner, judge => $judge, testcnt => $testcnt, + maybe private => $private, + maybe timeout => $timeout, + maybe olimit => $olimit, + maybe gensource => $gensource, + maybe genformat => $genformat, + maybe versource => $versource, + maybe verformat => $verformat, ); - $options{private} = $private if $private; - $options{timeout} = $timeout if $timeout; - $options{olimit} = $olimit if $olimit; $options{tests} = encode_json \@tests if @tests; - $options{gensource} = $gensource if $gensource; - $options{genformat} = $genformat if $genformat; - $options{versource} = $versource if $versource; - $options{verformat} = $verformat if $verformat; db->insert(problems => \%options); db->insert(contest_problems => {problem => $id, contest => $contest}) if $contest; }