Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

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
Issues while building Net::SSLeay module on linux and windows
2 direct replies — Read more / Contribute
by narasimp
on Apr 21, 2015 at 07:31

    We have downloaded Net::SSLeay module source from cpan and would like to compile it locally and use it. We are facing issues in two situations.

    We need your suggestions on couple of items: 1) We need to use Net::SSLeay module. We have compiled it on Linux x86_64 box using the following statements: perl Makefile.PL INC=-I”<openssl_path>/include" LIBS=-L” <openssl_path>/lib" This generates a Makefile which doesn’t seem to use –lcrypto option. I want to use this option since we are seeing the following error at the runtime: undefined symbol: X509_EXTENSION_free

    From the below link, it appears that we need to include –lcrypto option. Please help us how to include this option. I tried looking into but could not understand much since I am new to this Makefile.

    2) Secondly, while building on Windows, we need to include openssl_path, but INC= and LIBS= doesn’t seem to work. Openssl libraries are already present in a local directory. Please let us know how to include the path with the #perl option. Your suggestions will be very much appreciated.

perl print to csv
3 direct replies — Read more / Contribute
by bishop2001
on Apr 20, 2015 at 22:06

    Hi, This is what i have at this point. A hash key contains the 3rd element of an array and the value is the other 2 elements of an array
    This is the data i am working on
    12,1427766557, bob
    5,1427766556, bill
    10,1427766555, bob

    my %data;
    open(DATA, "<", "test.csv") or die "Can't open file: $!";
    while (my $row=<DATA>) {
      @$_ = split /(?:,|\s)+/, $row;
      $#$_!=2 ? next : push @{$data{$_->2}}, @$_1,0

    i just need to read this out so that it will look like this. Help please? im hoping to export this as a csv.
             name        name       name
     time    value       value      value
     time    value       value      value

SVG TT Graph
1 direct reply — Read more / Contribute
by artperl
on Apr 20, 2015 at 20:25
    hello monks, i was trying to plot a trend line chart using the subject module. everything is working except when i have more than 1000 data to plot, im getting: Template error: undef error - WHILE loop terminated (> 1000 iterations) i wonder if this is a limitation or if there is any workaround for me to be able to still generate the line chart with more than 1K data.
Ignoring timezones when comparing dates with Time::Piece
2 direct replies — Read more / Contribute
by Anonymous Monk
on Apr 20, 2015 at 19:16
    Hi. I want to take a given date, supplied as a text string in YYY-MM-DD format, and determine if it's >= the current day. I'm having trouble with the timezone handling. The strptime seems to return the result in gmtime. I'm using Time::Piece::Plus to get the current day, but that's in localtime. What's the simplest way to get them both in gmtime, since I really don't care about the time or timezones. Adding a timezone to the strptime format string seems ugly.
    #!/usr/bin/env perl use strict; use warnings; use Time::Piece::Plus; my $today = Time::Piece::Plus->today; my $date = Time::Piece::Plus->strptime("2015-04-20", '%Y-%m-%d'); print "Date: $date tzoffset=", $date->tzoffset, "\n"; print "Today: $today tzoffset=", $today->tzoffset, "\n"; print "Diff: ", ($date - $today), "\n";
    Date: Mon Apr 20 00:00:00 2015 tzoffset=0 Today: Mon Apr 20 00:00:00 2015 tzoffset=-25200 Diff: -25200
How do I go from procedural to object oriented programming?
8 direct replies — Read more / Contribute
by Lady_Aleena
on Apr 20, 2015 at 16:43

    (Jenda corrected me on what my subroutines are. They are procedures not functions. The title of this node and where ever the word, or any derivatives of, function has been changed to procedure.)

    Going from procedural programming to object oriented programming has been on my mind a lot lately. I have been told by a couple of people my code is very close to being OO, however when I gave OO a try the first time, I was told I was doing it all wrong. I would like to see how close I am, but I am having a hard time learning objects because the tutorials I have found start writing code right away. I have yet to find a tutorial which starts with the objective of the objects being written. For example I want...

    Criminal Minds is a 2005 television series which is still running.

    Iron Man is a 2008 film based on comics by Marvel Comics.

    The tutorials also do not show the data being munged up front like...

    They all start right in on the objects, leaving me completely in the dark about what the end goal for the objects is. From above you know my objective and have the data to reference while reading the procedures I wrote to get to my objective. The whole module is here if you would like to see the bigger picture.

    Now putting it all together to get my objective.

    I would like to know how close I am to having objects, what they would look like if I am close, and if there is anything which does not fit into OO. Is there anywhere I need to change my thinking (which will be hard since I have been doing things as above for a long while now)?

    If any of the OO tutorials were written with the objective, data, code, and wrap-up in that order; I might get them.

    Another reason I am doing this is to get my mind off of my pain and impending surgery. I am doing everything I can think of to get my mind off of them and stave off panic. Would you please help me?

    I hope I am not asking too much. Please sit back and enjoy a cookie.

    No matter how hysterical I get, my problems are not time sensitive. So, relax, have a cookie, and a very nice day!
    Lady Aleena
2 txt files comparison and sorting
3 direct replies — Read more / Contribute
by keltan
on Apr 20, 2015 at 13:57
    Hi i've got 2 txt files. 1.
    John, Kowalski, 34267 Eve, Nowak, 11232 Theodor, McNack, 3423
    11232, 5.0 55342, 2.0 3423, 3.5
    What do i need to do is:
    Exam results: 1. Eve Nowak 5.0 2. Theodor McNack 3.5 absent: 1. John Kowalski unidentified: 1. 55342
    As you can see in first text file i've got students with their numbers and in the second one i've got grades and numbers. What i need to do is sth like this:
    #!/usr/bin/perl -w $students = $ARGV[0]; $results = $ARGV[1]; open my $fh, '<', $students; while(<$fh>) { @def = split /,/, $_; chomp(@def1); print "@def"; } open my $fg, '<', $results; while(<$fg>){ @def1=split /,/,$_; chomp(@def1); print "@def1"; } close($fg); close($fh);
    I've written so far this code but i really don't know how to solve this task.
formline, undefined format STDOUT
4 direct replies — Read more / Contribute
by Anonymous Monk
on Apr 20, 2015 at 08:57

    Hi, I want to use formline to format the output, but getting Undefined format "STDOUT" .

    #!/usr/bin/env perl formline( "@<< @<< @<<", '1', '2', '2' ); write;

    Error : Undefined format "STDOUT" called. Need help, whats wrong ?

Printing portugese text in Excel
2 direct replies — Read more / Contribute
by raja567
on Apr 20, 2015 at 05:47

    Hi, I'm trying to print the text "ID Serviço Vantive" in excel sheet using the following code, but in Excel it is getting displayed as "ID Sevio Vantive". The character 'ç' is getting missed, I know it is because of encoding,decoding of characters but tried few ways to fix it and none of them worked. Can anyone help me how to get rid of this problem?

    use Locale::Msgcat; use Number::Localization; use Presentation; use utf8; use Encode ; my $rowCount = 0; my $colCount = 0; my $Field = ""; my $workbook = Excel::Writer::XLSX->new('test.xlsx'); $worksheet = $workbook->add_worksheet(); $worksheet->set_column( 0, 10, 40 ); my $gFmtBold = $workbook->add_format(); $gFmtBold->set_bold(); $gFmtBold->set_size(15); $gFmtBold->set_color('black'); $gFmtBold->set_align('center'); my $normalFmt = $workbook->add_format(); $normalFmt->set_align('center'); my (@outRecord); @outRecord = ("Nome do Produto","ID Serviço Vantive","Motivo","Quantid +ade"); foreach $Field (@outRecord) { $worksheet->set_column($rowCount,$colCount,40); $worksheet->write($rowCount,$colCount,decode('utf8',$Field),$gFm +tBold); $colCount++; }
Difference between dates
4 direct replies — Read more / Contribute
by htmanning
on Apr 19, 2015 at 23:47
    Monks, I have a dateadded field and a lastlogin field in this format 2014-04-15, in a mysql database. I'm trying to subtract one from the other so I can show all records since the lastlogin but not having any luck. Can someone help?


    UPDATE: I found it. This works:

    SELECT * FROM order_details WHERE order_date BETWEEN CAST('2014-02-01' AS DATE) AND CAST('2014-02- +28' AS DATE);
line graph
3 direct replies — Read more / Contribute
by artperl
on Apr 19, 2015 at 23:14

    Hi, I'm getting familiarized with a very cool module, named SVG::TT::Graph. In the example provided. I see the the area under the graph has some opacity. I am not able to figure out & find out how to set this. Also to change the color of the line & the point. Appreciate your help monks...

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 meditating upon the Monastery: (9)
    As of 2015-04-21 12:41 GMT
    Find Nodes?
      Voting Booth?

      Who makes your decisions?

      Results (393 votes), past polls