Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

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.

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

    Announcement:

    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: https://meet.jit.si/German-PM

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

    UPDATE

    on Daxim's request

    NO REBROADCAST WITHOUT PERMISSION!

    ONLY PRIVATE RECORDING ALLOWED!

    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
    Hi,

    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.

    Cheers,
    Rob
Supplications
Basic but stupid problem i cannot wrap my head around
3 direct replies — Read more / Contribute
by baxy77bax
on Aug 06, 2020 at 04:57
    hi,

    so the problem is the folloving:

    perl -le '$t="a/b"; if ($t =~/^(.*?)\//){$z=$1}elsif($t=~/\/(.*)/){$z= + $1} print $z' #prints a perl -le '$t="/b"; if ($t =~/^(.*?)\//){$z=$1}elsif($t=~/\/(.*)/){$z= +$1} print $z' #prints nothing
    it is probably something stupid , as i am quite tired but why isn't the second case being evaluated (or it is but why is it returning 0 )

    thnx

    baxy

Tk pop-up if condition is met
2 direct replies — Read more / Contribute
by IB2017
on Aug 05, 2020 at 17:18

    Is it possible to allow a popup in a text widget only if a condition is met, i.e. if a text has been selected? This is the code I have so far, which creates a popup, however, it checks if something has been selected only agter its creation.

    use strict; use warnings; use Tk; use Tk::Text; my $mw = tkinit(); my $text = $mw->Text()->pack(); $text->insert('end',"This is my first line\n"); $text->insert('end',"This is my second line\n"); PupupTextWidget($mw, $text); $mw->MainLoop(); sub PupupTextWidget{ my ($mw, $obj) = @_; my $messagePopupSave; if ($^O eq 'MSWin32'){ $messagePopupSave="Do something (ctrl+s)"; }else{ $messagePopupSave="Do something (cmd+s)"; } my $menu = $mw->Menu(-tearoff=>0, -menuitems=>[ [command=>$messagePopupSave, -command=>[sub { my $UserInput=$obj->getSelected; print $UserInput; }, $obj,]], [qw/command Copy/, -command=>['clipboardCopy', $obj,]], ]); $obj->menu($menu); return $obj; }
