Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: problem web xml file

by sunja (Initiate)
on Jul 01, 2012 at 22:15 UTC ( #979345=note: print w/replies, xml ) Need Help??


in reply to problem web xml file

hmm well I got it worked out I think. thanks for all the help!

sub g_zip { my $file = $_; my $data; my $ptr = new IO::Uncompress::Gunzip($file) or die $!; while (defined (my $line = $ptr->getline())) { $data .= $line; } $ptr->close(); return $data; }

Replies are listed 'Best First'.
Re^2: problem web xml file
by ig (Vicar) on Jul 02, 2012 at 05:51 UTC

    There's nothing wrong with unzipping it yourself, but another option is to use LWP::UserAgent and let it handle the decoding.

    #!C:/strawberry/perl/bin/perl.exe # use strict; use warnings; use LWP::UserAgent; my $url = 'http://atys.ryzom.com/api/character.php?key=FR521366R0REA16 +F998&part=items'; my $ua = LWP::UserAgent->new(); my $response = $ua->get($url); if($response->is_success) { print $response->decoded_content; } else { die $response->status_line; }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://979345]
help
Chatterbox?
[msh210]: perl -e'warn "test$/", "" '
[msh210]: doesn't append anything.
[msh210]: It should say "If the last nonempty element of LIST" or "If the string thus to be printed does not end in a newline""
[msh210]: Am I wrong?
[shmem]: no. You're right.
[msh210]: About time... last time I was right was... I don't even remember when.
[shmem]: perl -e 'warn "test$/", ^@^ '
[Eily]: well, at least it's right about warn doing the same thing as die :)
[shmem]: same with undef as last element
[msh210]: oh, good point. It's the best kind of correct

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (19)
As of 2017-04-24 12:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (439 votes). Check out past polls.