URI::CrawlableHash - convert ajax uri to crawlable
use URI::CrawlableHash; my $uri = URI->new("http://example.com/#!key1=value1&key2=value2"); # uri for crawler $uri->fragment_to_query; # http://example.com/?_escaped_fragment_=key1=value1%26key2=value2 # uri for browser $uri->query_to_fragment; # http://example.com/#!key1=value1&key2=value2 # always convert to #! (Google says pretty url) $guard = URI::CrawlableHash->convert_always("hash"); # always convert to ?_escaped_fragment_ (Google says ugly url) $guard = URI::CrawlableAjax->convert_always("query");
URI::CrawlableHash is URL transformer for AJAX URLs.
It adds some method to the
URI namespace. I hate this approach but I need it.
See also HTML5's history.pushState or history.replaceState http://www.w3.org/TR/html5/author/history.html#history
$uri->has_crawlable_hash; # return true if contain #!
$uri->has_escaped_fragment; # return true if contain _escaped_fragment_
This method return ugly URI. Note that this is destructive method.
If you want new object, call $uri->clone before call this method.
This method return pretty URI. This method is destructive itself too.
This method will make you happy or crash everything. please read source.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.