Looking for alternative for IPC::Shareable (or increase size)
7 direct replies — Read more / Contribute
by DomX
on Aug 05, 2020 at 16:55
    Hey Monks!
    I'm having a hard time today. I almost finished my program with over 9000 lines, but have one problem:

    Communication between my worker (forked unit) and master (GUI unit) has a size issue: (worker fills shared array, master reads content into not shared array and cleans shared array.)
    Length of shared data exceeds shared segment size at ./myprogram.pl line 1210.
    Buffer size is declared to be "65536". (No idea of unit, I think it's bytes.) This happens on one array element, when the containing string is longer than 65536.


    What I want to know:
    - is there a possibility to increase the size?
    - is there an alternative function, which allows me to share (bit long) text data between processes, without writing to disk? (Writing to Sqlite would decrease speed on this step extremely)

    If you don't know something like this, the only idea I have left is to make a Sqlite database "transfer", with just one column "data", and each row contains one string of my array. Many forks writing to it (slow...) and master reading and cleaning this table, just to prepare it to be saved in correct table and correct columns...
Scriptsock does not exist??
2 direct replies — Read more / Contribute
by marknher
on Aug 04, 2020 at 19:26

    Hi Monks!

    I have a perl sript ticketing system that is admittedly old but works perfect for our company. Recently, we started getting ERROR 503 messages on our website and it goes away in about 30 minutes. I reached out to the server admins and they responded with the following

    While revising this case our administrators have noticed you script is using socket connections which not completely closed and error similar to arises:

    AH02833: ScriptSock /var/run/cgid.sock.23916 does not exist:

    since the script attempts to reference to previous non existing socket previously used and the error noticed arises. We can not offer debugging of the scripts although and you should check with your website developers what socket connections are used, how are these closed and why the processes reference to an old connection so they could avoid that for your script.

    I've Googled around about this and went through my scripts trying to figure out anything that has changed but I come up blank. Anyone have any clues on what this really means so that I can hunt down the problem and fix it?

    Thanks, Mark T.

TK Listbox: scrolling with keys/mousewheel
1 direct reply — Read more / Contribute
by Ratazong
on Aug 04, 2020 at 03:57

    Dear monks

    I'm struggeling with creating a scrolled listbox in Tk: the code below works, however I'm not able to scroll with the arrow-keys nor with the mouse-wheel. Do I have to bind the events myself and code the related actions? Or am I just missing something?

    Thanks for your help! rata

    sub selectProjectDialog_newtest { $mw = shift; # store the main window my @project_choices = split(" ","Project1 Project2 Project3 Proje +ct4 Project11 Project12 Project13 Project14 ") ; my $projectSelection_tl= $mw->Toplevel( ); $projectSelection_tl->title("Select the project:"); $projectSelection_tl->Label(-text => 'Select the project Id:', + )->grid(-row => 5, -column => 10, -sticky => "w"); my $scrolled1 = $projectSelection_tl->Scrolled ("Listbox", -scrollbars => "se", -width => 50, -height => 4, -selectmode => "extended") ->grid(-row => 10, -column => 10, -columns +pan => 10, -rowspan => 10); $scrolled1->insert ("end", @project_choices); }

Effect of redirecting output to /dev/null on $? value
2 direct replies — Read more / Contribute
by Special_K
on Aug 02, 2020 at 20:14

    For reference, this is somewhat of a follow up question to a question I asked previously: https://perlmonks.org/?node_id=11120004

    What is the impact on the value of $? if the output of an application is redirected to /dev/null? This is running under RHEL7.

    For example, suppose I have a perl script that calls a compiled executable that seg faults:

    `my_executable_that_seg_faults`; my $exit_value = $? >> 8; my $signal_num = $? & 127; my $dumped_core = $? & 128; printf("return value is %d\n", $?); printf("exit_value = $exit_value\n"); printf("signal_num = $signal_num\n"); printf("dumped_core = $dumped_core\n");

    Running the above code produces the following output:

    return value is 11 exit_value = 0 signal_num = 11 dumped_core = 0

    This output is consistent with what I would expect based on information found here related to the $? variable: https://perldoc.perl.org/perlvar.html

    However if I change the executable call above to the following:

    `my_executable_that_seg_faults > /dev/null`;

    The following output is produced:

    return value is 35584 exit_value = 139 signal_num = 0 dumped_core = 0

    The above output is significantly different even though the application still seg faulted. Here are my questions:

    1. Why did the value of $? completely change when I added the output redirect to /dev/null but kept everything else the same?

    2. Does the value of $? in the second case still contain the same information but encoded differently?

    I created a different application with an intentional segmentation fault and called it using the above perl script. It produced the exact same output, suggesting that this behavior is not dependent on the behavior of the called application.

PerlMonks Discussions
Preview neither truncates nor warns
2 direct replies — Read more / Contribute
by hippo
on Aug 05, 2020 at 04:38

    Reading Re^10: XS.c: loadable library and perl binaries are mismatched (got handshake key 0xc100000, needed 0xc180000) I was encouraged to confirm what rgren925 reported. I constructed a reply with about 120kB in it and used the Preview button to check it. All of it was rendered and there was no warning (that I could see) that it was over the size limit for posting. When it was subsequently submitted it still rendered fine and it was only on a further navigation to the same node that it did truncate to ~64kB as I expected.

    This is not great from a UX perspective. The preview should either warn about the size or truncate it like the final submission would do or (ideally IMHO) both. The full text could still be retained in the textarea for ease of editing.


    🦛

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










    Results (51 votes). Check out past polls.

    Notices?