Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

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
Memory needed for perl process
1 direct reply — Read more / Contribute
by bsshetty17
on Jun 23, 2017 at 02:26

    Hi Monks, 2 quick questions. 1) What is the minimum memory required to start a perl process? 2)I need to install following cpan modules in HP_UX: \t Text::CSV_XS; \t SOAP::Lite; \t XML::Twig; \t Config::IniFiles; \t Parallel::ForkManager; Informatica is also installed in the same server. Informatica administrator is not agreeing to install the modules saying, It causes the informatica performance degradation. Can any one help to defend this? Thanks,

mod_perl best practices to increment XML payload
1 direct reply — Read more / Contribute
by glasswalk3r
on Jun 22, 2017 at 17:23

    Hello monks,

    I've being studying mod_perl in the past to implement a project that uses Apache as a reverse proxy, receives a SOAP request, modifies the payload (XML), handles it to the real web application, and returns back the response to the requester.

    What is the best practice in this case? I checked out Apache::ReverseProxy, but it defines a full handler and I'm guessing that using a Input or Output filter handler would be a better option (based on my readings of mod_perl2 User Guide book) combined with the standard Apache modules proxy and proxy_http to avoid reinventing the wheel.

    PS: I know mod_perl2 is not the "sexiest" framework at the moment, but I want to take advantage of already having it available on particular web servers by default.

    Thanks!

    Alceu Rodrigues de Freitas Junior
    ---------------------------------
    "You have enemies? Good. That means you've stood up for something, sometime in your life." - Sir Winston Churchill
Not able Login into webpage which use javascript while load
3 direct replies — Read more / Contribute
by trahulprajapati
on Jun 22, 2017 at 11:17

    Hi Monks I'm trying to login to a website which is using javascipt while loading. I have tried with WWW:Machanize but it is not working as WWW:Machanize not support javascript. Webpage is dynamically creating the login form as we have different option for login by selecting radio button. By simple view code it is not showing form form ,that means while loading the page it is calling javascript function and from in function form is loading. WWW:Machanize is not support javascript so is there any way by which i can login to site? I we cannot use WWW:Machanize::Firefox ,WWW::Scripter etc.. is there any way through which we can login by WWW:Machanize or somthing else? I have tried the following code:

    use strict; use warnings; use LWP::UserAgent; use WWW::Mechanize; my $login_url = 'abc.xyz.com'; my $username = "abc"; my $password = "xyz123"; my $mech = WWW::Mechanize->new(); $mech -> cookie_jar(HTTP::Cookies->new()); $mech -> get($login_url); $mech->submit_form( with_fields => { "userid" => $username, "authmethod" => 'on', "username" => $username, "login-form-type" => 'pwd', "password" => $$password }, button => "btnSubmit", ); $mech->save_content('out1.txt');
Pattern match and splitting of that
5 direct replies — Read more / Contribute
by Nansh
on Jun 22, 2017 at 09:29
    Hi My string looks like below

    RABBIT 45 -126.06686

    my output should be like 1)RABBIT 2)45 3)-126.06686

    #!usr/bin/perl use strict; use warnings; my $string="RABBIT 45 -126.06686"; (my $temp1)=$string=~ /^(\w+)\s+/; (my $temp2)=$string=~ /^\s+/(\d+)/; (my $temp3)=$string=~ /^(.*)\s+(\d+)\s+$/;
    I am not able to get -126.06686. Thank you.
Pulling from a list and inserting into XML documents
3 direct replies — Read more / Contribute
by gng4life
on Jun 22, 2017 at 09:25
    Hello All, First post so go easy on me. I'm getting back into Perl after not touching it for years so I am like a noob. This is what I need to do. I have text file A that three fields, for example IP address, MAC, hostname, and there about 200 of them, comma separated (I can change this to a csv or whatever if easier). I have about 200 XML documents that I need to search for tags and enter those three fields above into that section, save it, open the next document and enter the same three fields, save, repeat for all docs. Here is an example:
    File A hosta,1.1.1.1,00000C123456, hostb,2.2.2.2,00000C123457, hostc,3.3.3.3,00000C123458, hostd,4.4.4.4,00000C123459, etc...(about 200 items, will have more later) File 1 . <HOST_NAME></HOST_NAME> <HOST_IP></HOST_IP> <HOST_MAC></HOST_MAC> . . File 2 . <HOST_NAME></HOST_NAME> <HOST_IP></HOST_IP> <HOST_MAC></HOST_MAC> . . File 3 . <HOST_NAME></HOST_NAME> <HOST_IP></HOST_IP> <HOST_MAC></HOST_MAC> . . After all the docs are done, they will look like this... File 1 . <HOST_NAME>hosta</HOST_NAME> <HOST_IP>,1.1.1.1</HOST_IP> <HOST_MAC>00000C123456</HOST_MAC> . . File 2 . <HOST_NAME>hostb</HOST_NAME> <HOST_IP>,2.2.2.2</HOST_IP> <HOST_MAC>00000C123457</HOST_MAC> . . etc.
    I have portable strawberry Perl right now on my work computer. If it would be easier to do it in ActivePerl or in Strawberry Perl installed version, let me know and I can spin it up on another workstation. So what is the best way to do this? Thanks for any help!
