-
-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use of uninitialized value $i in pattern match (m//) #138
Comments
Hmmm, interesting. StrMatch is supposed to be a child of Str, which does do a definedness check. It looks like StrMatch's inlining code is not being strict as its parent type, so isn't checking definedness. That's definitely a bug. A workaround would be something like: ArrayRef[
( Defined ) & ( StrMatch[ qr/\A [0-9A-Z]{3} \z/x ] ),
1,
] I'll get this fixed in 2.4.1 though. |
I actually can't reproduce this error, as |
Ah, I see. You're using Eval::Closure, which does switch on warnings. Eval::TypeTiny does not. |
I have used Params::ValidationCompiler that depends ot Eval::Closure. Now I have switched to Type::Params. I don't understand your decision not to turn on warnings in Eval::TypeTiny. How should we have detected such an issue without warnings being raised? |
These two lines are exactly equivalent in functionality: !ref( $foo ) and $foo =~ m/.../
defined( $foo ) and !ref( $foo ) and $foo =~ m/.../ The only difference is that the first one will raise a warning if warnings are enabled and
Skipping |
I have understood this before. I like warnings and I treat them as issues. This is a matter of taste of course. I am very much |
Oh yeah, in normal code, I'd keep the warnings on for sure and would check definedness. Inline-generated code, I tend to value performance over maintainability and readability though. I'll keep the issue open until the next release. Just adds a bit of visibility in case somebody else tried to report the same issue. (Unlikely, but can happen.) |
Type-Tiny: 2.002001
This
defines a KeyList type constraint that is applied to a list with 3 elements. The second element is undef. If I set the environment variable EVAL_CLOSURE_PRINT_SOURCE to true the output is
Can this warning
be avoided?
The text was updated successfully, but these errors were encountered: