Try accessing the environment variables HTTPS, SERVER_PORT, and REQUEST_URI. For example:
mason_server.pl:
use v5.38;
use HTTP::Server::Simple::Mason;
{
package MyApp::Server;
use base 'HTTP::Server::Simple::Mason';
# Override 'mason_config' to provide the component root path
sub mason_config {
return ( comp_root => '/home/hakon/data/mason' );
}
}
# Create and start the server listening on port 3000 using your subclass
my $server = MyApp::Server->new(3000);
$server->run();
Try accessing the environment variables HTTPS, SERVER_PORT, and REQUEST_URI. For example:
mason_server.pl:
And in the
comp_root
folder I have this file:index.html:
After starting the server, you can visit http://localhost:3000/ to check the result..