CC: | "bug-Search-Sitemap [...] rt.cpan.org" <bug-Search-Sitemap [...] rt.cpan.org> |
Subject: | Re: Search::Sitemap::Types bug? |
Date: | Wed, 10 Jun 2009 01:26:00 +1000 |
To: | Jason Kohles <email [...] jasonkohles.com> |
From: | Andrew Solomon <andrew [...] illywhacker.net> |
hi Jason
I seem to have run into another issue along these lines, but this time
it dies and I haven't managed to see simple fix.
Please let me know if you can see a way around this one.
cheers
Andrew
==============================================================
einstein-2:search_sitemap andrew$ cat test.pl
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
use Search::Sitemap;
my $map = Search::Sitemap->new(pretty=>1);
# Main page, changes a lot because of the blog
$map->add( Search::Sitemap::URL->new(
loc => 'http://www.jasonkohles.com/',
lastmod => '2005-06-03',
changefreq => 'daily',
priority => 1.0,
) );
$map->write("foo.xml");
my $new_map = Search::Sitemap->new();
$new_map->read( 'foo.xml' );
print Dumper $new_map->urls;
==============================================================
einstein-2:search_sitemap andrew$ ./test.pl
WARNING: String found where Type expected (did you use a => instead of
a , ?) at /Users/andrew/gartoo-code/ext/lib/perl5//Search/Sitemap/Types.pm
line 60
Attribute (xmlparser) does not pass the type constraint because:
Validation failed for 'CodeRef' failed with value
XML::Twig=HASH(0xae4334) at
/Users/andrew/gartoo-code/ext/lib/perl5//Moose/Meta/Method/Delegation.pm
line 81
Search::Sitemap::safe_parse('Search::Sitemap=HASH(0xbfa604)',
'IO::File=GLOB(0xbf0ed0)') called at
/Users/andrew/gartoo-code/ext/lib/perl5//Search/Sitemap.pm line 159
Search::Sitemap::read('Search::Sitemap=HASH(0xbfa604)',
'foo.xml') called at ./test.pl line 21
einstein-2:search_sitemap andrew$ vim test.pl
einstein-2:search_sitemap andrew$ ./test.pl
WARNING: String found where Type expected (did you use a => instead of
a , ?) at /Users/andrew/gartoo-code/ext/lib/perl5//Search/Sitemap/Types.pm
line 60
Attribute (xmlparser) does not pass the type constraint because:
Validation failed for 'CodeRef' failed with value
XML::Twig=HASH(0xae4334) at
/Users/andrew/gartoo-code/ext/lib/perl5//Moose/Meta/Method/Delegation.pm
line 81
Search::Sitemap::safe_parse('Search::Sitemap=HASH(0xbfa628)',
'IO::File=GLOB(0xbf0ef4)') called at
/Users/andrew/gartoo-code/ext/lib/perl5//Search/Sitemap.pm line 159
Search::Sitemap::read('Search::Sitemap=HASH(0xbfa628)',
'foo.xml') called at ./test.pl line 21
einstein-2:search_sitemap andrew$
==============================================================
On Tue, Jun 9, 2009 at 7:39 AM, Jason Kohles<email@jasonkohles.com> wrote:
Show quoted text
> This is a warning that was recently added to MooseX::Types (see
> MooseX:Types::CheckedUtilExports).
>
> I'm going to release an update to fix it in the next day or two.
>
> Jason
>
> On Jun 8, 2009, at 10:49 AM, Andrew Solomon <andrew@illywhacker.net> wrote:
>
>> hi Jason
>>
>> I'm currently using:
>> ============================================
>> Search::Sitemap version 2.07
>> Moose::Util::TypeConstraints version 0.79
>> This is perl, v5.8.8 built for darwin-thread-multi-2level
>> Darwin einstein-2.local 9.7.0 Darwin Kernel Version 9.7.0: Tue Mar 31
>> 22:52:17 PDT 2009; root:xnu-1228.12.14~1/RELEASE_I386 i386
>>
>> Given the code:
>> ============================================
>>
>>
>> my $foo = Search::Sitemap::URL->new(
>> loc => 'http://www.jasonkohles.com/',
>> lastmod => '2005-06-03',
>> changefreq => 'daily',
>> priority => 1.0,
>> );
>> ============================================
>>
>> I get a warning:
>> ============================================
>> WARNING: String found where Type expected (did you use a => instead of
>> a , ?) at /Users/andrew/gartoo-code/ext/lib/perl5//Search/Sitemap/Types.pm
>> line 60
>>
>> Solution?
>> ============================================
>> Line 60 Search/Sitemap/Types.pm is
>> subtype SitemapLastMod, as 'Str', where { /$lastmod_re/ };
>> If I remove the quotes around Str the problem goes away.
>> subtype SitemapLastMod, as Str, where { /$lastmod_re/ };
>>
>>
>> Please let me know if it's a bug with Search::Sitemap or elsewhere.
>>
>> many thanks
>>
>> Andrew
>>
>