summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlevinse <levinse>2010-11-06 00:13:15 +0000
committerlevinse <levinse>2010-11-06 00:13:15 +0000
commit1c44f99502f6e71b3665faed6317ff770cfbd15d (patch)
tree90ea5f3afdc9f53c9b084c0574b59dcff59c66eb
parent55ec848ca6876fdd3032f097d96f09d01152c0f2 (diff)
Net::Vitelity improvements, RT4868
-rw-r--r--Changes5
-rw-r--r--lib/Net/Vitelity.pm21
2 files changed, 16 insertions, 10 deletions
diff --git a/Changes b/Changes
index 2fe70d8..d48bef4 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,10 @@
Revision history for Net-Vitelity
+0.02 Fri Nov 5 17:01:08 PDT 2010
+ -changes by Erik Levinson
+ -fix URL, fix missing use LWP::UserAgent, fix regexp match of response
+ -implement "new"
+
0.01 unreleased
First version, released on an unsuspecting world.
diff --git a/lib/Net/Vitelity.pm b/lib/Net/Vitelity.pm
index b43818b..1259820 100644
--- a/lib/Net/Vitelity.pm
+++ b/lib/Net/Vitelity.pm
@@ -2,6 +2,7 @@ package Net::Vitelity;
use warnings;
use strict;
+use LWP::UserAgent;
=head1 NAME
@@ -9,13 +10,13 @@ Net::Vitelity - Interface to Vitelity API
=head1 VERSION
-Version 0.01
+Version 0.02
=cut
-our $VERSION = '0.01';
+our $VERSION = '0.02';
-our $URL = 'http://70.84.157.157/api.php';
+our $URL = 'http://64.74.178.105/api.php';
our $AUTOLOAD;
@@ -33,7 +34,11 @@ our $AUTOLOAD;
=cut
sub new {
- #XXX need a generic new
+ my ($class,%data) = @_;
+ die "missing user and/or password" unless defined $data{'login'} && defined $data{'pass'};
+ my $self = { 'login' => $data{'login'}, 'pass' => $data{'pass'} };
+ bless $self, $class;
+ return $self;
}
sub AUTOLOAD {
@@ -57,14 +62,10 @@ sub AUTOLOAD {
die $response->status_line unless $response->is_success;
- #hmm
- #my $content = $response->content;
my $content = $response->decoded_content;
- #dear vitelity api: why does this make it easier to parse?
- $content =~ s/^x\[\[//;
- #$content =~ s/\[\[x$//;
- $content =~ s/\]\]x$//;
+ $content =~ /x\[\[(.*)\[\[x/s;
+ $content = $1;
wantarray ? split("\n", $content) : $content;