File Coverage

blib/lib/URI/fasp.pm
Criterion Covered Total %
statement 24 24 100.0
branch 4 4 100.0
condition n/a
subroutine 8 8 100.0
pod 3 3 100.0
total 39 39 100.0


line stmt bran cond sub pod time code
1             package URI::fasp;
2              
3 1     1   884 use strict;
  1         2  
  1         43  
4 1     1   5 use warnings;
  1         1  
  1         38  
5 1     1   17 use base 'URI::ssh';
  1         2  
  1         909  
6              
7 1     1   20667 use URI::QueryParam;
  1         887  
  1         187  
8              
9             our $VERSION = '0.01';
10              
11 2     2   1579 sub _init { shift->SUPER::_init(@_); }
12 2     2 1 2631 sub default_fasp_port { 33001 }
13              
14             # Aspera uses "port" to denote the FASP port. To avoid conflicting with the URI method of the
15             # same name we call this method "fasp_port".
16             sub fasp_port
17             {
18 5     5 1 2523 my $self = shift;
19 5 100       21 if(@_) {
20 2         13 $self->query_param('port', @_);
21 2         548 return;
22             }
23            
24 3 100       36 $self->query_param('port') or
25             $self->default_fasp_port;
26             }
27              
28             sub as_ssh
29             {
30 1     1 1 3 my $self = shift;
31 1         16 my $ssh = $self->clone;
32 1         16 $ssh->scheme('ssh');
33 1         381 $ssh->query(undef);
34 1         15 $ssh;
35             }
36              
37             1;
38              
39             =pod
40              
41             =head1 NAME
42              
43             URI::fasp - URI handler for Aspera's FASP protocol
44              
45             =head1 SYNOPSIS
46              
47             $fasp = URI->new('fasp://example.com:97001?port=33001&bwcap=25000');
48             print $fasp->port; # 97001
49             print $fasp->fasp_port; # 33001
50             print $fasp->query_param('bwcap') # 25000
51              
52             # ...
53              
54             $ssh = $fasp->as_ssh; # URI::ssh
55             print $ssh->port; # 97001
56              
57             =head1 DESCRIPTION
58              
59             Aspera uses seperate control and a data connections. The control connection is a SSH session.
60              
61             This class is a subclass of L<< C|URI >> and uses the L<< C >> mixin.
62              
63             =head1 METHODS
64              
65             =head2 C
66              
67             Return a L<< C|URI >> representation of the instance's control connection
68              
69             =head2 C
70              
71             The port used by the control connection, defaults to C<22>
72              
73             =head2 C
74              
75             The port used by the data connection, defaults to L<< C|/default_fasp_port >>
76              
77             =head2 C
78              
79             The default port used by the data connection, C<33001>
80              
81             =head1 SEE ALSO
82              
83             L, L, http://asperasoft.com
84              
85             =head1 AUTHOR
86              
87             Skye Shaw (sshaw AT lucas.cis.temple.edu)
88              
89             =head1 LICENSE
90              
91             Copyright (c) 2011 Skye Shaw. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.