I'm making an application in perl for the first time, and wanted to use a front controller approach where all requests go through one script which delegates what pages to load based on the uri.
what my script looks like:
use LWP::UserAgent;
use Template;
my $base_url = 'project.local/';
my $ua = LWP::UserAgent->new;
if ($ua->get($base_url . 'reports'))
{
my $reports_tt = Template->new(\%options);
$reports_tt->process('reports.tt', \%varz, 'reports.html') or die $reports_tt->error;
}
So on my home.html page, there is a link that points to 'project.local/reports'. I want to load the 'reports.html' page when this link is clicked. Using this approach I can keep all my routes in one place.
But this doesn't load the reports.html page, am I using LWP::UserAgent->get()
the wrong way? I think I need a way to route all requests to my script in the .htaccess file, but I'm not at all sure how to do that. Could someone kindly assist?