Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

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
11 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
CPAN clients exposed to sig-related vulnerabilities
on Nov 23, 2021 at 18:06
1 reply by hippo

    TL;DR - your CPAN client may be vulnerable to modified tarballs from untrusted mirrors (and will have been that way forever). Upgrade, force https, force signature verification and ensure it uses a trusted mirror by default.

    See the post listing the vulnerabilities and this in-depth explanation of what is vulnerable and what to do about it.


Sad News: David H Adler (DHA) has passed away
on Nov 22, 2021 at 18:07
1 reply by eyepopslikeamosquito

    Very sad to learn today of the recent passing of the lovely David H Adler Esq.

    Though I never met dha in person, I remember his delightful sense of humour from the mailing list years ago. I thought it strange that DHA was in New York, while I was in Sydney, yet we both relished the quirky sense of humour of the super-active mailing list back then.

    DHA's love of the fun side of Perl culture is also revealed in his only CPAN module: Semi::Semicolons

Verify Town Name
2 direct replies — Read more / Contribute
by PilotinControl
on Nov 29, 2021 at 19:34

    Hello Fellow Monks!
    I have a perplexing issue with my code below. I am trying to verify a town name located in a file using it as a check and balance before moving on to the next user input. However no matter what is inputted it moves on with out giving notice stating the town name has not been found. Thanks in advance!

    sub addind { open(MYINPUTFILE, "townsdata.txt"); # OPEN FOR INPUT $| = 1; my @lines = <MYINPUTFILE>; # READ FILE INTO LIST print "INDUSTRY TOWN\n"; my $indtwn = <STDIN>; $indtwn = <STDIN> until defined $indtwn; chomp $indtwn; cls(); my $found = 0; foreach my $townverify (@lines) { my @field = split(':',$townverify); if ($field[0] =~ m/^#/) { next; } if ($field[1] =~ /(?<![\w-])$indtwn(?![\w-])/i) { cls(); $found = 1; } else { cls(); print "TOWN RECORD NOT FOUND\n"; sleep 3; cls(); addind(); } # END FOREACH FILE LOOP my $output="inddata.txt"; open(DAT,"+<$output") || die("Cannot Open File"); my $indline; $indline = <DAT> until eof DAT; my ($indid) = $indline =~ m/\A(\d+):/; print DAT (++$indid); print DAT (":"); print DAT ($indtwn); print DAT ("\n"); close (DAT); print "INDUSTRY SUCCESSFULLY ADDED!!\n"; sleep 3; cls(); industry(); }
    2:PGHW:Pittsburgh West End

To not capture recursive group while collecting certain matches
4 direct replies — Read more / Contribute
by Anonymous Monk
on Nov 29, 2021 at 04:55
    How regex match must not capture recursive group used and required inside when collecting all the matched captured groups?
    just illustration
    How to manage m contains all matched kv correctly clean from matched recursive ?
Recalling a function iteratively
3 direct replies — Read more / Contribute
by dnamonk
on Nov 28, 2021 at 21:18
    Dear Monks, I have a general logic question. I need help in logic and not code. I have a question about recalling my function within a loop. Below is my code:
    List_new = myfunction() for items in List_new: if(my condition is TRUE): Execute some commands if(my condition is FALSE): recall myfunction()
    My problem is that I am loading "List_new" using myfunction(). How can I change "List_new" iteratively when my condition is False. I want to reload the function especially when the condition is FALSE. This means I keep calling the function until it is false and then execute the final output from myfunction(). Thank you in advance for your help.
running system commands, and getting return codes/status
3 direct replies — Read more / Contribute
by Anonymous Monk
on Nov 26, 2021 at 19:59

    Below is my code. It runs a backup program from a pTk GUI. My problem is at the 'system($cmd)' statement. The command gets executed before the message gets displayed in the text widget.

    I want a message that tells * is being done, then when the process is done a message that says * is done along with relevant error codes.

    Is there a better way to do this? And why are the messages displayed at the wrong time?

    my @cmd = ""; push (@cmd , $prog_args , $fullf +ile2 , "/" ); my $cmd2 = join " " , @cmd +; $text -> delete ('1.0' , 'end' ); $text -> insert ('end' , "\n" ); $text -> insert ('end' , "THIS +OPERATION SHOULD TAKE 5 min. to 15 min. \n ", 'highlite' ); my $exit_status = system( +$cmd2 ); print "\$exit_statu +s at L1447 =: $exit_status\n"; if ( 0 == $exit_sta +tus ) { $text -> insert ('end' , "\n\n" ); $text -> insert ('end' , "DONE! \n", 'h +ighlite' ); }
Perl DBI, Oracle truncating 30th character from the column name.
1 direct reply — Read more / Contribute
by Anonymous Monk
on Nov 26, 2021 at 06:14

    Hi Monks,

    While fetching data from Oracle db using Perl DBI, since column name is lengthy enough, oracle is truncating the 30th character from the column name, because of it's column length restriction it seems.

    Is there anything we can do using perl DBI to avoid this column name truncation from the result set.

    Thank you

How Perl can push array into array and then how retrieve
3 direct replies — Read more / Contribute
by Anonymous Monk
on Nov 24, 2021 at 22:59
    How do we correctly push array into array and then retrieve each of the outer array (explain both each separately clearly) ?
    my @f; my @e; for $i (0..40) { @e=($i+=2, $i+1); push($f,@e); # just it right ? } # how go on get it under multi array control

    Please help out, very thanked in advance
Using system (); with Strawberry Perl
8 direct replies — Read more / Contribute
by hadrons
on Nov 24, 2021 at 18:50
    Hi, I'm a newbie here and this is my first question to the group, so forgive any lapse in etiquette. I wrote this script that is heavy in the use of system() and I run it using cygwin and it runs fine in that tool- however, when I use Strawberry Perl to run it there are a number of commands within the system() that it doesn't recognize. For example:
    system ('grep -l "DATAmessage.*3\.0" *.xml > 3.0_files_arraydata.txt') +; system ("mv temp_3.0_files_onixarraydata.txt 3.0_files_arraydata.txt") +; system ("cat *files_arraydata.txt > data2.txt"); system ("rm data2.txt"); system ("sort -u data2.txt > data.txt");
    It appears that the commands grep, mv, cat and rm all fail because "grep|mv|cat|rm is not recognized as an internal or external command, operation program or batch file" I also use sort, but I receive no error message for that command.

    I have tried other things to swap out the system calls like File::Grep in place of the grep calls, but while File::Grep works, it was slower than molasses in the dead of winter in Strawberry Perl. I know many look-down on the use of system ();, but I find it to be very fast. Any suggestions? And thank you for reading.

Faster with my keyword or no ?
4 direct replies — Read more / Contribute
by abdan
on Nov 23, 2021 at 19:39
    Is having my keyword precedes identifier var. speed up the Perl performance compare to otherwise ?
Log In?

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (8)
As of 2021-11-30 08:07 GMT
Find Nodes?
    Voting Booth?

    No recent polls found