Skip Menu |

This queue is for tickets about the Search-Sitemap CPAN distribution.

Report information
The Basics
Id: 56964
Status: new
Priority: 0/
Queue: Search-Sitemap

People
Owner: Nobody in particular
Requestors: cpan [...] loowis.durge.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 2.10
Fixed in: (no value)



Subject: Can't update() a URL's priority
Trying to run the following code: use Search::Sitemap; my $map = Search::Sitemap->new(); $map->add( 'http://www.example.com/' ); $map->update( loc => 'http://www.example.com/', priority => 1.0, ); produces the following (fatal) error: Cannot coerce without a type coercion at C:/Perl/site/lib/Moose/Meta/TypeConstraint.pm line 83 Moose::Meta::TypeConstraint::coerce('Moose::Meta::TypeConstraint=HASH(0x 2262a94)', 1) called at C:/Perl/site/lib/MooseX/Types/TypeDecorator.pm line 200 eval {...} called at C:/Perl/site/lib/MooseX/Types/TypeDecorator.pm line 199 MooseX::Types::TypeDecorator::AUTOLOAD('MooseX::Types::TypeDecorator=HAS H(0x2888774)', 1) called at accessor priority defined at C:/Perl/site/lib/Search/Sitemap/URL.pm line 54 Search::Sitemap::URL::priority('Search::Sitemap::URL=HASH(0x22ddde4)', 1) called at C:/Perl/site/lib/Search/Sitemap.pm line 189 Search::Sitemap::update('Search::Sitemap=HASH(0x248bd4)', 'loc', 'http://www.example.com/', 'priority', 1) called at testmap.pl line 7 at C:/Perl/site/lib/MooseX/Types/TypeDecorator.pm line 202 MooseX::Types::TypeDecorator::AUTOLOAD('MooseX::Types::TypeDecorator=HAS H(0x2888774)', 1) called at accessor priority defined at C:/Perl/site/lib/Search/Sitemap/URL.pm line 54 Search::Sitemap::URL::priority('Search::Sitemap::URL=HASH(0x22ddde4)', 1) called at C:/Perl/site/lib/Search/Sitemap.pm line 189 Search::Sitemap::update('Search::Sitemap=HASH(0x248bd4)', 'loc', 'http://www.example.com/', 'priority', 1) called at testmap.pl line 7 I added the following code (which is totally guesswork!) to Perl\site\lib\Search\Sitemap\Types.pm and the problem seems to go away: coerce SitemapPriority, from Num, via { if ( $_ >= 0 && $_ <= 1 ) { return $_ }; return; }; But I've never even seen 'Moose' before so I've no idea if this is the correct fix.