Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

The Monastery Gates

( #131=superdoc: print w/replies, xml ) Need Help??

If you're new here please read PerlMonks FAQ
and Create a new user.

poll ideas quest 2021
Starts at: Jan 01, 2021 at 00:00
Ends at: Dec 31, 2021 at 23:59
Current Status: Active
5 replies by pollsters
    First, read How do I create a Poll?. Then suggest your poll here. Complete ideas are more likely to be used.

    Note that links may be used in choices but not in the title.

Perl News
The Perl and Raku Conference 2021 online
on Jun 08, 2021 at 02:55
0 replies by Discipulus
    Hello folks!

    today starts the The Perl and Raku Conference, Conference in the Cloud, at 11:30 New York time (16:30 GMT).

    You can see how-to-attend-this-conference and the whole scheduling.

    Profit it!


    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
Perl questionaire by Gobby
on Jun 02, 2021 at 03:54
6 replies by Tux

    A shared Vision of Perl


    Welcome to the survey on a shared vision of Perl!

    Gobby is an innovative, Perl-based, survey tool. We're committed to the future of the Perl ecosystem and people that make up these communities.

    We're looking for support in the development of Gobby as a Perl product. Please drop us a line to if you like our approach to surveys and would like to be part of Gobby's future.

    Best wishes,

    Gary Beckwith
    Founder of Gobby

    Enjoy, Have FUN! H.Merijn
Issue with LWP loading client certificate
3 direct replies — Read more / Contribute
by ffrost
on Jun 17, 2021 at 16:04

    Objective: To connect from my machine to an external server using HTTPS. The connection will use the GET verb and the external server should return a message back to the client. As a security mechanism, the certificate for my client must be sent to the server as authentication.

    I'm using LWP to get the response from the external server. I've run into two problems I'm not sure of. First, I am unsure if the LWP program is actually loading the certificate, which is in DER format. Second, since the server is responding with a 403 error I don't think they are getting my certificate. Am I loading the certificate correctly to send from my Windows machine to their external IIS server?

    The DER certificate is valid and has not expired. It is not a self-signed certificate.

    use LWP::UserAgent; use Data::Dumper; use Cwd; $cdir = getcwd; $endpoint = ‘https://omit/commotest'; $ua = LWP::UserAgent->new; $ua->ssl_opts(SSL_cert_file => "$cdir\\der.cer"); $ua->ssl_opts(SSL_use_cert => '1'); $response = $ua->get($endpoint); if ($response->is_success) { print Dumper $response; } else { print "Error: " . $response->status_line, "\n"; }
Mojo pp html_entities.txt
1 direct reply — Read more / Contribute
by Anonymous Monk
on Jun 17, 2021 at 12:45

    How can I override at run time the directory where Mojo searches for the file "html_entities.txt"? The reason is that I am trying to use PAR pp to create an executable of an application using Mojo on Windows 10, but the exe fails with the following error:

    Unable to open html entities file (C:\Users\de\AppData\Local\Temp\par-6663\cache-9973dd41d00e8bee27c9630746780ae38da71709\inc\lib\Mojo\resources\html_entities.txt): No such file or directory at C:\Users\de\AppData\Local\Temp\par-6663\cache-9973dd41d00e8bee27c9630746780ae38da71709\inc\lib/Mojo/ line 14.

    I already tried to add to the file explicitly:

    -a "C:\Strawberry\perl\vendor\lib\Mojo\resources;Mojo/resources"

    with no effect. So probably copying and pasting the file into my data structure and instruct Mojo to search there could be a fix. Any suggestion?

how to ignore spaces, commas or new line of an array when comparing
1 direct reply — Read more / Contribute
by noviceuser
on Jun 16, 2021 at 04:01

    I am trying to compare two arrays which may have strings/elements separated by newline, spaces or comma, how can i ignore those special characters while comparing

    e.g: suppose @array1 has contents like below

    abc xyz

    and @array2 has contents like below

    abc xyz
    my $comp = Array::Compare->new; if ($comp->compare(\@array1, \@array2)) { print "array same\n"; } else { print "array not same\n"; }
The "%" operator and its documentation.
1 direct reply — Read more / Contribute
by syphilis
on Jun 13, 2021 at 21:40

    UPDATE: I've now filed a bug report about this.

    I've been chewing on this over the last couple of days, and it doesn't look right to me.
    It's an issue that arises only when NV-precision is greater than IV-precision.
    So, if ivsize is 8 bytes, then in order to experience the issue, you'll generally need to use a quadmath build (nvtype of __float28, NV-precision of 113 bits).
    With such a perl, I get:
    C:\_32>perl -wle "$m = (2**113) - 1; $n = 2; print $m % $n;" 0
    In contrast, POSIX::fmod returns "1" for the same operation.
    C:\_32>perl -MPOSIX -wle "$m = (2**113) - 1; $n = 2; print fmod($m, $n +);" 1
    Here's the section of perlop documentation that I'm looking at:
    Binary "%" is the modulo operator, which computes the division remaind +er of its first argument with respect to its second argument. Given integ +er operands $m and $n: If $n is positive, then "$m % $n" is $m minus the largest multiple of $n less than or equal to $m. If $n is negative, th +en "$m % $n" is $m minus the smallest multiple of $n that is not less tha +n $m (that is, the result will be less than or equal to zero). If the operands $m and $n are floating point values and the absolute value of $n (that is "abs($n)") is less than "(UV_MAX + 1)", only the integer portion of $m and $n will be used in the operation (Note: here "UV_MAX +" means the maximum of the unsigned integer type). If the absolute value of the right operand ("abs($n)") is greater than or equal to "(UV_MAX + 1)", "%" computes the floating-point remainder $r in the equation "($r = $m - $i*$n)" where $i is a certain integer that makes +$r have the same sign as the right operand $n (not as the left operand $m like C function "fmod()") and the absolute value less than that of $n. Note that when "use integer" is in scope, "%" gives you direct access +to the modulo operator as implemented by your C compiler. This operator i +s not as well defined for negative operands, but it will execute faster.
    AFAICT, the parts of that documentation that are pertinent to my given example are:
    If $n is positive, then "$m % $n" is $m minus the largest multiple of +$n less than or equal to $m. .... If the operands $m and $n are floating point values and the absolute v +alue of $n (that is "abs($n)") is less than "(UV_MAX + 1)", only the integer portion of $m and $n will be used in the operation (Note: here "UV_MAX +" means the maximum of the unsigned integer type)
    And to me that implies that the correct calculation for the given example is to do:
    C:\_32>perl -wle "$r = 10384593717069655257060992658440191.0 - (519229 +6858534827628530496329220095.0 * 2); print $r;" 1
    This agrees with the value produced by POSIX::fmod(), but disagrees with the value produced by the "%" operator.
    Do we agree that perl is buggy here ?

    If you have a perl with ivsize of 4, you can also demonstrate the same issue.
    With ivsize of 4, NV-precision of 113 bits:
    C:\_32>perl -wle "$m = (2**113) - 1; $n = 2; print $m % $n;" 0 C:\_32>perl -MPOSIX -wle "$m = (2**113) - 1; $n = 2; print fmod($m, $n +);" 1
    With ivsize of 4, NV-precision of 64 bits (long double):
    C:\>perl -wle "$m = (2**64) - 1; $n = 2; print $m % $n;" 0 C:\>perl -MPOSIX -wle "$m = (2**64) - 1; $n = 2; print fmod($m, $n);" 1
    And now to really muddy the waters !! One might be expecting the trend to continue when ivsize is 4, and NV-precision is 53-bits .... but not so:
    C:\_32>perl -wle "$m = (2**53) - 1; $n = 2; print $m % $n;" 1 C:\_32>perl -MPOSIX -wle "$m = (2**53) - 1; $n = 2; print fmod($m, $n) +;" 1
    This time the "%" operator decides to act in accordance with (my reading of) the perlop documentation.

When not to use taint mode
8 direct replies — Read more / Contribute
by Bod
on Jun 12, 2021 at 15:09

    A few times recently in the Monastery I have noticed mention of taint mode

    A long time ago I first came across taint mode and decided it is far too difficult to understand...I've since looked again and it doesn't appear anything like as mystical as it once did. That's what happens when one improves of course.

    I have never used taint mode so have no idea of the ease or otherwise of actually using it. It seems from this poll that most others don't use it either. So why not? Is it that taint mode is actually difficult to use or are there reasons to keep it switched off as it is by default?

    Do you have any advice on the topic?

Organizational Culture (Part II): Meta Process
No replies — Read more | Post response
by eyepopslikeamosquito
on Jun 17, 2021 at 06:03

    Googling Organizational Culture revealed many folks offering (often pricey) Organizational Culture workshops based on theories concocted by a pair of enterprising boffins, quietly contemplating at the University of Michigan, located in the picturesque village of Ann Arbor.

    Though the definitive reference on their work is available for purchase from amazon, you can also get a feel for their process by reading this early paper:

    A Process for Changing Organizational Culture by Kim Cameron, University of Michigan 2008
    Handbook of Organizational Development, 2008: 429-445 (cited by 345)

    Abstract: This chapter outlines a process for diagnosing and changing organizational culture. It uses the Competing Values Framework to describe a validated approach to helping an organization change from a current culture to a desired culture.

    ... and from the (mostly youtube) links in the References section below. As you might expect, I was too cheap to pay for advice on this topic, so instead watched some youtube videos and read Kim's original paper. Though not necessarily the best organizational change process (alternative citations welcome), at least this is a concrete thing that can be discussed and analysed, and thus serve as a starting point for discussing specific ways to improve Organizational Culture (and Perl organizational culture too).

    For those seeking a Perl Monks connection to this academic paper, notice that Ann Arbor is a mere two hour scenic drive from Hope College in Holland Michigan, the sacred birthplace of Perl Monks (if you drive via Portage Michigan, you can further pick up some COVID-19 vaccines from Pfizer’s huge manufacturing facility on the way).

    Definition of Organizational Culture

    Although many definitions of culture have been proposed, the two main disciplines are:

    • Sociological (organizations have cultures). Assumes you can identify differences among organizational cultures, can change cultures, and can empirically measure cultures.
    • Anthropological (organizations are cultures). Assumes that nothing exists in organizations except culture, and one encounters culture anytime one rubs up against any organizational phenomena.

    In her 2008 paper, Cameron gave a popular and practical definition of culture as:

    the taken-for-granted values, underlying assumptions, expectations, and definitions present which characterize organizations and their members
    • serves as the social glue binding an organization together; and
    • represents how things are around here, affects the way members think, feel, and behave.

    and further perceptively noticed that:

    With very few exceptions, virtually every leading firm has developed a distinctive culture that is clearly identifiable by its key stakeholders

    This distinctive culture is sometimes created by the initial founder: Walt Disney, Bill Gates, and Larry Wall, for example. All three of these legends developed something special, something more vital than corporate strategy, market presence, or technical advantages: the power that arises from a unique and spirited culture.

    Curiously, most people are unaware of culture until suddenly confronted with a different one: travelling to Vietnam, for example, finding yourself immersed in different noises and smells and unable to understand a word of the local lingo ... or asking a question on SO after years of posting at Perl Monks. :)

    The culture of most organizations is invisible, most members have a hard time describing it, let alone consciously changing it -- that is why you need tools, such as The Competing Values Framework and the Organizational Culture Assessment Instrument (OCAI), developed by scholars Cameron and Quinn.

    Notice that Organizational Climate is distinct from Organizational Culture: Climate is temporary, Culture enduring.

Log In?

What's my password?
Create A New User
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2021-06-18 14:44 GMT
Find Nodes?
    Voting Booth?
    What does the "s" stand for in "perls"? (Whence perls)

    Results (89 votes). Check out past polls.