Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: I want to be a perl web browser -- what are my best options?

by frozenwithjoy (Priest)
on Jun 22, 2012 at 04:43 UTC ( [id://977765]=note: print w/replies, xml ) Need Help??


in reply to I want to be a perl web browser -- what are my best options?

I can't tell you how to be a web browser, but if you are interested in web development, you should take a look at Mojolicious and Dancer. They both are reasonably easy to learn, fun, and pretty full featured web frameworks. They both have guides and tutorials. Mojolicious also has some screencasts which make it nice to get an overview of some of what's possible. There is also Catalyst, some of the developers of which made Mojolicious.
  • Comment on Re: I want to be a perl web browser -- what are my best options?

Replies are listed 'Best First'.
Re^2: I want to be a perl web browser -- what are my best options?
by taint (Chaplain) on Jun 22, 2012 at 05:06 UTC

    Crap. It appears that I didn't explain my request well enough.
    What I'm looking for is a module, of bundle, that permits me to communicate
    with my web server(s), as though I was a web client (browser). Allowing me to
    post (speak) HTTP to the web server. Or, speak in the HTTP protocol. Sending
    request(s) && replies to the server, and seeing it's (servers) response(s).

    I hope this helps clarify my request better, and thank you for taking the time
    to respond.

    use perl::always;
    my $perl_version = "5.12.4";
    print $perl_version;

      LWP::Simple serves most of my (admittedly simple) requirements.

      Even if your requirements are more complicated, it would be a good starting point while you get used to Perlish way.

      Beyond that, there is LWP proper and all it's secure connection extensions. And then WWW::Mechanize and similar beyond that.


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

      The start of some sanity?

        Greetings zentara, and thank you for your reply.
        I see quite a few recomendations for WWW::Mechanize. To tell you the truth
        after posting this question, I went back to work on an old project "docperl",
        that predates that fancy web based version jon allen whipped up. Frankly,
        I like mine better, as it gropes your own server for any/all the modules you already
        have installed, and lists them, as well as producing the pod for viewing. I decided
        it warranted being made public, so I needed to bring it's formatting out of the
        '90's -- can you say Frames/Framesets? :P. Anyway, point being, while using it, I
        discovered I had LWP installed, as a prerequisite for another module I had
        installed. So read up on it, and had figured it to be adequate enough to fulfill my
        needs. But now back here to catch up on "Seekers of Perl Wisdom" posts, you, and
        others in this thread, have really piqued my interest in WWW::Mechanize. After
        glossing over the related link you posted. I'd have to agree, it looks pretty
        nice -- Thanks! :)

        "Perl Web Browser using Gtk2 and WebKit"
        Funny, I just happen to already have both of those installed. I was hoping to get
        some time to explore all that Gtk2 had to offer, so when I noticed it, I
        decided it was a "must have". I'll definitely have a look at that. But alas,
        I'm going to need to get up to speed on WWW::Mechanize. Once I build the
        necessary script(s) || module(s). I'll try and expand on it with the Gtk2
        interface/extension.

        Thanks again, to you, and everyone else, who have taken the time to respond!
        I'll post back to this thread with anything "noteworthy". :)

        use perl::always;
        my $perl_version = "5.12.4";
        print $perl_version;

      Mojolicious also has a HTTP client. There also are Web::Magic and the Mechanize (and WWW::Scripter) family of modules which implement HTTP clients that behave like a web browser to various degrees.

      Personally, I like the API that WWW::Mechanize gives, but none of the modules is inherently bad.

      There is a nice chapter on just this topic in Perl Testing by Lanworth and chromatic (see http://shop.oreilly.com/product/9780596100926.do ) and gives clear examples using WWW::Mechanize. You'll be up and testing in no time.

      To save you some time, here's a couple of hints from my brief experience:

      # check the html on the page - skip this for brevity $mech->page_links_ok(); html_tidy_ok( $mech->content() );
      This does a lot of work in just two little lines.
      $mech->content_contains( 'Sorry, we couldn’t find anything that +matched your search.' );
      This one took me forever to work out how to match the apostrophe. I went with the html entity in the end.

      perl -e 'print qq(Just another Perl Hacker\n)' # where's the irony switch?
      Ah, ok. Well, I'm definitely not an expert on this, so hopefully someone else can help you out. Also, I'm not sure if this is of use, but the things I linked do POST and well as GET, etc.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (9)
As of 2024-04-19 08:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found