Skip to content

Commit ae6e05e

Browse files
committed
safe print for interactive script
1 parent 2859922 commit ae6e05e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

resources/app/perl/interactive.pl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,18 +77,18 @@
7777
cb => sub {
7878
if ($mode =~ "unix-epoch") {
7979
if (length($input_text) == 0) {
80-
print "Seconds from the Unix epoch: ".time;
80+
print "Seconds from the Unix epoch: ".time or die;
8181
} else {
82-
print "Seconds from the Unix epoch: ".time."<br>Last input: ".$input_text;
82+
print "Seconds from the Unix epoch: ".time."<br>Last input: ".$input_text or die;
8383
}
8484
}
8585

8686
if ($mode =~ "local-time") {
8787
my $formatted_time = strftime('%d %B %Y %H:%M:%S', localtime);
8888
if (length($input_text) == 0) {
89-
print "Local date and time: ".$formatted_time;
89+
print "Local date and time: ".$formatted_time or die;
9090
} else {
91-
print "Local date and time: ".$formatted_time."<br>Last input: ".$input_text;
91+
print "Local date and time: ".$formatted_time."<br>Last input: ".$input_text or die;
9292
}
9393
}
9494
},

0 commit comments

Comments
 (0)