Browse files

0.01 release

  • Loading branch information...
1 parent eca9b37 commit a13c7ecd2e808bd215f5efa10bdc559de1f423d5 sshaw committed Dec 12, 2011
Showing with 32 additions and 78 deletions.
  1. +15 −26 README.pod
  2. +15 −35 lib/URI/fasp.pm
  3. +2 −17 t/fasp.t
View
41 README.pod
@@ -7,49 +7,38 @@ URI::fasp - URI handler for Aspera's FASP protocol
=head1 SYNOPSIS
$fasp = URI->new('fasp://example.com:97001?port=33001&bwcap=25000');
- $fasp->targetrate(10_000);
+ print $fasp->port; # 97001
+ print $fasp->fasp_port; # 33001
+ print $fasp->query_param('bwcap') # 25000
- print $fasp->port; # 97001
- print $fasp->fasp_port; # 33001
- print $fasp->bwcap; # 25000
# ...
- $ssh = $fasp->as_ssh; # URI::ssh
- print $ssh->port; # 97001
+
+ $ssh = $fasp->as_ssh; # URI::ssh
+ print $ssh->port; # 97001
=head1 DESCRIPTION
-Aspera uses seperate control and a data connections. The control connection is an SSH session.
-This class is a subclass of L<< C<URI::ssh> >> and uses the L<< C<URI::QueryParam> >> mixin.
+Aspera uses seperate control and a data connections. The control connection is a SSH session.
+
+This class is a subclass of L<< C<URI::ssh>|URI >> and uses the L<< C<URI::QueryParam> >> mixin.
=head1 METHODS
=head2 C<as_ssh>
-L<< C<URI::ssh> >> representation of the instance's control connection
+Return a L<< C<URI::ssh>|URI >> representation of the instance's control connection
-=head2 C<default_fasp_port>
+=head2 C<port>
-The default FASP port is 33001
+The port used by the control connection, defaults to C<22>
=head2 C<fasp_port>
-Defaults to L<< C<default_fasp_port> >>
-
-=head2 C<bwcap>
-
-Bandwidth cap
+The port used by the data connection, defaults to L<< C<default_fasp_port>|/default_fasp_port >>
-=head2 C<policy>
-
-Transfer policy
-
-=head2 C<httpport>
-
-Fallback HTTP port
-
-=head2 C<targetrate>
+=head2 C<default_fasp_port>
-Target transfer rate
+The default port used by the data connection, C<33001>
=head1 SEE ALSO
View
50 lib/URI/fasp.pm
@@ -8,20 +8,11 @@ use URI::QueryParam;
our $VERSION = '0.01';
-{
- no strict 'refs';
- for my $attr (qw|bwcap policy httpport targetrate|) {
- *$attr = sub {
- shift->query_param($attr, @_);
- }
- }
-}
-
sub _init { shift->SUPER::_init(@_); }
sub default_fasp_port { 33001 }
-# Aspera uses "port". To avoid conflicting with the URI method of the same name we call
-# this method "fasp_port". Both names are supported as query params.
+# Aspera uses "port" to denote the FASP port. To avoid conflicting with the URI method of the
+# same name we call this method "fasp_port".
sub fasp_port
{
my $self = shift;
@@ -54,49 +45,38 @@ URI::fasp - URI handler for Aspera's FASP protocol
=head1 SYNOPSIS
$fasp = URI->new('fasp://example.com:97001?port=33001&bwcap=25000');
- $fasp->targetrate(10_000);
+ print $fasp->port; # 97001
+ print $fasp->fasp_port; # 33001
+ print $fasp->query_param('bwcap') # 25000
- print $fasp->port; # 97001
- print $fasp->fasp_port; # 33001
- print $fasp->bwcap; # 25000
# ...
- $ssh = $fasp->as_ssh; # URI::ssh
- print $ssh->port; # 97001
+
+ $ssh = $fasp->as_ssh; # URI::ssh
+ print $ssh->port; # 97001
=head1 DESCRIPTION
Aspera uses seperate control and a data connections. The control connection is a SSH session.
+
This class is a subclass of L<< C<URI::ssh>|URI >> and uses the L<< C<URI::QueryParam> >> mixin.
=head1 METHODS
=head2 C<as_ssh>
-L<< C<URI::ssh>|URI >> representation of the instance's control connection
+Return a L<< C<URI::ssh>|URI >> representation of the instance's control connection
-=head2 C<default_fasp_port>
+=head2 C<port>
-The default FASP port is 33001
+The port used by the control connection, defaults to C<22>
=head2 C<fasp_port>
-Defaults to L<< C<default_fasp_port> >>
-
-=head2 C<bwcap>
+The port used by the data connection, defaults to L<< C<default_fasp_port>|/default_fasp_port >>
-Bandwidth cap
-
-=head2 C<policy>
-
-Transfer policy
-
-=head2 C<httpport>
-
-Fallback HTTP port
-
-=head2 C<targetrate>
+=head2 C<default_fasp_port>
-Target transfer rate
+The default port used by the data connection, C<33001>
=head1 SEE ALSO
View
19 t/fasp.t
@@ -2,7 +2,7 @@ use strict;
use warnings;
use URI;
-use Test::More tests => 19;
+use Test::More tests => 11;
my $uri = URI->new('fasp://example.com');
isa_ok($uri, 'URI::fasp');
@@ -11,30 +11,15 @@ is($uri->default_fasp_port, 33001);
is($uri->fasp_port, 33001);
is("$uri", 'fasp://example.com');
-# Like URI we only show the port if it's explicitly set
+# Like other URI subclasses the port should only be shown if it's explicitly set
$uri->fasp_port(33001);
is("$uri", 'fasp://example.com?port=33001');
$uri = URI->new('fasp://example.com:33001?port=5000&bwcap=1000&policy=fair&httpport=8080&targetrate=50000');
is($uri->fasp_port, 5000);
-is($uri->port, 33001);
-is($uri->bwcap, 1000);
-is($uri->policy, 'fair');
-is($uri->httpport, 8080);
-is($uri->targetrate, 50000);
-
$uri->fasp_port(33001);
is($uri->fasp_port, 33001);
-$uri->bwcap(25000);
-is($uri->bwcap, 25000);
-
-$uri->policy('unlimited');
-is($uri->policy, 'unlimited');
-
-$uri->targetrate(100000);
-is($uri->targetrate, 100000);
-
my $ssh = $uri->as_ssh;
isa_ok($ssh, 'URI::ssh');
is($ssh->port, 33001);

0 comments on commit a13c7ec

Please sign in to comment.