NAME

URI::CrawlableHash - convert ajax uri to crawlable

SYNOPSIS

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");

DESCRIPTION

URI::CrawlableHash is URL transformer for AJAX URLs.

See http://code.google.com/web/ajaxcrawling/docs/specification.html

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

METHODS

has_crawlable_hash

$uri->has_crawlable_hash; # return true if contain #!

has_escaped_fragment

$uri->has_escaped_fragment; # return true if contain _escaped_fragment_

fragment_to_query

This method return ugly URI. Note that this is destructive method.

If you want new object, call $uri->clone before call this method.

query_to_fragment

This method return pretty URI. This method is destructive itself too.

convert_always

This method will make you happy or crash everything. please read source.

AUTHOR

mala <cpan@ma.la>

SEE ALSO

URI

LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.