CPAN Installation of Perl Packages Fails
1 direct reply — Read more / Contribute
by m_jaser
on Jun 22, 2017 at 00:39

    Hello Perl Monks

    I've been trying to install some perl packages via CPAN but its failing, see the examples below for your reference. Can you please advise how can I successfully install these packages?

    [~]$ cpan -f -i Device::SerialPort Going to read '/home/emarwja/.cpan/Metadata' Database was generated on Thu, 22 Jun 2017 02:17:02 GMT Running install for module 'Device::SerialPort' Running make for C/CO/COOK/Device-SerialPort-1.04.tar.gz Checksum for /home/emarwja/.cpan/sources/authors/id/C/CO/COOK/Device-S +erialPort-1.04.tar.gz ok CPAN.pm: Going to build C/CO/COOK/Device-SerialPort-1.04.tar.gz To enable serial port tests, use: perl Makefile.PL TESTPORT=<DEVICE> where <DEVICE> is a specific port or 'auto' to autodetect. Running ./configure ... checking for gcc... no checking for cc... no checking for cl.exe... no configure: error: no acceptable C compiler found in $PATH See `config.log' for more details. The 'configure' script didn't like something. It should have told you what went wrong, but you can check 'config.log' for more details. Warning: No success on command[/usr/bin/perl Makefile.PL] COOK/Device-SerialPort-1.04.tar.gz /usr/bin/perl Makefile.PL -- NOT OK Running make test Make had some problems, won't test Running make install Make had some problems, won't install Could not read metadata file. Falling back to other methods to determi +ne prerequisites [~]$

    [~]$ cpan -f -i NET:TELNET Going to read '/home/emarwja/.cpan/Metadata' Database was generated on Thu, 22 Jun 2017 02:17:02 GMT Warning: Cannot install NET:TELNET, don't know what it is. Try the command i /NET:TELNET/ to find objects with matching identifiers. [~]$ [~]$ cpan -f -i NET:SSH Going to read '/home/emarwja/.cpan/Metadata' Database was generated on Thu, 22 Jun 2017 02:17:02 GMT Warning: Cannot install NET:SSH, don't know what it is. Try the command i /NET:SSH/ to find objects with matching identifiers. [~]$
An overlapping regex capture
2 direct replies — Read more / Contribute
by Peter Keystrokes
on Jun 21, 2017 at 15:18

    Hi there,

    I have a script which extracts sequences from a file containing thousands of fasta sequences and creates separate files for each of them.

    Here is my script:

    #!/usr/bin/perl use strict; use warnings; my %id2seq = (); my $id = ''; open File,"human_hg19_circRNAs_putative_spliced_sequence.fa",or die $! +; while(<File>){ chomp; if($_ =~ /^>(.+)/){ $id = $1; }else{ $id2seq{$id} .= $_; } } foreach $id (keys %id2seq){ if (-f $id){ print $id." Already exists, about to override it","\n" } open my $out_fh, '>>', "$id.fa" or die $!; print $out_fh (">".$id."\n",$id2seq{$id}, "\n"); close $out_fh; } close File;

    Now, the human_hg19_circRNAs_putative_spliced_sequence.fa file which I am working on contains sequences as such:

    >hsa_circ_0000001|chr1:1080738-1080845-|None|None

    ATGGGGTTGGGTCAGCCGTGCGGTCAGGTCAGGTCGGCCATGAGGTCAGGTGGGGTCGGCCATGAAGGTGGTGGGGGTCATGAGGTCACAAGGGGGTCGGCCATGTG

    My script captures each sequence header as the key of a hash and captures the sequence itself as the hash. But the problem is that I want to name the files with only a part of the $id and not the whole of it i.e. hsa_circ_0000001.

    Is there a simple way to do this? Or do I have to create a new hash to extract filenames?

    Pete.

from txt file to array
6 direct replies — Read more / Contribute
by WisDomSeeKer34
on Jun 21, 2017 at 15:01

    I have raw data like this:

    Washington
    New York
    Louisiana
    Georgia
    Texas
    Iowa
    etc.

    and I want to turn it into an array:
    qw (Washington, New York ....);

    I can do it manually but it is a fuzz to do it every time.
    Is it perhaps possible with while (< DATA >)? How to input raw data into a perl script?

using a 'here' doc to build a web page
3 direct replies — Read more / Contribute
by Anonymous Monk
on Jun 21, 2017 at 11:23
    I am constructing a web page by first defining variables which are extrapolated in the 'HERE' document. I am creating a HTML file by printing the 'HERE' document. It seems to be working OK. Is this a valid approach?
Win32::GUI - error adding a bitmap in button
3 direct replies — Read more / Contribute
by levW
on Jun 21, 2017 at 10:55

    Win32::GUI - error adding a bitmap in button:

    my @bitmap; my $path1 = "reload-page.jpg"; my $icoImage = new Win32::GUI::Bitmap($path1) || warn "bitmap:$!\n"; push(@bitmap, $icoImage); $buttons->{$counters1} = $main->AddButton(-name =>"ReloadUsers", -text + => "ReloadUsers",-font => $font13,-pos => [ 600, 101 ], -onClick => sub {&ReloadUsers});

    Getting an error: bitmap:Bad file descriptor....

    Will appreciate any help


Add your question
Title:
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?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    [Lady_Aleena]: Bw, happy Turing day!

    How do I use this? | Other CB clients
    Other Users?
    Others studying the Monastery: (7)
    As of 2017-06-23 09:26 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      How many monitors do you use while coding?















      Results (539 votes). Check out past polls.