These are the Perl equivalents of the PHP examples.
Printing a list of items pulled from an App's feed:
#!/usr/bin/perl -w use strict; use XML::Atom::Client; use CGI qw(:escapeHTML); my $url = "http://bandnames.ning.com/xn/atom/1.0/content(type='NingBlogPost')"; $url .= "?xn_auth=no&order=published\@D&from=0&to=10"; my $feed = XML::Atom::Client->new->getFeed($url); print "<ul>\n"; foreach my $entry ($feed->entries) { print "<li><a href='http://bandnames.ning.com/?action=post&id=" . $entry->id . "'>" . escapeHTML($entry->title) ."</a></li>\n"; } print "</ul>";
Posting an object to an App:
#!/usr/bin/perl -w use strict; use HTTP::Request::Common qw(POST); use LWP::UserAgent; my $ua = new LWP::UserAgent; my $app = "your-app-here.ning.com"; my $user = "your-NingID-here"; my $password = "your-password-here"; my $entry = <<XML; <entry xmlns="http://www.w3.org/2005/Atom" xmlns:xn="http://www.ning.com/atom/1.0" xmlns:my="http://$app"> <xn:type>Food</xn:type> <title type="text">Pizza</title> <summary type="text">A disc of baked dough covered with savoury toppings.</summary> <xn:private>false</xn:private> <my:rating type="number">5</my:rating> <my:ingredients type="string"> <xn:value>Dough</xn:value> <xn:value>Tomato Sauce</xn:value> <xn:value>Mozzarella Cheese</xn:value> <xn:value>Sun-dried Tomatoes</xn:value> <xn:value>Goats Cheese</xn:value> </my:ingredients> </entry> XML my $req = POST "https://$user:$password\@$app/xn/atom/1.0/content", Content_Type => 'form-data', Content => $entry; print $ua->request($req)->as_string;