Linux premium71.web-hosting.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64
LiteSpeed
Server IP : 198.187.29.8 & Your IP : 3.149.27.125
Domains :
Cant Read [ /etc/named.conf ]
User : cleahvkv
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
usr /
share /
perl5 /
pod /
Delete
Unzip
Name
Size
Permission
Date
Action
perl.pod
15.89
KB
-rw-r--r--
2023-05-18 21:34
perl5004delta.pod
54.92
KB
-rw-r--r--
2023-05-18 21:34
perl5005delta.pod
33.48
KB
-rw-r--r--
2023-05-18 21:34
perl5100delta.pod
54.23
KB
-rw-r--r--
2023-05-18 21:34
perl5101delta.pod
42.86
KB
-rw-r--r--
2023-05-18 21:34
perl5120delta.pod
87.18
KB
-rw-r--r--
2023-05-18 21:34
perl5121delta.pod
9.9
KB
-rw-r--r--
2023-05-18 21:34
perl5122delta.pod
9.38
KB
-rw-r--r--
2023-05-18 21:34
perl5123delta.pod
4
KB
-rw-r--r--
2023-05-18 21:34
perl5124delta.pod
3.59
KB
-rw-r--r--
2023-05-18 21:34
perl5125delta.pod
7.5
KB
-rw-r--r--
2023-05-18 21:34
perl5140delta.pod
140.94
KB
-rw-r--r--
2023-05-18 21:34
perl5141delta.pod
7.78
KB
-rw-r--r--
2023-05-18 21:34
perl5142delta.pod
6.73
KB
-rw-r--r--
2023-05-18 21:34
perl5143delta.pod
7.58
KB
-rw-r--r--
2023-05-18 21:34
perl5144delta.pod
6.18
KB
-rw-r--r--
2023-05-18 21:34
perl5160delta.pod
130.52
KB
-rw-r--r--
2023-05-18 21:34
perl5161delta.pod
6
KB
-rw-r--r--
2023-05-18 21:34
perl5162delta.pod
3.51
KB
-rw-r--r--
2023-05-18 21:34
perl5163delta.pod
3.99
KB
-rw-r--r--
2023-05-18 21:34
perl5180delta.pod
116.63
KB
-rw-r--r--
2023-05-18 21:34
perl5181delta.pod
6.44
KB
-rw-r--r--
2023-05-18 21:34
perl5182delta.pod
5.21
KB
-rw-r--r--
2023-05-18 21:34
perl5184delta.pod
4.53
KB
-rw-r--r--
2023-05-18 21:34
perl5200delta.pod
112.99
KB
-rw-r--r--
2023-05-18 21:34
perl5201delta.pod
10.64
KB
-rw-r--r--
2023-05-18 21:34
perl5202delta.pod
12.22
KB
-rw-r--r--
2023-05-18 21:34
perl5203delta.pod
9.17
KB
-rw-r--r--
2023-05-18 21:34
perl5220delta.pod
127.89
KB
-rw-r--r--
2023-05-18 21:34
perl5221delta.pod
10.51
KB
-rw-r--r--
2023-05-18 21:34
perl5222delta.pod
12.33
KB
-rw-r--r--
2023-05-18 21:34
perl5223delta.pod
8.26
KB
-rw-r--r--
2023-05-18 21:34
perl5224delta.pod
4.36
KB
-rw-r--r--
2023-05-18 21:34
perl5240delta.pod
63.41
KB
-rw-r--r--
2023-05-18 21:34
perl5241delta.pod
8.02
KB
-rw-r--r--
2023-05-18 21:34
perl5242delta.pod
4.02
KB
-rw-r--r--
2023-05-18 21:34
perl5243delta.pod
11.16
KB
-rw-r--r--
2023-05-18 21:34
perl5244delta.pod
4.4
KB
-rw-r--r--
2023-05-18 21:34
perl5260delta.pod
99.45
KB
-rw-r--r--
2023-05-18 21:34
perl5261delta.pod
7.74
KB
-rw-r--r--
2023-05-18 21:34
perl5262delta.pod
7.7
KB
-rw-r--r--
2023-05-18 21:34
perl5263delta.pod
6.9
KB
-rw-r--r--
2023-05-18 21:34
perl5280delta.pod
70.42
KB
-rw-r--r--
2023-05-18 21:34
perl561delta.pod
121.79
KB
-rw-r--r--
2023-05-18 21:34
perl56delta.pod
104.69
KB
-rw-r--r--
2023-05-18 21:34
perl581delta.pod
37.17
KB
-rw-r--r--
2023-05-18 21:34
perl582delta.pod
4.37
KB
-rw-r--r--
2023-05-18 21:34
perl583delta.pod
6.19
KB
-rw-r--r--
2023-05-18 21:34
perl584delta.pod
7.19
KB
-rw-r--r--
2023-05-18 21:34
perl585delta.pod
5.75
KB
-rw-r--r--
2023-05-18 21:34
perl586delta.pod
4.54
KB
-rw-r--r--
2023-05-18 21:34
perl587delta.pod
8.16
KB
-rw-r--r--
2023-05-18 21:34
perl588delta.pod
24.68
KB
-rw-r--r--
2023-05-18 21:34
perl589delta.pod
52.64
KB
-rw-r--r--
2023-05-18 21:34
perl58delta.pod
112.47
KB
-rw-r--r--
2023-05-18 21:34
perlaix.pod
19.96
KB
-rw-r--r--
2023-05-18 21:34
perlamiga.pod
5.61
KB
-rw-r--r--
2023-05-18 21:34
perlandroid.pod
7.69
KB
-rw-r--r--
2023-05-18 21:34
perlapi.pod
433.14
KB
-rw-r--r--
2023-05-18 21:34
perlapio.pod
18.83
KB
-rw-r--r--
2023-05-18 21:34
perlartistic.pod
6.85
KB
-rw-r--r--
2023-05-18 21:34
perlbook.pod
8.14
KB
-rw-r--r--
2023-05-18 21:34
perlboot.pod
294
B
-rw-r--r--
2023-05-18 21:34
perlbot.pod
304
B
-rw-r--r--
2023-05-18 21:34
perlbs2000.pod
7.87
KB
-rw-r--r--
2023-05-18 21:34
perlcall.pod
55.38
KB
-rw-r--r--
2023-05-18 21:34
perlce.pod
14.26
KB
-rw-r--r--
2023-05-18 21:34
perlcheat.pod
4.38
KB
-rw-r--r--
2023-05-18 21:34
perlclib.pod
9.39
KB
-rw-r--r--
2023-05-18 21:34
perlcn.pod
4.58
KB
-rw-r--r--
2023-05-18 21:34
perlcommunity.pod
7.05
KB
-rw-r--r--
2023-05-18 21:34
perlcygwin.pod
26.56
KB
-rw-r--r--
2023-05-18 21:34
perldata.pod
45.65
KB
-rw-r--r--
2023-05-18 21:34
perldbmfilter.pod
4.86
KB
-rw-r--r--
2023-05-18 21:34
perldebguts.pod
37.63
KB
-rw-r--r--
2023-05-18 21:34
perldebtut.pod
21.63
KB
-rw-r--r--
2023-05-18 21:34
perldebug.pod
38.34
KB
-rw-r--r--
2023-05-18 21:34
perldelta.pod
6.9
KB
-rw-r--r--
2023-05-18 21:34
perldeprecation.pod
17.74
KB
-rw-r--r--
2023-05-18 21:34
perldiag.pod
277.9
KB
-rw-r--r--
2023-05-18 21:34
perldos.pod
10.28
KB
-rw-r--r--
2023-05-18 21:34
perldsc.pod
25.01
KB
-rw-r--r--
2023-05-18 21:34
perldtrace.pod
7.77
KB
-rw-r--r--
2023-05-18 21:34
perlebcdic.pod
82.26
KB
-rw-r--r--
2023-05-18 21:34
perlembed.pod
36.32
KB
-rw-r--r--
2023-05-18 21:34
perlexperiment.pod
7.03
KB
-rw-r--r--
2023-05-18 21:34
perlfork.pod
13.04
KB
-rw-r--r--
2023-05-18 21:34
perlform.pod
16.22
KB
-rw-r--r--
2023-05-18 21:34
perlfreebsd.pod
1.57
KB
-rw-r--r--
2023-05-18 21:34
perlfunc.pod
383.75
KB
-rw-r--r--
2023-05-18 21:34
perlgit.pod
32.72
KB
-rw-r--r--
2023-05-18 21:34
perlgpl.pod
13.49
KB
-rw-r--r--
2023-05-18 21:34
perlguts.pod
136.06
KB
-rw-r--r--
2023-05-18 21:34
perlhack.pod
39.5
KB
-rw-r--r--
2023-05-18 21:34
perlhacktips.pod
54.21
KB
-rw-r--r--
2023-05-18 21:34
perlhacktut.pod
6.01
KB
-rw-r--r--
2023-05-18 21:34
perlhaiku.pod
1.47
KB
-rw-r--r--
2023-05-18 21:34
perlhist.pod
52.29
KB
-rw-r--r--
2023-05-18 21:34
perlhpux.pod
29.79
KB
-rw-r--r--
2023-05-18 21:34
perlhurd.pod
1.95
KB
-rw-r--r--
2023-05-18 21:34
perlintern.pod
53.29
KB
-rw-r--r--
2023-05-18 21:34
perlinterp.pod
32.9
KB
-rw-r--r--
2023-05-18 21:34
perlintro.pod
21.6
KB
-rw-r--r--
2023-05-18 21:34
perliol.pod
33.38
KB
-rw-r--r--
2023-05-18 21:34
perlipc.pod
69.17
KB
-rw-r--r--
2023-05-18 21:34
perlirix.pod
4.29
KB
-rw-r--r--
2023-05-18 21:34
perljp.pod
7.34
KB
-rw-r--r--
2023-05-18 21:34
perlko.pod
11.97
KB
-rw-r--r--
2023-05-18 21:34
perllexwarn.pod
355
B
-rw-r--r--
2023-05-18 21:34
perllinux.pod
1.45
KB
-rw-r--r--
2023-05-18 21:34
perllocale.pod
67.07
KB
-rw-r--r--
2023-05-18 21:34
perllol.pod
9.36
KB
-rw-r--r--
2023-05-18 21:34
perlmacos.pod
1001
B
-rw-r--r--
2023-05-18 21:34
perlmacosx.pod
11.78
KB
-rw-r--r--
2023-05-18 21:34
perlmod.pod
25.63
KB
-rw-r--r--
2023-05-18 21:34
perlmodinstall.pod
12.49
KB
-rw-r--r--
2023-05-18 21:34
perlmodlib.pod
74.69
KB
-rw-r--r--
2023-05-18 21:34
perlmodstyle.pod
22.05
KB
-rw-r--r--
2023-05-18 21:34
perlmroapi.pod
3.14
KB
-rw-r--r--
2023-05-18 21:34
perlnetware.pod
6.49
KB
-rw-r--r--
2023-05-18 21:34
perlnewmod.pod
10.78
KB
-rw-r--r--
2023-05-18 21:34
perlnumber.pod
8.16
KB
-rw-r--r--
2023-05-18 21:34
perlobj.pod
34.7
KB
-rw-r--r--
2023-05-18 21:34
perlootut.pod
26.16
KB
-rw-r--r--
2023-05-18 21:34
perlop.pod
133.06
KB
-rw-r--r--
2023-05-18 21:34
perlopenbsd.pod
1.18
KB
-rw-r--r--
2023-05-18 21:34
perlopentut.pod
9.23
KB
-rw-r--r--
2023-05-18 21:34
perlos2.pod
91.16
KB
-rw-r--r--
2023-05-18 21:34
perlos390.pod
15.31
KB
-rw-r--r--
2023-05-18 21:34
perlos400.pod
4.66
KB
-rw-r--r--
2023-05-18 21:34
perlpacktut.pod
50.08
KB
-rw-r--r--
2023-05-18 21:34
perlperf.pod
48.71
KB
-rw-r--r--
2023-05-18 21:34
perlplan9.pod
5
KB
-rw-r--r--
2023-05-18 21:34
perlpod.pod
21.68
KB
-rw-r--r--
2023-05-18 21:34
perlpodspec.pod
66.87
KB
-rw-r--r--
2023-05-18 21:34
perlpolicy.pod
25.03
KB
-rw-r--r--
2023-05-18 21:34
perlport.pod
85.55
KB
-rw-r--r--
2023-05-18 21:34
perlpragma.pod
5.05
KB
-rw-r--r--
2023-05-18 21:34
perlqnx.pod
6.52
KB
-rw-r--r--
2023-05-18 21:34
perlre.pod
118.07
KB
-rw-r--r--
2023-05-18 21:34
perlreapi.pod
29.62
KB
-rw-r--r--
2023-05-18 21:34
perlrebackslash.pod
31.07
KB
-rw-r--r--
2023-05-18 21:34
perlrecharclass.pod
47.88
KB
-rw-r--r--
2023-05-18 21:34
perlref.pod
34.48
KB
-rw-r--r--
2023-05-18 21:34
perlreftut.pod
18.35
KB
-rw-r--r--
2023-05-18 21:34
perlreguts.pod
37.43
KB
-rw-r--r--
2023-05-18 21:34
perlrepository.pod
509
B
-rw-r--r--
2023-05-18 21:34
perlrequick.pod
18.06
KB
-rw-r--r--
2023-05-18 21:34
perlreref.pod
14.4
KB
-rw-r--r--
2023-05-18 21:34
perlretut.pod
118.42
KB
-rw-r--r--
2023-05-18 21:34
perlriscos.pod
1.49
KB
-rw-r--r--
2023-05-18 21:34
perlrun.pod
52.29
KB
-rw-r--r--
2023-05-18 21:34
perlsec.pod
25.57
KB
-rw-r--r--
2023-05-18 21:34
perlsolaris.pod
29.12
KB
-rw-r--r--
2023-05-18 21:34
perlsource.pod
6.71
KB
-rw-r--r--
2023-05-18 21:34
perlstyle.pod
8.43
KB
-rw-r--r--
2023-05-18 21:34
perlsub.pod
71.26
KB
-rw-r--r--
2023-05-18 21:34
perlsymbian.pod
15
KB
-rw-r--r--
2023-05-18 21:34
perlsyn.pod
43.47
KB
-rw-r--r--
2023-05-18 21:34
perlsynology.pod
7.6
KB
-rw-r--r--
2023-05-18 21:34
perlthrtut.pod
45.37
KB
-rw-r--r--
2023-05-18 21:34
perltie.pod
37.7
KB
-rw-r--r--
2023-05-18 21:34
perltoc.pod
677.89
KB
-rw-r--r--
2023-05-18 21:34
perltodo.pod
376
B
-rw-r--r--
2023-05-18 21:34
perltooc.pod
294
B
-rw-r--r--
2023-05-18 21:34
perltoot.pod
294
B
-rw-r--r--
2023-05-18 21:34
perltrap.pod
10.37
KB
-rw-r--r--
2023-05-18 21:34
perltru64.pod
8.29
KB
-rw-r--r--
2023-05-18 21:34
perltw.pod
4.37
KB
-rw-r--r--
2023-05-18 21:34
perlunicode.pod
80.56
KB
-rw-r--r--
2023-05-18 21:34
perlunicook.pod
24.89
KB
-rw-r--r--
2023-05-18 21:34
perlunifaq.pod
13.33
KB
-rw-r--r--
2023-05-18 21:34
perluniintro.pod
37.44
KB
-rw-r--r--
2023-05-18 21:34
perluniprops.pod
278.62
KB
-rw-r--r--
2023-05-18 21:34
perlunitut.pod
7.76
KB
-rw-r--r--
2023-05-18 21:34
perlutil.pod
7.46
KB
-rw-r--r--
2023-05-18 21:36
perlvar.pod
76.53
KB
-rw-r--r--
2023-05-18 21:34
perlvms.pod
49.63
KB
-rw-r--r--
2023-05-18 21:34
perlvos.pod
3.75
KB
-rw-r--r--
2023-05-18 21:34
perlwin32.pod
38.38
KB
-rw-r--r--
2023-05-18 21:34
perlxs.pod
77.07
KB
-rw-r--r--
2023-05-18 21:34
perlxstut.pod
48.92
KB
-rw-r--r--
2023-05-18 21:34
perlxstypemap.pod
23.44
KB
-rw-r--r--
2023-05-18 21:34
Save
Rename
=encoding utf8 =for comment Consistent formatting of this file is achieved with: perl ./Porting/podtidy pod/perlhacktut.pod =head1 NAME perlhacktut - Walk through the creation of a simple C code patch =head1 DESCRIPTION This document takes you through a simple patch example. If you haven't read L<perlhack> yet, go do that first! You might also want to read through L<perlsource> too. Once you're done here, check out L<perlhacktips> next. =head1 EXAMPLE OF A SIMPLE PATCH Let's take a simple patch from start to finish. Here's something Larry suggested: if a C<U> is the first active format during a C<pack>, (for example, C<pack "U3C8", @stuff>) then the resulting string should be treated as UTF-8 encoded. If you are working with a git clone of the Perl repository, you will want to create a branch for your changes. This will make creating a proper patch much simpler. See the L<perlgit> for details on how to do this. =head2 Writing the patch How do we prepare to fix this up? First we locate the code in question - the C<pack> happens at runtime, so it's going to be in one of the F<pp> files. Sure enough, C<pp_pack> is in F<pp.c>. Since we're going to be altering this file, let's copy it to F<pp.c~>. [Well, it was in F<pp.c> when this tutorial was written. It has now been split off with C<pp_unpack> to its own file, F<pp_pack.c>] Now let's look over C<pp_pack>: we take a pattern into C<pat>, and then loop over the pattern, taking each format character in turn into C<datum_type>. Then for each possible format character, we swallow up the other arguments in the pattern (a field width, an asterisk, and so on) and convert the next chunk input into the specified format, adding it onto the output SV C<cat>. How do we know if the C<U> is the first format in the C<pat>? Well, if we have a pointer to the start of C<pat> then, if we see a C<U> we can test whether we're still at the start of the string. So, here's where C<pat> is set up: STRLEN fromlen; char *pat = SvPVx(*++MARK, fromlen); char *patend = pat + fromlen; I32 len; I32 datumtype; SV *fromstr; We'll have another string pointer in there: STRLEN fromlen; char *pat = SvPVx(*++MARK, fromlen); char *patend = pat + fromlen; + char *patcopy; I32 len; I32 datumtype; SV *fromstr; And just before we start the loop, we'll set C<patcopy> to be the start of C<pat>: items = SP - MARK; MARK++; SvPVCLEAR(cat); + patcopy = pat; while (pat < patend) { Now if we see a C<U> which was at the start of the string, we turn on the C<UTF8> flag for the output SV, C<cat>: + if (datumtype == 'U' && pat==patcopy+1) + SvUTF8_on(cat); if (datumtype == '#') { while (pat < patend && *pat != '\n') pat++; Remember that it has to be C<patcopy+1> because the first character of the string is the C<U> which has been swallowed into C<datumtype!> Oops, we forgot one thing: what if there are spaces at the start of the pattern? C<pack(" U*", @stuff)> will have C<U> as the first active character, even though it's not the first thing in the pattern. In this case, we have to advance C<patcopy> along with C<pat> when we see spaces: if (isSPACE(datumtype)) continue; needs to become if (isSPACE(datumtype)) { patcopy++; continue; } OK. That's the C part done. Now we must do two additional things before this patch is ready to go: we've changed the behaviour of Perl, and so we must document that change. We must also provide some more regression tests to make sure our patch works and doesn't create a bug somewhere else along the line. =head2 Testing the patch The regression tests for each operator live in F<t/op/>, and so we make a copy of F<t/op/pack.t> to F<t/op/pack.t~>. Now we can add our tests to the end. First, we'll test that the C<U> does indeed create Unicode strings. t/op/pack.t has a sensible ok() function, but if it didn't we could use the one from t/test.pl. require './test.pl'; plan( tests => 159 ); so instead of this: print 'not ' unless "1.20.300.4000" eq sprintf "%vd", pack("U*",1,20,300,4000); print "ok $test\n"; $test++; we can write the more sensible (see L<Test::More> for a full explanation of is() and other testing functions). is( "1.20.300.4000", sprintf "%vd", pack("U*",1,20,300,4000), "U* produces Unicode" ); Now we'll test that we got that space-at-the-beginning business right: is( "1.20.300.4000", sprintf "%vd", pack(" U*",1,20,300,4000), " with spaces at the beginning" ); And finally we'll test that we don't make Unicode strings if C<U> is B<not> the first active format: isnt( v1.20.300.4000, sprintf "%vd", pack("C0U*",1,20,300,4000), "U* not first isn't Unicode" ); Mustn't forget to change the number of tests which appears at the top, or else the automated tester will get confused. This will either look like this: print "1..156\n"; or this: plan( tests => 156 ); We now compile up Perl, and run it through the test suite. Our new tests pass, hooray! =head2 Documenting the patch Finally, the documentation. The job is never done until the paperwork is over, so let's describe the change we've just made. The relevant place is F<pod/perlfunc.pod>; again, we make a copy, and then we'll insert this text in the description of C<pack>: =item * If the pattern begins with a C<U>, the resulting string will be treated as UTF-8-encoded Unicode. You can force UTF-8 encoding on in a string with an initial C<U0>, and the bytes that follow will be interpreted as Unicode characters. If you don't want this to happen, you can begin your pattern with C<C0> (or anything else) to force Perl not to UTF-8 encode your string, and then follow this with a C<U*> somewhere in your pattern. =head2 Submit See L<perlhack> for details on how to submit this patch. =head1 AUTHOR This document was originally written by Nathan Torkington, and is maintained by the perl5-porters mailing list.