Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

[App::scrape] does support RDF.

No, it does not. Accepting XML does not count as supporting RDF. In general, RDF cannot be effectively processed with XML tools.

Web::Magic won't help me "fake" a proper ua_string like WWW::Mechanize , and it has all those exceptions, but no cookie jar?

Web::Magic lets you specify any user agent string you like. The POD for the "set_request_header" method shows two examples of how to do precisely that:

$magic->set_request_header('User-Agent', 'MyBot/0.1'); $magic->User_Agent('MyBot/0.1'); # same as above

And if you have a cookie jar you'd like to use:

$magic->user_agent->cookie_jar($cookies);

HTML::Query, Web::Query, Web::Scraper, Web::Magic ... a lot of the same kind of work, which horse to choose?

Sell me a horse?

Selecting stuff via CSS selectors is only a very small part of what Web::Magic does. (I almost regret using that feature in my first example.) Web::Magic aims to be the swiss army knife of HTTP-addressable resources. Whether it's a classic web page, a RESTful API, an Atom feed, or a WebDAV fileshare, Web::Magic can probably make dealing with it easier.

Let's suppose you have a RESTful API which supports up XML and JSON, depending on the request's HTTP Accept header. Web::Magic notices how you're trying to access the data, and does what you mean...

Web::Magic->new('http://example.com/new-document') ->POST($xmldom) ->{entry}{id};

It's smart enough to figure out the HTTP headers you want:

POST /new-document HTTP/1.1
Host: example.com
Content-Type: application/xml
Accept: application/json, text/x-yaml

<xmldoc>...</xmldoc>

But if you'd called it like this:

my @entries = Web::Magic->new('http://example.com/new-document') ->POST({ title => "Hello", foo => 1 }) ->entries; print $entries[0]->id;

Then the request would be more like:

POST /new-document HTTP/1.1
Host: example.com
Content-Type: application/x-www-form-urlencoded
Accept: application/atom+xml, application/rss+xml

title=Hello&foo=1

In reply to Re^4: Web::Magic 0.005 by tobyink
in thread Web::Magic 0.005 by tobyink

Title:
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!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • 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
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            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?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others surveying the Monastery: (8)
    As of 2020-03-30 14:18 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      To "Disagree to disagree" means to:









      Results (175 votes). Check out past polls.

      Notices?