Skip to content

better suggestions for builtin::trim equivalence (Resolves #23212) #23216

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

Open
wants to merge 1 commit into
base: blead
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions lib/builtin.pm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package builtin 0.018;
package builtin 0.019;

use v5.40;

Expand Down Expand Up @@ -43,6 +43,10 @@ can be requested for convenience.
Individual named functions can be imported by listing them as import
parameters on the C<use> statement for this pragma.

The L<builtin::compat> module from CPAN provides versions of many of these
functions that can be used on Perl versions where C<builtin> or specific
functions are not yet available.

B<Warning>: At present, many of the functions in the C<builtin> namespace are
experimental. Calling them will trigger warnings of the
C<experimental::builtin> category.
Expand Down Expand Up @@ -414,15 +418,12 @@ A complete list is in L<perlrecharclass/Whitespace>.

C<trim> is equivalent to:

$str =~ s/\A\s+|\s+\z//urg;
my $trimmed = $str =~ s/\A\s+//ur =~ s/\s+\z//ur;

Available starting with Perl 5.36. Since Perl 5.40, it is no longer
experimental and it is included in the 5.40 and higher builtin version
bundles.

For Perl versions where this function is not available look at the
L<String::Util> module for a comparable implementation.

=head2 is_tainted

$bool = is_tainted($var);
Expand Down Expand Up @@ -487,4 +488,4 @@ Available starting with Perl 5.40.

=head1 SEE ALSO

L<perlop>, L<perlfunc>, L<Scalar::Util>
L<perlop>, L<perlfunc>, L<Scalar::Util>, L<builtin::compat>
3 changes: 2 additions & 1 deletion t/porting/known_pod_issues.dat
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ bind(2)
blib
BSD::Resource
builtin
builtin::compat
ByteLoader
bytes
bzip2(1)
Expand Down Expand Up @@ -119,8 +120,8 @@ connect(2)
constant
CORE
Coro
CPAN
cpan
CPAN
cpan2dist(1)
CPAN::API::HOWTO
CPAN::Changes::Spec
Expand Down
Loading