Silence "used only once" warning in porting test#23284
Merged
khwilliamson merged 1 commit intoPerl:bleadfrom May 15, 2025
Merged
Silence "used only once" warning in porting test#23284khwilliamson merged 1 commit intoPerl:bleadfrom
khwilliamson merged 1 commit intoPerl:bleadfrom
Conversation
As suggested by Dave M. in Perl#23278 (comment).
Contributor
There was a problem hiding this comment.
This works. An alternative is to change test.pl to be
$::IS_ASCII = $::IS_ASCII = ord 'A' == 65;
$::IS_EBCDIC = $::IS_EBCDIC = ord 'A' == 193;
And then the individual .t files wouldn't have to do anything special.
But I don't know which is better. Maybe they should have to declare their use of this as the better practice.
Contributor
|
On Wed, May 14, 2025 at 08:32:40AM -0700, Karl Williamson wrote:
@khwilliamson commented on this pull request.
This works. An alternative is to change `test.pl` to be
```
$::IS_ASCII = $::IS_ASCII = ord 'A' == 65;
$::IS_EBCDIC = $::IS_EBCDIC = ord 'A' == 193;
And then the individual `.t` files wouldn't have to do anything special.
I don't think that will silence the warning:
$ cat /tmp/test.pl
$::ABC = $::ABC = 1;
$ perl -e'use warnings; use strict; require "/tmp/test.pl"; print "ok\n" if $::ABC'
Name "main::ABC" used only once: possible typo at -e line 1.
ok
$
But I don't know which is better. Maybe they should have to declare
their use of this as the better practice.
Looking at other test files, either they don't have warnings enabled,
or they happen to use the var more than once.
I think declaring it as 'our' in the test script is probably the best
approach.
…--
The warp engines start playing up a bit, but seem to sort themselves out
after a while without any intervention from boy genius Wesley Crusher.
-- Things That Never Happen in "Star Trek" #17
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As suggested by Dave M. in
#23278 (comment).
@iabyn