]> git.decadent.org.uk Git - maypole.git/blobdiff - lib/Maypole.pm
made setting user() and session() backward compatible
[maypole.git] / lib / Maypole.pm
index c6cef443b397ddf128dc25354cd61553dbf599c2..09493ece263a04f6dcb101f49450d3760835d9b6 100644 (file)
@@ -1,5 +1,4 @@
 package Maypole;
-use Class::C3;
 use base qw(Class::Accessor::Fast Class::Data::Inheritable);
 use UNIVERSAL::require;
 use strict;
@@ -13,7 +12,7 @@ use URI::QueryParam;
 use NEXT;
 use File::MMagic::XS qw(:compat);
 
-our $VERSION = '2.12';
+our $VERSION = '2.12_pre1';
 our $mmagic = File::MMagic::XS->new();
 
 # proposed privacy conventions:
@@ -437,8 +436,10 @@ sub handler : method  {
   die "status undefined after start_request_hook()" unless defined
     $self->status;
 
-  $self->session($self->get_session);
-  $self->user($self->get_user);
+  my $session = $self->get_session;
+  $self->session($self->{session} || $session);
+  my $user = $self->get_user;
+  $self->user($self->{user} || $user);
 
   my $status = $self->handler_guts;
   return $status unless $status == OK;
@@ -462,7 +463,7 @@ to call those actions. You may pass a query string in the usual URL style.
 You should not fully qualify the Maypole URLs.
 
 Note: any HTTP POST or URL parameters passed to the parent are not passed to the
-component sub-request, only what is included in the url passed as an argyument
+component sub-request, only what is included in the url passed as an argument
 to the method
 
 =cut
@@ -1294,9 +1295,9 @@ sub param
        $self->params->{$key} = $new_val;
     }
     
-    return ref $val ? @$val : ($val) if wantarray;
+    return (ref $val eq 'ARRAY') ? @$val : ($val) if wantarray;
         
-    return ref $val ? $val->[0] : $val;
+    return (ref $val eq 'ARRAY') ? $val->[0] : $val;
 }