Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

From text to csv with Text::CSV_XS

by Perlbeginner1 (Scribe)
on Oct 05, 2012 at 10:04 UTC ( #997427=perlquestion: print w/ replies, xml ) Need Help??
Perlbeginner1 has asked for the wisdom of the Perl Monks concerning the following question:

hello dear perl-fans


first of all - many thanks for the help. you helped me alot so far...


well i was running a script (see below) gave back the following;
linux-wyee:/home/martin/perl # perl kath_test_1.pl Loostown Ledochowskastra�e 4 3382 Loosdorf Telefonnummer: 027 +54 6257 FAX-Nummer: 02754 6257-4 linux-wyee:/home/martin/perl # the script below gives back result like this one; Loostown Ledochowskastraße 3382 Loostown Telefonnummer: 0002754 6257 FAX-Nummer: 0002754 6257-4
see more results:
Marias Neustift Neustift 28 4443 Maria Neustift Telefonnummer: 007250/ +204 FAX-Nummer: 07250/204-4 E-Mail: prre.marianeustift@dioezese-linz. +at <bMarias Puchheim Gmundner Stra&#65533;e 1b 4800 Attnang-Puchheim Tele +fonnummer: 007674/62334 FAX-Nummer: 07674/62334-4 E-Mail: prre.mariap +uchheim@dioezese-linz.at Marias Scharten Scharten 1 4612 Scharten Telefonnummer: 007272/5210 Marias Schmolln Maria Schmolln 2 5241 Maria Schmolln Telefonnummer: 00 +7743/2209-12 FAX-Nummer: 07743/2209-17 E-Mail: prre.mariaschmolln@dio +ezese-linz.at Mattighofen R&#65533;merstra&#65533;e 12 5230 Mattighofen Telefonnumme +r: 007742/2273 0676/87765221 FAX-Nummer: 07742/2273-22 E-Mail: peipfa +rre.mattighofen@dioezese-linz.at Mauerkirchens Pfarrhofstra&#65533;e 4 5270 Mauerkirchen Telefonnummer: + 007724/2262

note: the results should be stored in a csv formatted way...



for 1. therfore i did the changes: changed the $max_page_num to the max number and change $page to the starting number. this will only print the data to stdout (console)



now i am trying to modify it... :-)

well i have to put it to the CSV-values.

usually this can be done with use Text::CSV_XS (where the Class::CSV is based on). Note: A friend also suggested me using Text::CSV which will load up Text::CSV_XS or,

Well at the moment all the results will only print the data to stdout (console) im sure that i can modify it... :-)

i just installed the Text::CSV_XS took it from here: http://search.cpan.org/~hmbrand/Text-CSV_XS-0.91/CSV_XS.pm



how to combine the mechanize script with the one that takes care for the text-to-csv-transformation.

Comment on From text to csv with Text::CSV_XS
Select or Download Code
Re: From text to csv with Text::CSV_XS
by Perlbeginner1 (Scribe) on Oct 05, 2012 at 10:27 UTC
    by the way


    there has to be some sanitizing as well..

    there has to be some iso 8859 sanitizing....


    use Text::CSV::Encoded; my $csv = Text::CSV::Encoded->new ({ encoding_in => "iso-8859-1", # the encoding comes into Perl encoding_out => "cp1252", # the encoding comes out of Perl



Re: From text to csv with Text::CSV_XS
by marto (Chancellor) on Oct 05, 2012 at 15:17 UTC

    Should you really be dumping these details here? This looks like Address and contact details. You're also asking the same question in other places here for example.

    "Well at the moment all the results will only print the data to stdout (console) im sure that i can modify it... :-)"

    Uh huh?

    "i just installed the Text::CSV_XS took it from here: http://search.cpan.org/~hmbrand/Text-CSV_XS-0.91/CSV_XS.pm"

    We've been over this before, it's even displayed each time you post: What shortcuts can I use for linking to other information?.

    So this is related to your previous posts regards scraping thousands of websites using WWW::Mechanize? As you've found out, simply installing a module isn't going to make the code you need to integrate the required functionality with your previous scripts. Try reading the documentation, writing some code. See my previous response.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://997427]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2014-10-22 06:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (114 votes), past polls