Here's my first crack at pod for module2path and module2url.
I decided to put it at the end of the FUNCTONS head1. It didn't seem to make much sense at the beginning and it felt like I should keep focus on the exported functions.


Let me know if you had something else in mind and I'll rework it.

-=Chris
Index: lib/Apache/TestRequest.pm
===================================================================
--- lib/Apache/TestRequest.pm   (revision 111194)
+++ lib/Apache/TestRequest.pm   (working copy)
@@ -1088,6 +1088,50 @@
 specification, section 9.2, at
 I<http://www.faqs.org/rfcs/rfc2616.html> for more information.
 
+=head2 Helper Functions
+
+C<Apache::TestRequest> also includes a few helper functions to aid in
+the creation of urls used in the functions above.
+
+=over 4
+
+=item module2path
+
+  my $module = 'MyTestModule::TestHandler';
+  my $path   = Apache::TestRequest::module2path($module);
+    # returns 'MyTestModule__TestHandler'
+
+  my $res = GET "/$path";
+
+Converts a module name to a path safe for use in the various request
+methods above.
+
+=item module2url
+
+  my $module = 'MyTestModule::TestHandler';
+  my $uri    = Apache::TestRequest::module2url($module);
+    # returns 'http://host:port/MyTestModule__TestHandler'
+
+  my $res = GET $uri;
+
+Converts a module name to a full uri including the current
+configurations host:port and sets C<module> accordingly.
+
+The default scheme used is C<http>. You can override this by passing
+your preferred scheme into an optional second param:
+
+  my $module = 'MyTestModule::TestHandler';
+  my $uri = Apache::TestRequest::module2uri($module, {scheme => 'https'});
+    # returns 'https://host:port/MyTestModule__TestHandler'
+
+You may also override the default path with a path of your own:
+
+  my $module = 'MyTestModule::TestHandler';
+  my $uri = Apache::TestRequest::module2uri($module, {path => '/foo'});
+    # returns 'http://host:port/foo'
+
+=back
+
 =head1 ENVIRONMENT VARIABLES
 
 The following environment variables can affect the behavior of

Reply via email to