shell bypass 403

GrazzMean Shell

Uname: Linux web3.us.cloudlogin.co 5.10.226-xeon-hst #2 SMP Fri Sep 13 12:28:44 UTC 2024 x86_64
Software: Apache
PHP version: 8.1.31 [ PHP INFO ] PHP os: Linux
Server Ip: 162.210.96.117
Your Ip: 18.118.200.142
User: edustar (269686) | Group: tty (888)
Safe Mode: OFF
Disable Function:
NONE

name : List::UtilsBy.3pm
.\" Automatically generated by Pod::Man 4.11 (Pod::Simple 3.35)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings.  \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
.    ds -- \(*W-
.    ds PI pi
.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
.    ds L" ""
.    ds R" ""
.    ds C` ""
.    ds C' ""
'br\}
.el\{\
.    ds -- \|\(em\|
.    ds PI \(*p
.    ds L" ``
.    ds R" ''
.    ds C`
.    ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\"
.\" If the F register is >0, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD.  Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{\
.    if \nF \{\
.        de IX
.        tm Index:\\$1\t\\n%\t"\\$2"
..
.        if !\nF==2 \{\
.            nr % 0
.            nr F 2
.        \}
.    \}
.\}
.rr rF
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
.    \" fudge factors for nroff and troff
.if n \{\
.    ds #H 0
.    ds #V .8m
.    ds #F .3m
.    ds #[ \f1
.    ds #] \fP
.\}
.if t \{\
.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
.    ds #V .6m
.    ds #F 0
.    ds #[ \&
.    ds #] \&
.\}
.    \" simple accents for nroff and troff
.if n \{\
.    ds ' \&
.    ds ` \&
.    ds ^ \&
.    ds , \&
.    ds ~ ~
.    ds /
.\}
.if t \{\
.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
.    \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
.    \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
.    \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
.    ds : e
.    ds 8 ss
.    ds o a
.    ds d- d\h'-1'\(ga
.    ds D- D\h'-1'\(hy
.    ds th \o'bp'
.    ds Th \o'LP'
.    ds ae ae
.    ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "List::UtilsBy 3"
.TH List::UtilsBy 3 "2022-02-23" "perl v5.26.3" "User Contributed Perl Documentation"
.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NAME"
"List::UtilsBy" \- higher\-order list utility functions
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 1
\&   use List::UtilsBy qw( nsort_by min_by );
\&
\&   use File::stat qw( stat );
\&   my @files_by_age = nsort_by { stat($_)\->mtime } @files;
\&
\&   my $shortest_name = min_by { length } @names;
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
This module provides a number of list utility functions, all of which take an
initial code block to control their behaviour. They are variations on similar
core perl or \f(CW\*(C`List::Util\*(C'\fR functions of similar names, but which use the block
to control their behaviour. For example, the core Perl function \f(CW\*(C`sort\*(C'\fR takes
a list of values and returns them, sorted into order by their string value.
The \*(L"sort_by\*(R" function sorts them according to the string value returned by
the extra function, when given each value.
.PP
.Vb 1
\&   my @names_sorted = sort @names;
\&
\&   my @people_sorted = sort_by { $_\->name } @people;
.Ve
.SH "FUNCTIONS"
.IX Header "FUNCTIONS"
All functions added since version 0.04 unless otherwise stated, as the
original names for earlier versions were renamed.
.SS "sort_by"
.IX Subsection "sort_by"
.Vb 1
\&   @vals = sort_by { KEYFUNC } @vals
.Ve
.PP
Returns the list of values sorted according to the string values returned by
the \f(CW\*(C`KEYFUNC\*(C'\fR block or function. A typical use of this may be to sort objects
according to the string value of some accessor, such as
.PP
.Vb 1
\&   sort_by { $_\->name } @people
.Ve
.PP
The key function is called in scalar context, being passed each value in turn
as both \f(CW$_\fR and the only argument in the parameters, \f(CW@_\fR. The values are
then sorted according to string comparisons on the values returned.
.PP
This is equivalent to
.PP
.Vb 1
\&   sort { $a\->name cmp $b\->name } @people
.Ve
.PP
except that it guarantees the \f(CW\*(C`name\*(C'\fR accessor will be executed only once per
value.
.PP
One interesting use-case is to sort strings which may have numbers embedded in
them \*(L"naturally\*(R", rather than lexically.
.PP
.Vb 1
\&   sort_by { s/(\ed+)/sprintf "%09d", $1/eg; $_ } @strings
.Ve
.PP
This sorts strings by generating sort keys which zero-pad the embedded numbers
to some level (9 digits in this case), helping to ensure the lexical sort puts
them in the correct order.
.SS "nsort_by"
.IX Subsection "nsort_by"
.Vb 1
\&   @vals = nsort_by { KEYFUNC } @vals
.Ve
.PP
Similar to \*(L"sort_by\*(R" but compares its key values numerically.
.SS "rev_sort_by"
.IX Subsection "rev_sort_by"
.SS "rev_nsort_by"
.IX Subsection "rev_nsort_by"
.Vb 1
\&   @vals = rev_sort_by { KEYFUNC } @vals
\&
\&   @vals = rev_nsort_by { KEYFUNC } @vals
.Ve
.PP
\&\fISince version 0.06.\fR
.PP
Similar to \*(L"sort_by\*(R" and \*(L"nsort_by\*(R" but returns the list in the reverse
order. Equivalent to
.PP
.Vb 1
\&   @vals = reverse sort_by { KEYFUNC } @vals
.Ve
.PP
except that these functions are slightly more efficient because they avoid
the final \f(CW\*(C`reverse\*(C'\fR operation.
.SS "max_by"
.IX Subsection "max_by"
.Vb 1
\&   $optimal = max_by { KEYFUNC } @vals
\&
\&   @optimal = max_by { KEYFUNC } @vals
.Ve
.PP
Returns the (first) value from \f(CW@vals\fR that gives the numerically largest
result from the key function.
.PP
.Vb 1
\&   my $tallest = max_by { $_\->height } @people
\&
\&   use File::stat qw( stat );
\&   my $newest = max_by { stat($_)\->mtime } @files;
.Ve
.PP
In scalar context, the first maximal value is returned. In list context, a
list of all the maximal values is returned. This may be used to obtain
positions other than the first, if order is significant.
.PP
If called on an empty list, an empty list is returned.
.PP
For symmetry with the \*(L"nsort_by\*(R" function, this is also provided under the
name \f(CW\*(C`nmax_by\*(C'\fR since it behaves numerically.
.SS "min_by"
.IX Subsection "min_by"
.Vb 1
\&   $optimal = min_by { KEYFUNC } @vals
\&
\&   @optimal = min_by { KEYFUNC } @vals
.Ve
.PP
Similar to \*(L"max_by\*(R" but returns values which give the numerically smallest
result from the key function. Also provided as \f(CW\*(C`nmin_by\*(C'\fR
.SS "minmax_by"
.IX Subsection "minmax_by"
.Vb 1
\&   ( $minimal, $maximal ) = minmax_by { KEYFUNC } @vals
.Ve
.PP
\&\fISince version 0.11.\fR
.PP
Similar to calling both \*(L"min_by\*(R" and \*(L"max_by\*(R" with the same key function
on the same list. This version is more efficient than calling the two other
functions individually, as it has less work to perform overall. In the case of
ties, only the first optimal element found in each case is returned. Also
provided as \f(CW\*(C`nminmax_by\*(C'\fR.
.SS "uniq_by"
.IX Subsection "uniq_by"
.Vb 1
\&   @vals = uniq_by { KEYFUNC } @vals
.Ve
.PP
Returns a list of the subset of values for which the key function block
returns unique values. The first value yielding a particular key is chosen,
subsequent values are rejected.
.PP
.Vb 1
\&   my @some_fruit = uniq_by { $_\->colour } @fruit;
.Ve
.PP
To select instead the last value per key, reverse the input list. If the order
of the results is significant, don't forget to reverse the result as well:
.PP
.Vb 1
\&   my @some_fruit = reverse uniq_by { $_\->colour } reverse @fruit;
.Ve
.PP
Because the values returned by the key function are used as hash keys, they
ought to either be strings, or at least well-behaved as strings (such as
numbers, or object references which overload stringification in a suitable
manner).
.SS "partition_by"
.IX Subsection "partition_by"
.Vb 1
\&   %parts = partition_by { KEYFUNC } @vals
.Ve
.PP
Returns a key/value list of \s-1ARRAY\s0 refs containing all the original values
distributed according to the result of the key function block. Each value will
be an \s-1ARRAY\s0 ref containing all the values which returned the string from the
key function, in their original order.
.PP
.Vb 1
\&   my %balls_by_colour = partition_by { $_\->colour } @balls;
.Ve
.PP
Because the values returned by the key function are used as hash keys, they
ought to either be strings, or at least well-behaved as strings (such as
numbers, or object references which overload stringification in a suitable
manner).
.SS "count_by"
.IX Subsection "count_by"
.Vb 1
\&   %counts = count_by { KEYFUNC } @vals
.Ve
.PP
\&\fISince version 0.07.\fR
.PP
Returns a key/value list of integers, giving the number of times the key
function block returned the key, for each value in the list.
.PP
.Vb 1
\&   my %count_of_balls = count_by { $_\->colour } @balls;
.Ve
.PP
Because the values returned by the key function are used as hash keys, they
ought to either be strings, or at least well-behaved as strings (such as
numbers, or object references which overload stringification in a suitable
manner).
.SS "zip_by"
.IX Subsection "zip_by"
.Vb 1
\&   @vals = zip_by { ITEMFUNC } \e@arr0, \e@arr1, \e@arr2,...
.Ve
.PP
Returns a list of each of the values returned by the function block, when
invoked with values from across each each of the given \s-1ARRAY\s0 references. Each
value in the returned list will be the result of the function having been
invoked with arguments at that position, from across each of the arrays given.
.PP
.Vb 1
\&   my @transposition = zip_by { [ @_ ] } @matrix;
\&
\&   my @names = zip_by { "$_[1], $_[0]" } \e@firstnames, \e@surnames;
\&
\&   print zip_by { "$_[0] => $_[1]\en" } [ keys %hash ], [ values %hash ];
.Ve
.PP
If some of the arrays are shorter than others, the function will behave as if
they had \f(CW\*(C`undef\*(C'\fR in the trailing positions. The following two lines are
equivalent:
.PP
.Vb 2
\&   zip_by { f(@_) } [ 1, 2, 3 ], [ "a", "b" ]
\&   f( 1, "a" ), f( 2, "b" ), f( 3, undef )
.Ve
.PP
The item function is called by \f(CW\*(C`map\*(C'\fR, so if it returns a list, the entire
list is included in the result. This can be useful for example, for generating
a hash from two separate lists of keys and values
.PP
.Vb 2
\&   my %nums = zip_by { @_ } [qw( one two three )], [ 1, 2, 3 ];
\&   # %nums = ( one => 1, two => 2, three => 3 )
.Ve
.PP
(A function having this behaviour is sometimes called \f(CW\*(C`zipWith\*(C'\fR, e.g. in
Haskell, but that name would not fit the naming scheme used by this module).
.SS "unzip_by"
.IX Subsection "unzip_by"
.Vb 1
\&   $arr0, $arr1, $arr2, ... = unzip_by { ITEMFUNC } @vals
.Ve
.PP
\&\fISince version 0.09.\fR
.PP
Returns a list of \s-1ARRAY\s0 references containing the values returned by the
function block, when invoked for each of the values given in the input list.
Each of the returned \s-1ARRAY\s0 references will contain the values returned at that
corresponding position by the function block. That is, the first returned
\&\s-1ARRAY\s0 reference will contain all the values returned in the first position by
the function block, the second will contain all the values from the second
position, and so on.
.PP
.Vb 1
\&   my ( $firstnames, $lastnames ) = unzip_by { m/^(.*?) (.*)$/ } @names;
.Ve
.PP
If the function returns lists of differing lengths, the result will be padded
with \f(CW\*(C`undef\*(C'\fR in the missing elements.
.PP
This function is an inverse of \*(L"zip_by\*(R", if given a corresponding inverse
function.
.SS "extract_by"
.IX Subsection "extract_by"
.Vb 1
\&   @vals = extract_by { SELECTFUNC } @arr
.Ve
.PP
\&\fISince version 0.05.\fR
.PP
Removes elements from the referenced array on which the selection function
returns true, and returns a list containing those elements. This function is
similar to \f(CW\*(C`grep\*(C'\fR, except that it modifies the referenced array to remove the
selected values from it, leaving only the unselected ones.
.PP
.Vb 1
\&   my @red_balls = extract_by { $_\->color eq "red" } @balls;
\&
\&   # Now there are no red balls in the @balls array
.Ve
.PP
This function modifies a real array, unlike most of the other functions in this
module. Because of this, it requires a real array, not just a list.
.PP
This function is implemented by invoking \f(CW\*(C`splice\*(C'\fR on the array, not by
constructing a new list and assigning it. One result of this is that weak
references will not be disturbed.
.PP
.Vb 1
\&   extract_by { !defined $_ } @refs;
.Ve
.PP
will leave weak references weakened in the \f(CW@refs\fR array, whereas
.PP
.Vb 1
\&   @refs = grep { defined $_ } @refs;
.Ve
.PP
will strengthen them all again.
.SS "extract_first_by"
.IX Subsection "extract_first_by"
.Vb 1
\&   $val = extract_first_by { SELECTFUNC } @arr
.Ve
.PP
\&\fISince version 0.10.\fR
.PP
A hybrid between \*(L"extract_by\*(R" and \f(CW\*(C`List::Util::first\*(C'\fR. Removes the first
element from the referenced array on which the selection function returns
true, returning it.
.PP
As with \*(L"extract_by\*(R", this function requires a real array and not just a
list, and is also implemented using \f(CW\*(C`splice\*(C'\fR so that weak references are
not disturbed.
.PP
If this function fails to find a matching element, it will return an empty
list in list context. This allows a caller to distinguish the case between
no matching element, and the first matching element being \f(CW\*(C`undef\*(C'\fR.
.SS "weighted_shuffle_by"
.IX Subsection "weighted_shuffle_by"
.Vb 1
\&   @vals = weighted_shuffle_by { WEIGHTFUNC } @vals
.Ve
.PP
\&\fISince version 0.07.\fR
.PP
Returns the list of values shuffled into a random order. The randomisation is
not uniform, but weighted by the value returned by the \f(CW\*(C`WEIGHTFUNC\*(C'\fR. The
probabilty of each item being returned first will be distributed with the
distribution of the weights, and so on recursively for the remaining items.
.SS "bundle_by"
.IX Subsection "bundle_by"
.Vb 1
\&   @vals = bundle_by { BLOCKFUNC } $number, @vals
.Ve
.PP
\&\fISince version 0.07.\fR
.PP
Similar to a regular \f(CW\*(C`map\*(C'\fR functional, returns a list of the values returned
by \f(CW\*(C`BLOCKFUNC\*(C'\fR. Values from the input list are given to the block function in
bundles of \f(CW$number\fR.
.PP
If given a list of values whose length does not evenly divide by \f(CW$number\fR,
the final call will be passed fewer elements than the others.
.SH "TODO"
.IX Header "TODO"
.IP "\(bu" 4
\&\s-1XS\s0 implementations
.Sp
These functions are currently all written in pure perl. Some at least, may
benefit from having \s-1XS\s0 implementations to speed up their logic.
.IP "\(bu" 4
Merge into List::Util or List::MoreUtils
.Sp
This module shouldn't really exist. The functions should instead be part of
one of the existing modules that already contain many list utility functions.
Having Yet Another List Utilty Module just worsens the problem.
.Sp
I have attempted to contact the authors of both of the above modules, to no
avail; therefore I decided it best to write and release this code here anyway
so that it is at least on \s-1CPAN.\s0 Once there, we can then see how best to merge
it into an existing module.
.Sp
\&\fIUpdated 2015/07/16\fR: As I am now the maintainer of List::Util, some
amount of merging/copying should be possible. However, given the latter's key
position in the core \fIperl\fR distribution and head of the \*(L"\s-1CPAN\s0 River\*(R" I am
keen not to do this wholesale, but a selected pick of what seems best, by a
popular consensus.
.IP "\(bu" 4
\&\f(CW\*(C`head\*(C'\fR and \f(CW\*(C`tail\*(C'\fR\-like functions
.Sp
Consider perhaps
.Sp
.Vb 2
\&   head_before { COND } LIST  # excludes terminating element
\&   head_upto   { COND } LIST  # includes terminating element
\&
\&   tail_since  { COND } LIST  # includes initiating element
\&   tail_after  { COND } LIST  # excludes initiating element
.Ve
.Sp
(See also <https://rt.cpan.org/Ticket/Display.html?id=105907>).
.SH "AUTHOR"
.IX Header "AUTHOR"
Paul Evans <leonerd@leonerd.org.uk>
© 2025 GrazzMean