Skip to content

Commit 3729cc7

Browse files
committed
better suggestions for builtin::trim equivalence (Resolves #23212)
1 parent 5b9aabc commit 3729cc7

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

lib/builtin.pm

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package builtin 0.018;
1+
package builtin 0.019;
22

33
use v5.40;
44

@@ -43,6 +43,10 @@ can be requested for convenience.
4343
Individual named functions can be imported by listing them as import
4444
parameters on the C<use> statement for this pragma.
4545
46+
The L<builtin::compat> module from CPAN provides versions of many of these
47+
functions that can be used on Perl versions where C<builtin> or specific
48+
functions are not yet available.
49+
4650
B<Warning>: At present, many of the functions in the C<builtin> namespace are
4751
experimental. Calling them will trigger warnings of the
4852
C<experimental::builtin> category.
@@ -414,15 +418,12 @@ A complete list is in L<perlrecharclass/Whitespace>.
414418
415419
C<trim> is equivalent to:
416420
417-
$str =~ s/\A\s+|\s+\z//urg;
421+
s/\A\s+//u, s/\s+\z//u for my $trimmed = $str;
418422
419423
Available starting with Perl 5.36. Since Perl 5.40, it is no longer
420424
experimental and it is included in the 5.40 and higher builtin version
421425
bundles.
422426
423-
For Perl versions where this function is not available look at the
424-
L<String::Util> module for a comparable implementation.
425-
426427
=head2 is_tainted
427428
428429
$bool = is_tainted($var);
@@ -487,4 +488,4 @@ Available starting with Perl 5.40.
487488
488489
=head1 SEE ALSO
489490
490-
L<perlop>, L<perlfunc>, L<Scalar::Util>
491+
L<perlop>, L<perlfunc>, L<Scalar::Util>, L<builtin::compat>

t/porting/known_pod_issues.dat

+2-1
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ bind(2)
7676
blib
7777
BSD::Resource
7878
builtin
79+
builtin::compat
7980
ByteLoader
8081
bytes
8182
bzip2(1)
@@ -119,8 +120,8 @@ connect(2)
119120
constant
120121
CORE
121122
Coro
122-
CPAN
123123
cpan
124+
CPAN
124125
cpan2dist(1)
125126
CPAN::API::HOWTO
126127
CPAN::Changes::Spec

0 commit comments

Comments
 (0)