my $newjobtime = $min % 10;
####
if ($hour = 1 or $hour = 9 or $hour = 17 or $hour >= 24) {
####
my $snowagerleft = ($hour + 8 - 1) % 8;
if($snowagerleft) {
# "$snowagerleft until awakens"
}
else {
# "steal your keep"
}
####
if ($hour < 2) {
my $newday;
$newday = 2 - $hour;
# ...
}
elsif ($hour >= 2) {
my $newday;
$newday = 24 - $hour;
# ...
}
####
my $newday = 24 - $hour;
$newday = ($newday + 2) % 24;
####
#!/usr/bin/perl
use warnings;
use strict;
use CGI qw(:standard *table);
sub format_section {
my ($width, $title, $message) = @_;
return Tr(
td({width => $width, bgcolor => "gray" }, $title),
td($message)
);
}
my ($sec, $min, $hour) = localtime(time);
my $newdayleft = 24 - $hour;
$newdayleft = ($newdayleft + 2) % 24;
my $hourminsleft = 60 - $min;
my $newjobleft = $min % 10;
my $snowagerleft = ($hour + 8 - 1) % 8;
my $snowagermsg = $snowagerleft
? (
"There are $snowagerleft hours(s) "
. "and $hourminsleft minute(s) left until he awakens!"
)
: (
font({ color => "blue" }, q(The snowager is sleeping!))
. q( ) x 34
. a({
href => "http://www.neopets.com/winter/snowager2.phtml",
target => "_blank"
}, q(Steal your keep!))
);
print header
. start_html
. h2({align => "center"}, "Important Neopets Times")
. br()
. "The current server time is $hour:$min:$sec"
. start_table
. format_section(15, Jobs => (
"There are "
. font({ color => "blue" }, $newjobleft)
. " minute(s) until jobs are replenished."
))
. format_section(15, Snowager => $snowagermsg)
. format_section(
20,
"New Day",
"There are $newdayleft hour(s) "
. "and $hourminsleft minute(s) until the new day."
)
. end_table
. end_html;