diff options
Diffstat (limited to 'FS')
-rw-r--r-- | FS/FS/Mason.pm | 3 | ||||
-rw-r--r-- | FS/FS/Mason/Request.pm | 5 | ||||
-rw-r--r-- | FS/FS/Mason/StandaloneRequest.pm | 23 |
3 files changed, 27 insertions, 4 deletions
diff --git a/FS/FS/Mason.pm b/FS/FS/Mason.pm index 9b010e8d6..2d45e78a1 100644 --- a/FS/FS/Mason.pm +++ b/FS/FS/Mason.pm @@ -458,7 +458,8 @@ sub mason_interps { #my $request_class = 'HTML::Mason::Request'. #( $mode eq 'apache' ? '::ApacheHandler' : '' ); - my $request_class = 'FS::Mason::Request'; + my $request_class = $mode eq 'standalone' ? 'FS::Mason::StandaloneRequest' + : 'FS::Mason::Request'; #not entirely sure it belongs here, but what the hey if ( %%%RT_ENABLED%%% && $mode ne 'standalone' ) { diff --git a/FS/FS/Mason/Request.pm b/FS/FS/Mason/Request.pm index 95c802796..565f85eb0 100644 --- a/FS/FS/Mason/Request.pm +++ b/FS/FS/Mason/Request.pm @@ -24,7 +24,7 @@ sub new { my %opt = @_; my $mode = $superclass =~ /Apache/i ? 'apache' : 'standalone'; - freeside_setup($opt{'comp'}, $mode); + $class->freeside_setup($opt{'comp'}, $mode); $class->SUPER::new(@_); @@ -34,8 +34,7 @@ sub new { # for Mason 1.39 vs. Perl 5.10.0 sub freeside_setup { - - my( $filename, $mode ) = @_; + my( $class, $filename, $mode ) = @_; if ( $filename =~ qr(/REST/\d+\.\d+/NoAuth/) ) { diff --git a/FS/FS/Mason/StandaloneRequest.pm b/FS/FS/Mason/StandaloneRequest.pm new file mode 100644 index 000000000..a5e4dcb2a --- /dev/null +++ b/FS/FS/Mason/StandaloneRequest.pm @@ -0,0 +1,23 @@ +package FS::Mason::StandaloneRequest; + +use strict; +use warnings; +use base 'FS::Mason::Request'; + +sub new { + my $class = shift; + + $class->alter_superclass('HTML::Mason::Request'); + + #huh... shouldn't alter_superclass take care of this for us? + __PACKAGE__->valid_params( %{ HTML::Mason::Request->valid_params() } ); + + my %opt = @_; + #its already been altered# $class->freeside_setup($opt{'comp'}, 'standalone'); + FS::Mason::Request->freeside_setup($opt{'comp'}, 'standalone'); + + $class->SUPER::new(@_); + +} + +1; |