Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Seekers of Perl Wisdom

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

If you have a question on how to do something in Perl, or you need a Perl solution to an actual real-life problem, or you're unsure why something you've tried just isn't working... then this section is the place to ask. Post a new question!

However, you might consider asking in the chatterbox first (if you're a registered user). The response time tends to be quicker, and if it turns out that the problem/solutions are too much for the cb to handle, the kind monks will be sure to direct you here.

User Questions
Mouse action using SVG
1 direct reply — Read more / Contribute
by Ezhil4663
on Jul 29, 2016 at 17:14

    Can anyone please provide me a simple example that uses svg's mouse action? I couldn't find any good example online. I would like to show a message when I click on a rectangle. I am using SVG module for developing graphics.

Perl: info from database into a form(HTML)
2 direct replies — Read more / Contribute
by alen129
on Jul 29, 2016 at 16:32
    I'm working on a very specific problem at my work place and have not been able to find answers for what I'm searching for I'm looking to retrieve information from a MySQL DB and adding it to a form so it can be added(submitted) to a different DB, but before submitting the user needs to be able to make changes and add more data to the retrieved information form the first database.(imagine "copy and pasting if you will" from first database into the HTML form without submitting, if it makes any sense) I've been stuck on this problem for for a few days. Any help or ideas are appreciated.
Difference between these regexes
5 direct replies — Read more / Contribute
by haukex
on Jul 29, 2016 at 08:36

    Fellow Monks,

    I seek your wisdom: A recent node (Re: No tools? Use Perl?!) got me wondering: Is there a difference between these three regexes that I am missing, primarily in terms of what they match? In particular I'm interested in the first two - I understand the first and third regexes, but am not an expert on look-arounds.

    1. /<(.*?)>/s
    2. /<((?:(?!>).)*)>/s
    3. /<([^>]*)>/s

    I have yet to find a difference - I am not sure if there even is one - but I'm probably not being creative enough in my test cases...

    -- Hauke D

Recover perl file from .exe
3 direct replies — Read more / Contribute
by Anonymous Monk
on Jul 29, 2016 at 05:02

    Hi Monks,

    My harddisk is crashed some days ago and I lost my source code of my application but having the exe which compiled with PerlAPP version 9.2.

    Can you give me some help to decompiled it or recover it from *.exe?

    Thanks in advance

Tk Failed to AUTOLOAD 'Tk::Frame::labelPack' at C:\Strawberry\perl\lib\Tk/Tk/ line 203.
3 direct replies — Read more / Contribute
by pks283
on Jul 29, 2016 at 02:01

    Below is my code i am getting below error of is missing.

    I have installed Tk multiple times and using strawberry perl. Failed to AUTOLOAD 'Tk::Frame::labelPack' at C:\Strawberry\perl\lib\Tk/Tk/ line 203.

    cpan> install Tk::Frame::labelPack Warning: Cannot install Tk::Frame::labelPack, don't know what it is.

    Try the command i /Tk::Frame::labelPack/ to find objects with matching identifiers.

    my $mw = MainWindow->new(); $mw -> geometry("1000x400"); my $book = $mw->NoteBook()->pack(); my $title = $mw -> title("Spec Analysis"); $mw ->BrowseEntry(-label => 'Product', -choices=> \@product_list, -var +iable => \$product_st, -browsecmd =>\&getselect_product, -font => "co +urier 11 bold" ) ->place(-x=>1,-y=>120); $mw ->BrowseEntry(-label => 'Package', -choices=> \@package_list, -var +iable => \$package_st, -browsecmd =>\&getselect_package, -font => "co +urier 11 bold" ) ->place(-x=>275,-y=>120); MainLoop;
    thx in advance
modification of the script to consume less memory with higher speed
3 direct replies — Read more / Contribute
by Anonymous Monk
on Jul 29, 2016 at 01:34
    I have written a script which compares multiple files and give the number of occurrence of each paragraph in each file. The script is working fine with smaller files but when applied to large files the program is stuck with no output. I need some help in modifying the script so that it can run on all files even if its very large. My script:
    #!/usr/bin/env perl use strict; use warnings; my %seen; $/ = ""; while (<>) { chomp; my ($key, $value) = split ('\t', $_); my @lines = split /\n/, $key; my $key1 = $lines[1]; $seen{$key1} //= [ $key ]; push (@{$seen{$key1}}, $value); } foreach my $key1 ( sort keys %seen ) { my $tot = 0; my $file_count = @ARGV; for my $val ( @{$seen{$key1}} ) { $tot += ( split /:/, $val )[0]; } if ( @{ $seen{$key1} } >= $file_count) { print join( "\t", @{$seen{$key1}}); print "\tcount:". $tot."\n\n"; } }
    please help me as soon as possible
Strip html from string using perl
1 direct reply — Read more / Contribute
by Mj1234
on Jul 29, 2016 at 00:26
    Hello Monks,

    I have a string with html tags as shown below.

    <style>table{border-collapse: collapse;margin-left: 1cm;font-Family: c +ourier;width: 60%} \.hoverTable tr{background: #D8D8D8;} \.hoverTable + tr:hover{background-color: #ffff99; } </style><table border=2 class=\"hoverTable\"><tr><td bgcol +or=\"#366092\" width=\"18%\"><font color=\"White\">Name</font></td><t +d><b>ABC</b></td></tr><tr> <td bgcolor=\"#366092\" width=\"18%\"><font color=\"White\ +">Subject</font></td><td><b>XYZ</b></td></tr></table>

    How can I remove the html content and retain only the plain text using HTML::Parser?

Help, Parallel::ForkManager
1 direct reply — Read more / Contribute
by Perl_Love
on Jul 28, 2016 at 23:44
    #!/usr/bin/perl -w use Parallel::ForkManager; my $pm = Parallel::ForkManager->new(5); my @num = 1 .. 10; my $ok=0; for my $num (@num) { $pm->start and next; ++$ok; print "$ok\n"; $pm->finish; } $pm->wait_all_children;
    I want print 1..10, but it print 1,1,1,1,1,1,1,1,1,1 thanks a lot!
How to parse a file with emails and IP's and output a sorted list with a total count
4 direct replies — Read more / Contribute
by mitzyc
on Jul 28, 2016 at 18:39

    I really need help. I've been trying to code this myself for over 3 hours now, and nothing I do works.

    I have a vpopmail file like this:

    Jul 28 13:42:27 mail vpopmail[47985]: vchkpw-smtp: (PLAIN) login success
    Jul 28 13:42:28 mail vpopmail[47992]: vchkpw-smtp: (PLAIN) login success
    Jul 28 13:42:29 mail vpopmail[47994]: vchkpw-smtp: (PLAIN) login success
    Jul 28 13:42:27 mail vpopmail[47985]: vchkpw-smtp: (PLAIN) login success
    Jul 28 13:42:28 mail vpopmail[47992]: vchkpw-smtp: (PLAIN) login success
    Jul 28 13:42:29 mail vpopmail[47994]: vchkpw-smtp: (PLAIN) login success

    I'm trying to write a routine that reads in this file, sorts the list, and gives a count:
    => (1)
    => (2)
    joe total: 2 unique IP's
    => (1)
    sally total: 1 unique IP's

    I know basic perl. But object oriented programming is something I'm trying to learn, but I just can't seem to get it.

    If I had a working example written like this.. I could understand it better, and then be able to finally get how it works when I see the code.

    The output format doesn't have to be exact.

    I'm hunting to see how many unique IP addresses a person is successfully logging in from and output the counts

    I tried playing with XML::Simple, and gave up when I got this:

    Can't call method "address" on unblessed reference

    #!/usr/bin/perl use XML::Simple; my $xml = new XML::Simple; my $sender = { 'address' => '', 'ips' => ["12.52","13.53","14.54.55"], }; # add another IP to an existing user $sender->address->'' {; ->ips = "16.70.71"; };

    I know I'm screwing up syntax, and all the examples I've been trying to incorporate never seem to work. I'd have a longer code sample if I had it, but I kept erasing my code and trying again, and again, and again.

    This led me to Perl Monks. Please help if you can. :)

    - Mitzy

Crypt() usage
3 direct replies — Read more / Contribute
by fionbarr
on Jul 28, 2016 at 12:04
    Is the 'crypt' function identical on Windows and *nix platforms?

Add your question
Your question:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • 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 about the Monastery: (1)
    As of 2016-07-31 00:34 GMT
    Find Nodes?
      Voting Booth?
      What is your favorite alternate name for a (specific) keyboard key?

      Results (269 votes). Check out past polls.