URI::ImpliedBase - magically force all URIs to be absolute
use URI::ImpliedBase;
# Set the base to search.cpan.org $u = URI::ImpliedBase->new("http://search.cpan.org");
$v = URI::ImpliedBase->new('subdir') print $v->as_string; # prints http://search.cpan.org/subdir
# No default now URI::ImpliedBase->clear();
# Force current working directory to be the URI $w = URI::ImpliedBase->new("../wsdl/test.wsdl"); print $w->as_string; # prints (e.g.) file:///Users/joe/wsdl/test.wsdl
You can force a new base at any time by calling "URI::ImpliedBase-"clear()>.
The base is stored internally at the moment; this may be problematic for multi-threaded code.
Joe McMahon mcmahon@ibiblio.org http://ibiblio.org/mcmahon
The full text of the license can be found in the LICENSE file included with this module.
If there is no scheme, but there is a path, and there's no existing default base,"URI::ImpliedBase" guesses that the path is a reference to the local filesystem relative to the current working directory. It saves the current working directory as the base and "file:" as the scheme, then uses these to build an absolute "file:" URI and returns it.
If there's no scheme, and there is a path, and there is a default base, "URI::ImpliedBase" uses the default base to convert the path to an absolute URI.
The base is stored in a package lexical, $current_base. This may be a problem for multithreaded code, or code under "mod_perl" or "mod_soap"; this code has not been tested in these environments.
Закладки на сайте Проследить за страницей |
Created 1996-2024 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |