From 8bb80034f59b3370ce0940d48d0e418dd8e18993 Mon Sep 17 00:00:00 2001 From: Marius Gavrilescu Date: Sun, 12 Apr 2015 23:03:45 +0300 Subject: [PATCH] Use PerlX::Maybe for Add --- lib/Gruntmaster/App/Command/Add.pm | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) 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; } -- 2.39.2