Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

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.

Quests
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!

    L*

    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

    Hello!

    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 info@gobby.io 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
Supplications
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/Base.pm 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
    Hi,

    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.

    Cheers,
    Rob
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?

AnyEvent::HTTPD -> Extra Callback after response?
2 direct replies — Read more / Contribute
by sectokia
on Jun 10, 2021 at 21:51
    Hi Monks,

    I cannot work out why in this code the callback sub is called twice. The response goes to the client after the timer expires the first time, but then it triggers all over again. Code:

    use strict; use warnings; use AnyEvent::HTTPD; my $h = AnyEvent::HTTPD->new(port => 8123);; my $timer; $h->reg_cb ( '/test' => sub { my ($httpd,$req) = @_; $req->respond({ content => ['text/plain', sub { my ($data_cb) = @_; return unless $data_cb; print "Setting timer...\n"; $timer = AnyEvent->timer(after => 5, cb => sub { print "Sending response...\n"; $data_cb->("Hello"); $data_cb->(); }); }] }); }, ); my $c = AnyEvent::condvar; $c->recv();
    Output:
    Setting timer... Sending response... Setting timer... Sending response...
    I was expecting the sub to only be called once. But it ends up being called a second time? Is there any way to avoid this? Thanks!
a look at Sub::Genius with the debugger, and use v in 2021
1 direct reply — Read more / Contribute
by Aldebaran
on Jun 10, 2021 at 20:51

    I was looking at my normal youtube feed when Leon Timmermans came up with a presentation about Raku. (Certainly interesting, and I have questions for him, but not now.) I soon realized that the zoom convention was happening, and that I could get it in essentially real time on youtube. I have them on as I go about my business, and B Estrade's talk comes on. I went about cleaning the kitchen at the start, but once it started into graph theory, I got very interested, and gave it my full attention. As things started cooking, the moderator chimed in that five minutes remained, and the presenter was left to rush through slides, to my, and seemingly, his dismay. He didn't get to running code, but I was interested enough to see what I could dig up. I feel like there was a second half to the talk that I would gladly hear. I tried to fill in the gaps by working some code, and I would like to post sources, output and questions.

    Thanks to presenters. I've seen several and might need half a year to see them all. I appreciate your service. Thanks also for comments,

Meditations
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
    which:
    • serves as the social glue binding an organisation 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 Organisational Culture: Climate is temporary, Culture enduring.

