You are viewing a plain text version of this content. The canonical link for it is here.
Posted to asp@perl.apache.org by Laszlo Zavaleta <wr...@kopu.org> on 2005/07/22 02:24:14 UTC

[patch]adding url var separator support

hey.
i wanted to use Apache::ASP::Server's URL() method to roll my URLs by
specifying the variable/value pairs, but noticed that it didn't have
support for the semicolon (;) field-separator, only the ampersand (&)
is currently supported, so i added support for it.
the way the use changes is simply that now you may add an extra
variable to specify your field-separator, otherwise the default will
still be the ampersand (&).
thus instead of,

  $Server->URL($url, \%params)
  
now you can do

  $Server->URL($url, \%params, ';')
  
to get your URL returned to you with the variable/value pairs
separated by a semicolon (;).

by the way, Apache::ASP rocks, so huge thanks to all of you that have
contributed to it by now, ive only been using it for a few months, but
so far ive had little trouble with it and they all turned out to be my
own fault as well :)

it is my very first patch, so i apologise if it isnt in the form it
should be. the patch was generated with 'diff -Naur'.

--- /usr/lib/perl5/site_perl/5.8.4/Apache/ASP/Server.pm.orig    2005-06-25 11:24:52.000000000 +1000
+++ /usr/lib/perl5/site_perl/5.8.4/Apache/ASP/Server.pm 2005-06-25 11:10:03.000000000 +1000
@@ -135,8 +135,9 @@
 }
 
 sub URL {
-    my($self, $url, $params) = @_;
+    my($self, $url, $params, $fs) = @_;
     $params ||= {};
+       $fs ||= "&";
     
     if($url =~ s/\?(.*)$//is) {
         my $old_params = $self->{asp}{Request}->ParseParams($1);
@@ -175,7 +176,7 @@
        }
     }
     if(@query) {
-       $url .= '?'.join('&', @query);
+       $url .= '?'.join($fs, @query);
     }
 
     $url;

-- 
Geeveston, 21/2300[UTC]: Cloudy;  14 (  1/ 15);
Gero arte.

---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org