home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / xampp / xampp-perl-addon-1.4.9-installer.exe / URI.pm < prev    next >
Encoding:
Perl POD Document  |  2004-09-23  |  7.0 KB  |  406 lines

  1. # /*
  2. #  * *********** WARNING **************
  3. #  * This file generated by ModPerl::WrapXS/0.01
  4. #  * Any changes made here will be lost
  5. #  * ***********************************
  6. #  * 01: lib/ModPerl/Code.pm:701
  7. #  * 02: O:\147xampp\sources\mod_perl-1.99_16\blib\lib/ModPerl/WrapXS.pm:584
  8. #  * 03: O:\147xampp\sources\mod_perl-1.99_16\blib\lib/ModPerl/WrapXS.pm:1100
  9. #  * 04: Makefile.PL:335
  10. #  * 05: Makefile.PL:283
  11. #  * 06: Makefile.PL:51
  12. #  */
  13.  
  14.  
  15. package Apache::URI;
  16.  
  17. use strict;
  18. use warnings FATAL => 'all';
  19.  
  20.  
  21.  
  22. use Apache::XSLoader ();
  23. our $VERSION = '0.01';
  24. Apache::XSLoader::load __PACKAGE__;
  25.  
  26.  
  27.  
  28. 1;
  29. __END__
  30.  
  31. =head1 NAME
  32.  
  33. Apache::URI - Perl API for manipulating URIs
  34.  
  35.  
  36.  
  37.  
  38. =head1 Synopsis
  39.  
  40.   use Apache::URI ();
  41.   
  42.   $hostport = $r->construct_server();
  43.   $hostport = $r->construct_server($hostname);
  44.   $hostport = $r->construct_server($hostname, $port);
  45.   $hostport = $r->construct_server($hostname, $port, $pool);
  46.   
  47.   $url = $r->construct_url();
  48.   $url = $r->construct_url($rel_uri);
  49.   $url = $r->construct_url($rel_uri, $pool);
  50.   
  51.   $parsed_uri = $r->parse_uri($uri);
  52.   
  53.   $parsed_uri = $r->parsed_uri();
  54.   
  55.   $url = join '%20', qw(one two three);
  56.   Apache::URI::unescape_url($url);
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66. =head1 Description
  67.  
  68. While C<APR::URI> provides a generic API to dissect, adjust and put
  69. together any given URI string, C<Apache::URI> provides an API specific
  70. to Apache, by taking the information directly from the C<$r>
  71. object. Therefore when manipulating the URI of the current HTTP
  72. request usually methods from both classes are used.
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79. =head1 API
  80.  
  81. C<Apache::URI> provides the following functions and methods:
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88. =head2 C<construct_server>
  89.  
  90. Construct a string made of hostname and port
  91.  
  92.   $hostport = $r->construct_server();
  93.   $hostport = $r->construct_server($hostname);
  94.   $hostport = $r->construct_server($hostname, $port);
  95.   $hostport = $r->construct_server($hostname, $port, $pool);
  96.  
  97. =over 4
  98.  
  99. =item obj: C<$r>
  100. ( C<L<Apache::RequestRec object|docs::2.0::api::Apache::RequestRec>> )
  101.  
  102. The current request object
  103.  
  104. =item opt arg1: C<$hostname> ( string )
  105.  
  106. The hostname of the server.
  107.  
  108. If that argument is not passed,
  109. C<L<$r-E<gt>get_server_name|docs::2.0::api::Apache::RequestUtil/C_get_server_name_>>
  110. is used.
  111.  
  112. =item opt arg2: C<$port> ( string )
  113.  
  114. The port the server is running on.
  115.  
  116. If that argument is not passed,
  117. C<L<$r-E<gt>get_server_port|docs::2.0::api::Apache::RequestUtil/C_get_server_port_>>
  118. is used.
  119.  
  120. =item opt arg3: C<$pool>
  121. ( C<L<APR::Pool object|docs::2.0::api::APR::Pool>> )
  122.  
  123. The pool to allocate the string from.
  124.  
  125. If that argument is not passed,
  126. C<L<$r-E<gt>pool|docs::2.0::api::Apache::RequestRec/C_pool_>> is used.
  127.  
  128. =item ret: C<$hostport> ( string )
  129.  
  130. The server's hostport string
  131.  
  132. =item since: 1.99_10
  133.  
  134. =back
  135.  
  136. Examples:
  137.  
  138. =over
  139.  
  140. =item *
  141.  
  142. Assuming that:
  143.  
  144.   $r->get_server_name == "localhost";
  145.   $r->get_server_port == 8001;
  146.  
  147. The code:
  148.  
  149.   $hostport = $r->construct_server();
  150.  
  151. returns a string:
  152.  
  153.   localhost:8001
  154.  
  155. =item *
  156.  
  157. The following code sets the values explicitly:
  158.  
  159.   $hostport = $r->construct_server("my.example.com", 8888);
  160.  
  161. and it returns a string:
  162.  
  163.   my.example.com:8888
  164.  
  165. =back
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172. =head2 C<construct_url>
  173.  
  174. Build a fully qualified URL from the uri and information in the
  175. request rec:
  176.  
  177.   $url = $r->construct_url();
  178.   $url = $r->construct_url($rel_uri);
  179.   $url = $r->construct_url($rel_uri, $pool);
  180.  
  181. =over 4
  182.  
  183. =item obj: C<$r>
  184. ( C<L<Apache::RequestRec object|docs::2.0::api::Apache::RequestRec>> )
  185.  
  186. The current request object
  187.  
  188. =item opt arg1: C<$rel_uri> ( string )
  189.  
  190. The path to the requested file (it may include a concatenation of
  191. I<path>, I<query> and I<fragment> components).
  192.  
  193. If that argument is not passed,
  194. C<L<$r-E<gt>uri|docs::2.0::api::Apache::RequestRec/C_uri_>> is used.
  195.  
  196. =item opt arg2: C<$pool>
  197. ( C<L<APR::Pool object|docs::2.0::api::APR::Pool>> )
  198.  
  199. The pool to allocate the URL from
  200.  
  201. If that argument is not passed,
  202. C<L<$r-E<gt>pool|docs::2.0::api::Apache::RequestRec/C_pool_>> is used.
  203.  
  204. =item ret: C<$url> ( string )
  205.  
  206. A fully qualified URL
  207.  
  208. =item since: 1.99_10
  209.  
  210. =back
  211.  
  212. Examples:
  213.  
  214. =over
  215.  
  216. =item *
  217.  
  218. Assuming that the request was
  219.  
  220.   http://localhost.localdomain:8529/test?args
  221.  
  222. The code:
  223.  
  224.   my $url = $r->construct_url;
  225.  
  226. returns the string:
  227.  
  228.   http://localhost.localdomain:8529/test
  229.  
  230. notice that the query (args) component is not in the string. You need
  231. to append it manually if it's needed.
  232.  
  233.  
  234. =item *
  235.  
  236. Assuming that the request was
  237.  
  238.   http://localhost.localdomain:8529/test?args
  239.  
  240. The code:
  241.  
  242.   my $rel_uri = "/foo/bar?tar";
  243.   my $url = $r->construct_url($rel_uri);
  244.  
  245. returns the string:
  246.  
  247.   http://localhost.localdomain:8529/foo/bar?tar
  248.  
  249. =back
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258. =head2 C<parse_uri>
  259.  
  260. Break apart URI (affecting the current request's uri components)
  261.  
  262.   $r->parse_uri($uri);
  263.  
  264. =over 4
  265.  
  266. =item obj: C<$r>
  267. ( C<L<Apache::RequestRec object|docs::2.0::api::Apache::RequestRec>> )
  268.  
  269. The current request object
  270.  
  271. =item arg1: C<$uri> ( string )
  272.  
  273. The uri to break apart
  274.  
  275. =item ret: no return value
  276.  
  277. =item warning:
  278.  
  279. This method has several side-effects explained below
  280.  
  281. =item since: 1.99_10
  282.  
  283. =back
  284.  
  285. This method call has the following side-effects:
  286.  
  287. =over
  288.  
  289. =item 1
  290.  
  291. sets C<L<$r-E<gt>args|docs::2.0::api::Apache::RequestRec/C_args_>> to
  292. the rest after C<'?'> if such exists in the passed C<$uri>, otherwise
  293. sets it to C<undef>.
  294.  
  295. =item 2
  296.  
  297. sets C<L<$r-E<gt>uri|docs::2.0::api::Apache::RequestRec/C_uri_>> to
  298. the passed C<$uri> without the
  299. C<L<$r-E<gt>args|docs::2.0::api::Apache::RequestRec/C_args_>> part.
  300.  
  301. =item 3
  302.  
  303. sets
  304. C<L<$r-E<gt>hostname|docs::2.0::api::Apache::RequestRec/C_hostname_>>
  305. (if not set already) using the (C<scheme://host:port>) parts of the
  306. passed C<$uri>.
  307.  
  308. =back
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315. =head2 C<parsed_uri>
  316.  
  317. Get the current request's parsed uri object
  318.  
  319.   my $uri = $r->parsed_uri();
  320.  
  321. =over 4
  322.  
  323. =item obj: C<$r>
  324. ( C<L<Apache::RequestRec object|docs::2.0::api::Apache::RequestRec>> )
  325.  
  326. The current request object
  327.  
  328. =item ret: C<$uri>
  329. ( C<L<APR::URI object|docs::2.0::api::APR::URI>> )
  330.  
  331. The parsed uri
  332.  
  333. =item since: 1.99_10
  334.  
  335. =back
  336.  
  337. META: this object is suitable for a currently non-existing rpath()
  338. method
  339.  
  340.  
  341.  
  342.  
  343.  
  344.  
  345.  
  346. =head2 C<unescape_url>
  347.  
  348. Unescape URLs
  349.  
  350.   Apache::URI::unescape_url($url);
  351.  
  352. =over 4
  353.  
  354. =item obj: C<$url> ( string )
  355.  
  356. The URL to unescape
  357.  
  358. =item ret: no return value
  359.  
  360. The argument C<$url> is now unescaped
  361.  
  362. =item since: 1.99_10
  363.  
  364. =back
  365.  
  366. Example:
  367.  
  368.   my $url = join '%20', qw(one two three);
  369.   Apache::URI::unescape_url($url);
  370.  
  371. C<$url> now contains the string:
  372.  
  373.   "one two three";
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381. =head1 See Also
  382.  
  383. C<L<APR::URI|docs::2.0::api::APR::URI>>, L<mod_perl 2.0
  384. documentation|docs::2.0::index>.
  385.  
  386.  
  387.  
  388.  
  389. =head1 Copyright
  390.  
  391. mod_perl 2.0 and its core modules are copyrighted under
  392. The Apache Software License, Version 2.0.
  393.  
  394.  
  395.  
  396.  
  397. =head1 Authors
  398.  
  399. L<The mod_perl development team and numerous
  400. contributors|about::contributors::people>.
  401.  
  402. =cut
  403.  
  404.