[Maypole] cookies and other headers in CGI::Maypole

From: Gabor Szabo (gabor at perl.org.il)
Date: Mon Sep 06 2004 - 08:42:02 BST


Hi,

I am new to Maypole and to the list.
Trying to put together a CGI::Maypole application.

I was trying to send cookies but could not find a way so far so I
override function of CGI::Maypole in order to be able to do so.
Here is the new function:

sub send_output {
    my $r = shift;

    print $r->{cgi}->header(-type => $r->{content_type},
                        -content_length => length $r->{output},
                        -cookie => $r->{cookie},
            );
    print $r->{output};
}

This works but maybe I just missed the existing way to set the cookie ?

In any case it would be nice if I could change all the headers (e.g. I
am sure I'll want to change the charset parameter in some of my
applications) without overriding this function.
Maybe to prepare the additional parameters for the header like this

   $r->{header} = {-charset => 'utf8', cookie => $cookie};

and then replace the function in CGI::Maypole with this one:

sub send_output {
   my $r = shift;

   my %header = {
        -type => $r->{content_type},
        -content_length => length $r->{output},
   };

   %header = %{$r->{header}};

    print $r->{cgi}->header(%header);
    print $r->{output};
}

Gabor

_______________________________________________
maypole mailing list
maypole at lists.netthink.co.uk
http://lists.netthink.co.uk/listinfo/maypole



This archive was generated by hypermail 2.1.3 : Thu Feb 24 2005 - 22:25:56 GMT