[Denver-pm] Denver-pm Digest, Vol 13, Issue 1

Jon three18ti at gmail.com
Tue Aug 26 14:11:36 PDT 2014


Hello Robert,

I don't have the script handy, but I've used Mojo::UserAgent in the past as
it makes this trivial.

I realize most people don't think, "hey, I need a way to interact with a
webpage, let's install a web building framework", but it sounds like
exactly what you are looking for.

you can do something along the lines of:

#!/usr/bin/perl
use 5.010;
use strict;
use warnings;

use Mojo::UserAgent;

my $url = 'http://example.com';

my $ua = Mojo::UserAgent->new;

my $result = $ua->post( $url . '/someform' => form => { somefield => 'some
value', anotherfield => 'another valule' } );

# do stuff with result

my ($url) = $result =~ /(http:\/\/.*)/; # this is not a good regex for a
number of reasons you'll have to figure out how to grab the url yourself

$ua->get($url);

I remember finding Mojo::UserAgent because I was having similar problems
with WWW::Mech. (and the guys on the #mojo channel on irc.perl.org are
usually super helpful).

The docs leave something to be desired, but check out:
http://mojolicio.us/perldoc/Mojo/UserAgent

Best Regards,
Jon A


On Tue, Aug 26, 2014 at 1:00 PM, <denver-pm-request at pm.org> wrote:

> Send Denver-pm mailing list submissions to
>         denver-pm at pm.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         http://mail.pm.org/mailman/listinfo/denver-pm
> or, via email, send a message with subject or body 'help' to
>         denver-pm-request at pm.org
>
> You can reach the person managing the list at
>         denver-pm-owner at pm.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Denver-pm digest..."
>
>
> Today's Topics:
>
>    1. WWW::Mech examples (Robert L. Harris)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Mon, 25 Aug 2014 15:49:34 -0600
> From: "Robert L. Harris" <robert.l.harris at gmail.com>
> To: Denver-pm at pm.org
> Subject: [Denver-pm] WWW::Mech examples
> Message-ID:
>         <CAOXayVsUp4TTwLomxipFJ3NJk19n60jzzmuQu=
> KBkN+8vk9J7Q at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
>   I'm working on a new script to pull some files off an internal company
> app server.  I'm trying to figure it out using some examples I've found
> online but figured I'd ask.  Anyone have a script that does something close
> to this in a simple, easy to figure out manner:
>
>
> Connect to http://apps.company.com
> Submit 4 values into a form and hit submit.
>    * This triggers some dynamic output that runs for a few mins while it
> generates some data then gives a link at the bottom.
> Grab the link at the bottom
> Download a .tgz off of the resulting link's page
>
> Robert
>
>
> --
> :wq!
> ---------------------------------------------------------------------------
> Robert L. Harris
>
> DISCLAIMER:
>       These are MY OPINIONS             With Dreams To Be A King,
>        ALONE.  I speak for                      First One Should Be A Man
>        no-one else.                                     - Manowar
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://mail.pm.org/pipermail/denver-pm/attachments/20140825/326b0f05/attachment-0001.html
> >
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> Denver-pm mailing list
> Denver-pm at pm.org
> http://mail.pm.org/mailman/listinfo/denver-pm
>
>
> ------------------------------
>
> End of Denver-pm Digest, Vol 13, Issue 1
> ****************************************
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/denver-pm/attachments/20140826/39c65a8a/attachment.html>


More information about the Denver-pm mailing list