-
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: |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments
-
Mojolicious docs assume the signatures feature is enabled. See https://metacpan.org/pod/Mojolicious::Guides::FAQ#What-does-%22Illegal-character-in-prototype%22-mean? |
Beta Was this translation helpful? Give feedback.
-
Grinnz: Thanx for the reply. |
Beta Was this translation helpful? Give feedback.
-
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. |
Beta Was this translation helpful? Give feedback.
-
I'm not sure what you mean by no var names. The signatures, as shown in the examples, contain variable names. |
Beta Was this translation helpful? Give feedback.
-
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
|
Beta Was this translation helpful? Give feedback.
-
(@) is a valid prototype. |
Beta Was this translation helpful? Give feedback.
-
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
|
Beta Was this translation helpful? Give feedback.
Mojolicious docs assume the signatures feature is enabled. See https://metacpan.org/pod/Mojolicious::Guides::FAQ#What-does-%22Illegal-character-in-prototype%22-mean?