Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

41 lines (32 sloc) 1.242 kb
use strict;
use CGI::Header;
use Test::More tests => 18;
my %adaptee;
my $adapter = tie my %adapter, 'CGI::Header', \%adaptee;
%adaptee = ( -attachment => 'genome.jpg' );
is $adapter{Content_Disposition}, 'attachment; filename="genome.jpg"';
ok exists $adapter{Content_Disposition};
is delete $adapter{Content_Disposition}, 'attachment; filename="genome.jpg"';
is_deeply \%adaptee, {};
%adaptee = ( -attachment => q{} );
is $adapter{Content_Disposition}, undef;
ok !exists $adapter{Content_Disposition};
%adaptee = ( -attachment => undef );
is $adapter{Content_Disposition}, undef;
ok !exists $adapter{Content_Disposition};
%adaptee = ();
is $adapter{Content_Disposition}, undef;
ok !exists $adapter{Content_Disposition};
%adaptee = ( -content_disposition => 'inline' );
is $adapter{Content_Disposition}, 'inline';
ok exists $adapter{Content_Disposition};
is delete $adapter{Content_Disposition}, 'inline';
is_deeply \%adaptee, {};
%adaptee = ( -attachment => 'foo' );
$adapter{Content_Disposition} = 'inline';
is_deeply \%adaptee, { -content_disposition => 'inline' };
%adaptee = ();
is $adapter->attachment, undef;
$adapter->attachment( 'genome.jpg' );
is $adapter->attachment, 'genome.jpg';
is $adaptee{-attachment}, 'genome.jpg';
Jump to Line
Something went wrong with that request. Please try again.