Skip to content

Commit 731bbbd

Browse files
committed
move slurp() from QueryType::CGI to Upload, so all QueryType classes inherit it.
fixes it googlecode issue FormFu#64
1 parent f8414e9 commit 731bbbd

File tree

4 files changed

+21
-18
lines changed

4 files changed

+21
-18
lines changed

lib/HTML/FormFu/QueryType/CGI.pm

+1-15
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package HTML::FormFu::QueryType::CGI;
2-
32
use Moose;
3+
44
extends 'HTML::FormFu::Upload';
55

66
use HTTP::Headers;
@@ -50,20 +50,6 @@ sub fh {
5050
return $self->_param;
5151
}
5252

53-
sub slurp {
54-
my ($self) = @_;
55-
56-
my $fh = $self->fh;
57-
58-
return if !defined $fh;
59-
60-
binmode $fh;
61-
62-
local $/;
63-
64-
return <$fh>;
65-
}
66-
6753
__PACKAGE__->meta->make_immutable;
6854

6955
1;

lib/HTML/FormFu/QueryType/CGI/Simple.pm

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package HTML::FormFu::QueryType::CGI::Simple;
2-
32
use Moose;
3+
44
extends 'HTML::FormFu::QueryType::CGI';
55

66
sub parse_uploads {

lib/HTML/FormFu/QueryType/Catalyst.pm

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
package HTML::FormFu::QueryType::Catalyst;
2-
32
use Moose;
3+
44
extends 'HTML::FormFu::Upload';
55

6+
use IO::File ();
67
use Scalar::Util qw( weaken );
78

8-
__PACKAGE__->mk_item_accessors(qw( basename tempname ));
9+
has basename => ( is => 'rw', traits => ['Chained'] );
10+
has tempname => ( is => 'rw', traits => ['Chained'] );
911

1012
sub parse_uploads {
1113
my ( $class, $form, $name ) = @_;

lib/HTML/FormFu/Upload.pm

+15
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ has size => ( is => 'rw', traits => ['Chained'] );
1515
has type => ( is => 'rw', traits => ['Chained'] );
1616

1717
sub BUILD {}
18+
1819
sub _param {
1920
my ( $self, $param ) = @_;
2021

@@ -29,6 +30,20 @@ sub _param {
2930
return defined $self->{_param} ? $self->{_param}->param : ();
3031
}
3132

33+
sub slurp {
34+
my ($self) = @_;
35+
36+
my $fh = $self->fh;
37+
38+
return if !defined $fh;
39+
40+
binmode $fh;
41+
42+
local $/;
43+
44+
return <$fh>;
45+
}
46+
3247
__PACKAGE__->meta->make_immutable;
3348

3449
1;

0 commit comments

Comments
 (0)