in reply to How do I set an element in XML:RSS element as CDATA?

http://search.cpan.org/grep?cpanid=SHLOMIF&release=XML-RSS-1.49&string=cdata&i=1&n=1&C=0

http://cpansearch.perl.org/src/SHLOMIF/XML-RSS-1.49/t/test-generated-items.t

my $rss = create_channel_rss({ version => "0.91", image_link => undef, channel_params => [ title => "Hello and <![CDATA[Aloha<&>] +]>"], });

Replies are listed 'Best First'.
Re^2: How do I set an element in XML:RSS element as CDATA?
by kenclark (Novice) on Jan 07, 2012 at 22:58 UTC
    Got it. Simple (and obvious!). For any future readers, this is how the example code would be modified:
    #!/usr/bin/perl use XML::RSS; my $description = "<b>How do I get this to be CDATA?</b>"; my $rss = new XML::RSS (output=>'2.0'); $rss->channel( title => "Sample RSS Feed", 'link' => "http://www.somewhere.com", description => "Example Feed", ); $rss->add_item( title => "Test", 'link' => "http://www.testitem.com", description => "<![CDATA[$description]]>", ); print $rss->as_string();
      Wait, so XML::RSS can't actually have the text <![CDATA[...]]> in any of its fields!?!