Subject: | $map->file doesn't work with passing in $c->uri_for('blah') |
If you're trying to use WWW::Google::Sitemaps from within a catalyst
application and do something like:
$map->add(loc => $c->uri_for('foo') the code throws a fatal error:
"element #PCDATA can only be created from text at
/Library/Perl/5.8.6/WWW/Google/SiteMap/URL.pm line 242"
fixing the offending line(s) in the code from (val) to ("$val") so that
the variable stringifies correctly fixes this.
Subject: | www_gsm_catalyst_uri_for.patch |
--- lib/WWW/Google/SiteMap/URL.pm 2007-01-29 10:34:54.000000000 +1100
+++ /Library/Perl/5.8.6/WWW/Google/SiteMap/URL.pm 2006-08-24 10:40:25.000000000 +1000
@@ -239,9 +239,10 @@
foreach(@fields) {
my $val = $self->$_() || next;
if($_ eq 'loc') {
- $val = XML::Twig::Elt->new('#PCDATA' => encode_entities("$val")); $val->set_asis(1);
+ $val = XML::Twig::Elt->new('#PCDATA' => encode_entities($val));
+ $val->set_asis(1);
} else {
- $val = XML::Twig::Elt->new('#PCDATA' => "$val");
+ $val = XML::Twig::Elt->new('#PCDATA' => $val);
}
push(@elements,$val->wrap_in($_));
}