Just a few quick remarks,
# $opts{t} = 60 unless (defined $opts{t});
$opts{t} //= 60;
(check perldoc perlop for //
operator)
# not ($opts{u} eq "hours")
($opts{u} ne "hours")
(ne
as not equal)
Prefer and
over &&
as later is higher precedence operator and is usually used when you want to take advantage of this particular feature (the same goes for ||
vs. or
).
my $ok = eval {
assert_valid_json ($response->content);
1;
};
if (!$ok) { #error..
(reason: http://stackoverflow.com/a/2166162/223226 https://stackoverflow.com/a/2166162/223226)
# my $dateFormat = $_[0];
# my $dateFromJSON = $_[1];
my ($dateFormat, $dateFromJSON) = @_;
(assign all vars at once from @_
array)
Just a few quick remarks,
# $opts{t} = 60 unless (defined $opts{t});
$opts{t} //= 60;
(check perldoc perlop for //
operator)
# not ($opts{u} eq "hours")
($opts{u} ne "hours")
(ne
as not equal)
Prefer and
over &&
as later is higher precedence operator and is usually used when you want to take advantage of this particular feature (the same goes for ||
vs. or
).
my $ok = eval {
assert_valid_json ($response->content);
1;
};
if (!$ok) { #error..
(reason: http://stackoverflow.com/a/2166162/223226)
# my $dateFormat = $_[0];
# my $dateFromJSON = $_[1];
my ($dateFormat, $dateFromJSON) = @_;
(assign all vars at once from @_
array)
Just a few quick remarks,
# $opts{t} = 60 unless (defined $opts{t});
$opts{t} //= 60;
(check perldoc perlop for //
operator)
# not ($opts{u} eq "hours")
($opts{u} ne "hours")
(ne
as not equal)
Prefer and
over &&
as later is higher precedence operator and is usually used when you want to take advantage of this particular feature (the same goes for ||
vs. or
).
my $ok = eval {
assert_valid_json ($response->content);
1;
};
if (!$ok) { #error..
(reason: https://stackoverflow.com/a/2166162/223226)
# my $dateFormat = $_[0];
# my $dateFromJSON = $_[1];
my ($dateFormat, $dateFromJSON) = @_;
(assign all vars at once from @_
array)
Just a few quick remarks,
# $opts{t} = 60 unless (defined $opts{t});
$opts{t} //= 60;
(check perldoc perlop for //
operator)
# not ($opts{u} eq "hours")
($opts{u} ne "hours")
(ne
as not equal)
Prefer and
over &&
as later is higher precedence operator and is usually used when you want to take advantage of this particular feature (the same goes for ||
vs. or
).
my $ok = eval {
assert_valid_json ($response->content);
1;
};
if (!$ok) { #error..
(reason: http://stackoverflow.com/a/2166162/223226)
# my $dateFormat = $_[0];
# my $dateFromJSON = $_[1];
my ($dateFormat, $dateFromJSON) = @_;
(assign all vars at once from @_
array)