From robert.l.harris at gmail.com Mon Aug 25 14:49:34 2014 From: robert.l.harris at gmail.com (Robert L. Harris) Date: Mon, 25 Aug 2014 15:49:34 -0600 Subject: [Denver-pm] WWW::Mech examples Message-ID: 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: From three18ti at gmail.com Tue Aug 26 14:11:36 2014 From: three18ti at gmail.com (Jon) Date: Tue, 26 Aug 2014 15:11:36 -0600 Subject: [Denver-pm] Denver-pm Digest, Vol 13, Issue 1 In-Reply-To: References: Message-ID: 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, 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" > To: Denver-pm at pm.org > Subject: [Denver-pm] WWW::Mech examples > Message-ID: > 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: From robert.l.harris at gmail.com Tue Aug 26 14:14:35 2014 From: robert.l.harris at gmail.com (Robert L. Harris) Date: Tue, 26 Aug 2014 15:14:35 -0600 Subject: [Denver-pm] Denver-pm Digest, Vol 13, Issue 1 In-Reply-To: References: Message-ID: I actually got it working. I'm sure it's not ideal as I see some areas needing cleanup but I'll be happy to share with anyone who wants to see how I did it. On Tue, Aug 26, 2014 at 3:11 PM, Jon wrote: > 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, 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" >> To: Denver-pm at pm.org >> Subject: [Denver-pm] WWW::Mech examples >> Message-ID: >> > 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 >> **************************************** >> > > -- :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: From three18ti at gmail.com Tue Aug 26 14:21:32 2014 From: three18ti at gmail.com (Jon) Date: Tue, 26 Aug 2014 15:21:32 -0600 Subject: [Denver-pm] Denver-pm Digest, Vol 13, Issue 1 In-Reply-To: References: Message-ID: Hey Robert, Sure, I'm always up to learn a new trick. Thanks, Jon A On Aug 26, 2014 3:14 PM, "Robert L. Harris" wrote: > > I actually got it working. I'm sure it's not ideal as I see some areas > needing cleanup but I'll be happy to share with anyone who wants to see how > I did it. > > > > On Tue, Aug 26, 2014 at 3:11 PM, Jon wrote: > >> 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, 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" >>> To: Denver-pm at pm.org >>> Subject: [Denver-pm] WWW::Mech examples >>> Message-ID: >>> >> 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 >>> **************************************** >>> >> >> > > > -- > :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: