edoceo

Edoceo::UserAgent is a wrapper package for LWP::UserAgent and a few others. When first using LWP information was difficult to find for a complete UserAgent framework. Looking for a package that was smart enough to handle a session, cookies and other full scale UA features was difficult. This framework is provided to help others, it surely needs to be customized for the readers environment. Assistance with PERL development is also available, for a fee, please use our contact form.

This package will provide an almost complete UserAgent, it uses cookies to maintain sessions if need be. There is also some utility functions for debugging the traffic. Eventually this will make it into a nifty package that can be use'd.

Edoceo::UserAgent

UserAgent is extremely easy to use, simply do this the package will do everything.

#!/usr/bin/perl

use strict;
use Edoceo::UserAgent;

my $url = 'http://www.edoceo.com/contact.php';
my $ua = Edoceo::UserAgent->new();


# This is a standard LWP HTTP Response
my $res = $ua->get($url);
# $res = $ua->post($url,$post_data);
# $res = $ua->file($url,$file_data);

# Returns an array of HTTP::Form objects, if any present in last response
# undef if no response or no forms
my @forms = $ua->forms();
print $forms[0]->dump;

#$ua->save_cookies($file_name);
#$ua->load_cookies($file_name);

# Oh yea, view the content or give to HTML::Parser
print $res->content;

Installation

This can be saved into the @INC path, a recommended location is like /usr/lib/perl5/site_perl/Edoceo/UserAgent.pm, choose wisely. Gentoo Linux allows for /etc/perl/Edoceo/UserAgent.pm, Gentoo is good.

Requirements

Edoceo::UserAgent need the following packages to run

  • warnings
  • Carp
  • Crypt::SSLeay - if SSL support is needed
  • LWP::UserAgent
  • HTML::Form
  • HTTP::Cookies
  • HTTP::Request

Change Log

6 Dec 2004
This page was created, the package is available but incomplete

Loading Comments from Disqus...