Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

The Monastery Gates

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

Donations gladly accepted

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

poll ideas quest 2020
Starts at: Jan 01, 2020 at 00:00
Ends at: Dec 31, 2020 at 23:59
Current Status: Active
10 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
German Perlmongers Online Meeting
on Aug 04, 2020 at 12:59
0 replies by LanX
    @ All German speakers here:

    Next German PM Online Meeting in (cough) 30 minutes.


    Hallo Perlmongers aus den deutschsprachigem Raum,

    Heute, am Dienstag, den 4. August 2020, um 19:30 Uhr ist German-PM Online-Treffen im Jitsi.

    Dank Corona wurde das Online-Treffen mehrfach in Erlangen und Frankfurt ausprobiert. Der Wunsch wurde geäußert, das online neben den Treffen vor Ort weiterzuführen.

    Nimm an der Besprechung teil:

    I'm not the organizer, but I'll use this thread for future announcements.


    on Daxim's request



    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery

Strawberry Perl-5.30.3 is available
on Aug 02, 2020 at 09:02
1 reply by syphilis

    Just noticed that Strawberry Perl-5.30.3 is now available.
    The date given there is 2020-07-13, but I know it wasn't available earlier today. (Looks like the date is the date that perl was built - not the date at which the distro became available.)

    Hopefully, that indicates that 5.32.0 might not be too far away.
    Actually, I build my own perls on Windows and therefore don't rely on the Strawberry project for perl. It's still a very handy reference for me, but.
    And I do look forward to using the updated gcc compiler that usually accompanies new Strawberry Perl major releases.
    Since the mingw-w64 project stopped providing recent builds of gcc (as of a couple of years ago), I've come to rely on Strawberry for my gcc upgrades.

    Anyway ... just thought it was worth mentioning ... and looking forward to a 5.32.0 release soon, with (fingers crossed) gcc-9 or gcc-10.

all permutations of given lenght
4 direct replies — Read more / Contribute
by cataclismic_user
on Aug 11, 2020 at 03:11
    Dear Perl Monks,

    I am a novice of Perl. My question is rather simple: how can I generate all permutations of a set of characters, with a given length, in an computationally efficient manner?

    To further explain my conundrum: I have a large list of elements such as O=C(O)C(N)CCC/N=C(\N)N, O=C(N)C[C@H](N)C(=O)O, O=C(O)[C@@H](N)Cc1cncn1 and so on. I want to generate all possible permutations, including repetitions of these strings, in a given length (for ex. 6).

    Thank you in advance!

CPAN Module to determing overlap of 2 lists?
7 direct replies — Read more / Contribute
by wazat
on Aug 10, 2020 at 17:27

    I want to determine the overlap between the end of one list and the beginning of another. I have a quick brute force solution, but prefer to use an existing module if one is available. I didn't find one when I searched metacpan, but that doesn't mean it doesn't exist.

    # example @list1 = qw(a b c); @list2 = qw(b c d); # a b c # b c d # 1 2 list_overlap( \@list1, \@list2 ); # returns 2 @list1 = qw(a b c d b); @list2 = qw(b c d); # a b c d b # b c d # 1 list_overlap( \@list1, \@list2 ); # returns 1

    I don't know if this problem has a name.

    Intended use is to combine two bash_history files captured on different dates into a single bash_history file that doesn't duplicate the overlap between the files. (Yes, if I set HISTFILESIZE to -1, then bash would maintain an unlimited history file.

    __edit__ As pointed out, I should also specify that I want the largest overlap.

Not understanding while loop counting
5 direct replies — Read more / Contribute
by zapdos
on Aug 10, 2020 at 03:56
    $count = 0; while ($count < 10) { $count += 1; print "count is now $count\n"; }

    I don't get it. Why is it printing till 10 if the conditional expression asserts it should be less than (<) 10 and not less than or equal (<=) to 10? Shouldn't it print just till 9?

Generalizing a REGEX
2 direct replies — Read more / Contribute
by Anonymous Monk
on Aug 08, 2020 at 14:55
    foreach (@newlist) { $_ =~ s/[.](.*)/($section) }

    The above code performs the transform cat.1 ---> cat(1) It also performs the transform ---> ld(5) # which is WRONG! Is there a way to generalize this regex so it does: cat.1 ---> cat(1) ---> Thanks

Dependencies for a project - Perl6/Raku
2 direct replies — Read more / Contribute
by asoftware
on Aug 08, 2020 at 02:06

    Good day Monks,

    It has been a decade since I wrote any Perl, and recently I noticed the growth of Perl6 and the coining of "Raku". Side note, I am very pleased to see the Perl family withstanding the test of time. I recall my most productive engineering days were spent lovingly writing Perl.

    The wisdom I seek is two fold:

    1. Is there an ordained or at least idiomatic method of describing the module dependencies of a Raku project?
    2. Is there an ordained or at least idiomatic project structure for a Raku project? I see mi6, which appears to be the module structure required for module authors

    Generally, I am interested in understanding if there has been any formalization of describing required modules, not just in another module/package, but also in an arbitrary project. And potentially supporting project specific versions/installations of modules per project.

    Thanks for your time

    -- Cam
XML::LibXML::XPathContext->string_value - should ALL of the descendant's text be there?
1 direct reply — Read more / Contribute
by bobn
on Aug 07, 2020 at 22:52

    So I started playign around with XML parsing (well HTML but it's well enough formed I can use XML parsers on it). I ran into something on the Perl side of things I don't understand.

    I get a nodeset, start walking through it and getting text out, but when it comes out, for each node I get the text contained in node element AND the text of all of it's descendants (contained elements).

    I'm getting this with XML::LibXML::XPathContext, but it happens with XML::XPath as well.

    The event driven parsers I've tried don't seem to have this issue - they think that Text belongs to the innermost containing element, just like I do. lxml.etree in python, their binding for libxml2, does not do this, (though it definitely has oddities of it's own - check out "tail text" sometime, it's a doozy!).

    I'm going to stop now, 'coz I'm becoming increasingly sure I'm just missing something stupidly.

    Is it supposed to do this, and if so, how do I get at just the text for the outermost element of my node?

    #!/usr/bin/perl use XML::LibXML::XPathContext; our $contents = <<EOT; <html> <head> <title>Title_Text</title> </head> <body> <p>paragraph_text</p> <div> <div> innnermost_text </div> </div> </body> </html> EOT open my $fh, '>', './x.html'; print $fh $contents; close $fh; my $init_node = XML::LibXML->new->parse_file('./x.html'); my $xp = XML::LibXML::XPathContext->new($init_node); my $i= 0; my $nodeset = $xp->findnodes('//*'); for my $node ($nodeset->get_nodelist) { my $elname = $node->getName(); print qq[<$elname> node - $i\n]; my $text = ''; $text = $node->string_value(); # this brings in text of # *all* descendant nodes $text =~ s/(\s)+/$1/msg; print 'Text = ', $text, "\n"; $i++; }
    <html> node - 0 Text = Title_Text paragraph_text innnermost_text <head> node - 1 Text = Title_Text <title> node - 2 Text = Title_Text <body> node - 3 Text = paragraph_text innnermost_text <p> node - 4 Text = paragraph_text <div> node - 5 Text = innnermost_text <div> node - 6 Text = innnermost_text

    --Bob Niederman,

    All code given here is UNTESTED unless otherwise stated.

IO::Socket::SSL install problems
2 direct replies — Read more / Contribute
by Anonymous Monk
on Aug 07, 2020 at 19:04

    Hello smart monks, I'm trying to install IO::Socket::SSL from CPAN on a windows 10 server and it keeps on hanging. I've tried shipping the connection tests and a force install and I get to the point below where it sits for hours. Any help on how to get past this would be greatly appreciated. Terminal output is right below:

    # connect to 0: success reuse=0 version=TLSv1_3 t/session_ticket.t ................ 1/6 # connect to 0: success reuse= +1 version=TLSv1_3 # connect to 1: success reuse=1 version=TLSv1_3 # connect to 1: success reuse=0 version=TLSv1_3 # connect to 0: success reuse=0 version=TLSv1_3 # connect to 0: success reuse=1 version=TLSv1_3 t/session_ticket.t ................ ok t/sessions.t ...................... ok t/set_curves.t .................... ok t/signal-readline.t ............... skipped: signals not relevant on t +his platform t/sni.t ........................... ok t/sni_verify.t .................... 1/17


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 examining the Monastery: (3)
As of 2020-08-14 01:11 GMT
Find Nodes?
    Voting Booth?
    Which rocket would you take to Mars?

    Results (75 votes). Check out past polls.