perldoc.perl.org | Perl programming documentation - http : //perldoc.perl.org | Version Control System library
kandi X-RAY | perldoc.perl.org Summary
kandi X-RAY | perldoc.perl.org Summary
this archive contains the source code for the website which holds the core documentaion for perl in html and pdf formats. perl build-perldoc-pdf.pl --output-path /path/to/output [options] perl build-perldoc-static.pl --output-path /path/to/output [options] perl build-perldoc-html.pl --output-path /path/to/output [options] perl build-perldoc-js.pl --output-path /path/to/output [options]. --perl /path/to/perl - specify perl interpreter to document --download - produce a downloadable version of the documentation --pdf - include pdf download links (default) --nopdf - do not include pdf download links. please be aware that this software was written for the specific purpose of generating the perldoc.perl.org website, and not to solve generic problems like "convert a directory of pod to html"
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of perldoc.perl.org
perldoc.perl.org Key Features
perldoc.perl.org Examples and Code Snippets
Community Discussions
Trending Discussions on perldoc.perl.org
QUESTION
With or without parentheses, an empty list is returned upon failure.
But I do not get empty list upon failure:
...ANSWER
Answered 2021-Apr-27 at 02:33Binding the operand using !~
can't cause the match operator to simply swap what it returns on a match and what it returns when there's no match.
In list context, the match operator normally returns the captured substrings, or an empty list if there's no match. Swapping the return values would require returning an empty list on a match, and the captured substrings when there's no match. That's impossible since nothing is captured when there's no match.
s///
and tr///
have similar problems as they normally return the number of substitutions.
Instead, EXPR !~ OP
is short for !( EXPR =~ OP )
, and !
evaluates its operand in scalar context (since it's needs a true or false value).
QUESTION
perluniprops lists the Unicode properties of the version of Unicode it supports. For Perl 5.32.1, that's Unicode 13.0.0.
You can obtain a list of the characters that match a category using Unicode::Tussle's unichars
.
ANSWER
Answered 2021-Apr-19 at 19:36From the comments, I believe you are trying to port a Perl program using \p
regex properties to Python. You don't need a list of all categories (whatever that means); you just need to know what Code Points each of the property used by the program matches.
Now, you could get the list of Code Points from the Unicode database. But a much simpler solution is to use Python's regex module instead of the re module. This will give you access to the same Unicode-defined properties that Perl exposes.
The latest version of the regex module even uses Unicode 13.0.0 just like the latest Perl.
Note that the program uses \p{IsAlnum}
, a long way of writing \p{Alnum}
. \p{Alnum}
is not a standard Unicode property, but a Perl extension. It's the union of Unicode properties \p{Alpha}
and \p{Nd}
. I don't know know if the regex module defines Alnum
identically, but it probably does.
QUESTION
I'm trying to implement an alarm in my Perl backend process so that it will terminate if it gets stuck for too long. I tried to implement the code given on the alarm documentation page on Perldoc (this is verbatim from the documentation other than the line that calls my program's key subroutine instead of the sample line in the documentation):
...ANSWER
Answered 2021-Apr-12 at 00:31Signals and threads don't mix well. You might want to rethink your use of signals. For example, you could move all the thread stuff to a child process.
Signal handlers are only called between Perl ops. The main thread is in a call to XS sub thread->join
, and the signal handler will be called once join
returns.
Most blocking system calls can be interrupted (returning error EINTR
), so it might be possible to write a signal-aware version of join
. Except I seem to remember pthread functions not being interruptible, so maybe not.
In this particular case, you could have the threads signal the main thread when they are over using a system that allows the main thread to block until the a signal occurs or a timeout has occured. cond_signal
/cond_timedwait
is such a system.
QUESTION
I'm trying to make a perl one-liner mimic awk's file-relative line number counter "FNR". In itself this is not a problem. In one attempt, I used the following command:
...ANSWER
Answered 2021-Apr-03 at 12:15Built-in unary functions are special-cased in the parser. There's no perl-level way to do the same for subroutine calls.
QUESTION
Why don't I have to use use Math::Trig;
in my Perl program to call atan2()
?
According to documentation, atan2()
is not part of the "Perl Core".
I have Perl 5.18.4. I looked at the list of standard Perl modules, and I DO see Math::Trig listed, but I still thought that the "use" statement was required. Admittedly, my Perl knowledge is only about 6 months old at this point. So, a simple answer would be a quote from an official Perl document. Or, maybe there is something else going on here that I don't understand.
Here is an example of what I am talking about.
...ANSWER
Answered 2021-Mar-01 at 16:54Because atan2
is a builtin function, like sin
or cos
. Or print
.
QUESTION
EDIT: For anyone who has arrived here with this issue, I found this documented almost verbatim in the perldoc at https://perldoc.perl.org/perlop#Conditional-Operator
In writing a simple subroutine, I found I kept getting incorrect results using the ternary operator, but correct results using a more simple if statement. I'm sure there is an explanation, but I'm simply not seeing it.
When fed the following input:
...ANSWER
Answered 2021-Feb-23 at 01:08It is, in fact, a precedence issue. The way to diagnose precedence problems is with B::Deparse
:
QUESTION
If I have two configurations of the same version of Perl for example,
- One compiled with
-Dusethreads
- One compiled without it
Will both of those version be able to share the same corelist modules? Or will I need to a package a separate one too. Is there known XS code compilation oddities with this approach? Is it likely that anything built against a threaded Perl will work with a non-threaded Perl? Assuming the version is the same.
...ANSWER
Answered 2021-Feb-20 at 18:49In general, XS modules are not binary compatible between different build options (and between different perl releases). Because if nothing else, different build options may cause the sizes and alignment of structures to vary between the perl core and the compiled modules, which will cause a crash if both have access to the same struct (such as a perl scalar var). Also in MULTIPLICITY builds, which includes threaded builds, most perl core API functions have an extra argument added (a pointer to the current interpreter), and calling that function without that pointer or vice versa will again cause a crash.
QUESTION
I have created a very small sample code below to illustrate how Perl's index()
function's return value changes for empty substr
("") on string that is passed or not passed through Encode::decode()
.
ANSWER
Answered 2021-Feb-18 at 00:42This would be considered a bug, which I've reported here.
Minimal code to reproduce:
QUESTION
According to Perldoc( https://perldoc.perl.org/perlop#Comma-Operator ):
Comma Operator
...
In list context, it's just the list argument separator, and inserts both its arguments into the list. These arguments are also evaluated from left to right.
In following code, I thought $n
should be 1
but it became 2
. What am I missing?
ANSWER
Answered 2021-Jan-31 at 20:51It does get evaluated left-to-right.
QUESTION
According to the perldoc -f die
, which documents $SIG{__DIE__}
Although this feature was to be run only right before your program was to exit, this is not currently so: the
$SIG{__DIE__}
hook is currently called even inside evaled blocks/strings! If one wants the hook to do nothing in such situations, putdie @_ if $^S;
as the first line of the handler (see$^S
in perlvar). Because this promotes strange action at a distance, this counterintuitive behavior may be fixed in a future release.
So let's take a basic signal handler which will trigger with eval { die 42 }
,
ANSWER
Answered 2021-Jan-28 at 17:58caller(1)
Just a bit further down the rabbit hole with [caller(1)]->[3] eq '(eval)'
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install perldoc.perl.org
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page