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

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
XML::Twig and file encoding
No replies — Read more | Post response
by slugger415
on Jul 30, 2014 at 13:33

    Hello, another XML::Twig question. My original files are UTF8 encoded, but after I run my script they are ANSI encoded. Special characters such as German small sharp s ( ß when encoded) still appear in the output, but don't display properly in my XML editor.

    I've set keep_encoding, which does save the file in UTF8, but produces some odd character strings and spacing.

    Any thoughts on this? thanks as always, Scott

Keeping browser active while computing in Perl/CGI
2 direct replies — Read more / Contribute
by vit
on Jul 30, 2014 at 10:26
    Dear Monks
    I am using Perl/CGI for my web application. It performs computation for 20 minutes or so. The browser does not keep session for such a long time and turns to some dummy page.
    Is there anything to keep it on my page till the end of computations?
Perl/Tk problems with PNG transparence
1 direct reply — Read more / Contribute
by wmfs
on Jul 30, 2014 at 08:50
    Having created PNG images of playing cards and used GIMP to 'transparent' curved corners, I having problems with Perl/Tk failing to allow the background to be shown in these 'transparent' areas, instead I am seeing four white areas. There is now problem is displayed in HTML: (my HTML code is not showing correctly so for imgage please read img.)


    <body bgcolor="#E6E6FA">

    <imgage src="Cards/00.png">

    <imgage src="Cards/20.png">

    <imgage src="Cards/50.png">

    ...... etc (see:- but the 'failing' code, of the form:
    $Card_Back = $main->Photo( '-format' => 'png', -file => $dir . "Cards/00.png");
    produces this type of display: Thanks for any help, Bill
run in-program shell script under windows using cygwin
4 direct replies — Read more / Contribute
by sandy105
on Jul 30, 2014 at 07:02

    i am trying to write a program which calls shell scripts using cygwin on windows , but it give me dialog box for "open file with " for the shell can can i make it run under existing environment


    $path = "/old/"; $command ="$path"; system $command; my $output = qx/ /;
How can I create MS Word 2013 documents using Perl?
3 direct replies — Read more / Contribute
by shajiindia
on Jul 30, 2014 at 03:54
    Dear Monks,

    I am using Microsoft Word 2013 and I tried to download the module "Win32::Word::Writer" but can't get things right.

    Is there any Perl module to create Word 2013 documents which I can make use of?

    I am using Strawberry Perl Version 5.20 on Windows 8.1

    Please help.
Direferencing problem
6 direct replies — Read more / Contribute
by David92
on Jul 30, 2014 at 03:20
    Hey Monks,

    I got a problem with my PERL program, more specific with direferencing. I think I got confused, because first I have to direference it into a Hash, then it says, it contains array elements, then again, hash elements. But let me ask you, what do you think.

    $artfList = $ctf->PlanningAp->getArtifactListInPLanningFolder($session +,$parent,$filters,$recursive); %artfList =%$artfList; foreach $element (keys %artfList){ print "$element\n"; #outpus is: dataRows print "$artfList{dataRows}\n"; #output is: ARRAY(0x2139d) } @Array = @{$artfList{dataRows}}; foreach $element (@Array){ print "$element\n"; # output is: ArtifactsInPlanningFolderSoapRow += HASH(0x3a3acf0) }

    And here is where I got stucked. What I notice is, that there's again a HASH reference. How to direference that array now back to hash?

    This procedure should return me Artifact List (artf000,artf001,etc). The procedure is taken from online notes and that's how the return value is described.

    There are NO syntax errors if you might find ones in the above code, since I typed it over and not copy pasted!


    Alot of infromation from the Database that I am trying to access, it's even too much to copy and some information of company I'd rather not display. But I dont know how to access elements, I'll try to retype structure:

    bless( { 'priority' => '1', 'id' => 'artf0000', 'category' => 'V0B' }, 'ArtifactsInPlanningFolderSoapRow' ) # and it

    Hope you guys can scrumble through this. The above code repeats itself for each different artifact.

    Please assist me,


Issue with Redirect
1 direct reply — Read more / Contribute
by ndhaundiyal
on Jul 30, 2014 at 01:17

    Hi, I am having a perl module that detects the device and adds mobile/desktop (e.g., /homepage.html -> /homepage.desktop.html or / the url and sends it back to apache to process the same. Now, whenever apache processes the request it shows desktop/mobile in the extension part in the browser which I want to hide. Below is the code snippet that is doing the mentioned task for me.

    if ($model_group) { splice @uri_elements, 1, 0, $model_group; my $new_uri = join('.', @uri_elements); debug("New URI: ", $new_uri); $r->uri($new_uri); }
perlbrew is broken
4 direct replies — Read more / Contribute
by lcarter
on Jul 29, 2014 at 23:32

    My perlbrew is broken after upgrading from xubuntu 13.10 to xubuntu 14.04.

    The $PATH variable now contains just this entry: /home/lcarter/perl5/perlbrew/bin:/home/lcarter/perl5/perlbrew/perls/perl-5.16.3/bin

    I then manually added the contents of the /etc/environment to the $PATH variable.

    Now I am getting this: Can't locate App/ in @INC

    I do have in /usr/local/share/perl/5.14.2/App/

    I would greatly appreciate your help.

SOAP::Lite additional namespace
1 direct reply — Read more / Contribute
by montaseri
on Jul 29, 2014 at 20:03
    How do I add additional namespaces to the Envelope or Method of a SOAP request? I currently have:
    <soap:Envelope soap:encodingStyle="" xmlns:soap="" etc > <soap:Body> <myMethod xmlns="http://www/xyz">
    I need to either add another xmlns to the method/operation or add it to the envelope. For example, I'd like the method to look like
    <myMethod xmlns="http://www/xyz" xmlns="http://abc">
    I can not figure out how to do that from SOAP::Lite doc
Including modules and pragmas in caller's scope via use
2 direct replies — Read more / Contribute
by wanna_code_perl
on Jul 29, 2014 at 16:49

    Hello monks,

    I already have several Local::... modules that do things too specific for general public consumption. Now I have a "smaller" problem:

    Like many programmers, I have an ever-growing repository of useful subroutines that are either too isolated or too simple to (yet...) merit their own module (in the Local:: module namespace or otherwise). I also have a list of modules and pragmas I use in almost every script. However, these are things I'd like to have available in most of my internal-use scripts.

    The subroutines? Easy. Just pile them in a new module (say, Local::Junk and @EXPORT them by default (or with Exporter::Easy and qw(:all) if I'm feeling extra pedantic...).

    But I don't know how to the other modules (and pragmas) that I'd like to include by default whenever I use Local::Junk, such as List::Util, autodie, etc.

    In other words, I'd like to be able to simply do something like this:

    use Local::Junk qw(:all);

    Instead of:

    use strict; use warnings; use autodie; use List::Util qw(first max maxstr min minstr reduce shuffle sum); # etc...

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!
  • 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
  • Outside of code tags, you may need to use entities for some characters:
            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 perusing the Monastery: (14)
    As of 2014-07-30 18:16 GMT
    Find Nodes?
      Voting Booth?

      My favorite superfluous repetitious redundant duplicative phrase is:

      Results (239 votes), past polls