Steps to reproduce the behaviorBrowse the docs for Mojo::Log at https://metacpan.org/pod/Mojo::Log. My code uses: And later: Expected behaviorPerl should not report any errors. Actual behaviorI get these Perl error messages: SolutionI found that by changing the code thusly, the errors no longer appear: |
Replies: 7 comments 5 replies
|
Mojolicious docs assume the signatures feature is enabled. See https://metacpan.org/pod/Mojolicious::Guides::FAQ#What-does-%22Illegal-character-in-prototype%22-mean? |
|
Grinnz: Thanx for the reply. |
|
You need either a "use v5.36 (or higher) declaration" or to pass the -signatures argument to Mojo::Base or Mojolicious::Lite. That is the only way they will be enabled. |
|
I'm not sure what you mean by no var names. The signatures, as shown in the examples, contain variable names. |
|
Hi Dan
Indeed they do. But I got Perl compile errors with names, so I used
sigils. And then 1 sigil, and it worked.
And I emphasize, the code says 'use 5.40.0;'. I doubt 'use v5.40.0;'
(i.e. an extra 'v') would make a difference.
I am perplexed.
…On 2024-11-06 17:42, Dan wrote:
I'm not sure what you mean by no var names. The signatures, as shown
in the examples, contain variable names.
--
Cheers, Ron
savage.net.au
symboliciq.au
|
|
(@) is a valid prototype. |
|
Hi Dan
I just used:
use 5.40.0;
use feature 'signatures';
and:
$demo -> logger -> format(sub ($time, $level, @lines) {"Level: $level.
Msg: $lines[0]\n"});
It worked with and without the 'use feature' line. Why did it fail
before? IDN. But at least it's working.
Thanx for your help.
…On 2024-11-06 18:20, Dan wrote:
(@) is a valid prototype. ($, $, @) is a valid signature, but one
where none of the variables are usable in the subroutine. If you got
compilation errors with the latter but not the former, you did not
enable signatures correctly.
--
Cheers, Ron
savage.net.au
symboliciq.au
|
Mojolicious docs assume the signatures feature is enabled. See https://metacpan.org/pod/Mojolicious::Guides::FAQ#What-does-%22Illegal-character-in-prototype%22-mean?