Permalink
Browse files

Initial skeleton of WWW::PhyloBox

  • Loading branch information...
0 parents commit 132e1e4950cf875452c0f1c75c993dc05a2210c1 @leto committed Nov 8, 2010
Showing with 545 additions and 0 deletions.
  1. +10 −0 .gitignore
  2. +3 −0 Changes
  3. +17 −0 dist.ini
  4. +52 −0 lib/WWW/PhyloBox.pm
  5. +11 −0 t/00-load.t
  6. +18 −0 t/01-post-newick.t
  7. +17 −0 t/02-create-phyloxml.t
  8. +1 −0 t/data/foo.newick
  9. +416 −0 t/data/phylo.xml
@@ -0,0 +1,10 @@
+*~
+#*#
+.#*
+blib/*
+\.*sw[op]
+\.build
+_build
+Build
+MYMETA.yml
+t/var/*
@@ -0,0 +1,3 @@
+Revision history for Bio::Chado::Loader
+
+
@@ -0,0 +1,17 @@
+name = WWW-PhyloBox
+author = Jonathan "Duke" Leto <jonathan@leto.net>
+license = Perl_5
+version = 0.01
+copyright_holder = Jonathan "Duke" Leto
+copyright_year = 2010
+
+[@RBUELS]
+dist = WWW-PhyloBox
+repository_at = github
+homepage_url = http://github.com/leto/www-phylobox
+
+[Prereqs]
+;; note: most prereqs will be autodiscovered
+
+[Prereqs / TestRequires]
+Test::Most = 0.87
@@ -0,0 +1,52 @@
+package WWW::PhyloBox;
+
+use Moose;
+use LWP::UserAgent;
+use Data::Dumper;
+
+has base_url => (
+ isa => 'Str',
+ is => 'rw',
+ default => 'http://2-0.latest.phylobox.appspot.com',
+);
+has useragent_class => (
+ isa => 'Str',
+ is => 'ro',
+ default => 'LWP::UserAgent',
+);
+has useragent_args => ( isa => 'HashRef', is => 'ro', default => sub { {} } );
+
+sub BUILD {
+ my ($self) = @_;
+ $self->ua( LWP::UserAgent->new );
+}
+
+has ua => (
+ isa => 'Object',
+ is => 'rw'
+);
+
+# ABSTRACT: eats babies
+
+=head1 SYNOPSIS
+
+Stuff
+
+=head1 ABSTRACT
+
+This talks to PhyloBox
+
+=cut
+
+
+sub create {
+ my ($self, %args) = @_;
+
+ my $response = $self->ua->post(
+ $self->base_url . "/tree/edit",
+ %args,
+ );
+ warn Dumper [ $response ];
+}
+
+1;
@@ -0,0 +1,11 @@
+#!perl
+
+use Test::More tests => 1;
+
+use lib './lib';
+
+BEGIN {
+ use_ok( 'WWW::PhyloBox' );
+}
+
+diag( "Testing WWW::PhyloBox Perl $], $^X" );
@@ -0,0 +1,18 @@
+use Test::Most;
+use WWW::PhyloBox;
+use File::Slurp qw/slurp/;
+
+plan( tests => 2 );
+
+my $phylobox = WWW::PhyloBox->new;
+my $newick = slurp("t/data/foo.newick");
+
+isa_ok($phylobox, 'WWW::Phylobox');
+
+lives_ok {
+ $phylobox->create(
+ method => "phyloxml",
+ phyloxml => $newick,
+ )
+}, 'creating newick';
+
@@ -0,0 +1,17 @@
+use Test::Most;
+use WWW::PhyloBox;
+use File::Slurp qw/slurp/;
+
+plan( tests => 2 );
+
+my $phylobox = WWW::PhyloBox->new;
+my $phyloxml = slurp("t/data/phylo.xml");
+
+isa_ok($phylobox, 'WWW::Phylobox');
+
+lives_ok {
+ $phylobox->create(
+ method => "phyloxml",
+ phyloxml => $phyloxml,
+ )
+}, 'creating phyloxml';
@@ -0,0 +1 @@
+(1:0.082376,(2:0.196674,((3:0.038209,6:0.354293):0.026742,5:0.094338):0.064142):0.067562,4:0.295612)
Oops, something went wrong.

0 comments on commit 132e1e4

Please sign in to comment.