Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

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
soap parsing
2 direct replies — Read more / Contribute
by natxo
on Dec 01, 2015 at 18:04
    for Zimbra ( there is an admin soap interface we can (ab)use to provision user accounts. Unsurprisingly there is a cpan module to help us with it: I am a bit puzzled though on how to get to the info:
    use ZCS::Admin; + + my $zimbra = ZCS::Admin->new( + proxy => 'https://host.domain.tld7071/service/admin/soap/', name => 'admin', + password => 'password', + ); + + die ZCS::Admin->faultinfo($zimbra) if !$zimbra; + + my $accountinfo = $zimbra->getaccount( name => "username\@domain\.tld" + ); print $accountinfo, "\n";
    This gives me an xml document like this:
    <GetAccountResponse xmlns="urn:zimbraAdmin"><account name="user@domain +.tld" id="0cf5bb57-a2e8-4e3a-9c3a-ce40d13446db"><a n="zimbraPrefCalen +darReminderMobile">FALSE</a><a n="zimbraPrefIMLogChats">TRUE</a><a n= +"zimbraDeviceLockWhenInactive">FALSE</a><a n="zimbraPrefFileSharingAp +plication">briefcase</a><a n="zimbraPrefCalendarWorkingHours">1:N:080 +0:1700,2:Y:0800:1700,3:Y:0800:1700,4:Y:0800:1700,5:Y:0800:1700,6:Y:08 +00:1700,7:N:0800:1700</a><a n="zimbraFeatureOutOfOfficeReplyEnabled"> +TRUE</a><a n="zimbraPrefCalendarViewTimeInterval">1h</a><a n="zimbraP +refComposeFormat">html</a><a n="zimbraPrefIMNotifyStatus">TRUE</a><a +n="zimbraPrefLocale">nl</a><a n="zimbraQuotaWarnPercent">90</a><a n=" +givenName">User</a><a n="zimbraPrefIMReportIdle">TRUE</a><a n="zimbra +MailHost">host.domain.tld</a><a n="zimbraFeatureMailForwardingEnabled +">TRUE</a><a n="zimbraPrefSaveToSent">TRUE</a><a n="zimbraPrefDisplay +ExternalImages">FALSE</a><a n="zimbraPrefOutOfOfficeCacheDuration">7d +</a ...... </account></GetAccountResponse>
    What is the best way to get to the info? Thanks in advance?
Multiple Perl files sharing a single socket - is it possible/sensible?
3 direct replies — Read more / Contribute
by ljamison
on Dec 01, 2015 at 16:52

    Greetings Monks! I'm new as a user but not new to PM or programming (it has helped countless times in recent weeks during some tough projects!) and I am hoping that the wealth of knowledge here can assist with a problem I can't seem to wrap my head around!

    I am trying to create workflow of sorts which uses socket connections to relay extracted MySQL data from localhost to LAN server and vice versa. I was successfully able to create each individual .pl file (8 files in all) and extract information through each file as necessary.

    The part I am stuck on regards the actual socket connection for them to relay the data to the server. My concern is creating a bottleneck of sorts if (in the worst case scenario) all 8 files were to try sending data over the socket at the same time. Is it possible/sensible to create a separate file just containing socket information and allow that socket file to handle the relay for all files? If so, how could it be achieved? Is there another method that makes more sense?

Trouble with DBIx::Class
1 direct reply — Read more / Contribute
by digger
on Dec 01, 2015 at 15:15

    Hello Monks,

    I've been asked to take on a project to import a number of xml files into a database. The data model is not great and I think it is a problem for DBIx::Class.

    Let's say we have 3 tables, A, B and C. B and C reference A and C references B. When DBIx::Class generates the sql to insert a record for this design it will leave off one of the foreign keys. Most often, it is the foreign key that is accessible through the relationship instead of directly.

    I know the db layout isn't great, but it is what I was given and I don't have the luxury of changing it at this point. Is this an issue with DBIC? Is it too smart to work with ugly db designs?

    I appreciation any insight.

How to match more than 32766 times in regex?
3 direct replies — Read more / Contribute
by rsFalse
on Dec 01, 2015 at 13:21
    Included scripts did not encrypt using pp
    2 direct replies — Read more / Contribute
    by jowe
    on Dec 01, 2015 at 11:50

      Hello PerlMonks, I am using

      • PAR::Packer 1.028
      • Filter::Crypto 2.07
      in a 'Windows 7 (32bit)', 'Strawberry' environment.

      The task: pp should produce an encrypted executable 'foo.exe' from multiple source files using the following command:

      pp -f Crypto -M Filter::Crypto::Decrypt -o foo.exe
      '' includes other files (, via 'do'-statements.

      foo.exe as an interactive program is being build and executed without any problems. However, during execution I had a closer look at the temporary runtime directory structure. I found, that '' is encrypted whereby the other '.pl'-files ( and are not encrypted at all.

      Could you please advise, what to do to have all '.pl'-files encrypted.

      Thank you very much for your help - Jo
    Create a desktop icon for perl program in ubuntu?
    2 direct replies — Read more / Contribute
    by yedukondalu
    on Nov 30, 2015 at 23:27

      Hi.. I am trying to create a desktop icon for my perl program wrirren in perl Tk module.I tried creating using .desktop file..But it is not working.

      [Desktop Entry] Version=1.0 Name=hotel Exec=perl /home/yathayed/yedukondalu/programs/perl/advanced/tk/hotel_b Path=/home/yathayed/yedukondalu/programs/perl/advanced/tk Terminal=false Type=Application Categories=Utility;Application;Development;
    question about variables from new perl user
    5 direct replies — Read more / Contribute
    by rst
    on Nov 30, 2015 at 17:33
      Hello, I'm new to perl, but not programing. I'm playing with fetching data from web pages. I have a simple program:
      use warnings; use LWP::Simple; my $url = ''; my ($t1, $t2, $t3, $t4, $t5)=head($url) or die 'Unable to get page +'; my $temp = head($url) or die 'Unable to get page'; print Dumper($temp,$t1, $t2, $t3, $t4, $t5); print "done\n"; exit 0;
      Note, this question is about the particular code snippet, but even more it is about understanding variables in Perl. I used $t1 - $t5 because the documentation said that head() returns a list. $temp contains a lot of information, $t1, - $t5 contain only a very little. How would I get something like the return code (_rc) or the etag header, or the user agent? My first instinct (which seems to be wrong) would be to treat this like an associative array and try
      $temp['headers']['etag'] and $temp['_rc'] and $temp['_request']['_headers']['user-agent']
      I would like to understand this. Any help would be appreciated.
    Dynamic interpolation in a string with a scalar variable?
    4 direct replies — Read more / Contribute
    by nysus
    on Nov 30, 2015 at 15:54
      I was trying to figure out if it was possible to modify a string by changing the value of an interpolated scalar variable inside the string after the string is declared. The following bit of code doesn't work but illustrates what I'm trying to achieve:
      my $variable = 3; my $string = "Variable: ${\$variable}\n"; print $string; #results in "Variable: 3" $variable = 4; print $string; #still results in "Variable: 3" but I'd like it to result in "Variable +: 4"

      $PM = "Perl Monk's";
      $MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon";
      $nysus = $PM . $MCF;
      Click here if you love Perl Monks

    Merging Data into one array
    5 direct replies — Read more / Contribute
    by Anonymous Monk
    on Nov 30, 2015 at 15:10
      Hi there Monks!

      I am trying to merge these two arrays only if the acc matches, can any one tell me what could be the best way to do this?
      #!/usr/bin/perl use strict; use warnings; use Data::Dumper; my $data1 = [ { 'NAME' => '1PAUL DY', 'DATE' => '12009-05-05', 'NUMBER' => '100001', 'ACC' => '1A1A', }, { 'NAME' => '2PAUL DY', 'DATE' => '2011-01-05', 'NUMBER' => '200331', 'ACC' => '2A3B', }, { 'NAME' => '4PAUL DY', 'DATE' => '42011-01-05', 'NUMBER' => '4200331', 'ACC' => '6A4B', }, ]; my $data2 = [ { 'EXT1' => '1b', 'EXT2' => '12b', 'EXT3' => '13b', 'EXT4' => '14d', 'ACC' => '1A1A', }, { 'EXT1' => '2b', 'EXT2' => '2b', 'EXT3' => '2b', 'EXT4' => '2d', 'ACC' => '2A3B', }, { 'EXT1X' => '4b', 'EXT2X' => '4b', 'EXT3X' => '4b', 'EXT4X' => '4d', 'ACC' => '4A4B', }, ]; # Merge all the data my @all_data; foreach my $one_data ( @{ $data1 } ) { my $sec_data = shift @{ $data2}; push @all_data, { %{ $one_data }, %{ $sec_data } }; } print Dumper \@all_data;

      Thanks for the help!
    Bioinformatics program writing question
    3 direct replies — Read more / Contribute
    by Theworldarriving
    on Nov 30, 2015 at 14:52
      This is the approach I would like to take. I have 5 mitochondrial dna sequences. I would like to run a loop (I'm not sure how to do this) to see which one is most similar to the mtdna of It will print this result. Tympanuchus cupido cupido is the bird I'm trying to compare the other mtdna to. Then, I would like to swap the mtdna of the Heath Hen to the closest relative. Google Drive
      #!/usr/bin/perl use strict; use warnings; # we are going to run a loop the mtdn subspecies of the prairie hen to + Tympanuchus cupido cupido to see which one is most similar percentwi +se. Then we will select the closest relative and the nucelotides with + heath hen mtdna. # What do I do next?

    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 exploiting the Monastery: (4)
    As of 2015-12-02 01:37 GMT
    Find Nodes?
      Voting Booth?

      My keyboard shows this many letters:

      Results (31 votes), past polls