-1

Is any other modules is in perl to extract the webpage content other than LWP modules? I wanted to read a web page content in perl without using any LWP modules.

Thanks, Krishna

Krishna
  • 7
  • 1
  • 2
    Sure, you could hit port 80 and issue a GET command, but you probably aren't allowed to use IO::Socket either :) – Paul Alan Taylor Nov 07 '12 at 11:32
  • 1
    You're looking for "other modules" aside from LWP and others within the LWP::* namespace to do what the LWP and LWP::* modules do? Perhaps you could explain what it is about LWP and the LWP::* modules that prevent you from using them so that we can understand what other tools to direct you toward. If the only criteria is that the module not be named LWP::*, just rename the module. – DavidO Nov 07 '12 at 12:03
  • I am trying to read a webpage content which is internal to my organisation. I have used LWP::UserAgent module to read web page content which worked well when i execute script from command line(Here owner of executing script is my id(i.e.my name itself)). Actually I have to run the script through scheduling job, here my script is failing , because when script is scheduled the userid changes. This is the restriction i have. So, wanted to know modules (or any code) other than LWP to read a web page content. – Krishna Nov 07 '12 at 12:15
  • That doesn't make sense. What kind of id are you talking about? How is it failing? Please update your post to show an error message. I don't think your problem lies with LWP. – simbabque Nov 07 '12 at 12:22
  • I am getting following error message :: Can't call method "getFullName" on an undefined value at functions.pl line 83, line 283, I am not sure, functions.pl script is internal to LWP module or related to webpage which i am trying to read webpage content. When script is executed from command line, its able to get my shortid's full name and executed successfully. But when i execute the script using scheduled job, it is not able to get the scheduled job id's Fullname i.e. not to able to get any result when "getFullName" function is called. So, script is failing. – Krishna Nov 07 '12 at 12:40
  • That is why i wanted to know differnt way of reading webpage content. – Krishna Nov 07 '12 at 12:41
  • 1
    Although there are good alternatives (see the answers below) maybe you should try to debug your script (with our help). Reduce it to a minimal failing example and post it with a good problem description. – memowe Nov 07 '12 at 12:55

2 Answers2

2

HTTP::Tiny

Dependencies:

bytes Carp IO::Socket strict Time::Local warnings

abbypan
  • 158
  • 1
  • 11
1

A very powerful alternative is contained in Mojolicious as part of the web framework. There's a UserAgent which works pretty good together with the DOM parser.

See this answer with a small real world example.

Community
  • 1
  • 1
memowe
  • 2,656
  • 16
  • 25