#!/usr/bin/perl use Mojolicious::Lite; my $logLine; require './bigFileFullOfSubs.pl'; require './subImWorkingOn.pl'; any '/' => sub { my $c = shift; $logLine = ""; subImWorkingOn(); $c->stash(logLine => $logLine); $c->render(template => 'main'); }; app->start; __DATA__ @@ main.html.ep
<%= $logLine %>
####
#!/usr/bin/perl -w
use strict;
use warnings;
sub Log { # Generates nice looking log comment with time.
my ($LogItem) = @_;
$LogItem =~ s/\n/ /g;
my $Time = "functionThatGetsTheTime()";
my $thisLog = "[ $Time ] :: $LogItem\n";
$logLine .= $thisLog;
}
return 1;
####
use warnings;
use strict;
sub subImWorkingOn {
Log("Interesting information for the user here.");
Log("Even more fascinating information for the user here!");
Log("Processing complete");
}
return 1;
####
Global symbol "$logLine" requires explicit package name (did you forget to declare "my $logLine"?) at ./bigFileFullOfSubs.pl line 11.