Organizational Culture (Part I): Introduction
3 direct replies — Read more / Contribute
by eyepopslikeamosquito
on Jun 11, 2021 at 07:58

    The recent turmoil in Perl's organizational culture, discussed recently here at Perl Monks in:

    left me feeling sad. Sadder after reading of the Australian Defence Force's long-drawn-out battles with cultural change: because it made me realise that organizational cultural problems are dauntingly difficult - and often prohibitively expensive - to put right.

    For therapy, I've decided to follow up my nine-part series on Agile processes in organizations with a new (ten-part :-) series of articles exploring the perplexing multi-disciplinary topic of Organizational Culture. There's certainly no shortage of material, with a mind-boggling number and variety of disciplines in play, such as:

    Please feel free to mention other disciplines I've overlooked or that you'd like to see discussed.

    A possible breakdown by topic is:

    • Broad Overview of Organizational Culture
    • Meta Process: that is, a process to build a process to effectively change Organizational Culture
    • Culture variation in different countries
    • Software Industry Culture
    • Open Source Software Culture
    • Perl Culture
    • Perl Monks Culture! :)
    • Space/Aircraft Industry Culture. As a space nut, I doubt I'll be able to restrain myself from scrutinizing the impact of organizational culture on the Space Shuttle Challenger and Columbia disasters.
    Again, feel free to suggest other topics you'd like to see discussed.

    Please note that I'm just an interested layman on all these topics, so please correct me when I veer off course. I also welcome your feedback and opinion, along with insights, anecdotes and any useful citations you may know of.

    To kick off this series, given that I've just finished reading Sapiens, I thought it'd be fun to speculate on how our early evolutionary history helps explain some of the peculiar and counter-productive behaviour we witness today.

    PreHistory

    Around 2.5 million years ago, an unremarkable new species appeared in Africa. Now, I doubt these early humans, enduring their daily battle for survival along with many other species, had any inkling back then that they would one day walk on the moon, split the atom, map the genome, calculate the age of the universe ... and compose Perl programs, obfus and poetry.

    How on earth did this unremarkable and physically weak new species win this brutal evolutionary war? Sapiens revealed the (surprising to me) secret:

    A green monkey can yell to its comrades, "Careful! A lion!". But a modern human can tell her friends that this morning, near the bend in the river, she saw a lion tracking a herd of bison. She can then describe the exact location, including the different paths leading to the area. With this information, the members of her band can put their heads together and discuss whether they should approach the river, chase away the lion, and hunt the bison.

    Homo sapiens is primarily a social animal. Social cooperation is our key for survival and reproduction. It is not enough for individual men and women to know the whereabouts of lion and bison. It's much more important for them to know who in their band hates whom, who is sleeping with whom, who is honest, and who is a cheat. ... The most important information that needed to be conveyed was about humans, not lions and bison. Our language evolved as a way of gossiping.

    Do you think that history professors chat about the reasons for the First World War when they meet for lunch, or that nuclear physicists spend their coffee breaks at scientific conferences talking about quarks? Sometimes. But more often, they gossip about the professor who caught her husband cheating, or the quarrel between the head of the department and the dean, or the rumours that a colleague used his research funds to buy a Lexus.

    Only Homo sapiens can speak about things that don't really exist. You could never convince a monkey to give you a banana by promising him limitless bananas after death in monkey heaven. But why is it so important? Fiction has enabled us not merely to imagine things, but to do so collectively. We can weave common myths. Such myths give Sapiens the unprecedented ability to cooperate flexibly in large numbers.

    Ants and bees can also work together in huge numbers, but they do so in a very rigid manner and only with close relatives. Sapiens can cooperate in extremely flexible ways with countless numbers of strangers. That's why Sapiens rule the world, whereas ants eat our leftovers and chimps are locked up in zoos. (Update: so far researchers have failed to locate lawyer bees; bees don't need lawyers because there is no danger that they might forget or violate the hive constitution).

    Myths and fictions accustomed people, nearly from the moment of birth, to think in certain ways, to behave in accordance with certain standards, to want certain things, and to observe certain rules. They thereby created artificial instincts that enabled millions of strangers to cooperate effectively. This network of artificial instincts is called culture.

    The theory of evolution tells us that instincts, drives and emotions evolve in the sole interest of survival and reproduction ... yet when some of these evolutionary pressures abruptly disappear (due to sudden changes in human culture), these hard-won instincts do not instantly disappear with them ... which explains why today young men drive recklessly and fight in pubs. They are simply following ancient genetic impulses that, though counter productive today, made perfect sense 70,000 years ago, where a young hunter who risked his life chasing a mammoth outshone all his competitors to win the affections of the local beauty. Sadly, those same successful macho genes today give us a mouthful on Perl mailing lists, IRC and Twitter.

    With their brain growing (to keep track of the thousands of connections, deceits and subterfuge required for superior gossiping) and their hips narrowing (to facilitate walking upright), evolution favoured early births ... leading to helpless babies ... requiring a tribe to raise them ... favouring those with strong social abilities. Being born immature and with a big brain further allowed humans to be taught more flexibly than any other species -- which explains why we witness today the appalling spectacle of impressionable youngsters being effortlessly led to love Python and hate Perl.

    PM References

    Updated: Make Homo sapiens stand out from surrounding text, and with the species name (sapiens) in all lower case, a convention used by biologists, such as erix. 13-June: added bee lawyer joke to quoted Sapiens passage.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2021-06-17 21:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What does the "s" stand for in "perls"? (Whence perls)












    Results (85 votes). Check out past polls.

    Notices?