summaryrefslogtreecommitdiffstats
path: root/lib/Web/Response.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Web/Response.pm')
-rw-r--r--lib/Web/Response.pm19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/Web/Response.pm b/lib/Web/Response.pm
index 89c0e26..7ab39db 100644
--- a/lib/Web/Response.pm
+++ b/lib/Web/Response.pm
@@ -79,6 +79,25 @@ has _encoding_obj => (
},
);
+sub BUILDARGS {
+ my $class = shift;
+
+ if (@_ == 1 && ref($_[0]) eq 'ARRAY') {
+ return {
+ status => $_[0][0],
+ (@{ $_[0] } > 1
+ ? (headers => $_[0][1])
+ : ()),
+ (@{ $_[0] } > 2
+ ? (content => $_[0][2])
+ : ()),
+ };
+ }
+ else {
+ return $class->SUPER::BUILDARGS(@_);
+ }
+}
+
sub redirect {
my $self = shift;
my ($url, $status) = @_;