Hi. I had noticed that Dancer/MIME.pm (and also Dancer/Core/MIME.pm in Dancer2) return 42 https://github.com/sukria/Dancer/blob/devel/lib/Dancer/MIME.pm#L67 This is wrong, because generate warning $ perl -wce '42' Useless use of a constant (42) in void context at -e line 1. -e syntax OK Also, with `use warnings FATAL => 'all'` (default for Moo) returned error $ perl -c -Ilib lib/Dancer/Core/MIME.pm ; echo $? Useless use of a constant (42) in void context at lib/Dancer/Core/MIME.pm line 77. 255 -- Vladimir Lettiev aka crux ✉ theCrux@gmail.com
This should indeed be fixed. Thank you! On Mon, Oct 31, 2011 at 2:44 PM, <thecrux@gmail.com> wrote:
Hi.
I had noticed that Dancer/MIME.pm (and also Dancer/Core/MIME.pm in Dancer2) return 42 https://github.com/sukria/Dancer/blob/devel/lib/Dancer/MIME.pm#L67
This is wrong, because generate warning $ perl -wce '42' Useless use of a constant (42) in void context at -e line 1. -e syntax OK
Also, with `use warnings FATAL => 'all'` (default for Moo) returned error
$ perl -c -Ilib lib/Dancer/Core/MIME.pm ; echo $? Useless use of a constant (42) in void context at lib/Dancer/Core/MIME.pm line 77. 255
-- Vladimir Lettiev aka crux ✉ theCrux@gmail.com _______________________________________________ Dancer-users mailing list Dancer-users@perldancer.org http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
On Mon, Oct 31, 2011 at 8:50 AM, sawyer x <xsawyerx@gmail.com> wrote:
This should indeed be fixed.
Thank you!
On Mon, Oct 31, 2011 at 2:44 PM, <thecrux@gmail.com> wrote:
Hi.
I had noticed that Dancer/MIME.pm (and also Dancer/Core/MIME.pm in Dancer2) return 42 https://github.com/sukria/Dancer/blob/devel/lib/Dancer/MIME.pm#L67
This is wrong, because generate warning $ perl -wce '42' Useless use of a constant (42) in void context at -e line 1. -e syntax OK
Also, with `use warnings FATAL => 'all'` (default for Moo) returned error
$ perl -c -Ilib lib/Dancer/Core/MIME.pm ; echo $? Useless use of a constant (42) in void context at lib/Dancer/Core/MIME.pm line 77. 255
I don't understand. All modules are required to end with a true value. Usually, it is 1; but 42; should be fine. What am I missing? -Naveed
I agree it shouldn't cause a problem, but that it should be fixed, because it's non-standard and confuses newbies. :) On Mon, Oct 31, 2011 at 4:47 PM, Naveed Massjouni <naveedm9@gmail.com>wrote:
On Mon, Oct 31, 2011 at 8:50 AM, sawyer x <xsawyerx@gmail.com> wrote:
This should indeed be fixed.
Thank you!
On Mon, Oct 31, 2011 at 2:44 PM, <thecrux@gmail.com> wrote:
Hi.
I had noticed that Dancer/MIME.pm (and also Dancer/Core/MIME.pm in Dancer2) return 42 https://github.com/sukria/Dancer/blob/devel/lib/Dancer/MIME.pm#L67
This is wrong, because generate warning $ perl -wce '42' Useless use of a constant (42) in void context at -e line 1. -e syntax OK
Also, with `use warnings FATAL => 'all'` (default for Moo) returned
error
$ perl -c -Ilib lib/Dancer/Core/MIME.pm ; echo $? Useless use of a constant (42) in void context at
lib/Dancer/Core/MIME.pm
line 77. 255
I don't understand. All modules are required to end with a true value. Usually, it is 1; but 42; should be fine. What am I missing? -Naveed
On Mon, Oct 31, 2011 at 10:47:59AM -0400, Naveed Massjouni wrote: ...
$ perl -c -Ilib lib/Dancer/Core/MIME.pm ; echo $? Useless use of a constant (42) in void context at lib/Dancer/Core/MIME.pm line 77. 255
I don't understand. All modules are required to end with a true value. Usually, it is 1; but 42; should be fine. What am I missing?
http://stackoverflow.com/questions/1860869/what-are-valid-perl-module-return... "The danger of using the return value, aside from obfuscation, is that it only works once." -- Vladimir Lettiev aka crux ✉ theCrux@gmail.com
On 31/10/2011 15:08, thecrux@gmail.com wrote:
On Mon, Oct 31, 2011 at 10:47:59AM -0400, Naveed Massjouni wrote: ...
$ perl -c -Ilib lib/Dancer/Core/MIME.pm ; echo $? Useless use of a constant (42) in void context at lib/Dancer/Core/MIME.pm line 77. 255
I don't understand. All modules are required to end with a true value. Usually, it is 1; but 42; should be fine. What am I missing?
http://stackoverflow.com/questions/1860869/what-are-valid-perl-module-return...
"The danger of using the return value, aside from obfuscation, is that it only works once."
The 42 is my fault. I use non standard return values in lot of modules, and never had a complain. :) I do not mind to change it, but I would like to understand why issuing that warning is a problem. Try to run the same line of code against lib/Dancer/Route.pm :P Cheers
On Mon, Oct 31, 2011 at 06:52:35PM +0000, ambs wrote:
On 31/10/2011 15:08, thecrux@gmail.com wrote:
On Mon, Oct 31, 2011 at 10:47:59AM -0400, Naveed Massjouni wrote: ...
$ perl -c -Ilib lib/Dancer/Core/MIME.pm ; echo $? Useless use of a constant (42) in void context at lib/Dancer/Core/MIME.pm line 77. 255
I don't understand. All modules are required to end with a true value. Usually, it is 1; but 42; should be fine. What am I missing?
http://stackoverflow.com/questions/1860869/what-are-valid-perl-module-return...
"The danger of using the return value, aside from obfuscation, is that it only works once."
The 42 is my fault. I use non standard return values in lot of modules, and never had a complain. :)
I do not mind to change it, but I would like to understand why issuing that warning is a problem. Try to run the same line of code against lib/Dancer/Route.pm :P
This shows quality of code ) As mentioned, warning becomes errors when used use warnings FATAL => 'all'; This pargma used in Moo and affects Dancer2. So when i try to check syntax of each module, i get nonzero exit status $ ack --perl -f | xargs -n 1 perl -Ilib -c ..... lib/Dancer/Core/Request.pm syntax OK Useless use of a constant (42) in void context at lib/Dancer/Core/MIME.pm line 77, <DATA> line 998. xargs: perl: exited with status 255; aborting Is it ok? No, first important test for any perl program was failed On practice, this prevents to build rpm package of dancer2 for my favourite linux distro, because standard syntax check failed. -- Vladimir Lettiev aka crux ✉ theCrux@gmail.com
participants (4)
-
ambs -
Naveed Massjouni -
sawyer x -
thecrux@gmail.com