Skip to content

Commit 52e2682

Browse files
committed
better suggestions for builtin::trim equivalence (Resolves Perl#23212)
1 parent b39e463 commit 52e2682

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

lib/builtin.pm

Lines changed: 7 additions & 6 deletions
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+
my $trimmed = $str =~ s/\A\s+//ur =~ s/\s+\z//ur;
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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ bc(1)
4040
Benchmark::Perl::Formance
4141
bind(2)
4242
BSD::Resource
43+
builtin::compat
4344
ByteLoader
4445
bzip2(1)
4546
Carp::Always

0 commit comments

Comments
 (0)