Mailing List Archive

xmlDecl error
Hello,

I'm getting the following error when publishing an XML file from the CMS:
Can't call method "xmlDecl" on an undefined value at /usr/local/bricolage/data/burn/comp/oc_1028/partners/atom/mobile/cover.mc line 9.

Here is the line that is throwing the error:
$writer->xmlDecl("UTF-8");

My bricolage.conf file has this line:
INCLUDE_XML_WRITER = Yes

The story previews just fine, but throws the above error in the job queue when I publish.

Here is the entire template for reference:
<%perl>
use POSIX qw(strftime);

my $limit = 20;
my $build_date = strftime( "%a, %d %b %Y %H:%M:%S %z", localtime() );
my $copyright = "Copyright (c) " . strftime("%Y", localtime() ) . " CBS Studios Inc. All Rights Reserved.";
my $self_url = "http://www.jeffprobst.com/partners/atom/mobile/index.xml";

$writer->xmlDecl("UTF-8");
$writer->startTag("feed", "xmlns:atom" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://search.yahoo.com/mrss/", "version" => "2.0");

my $title = $story->get_title;
$writer->cdataElement("title",$title);
$writer->dataElement("updated",$build_date);

my @story_list = $story->list({ element_key_name=>"post", Limit=>$limit, Order=>"cover_date", Active=>1, publish_status=>1, published_version=>1, OrderDirection=>"DESC"});

foreach my $item (@story_list) {
$m->comp("/library/atom_item.mc", item=>$item);
}

$writer->endTag("feed");
</%perl>

Thank you so much for your assistance!

Michael Fletcher
RE: xmlDecl error [ In reply to ]
Problem solved.

Since we use the queue for our publishing, I decided to check the permissions for the user in bric_queued.sh and found the problem. By changing that user's permission from "Publishing Admin" to "Global Admin" it allowed XML::Writer object to be found by the user. Personally, I'd call this a bug, but at least I know now that the publisher needs to have Global Admin rights to write XML with $writer.

I hope at least that this info is useful to others.

Mike
Re: xmlDecl error [ In reply to ]
On May 2, 2012, at 11:50 AM, Fletcher, Michael wrote:

> Since we use the queue for our publishing, I decided to check the permissions for the user in bric_queued.sh and found the problem. By changing that user's permission from "Publishing Admin" to "Global Admin" it allowed XML::Writer object to be found by the user. Personally, I'd call this a bug, but at least I know now that the publisher needs to have Global Admin rights to write XML with $writer.
>
> I hope at least that this info is useful to others.

Yes, please file a bug report, it certainly sounds like a bug.

https://bricolage.lighthouseapp.com/

Thanks,

David