-
Notifications
You must be signed in to change notification settings - Fork 559
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
[doc] perlxstut update #18163
Comments
This just adds 'my $i' to make the test pass on strict, and it cleans it up and provides test names for the tests. I kept the tabs that were used.
This just adds 'my $i' to make the test pass on strict, and it cleans it up and provides test names for the tests. I kept the tabs that were used.
This just adds 'my $i' to make the test pass on strict, and it cleans it up and provides test names for the tests. I kept the tabs that were used.
I'll check the other examples. |
EXAMPLE 4 The content #include "./mylib.h" can be changed to #include "mylib.h". The content ./Mytest2/mylib/mylib.h can be changed to Mytest2/mylib/mylib.h. 'NAME', 'VERSION_FROM', 'LIBS', 'DEFINE', 'INC' and 'MYEXTLIB' do not need to be enclosed in single quotes. There's no single line that says "mylib" in the generated MANIFEST file.
The recommendation to edit the .pm file is obscure.
The number of tests in the Mytest2.t script should be changed to "5".
|
EXAMPLE 5
Include EXAMPLE 6
Include EXAMPLE 9 Passing open files to XSes Is perlioputs a misprint? These comments might be added, respectively from perlapio and perlguts.
Suggested addition below this line. The real work is done in the standard typemap. For more details, see perlapio. See also Perhaps add perlapio to the list of URLs to consult. |
Thank you for checking the rest of the examples. I made a few changes.
This might have been the author trying to indicate more strongly that these files are in the current directory, but I revised this nonetheless.
They don't need to be, but I prefer them there nowadays. Autoquoting rules in Perl are... subtle (some sometimes strange), so it doesn't hurt to be more explicit as a practice.
I think this should be edited the code, rather than the tutorial.
Same as above.
Same as above. |
Fixed!
Fixed!
I think the idea here was to give an example of what would it look like if you implemented a function
While I think they require reading more to fully understand these comments, I'm in favor of putting them here so they don't make the user immediately wonder "oh wait... what are these?" This small hint tells them in a few words what these are for and they can decide for themselves when to read more about them.
Done.
Done. |
And I also removed calling functions with |
EXAMPLE 4
I favour consistency with the Makefile.PL presentation from EXAMPLES 1 and 4, on the former NAME, VERSION_FROM, LIBS, DEFINE, and INC, are not enclosed with single quotes. |
They are actually extremely simple (though I empathize as I shared this view some years ago) - I think it's a failing of the documentation that it doesn't make this more obvious, but I can't say exactly what or where it should be improved to address this. The best explanation of it currently is https://perldoc.pl/perldata#Identifier-parsing as it is the same as the identifier parsing rules (minus double colons), and boils down to "containing only letters, digits, or underscore, and not starting with a digit". The leading minus is a weird addition to this since it is actually the unary minus operator applying its own same autoquoting rule to the following bareword. |
This misses a subtle point of newlines breaking autoquoting. |
I just pushed a fix to the PR that normalizes the quoting for other examples of |
@Grinnz would you concur of the commits that |
I don't think either way is any more clear, but the quotes add clutter, I am not sure how relevant my personal style preferences are to this document though. |
There's something to be said about leaving program, in this instance EXAMPLE 9 Passing open files to XSes The basis for my suggested changes was due to PERL_NO_GET_CONTEXT already being addressed in SPECIAL NOTES. Factually PERL_NO_GET_CONTEXT is in the |
True.
Are you asking for a particular change here? I don't follow. |
SHORT In this instance the reader may wonder why the single quotes are in the tutorial but absent in the files generated by the command the reader is told to run. I'm not fond of the proposed addition of the single quotes. TL;DR My preferences are not to oblige the reader to think more. EXAMPLE 4 Telling the reader to replace a non-existant line with three lines rather than to append three lines. Telling the reader to edit the .pm file and change the variable Both are already present in generated *.pm files. Running
Telling the reader to change the number of tests to "4" when the test fails unless changed to "5". |
|
This is not the best way to submit a request for changes to the Perl 5 core distribution. While there are a number of ways to create and submit a patch, since you have already opened a GH issue I'll only discuss the way that involve github.com, namely, a pull request. You should fork the entire repository to your github account, clone to your local machine, create a branch to hold your revisions on your local machine, edit, make sure the entire test suite passes, push your branch to your github repository, and then initiate a pull request. The Perl-specific details of this can be found by calling What you appear to have done above is to create a new repository in your github account that contains only the particular file you want to revise and a patch of that file. While we do accept single patches provided as email attachments (and we have since 1987!), if you use github you should follow the standard pull request procedures. Thank you very much. |
I've just applied all of the remaining suggestions and will merge them, closing this ticket. If you have any other suggestions, I highly recommend submitting them as either a patch file or a GitHub Pull Request. If you need assistance in creating your first Pull Request, I recommend reading this or this. The above guide by @jkeenan is also very helpful. Thank you for all the help. :) |
* GH #18163: Stricter, cleaned up test example: This just adds 'my $i' to make the test pass on strict, and it cleans it up and provides test names for the tests. I kept the tabs that were used. * Use relative path * Indent for readability * Missing variables * Add another reference * Remove '&' in function calls * Add some hints * Normalize quoting in WriteMakeFile examples * Remove explicit quotes * Apply all additional suggestions * replace tabs, make line shorter
https://perldoc.perl.org/perlxstut.html
Perl 5.22.2
Running
h2xs -A -n Mytest
creates at/Mytest.t
file withuse strict;
.EXAMPLE 3
Running
make test
then of course outputs the question(did you forget to declare "my $i"?)
.The maintainer's e-mail address is furthermore invalid.
The text was updated successfully, but these errors were encountered: