Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
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
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
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 hackeriet.no 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 London.pm 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 London.pm mailing list back then.

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

Supplications
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) ?
    illustrated
    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 ?
Regex with HTML::Entities
3 direct replies — Read more / Contribute
by Horst.Lohnstein
on Nov 23, 2021 at 01:38

    Hi Monks,

    I have a question concerning Regex with HTML::Entities. I try to replace patterns with a keyword with some HTML-Code: The keword is encapsulated between ✶ (a little star). The keyword itself is of the form: Adjektive (Nominalflexion~84. The whole pattern looks like: {✶Adjektive (Nominalflexion)~87✶}

    use HTML::Entities; # $text is some Text from a mysql database my $sep = decode_entities('✶'); my @v = ($text =~ /\{$sep(.*?)$sep\}/sg); # alle Verweise # @v contains all patterns (which means that they match)

    The matched elements in @v have the form: {✶Adjektive (Nominalflexion)~87✶} Going through all elements in @v, I try to replace the matched elements in the following way:

    $b = "Adjektive (Nominalflexion)~87"; $c = "\{$sep$b$sep\}"; $r = "<div>some Text $b some other text</div>"; $text =~ s/$c/$r/s;

    I tried a lot of variants including quotes (?:...), and what not. Nothing worked! Is there anyone, who can stop my wasting of time with these questions? Thanks in advance! Best regards, Horst

Hash versus chain of elsifs
5 direct replies — Read more / Contribute
by mldvx4
on Nov 22, 2021 at 02:32

    I have a question about what is more efficient for a small lookup function with only a few thousand items. Specifically I have a function in a module and that module has a function which gets passed a string. The function needs to determine if that string is in a set of a few thousand strings or not. How is that done most efficiently, and does the "best" approach vary by scale?

    One way might be to load a hash with the strings as keys, and then see if defined($hash{$string}) or if defined($hash{$string}) has a value set.

    Another would be to have a chain of elsif statements, and have the function cascade through those until either the end is reached or a match has been found.

    Which approach is more appropriate or efficient? Or are the better approaches which can be used?

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2021-11-28 18:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?