CGI-Test-Input-Custom
view release on metacpan or search on metacpan
lib/CGI/Test/Input/Custom.pm view on Meta::CPAN
sub _firstdef {
defined && return $_ for @_;
undef;
}
sub new {
my ($class, %args) = @_;
my $this = bless {}, $class;
$this->_init;
$this->{_ctic_mime_type} = _firstdef(delete $args{-mime_type}, 'application/octet-stream');
$this->{_data_decoded} = _firstdef(delete $args{-content}, '');
$this->{_encoding} = _firstdef(delete $args{-encoding}, 'utf8');
%args and croak "unsupported constructor argument(s) ".join(', ', keys %args);
$this->{stale} = 1;
$this;
}
*make = \&new;
for (qw(widget field file file_now)) {
my $m = "add_$_";
lib/CGI/Test/Input/Custom.pm view on Meta::CPAN
sub set_mime_type {
my ($this, $type) = @_;
$this->{_ctic_mime_type} = $type;
}
sub mime_type { shift->{_ctic_mime_type} }
sub _build_data {
my $this = shift;
encode($this->{_encoding}, $this->{_data_decoded})
}
sub add_content {
my $this = shift;
$this->{_data_decoded} .= join('', @_);
$this->{stale} = 1;
}
1;
__END__
=head1 NAME
( run in 0.245 second using v1.01-cache-2.11-cpan-26ccb49234f )