let's say you have a uri:

  my $uri = 'http://user:[EMAIL PROTECTED]:8000/path?args#fragment';

and you APR::URI::parse() it:

  my $parsed = APR::URI::parse($r->pool, $uri);

Now you decide that the new URL shouldn't have the query and fragment fields. So you do:

  $parsed->query('');
  $parsed->fragment('');

But when you call:

  print $parsed->unparse;

it does not DWIM, printing:

  http://user:[EMAIL PROTECTED]:8000/path?#

The problem is that unparse handles an empty string "" and NULL as totally different things. "" is a perfectly valid fragment or query field. So if you don't want '#' you must set parsed->fragment to NULL, same goes for '?' and parsed->query. While our automatic get/set accessors happen to support set-to-NULL mode, by passing undef as an argument, it generates a warning:

  Use of uninitialized value in subroutine entry

Both, when accepting an undef as an argument and when returning one.

While, I see no problem with adjusting the API to allow passing undef to set a certain field to NULL, I see a problem with returning undef for fields with NULL, when a string is expected. But may be it makes a perfect sense.

I'm not sure what's the best solution here.

Anybody remembers how mp1 is dealing with those so I don't need to dig it up?

--
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to