Hypnotoad and main namespace
How do I handle the main namespace under Hypnotoad?
I have this small server:
#!/usr/bin/perl
use Modern::Perl;
use Mojolicious::Lite;
use extmod;
sub hello
{
say "hello";
}
get "/" => sub
{
my $c = shift;
extmod::put();
$c->render(text=>"ok");
};
app->start;
... and this module:
use Modern::Perl;
package extmod;
sub put
{
say ">>put:";
::hello();
}
1;
A subroutine in a module tries to call sub in the main namespace;
This works fine under the standard mojo server. But not under Hypnotoad:
put: [Tue May 30 14:20:37 2017] [error] Undefined subroutine & main :: hello is called on line extmod.pm 8.
Is this a function? How can I see the global namespace in a module?
+3
source to share
No one has answered this question yet
Check out similar questions: