Provide better <form /> specification by new: &My:Web::form_method
authorshort <>
Sun, 2 Oct 2005 05:58:47 +0000 (05:58 +0000)
committershort <>
Sun, 2 Oct 2005 05:58:47 +0000 (05:58 +0000)
Web.pm

diff --git a/Web.pm b/Web.pm
index 1a3f9e0..490e680 100644 (file)
--- a/Web.pm
+++ b/Web.pm
@@ -37,6 +37,7 @@ our @EXPORT=qw(
                $W
                &input_hidden_persistents
                &escapeHTML
+               &form_method
                );
 our @ISA=qw(Tie::Handle Exporter);
 
@@ -278,6 +279,16 @@ my($class,%args)=@_;
        return $W;
 }
 
+sub form_method($)
+{
+my($method)=@_;
+
+       return q{enctype="application/x-www-form-urlencoded" accept-charset="us-ascii utf-8"} if $method eq "post";
+       return                                             q{accept-charset="us-ascii utf-8"} if $method eq "get";
+       cluck "Undefined method: $method";
+       return ""
+}
+
 sub merge_post_args($)
 {
 my($class)=@_;