This is a bad idea, if you want to call external functions then they should
be in a common module that can be used from where you call them.

On Tue, May 30, 2017 at 7:29 AM, Yuriy Zhilovets <[email protected]>
wrote:

> Hi everybody!
>
> How to handle different namespaces 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 a sub in the main namespace;
>
> This works ok under the standard mojo server. But not under the Hypnotoad:
>
> *>>put:*
> *[Tue May 30 14:20:37 2017] [error] Undefined subroutine &main::hello
> called at extmod.pm <http://extmod.pm> line 8.*
>
> Is it a feature? How to see global namespace in the module?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Mojolicious" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/mojolicious.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

Reply via email to