libxml-feed-perl-0.52+dfsg.orig/0000755000175000017500000000000012114441004015727 5ustar gregoagregoalibxml-feed-perl-0.52+dfsg.orig/MANIFEST0000444000175000017500000000300412114441004017053 0ustar gregoagregoaBuild.PL Makefile.PL Changes eg/check_feed.pl lib/XML/Feed.pm lib/XML/Feed/Content.pm lib/XML/Feed/Enclosure.pm lib/XML/Feed/Entry.pm lib/XML/Feed/Entry/Format/Atom.pm lib/XML/Feed/Entry/Format/RSS.pm lib/XML/Feed/Format/Atom.pm lib/XML/Feed/Format/RSS.pm MANIFEST This list of files MANIFEST.SKIP META.json META.yml README t/00-compile.t t/01-parse.t t/02-create.t t/04-splice-atom.t t/04-splice-rss.t t/05-atom10-link.t t/06-atom10.t t/07-atom10-create.t t/08-convert-summary-bug.t t/09-missing-content-bug.t t/10-mix-and-match.t t/11-xml-base-atom.t t/11-xml-base-rss.t t/12-multi-categories-atom.t t/12-multi-categories-rss.t t/12-multi-categories.base t/12-multi-subjects-rss.t t/13-category-hash-bug.t t/14-enclosures.t t/14-multi-enclosures.t t/15-odd-date.t t/16-convert-mult-categories.t t/17-double.t t/18-double2.t t/19-double3.t t/20-no-enclosures.t t/21-rss2-permalinks.t t/22-bug73160.t t/23-eval.t t/pod-coverage.t t/pod.t t/samples/atom-10-example.xml t/samples/atom-enclosure.xml t/samples/atom-full.xml t/samples/atom-multi-enclosure.xml t/samples/atom-multiple-categories.xml t/samples/atom.xml t/samples/base_atom.xml t/samples/base_rss.xml t/samples/rss-multiple-categories.xml t/samples/rss-multiple-subjects.xml t/samples/rss10-double.xml t/samples/rss10-double2.xml t/samples/rss10-invalid-date.xml t/samples/rss10-odd-date.xml t/samples/rss10.xml t/samples/rss20-double.xml t/samples/rss20-enclosure.xml t/samples/rss20-multi-enclosure.xml t/samples/rss20-no-summary.xml t/samples/rss20-p.xml t/samples/rss20.xml libxml-feed-perl-0.52+dfsg.orig/Changes0000444000175000017500000005275112114210615017234 0ustar gregoagregoa2013-02-28 Dave Cross * lib/XML/Feed.pm, lib/XML/Feed/Content.pm, lib/XML/Feed/Enclosure.pm, lib/XML/Feed/Entry.pm, lib/XML/Feed/Entry/Format/Atom.pm, lib/XML/Feed/Entry/Format/RSS.pm, lib/XML/Feed/Format/Atom.pm, lib/XML/Feed/Format/RSS.pm: Bump versions for release. 2013-02-26 Gabor Szabo * Build.PL: add dist_author and x_contributors to META files * .gitignore: ignore some generated files 2013-01-08 Gabor Szabo * lib/XML/Feed.pm, lib/XML/Feed/Content.pm, lib/XML/Feed/Enclosure.pm, lib/XML/Feed/Entry.pm, lib/XML/Feed/Entry/Format/Atom.pm, lib/XML/Feed/Entry/Format/RSS.pm, lib/XML/Feed/Format/Atom.pm, lib/XML/Feed/Format/RSS.pm: add use warnings to the modules * Build.PL, lib/XML/Feed/Content.pm, lib/XML/Feed/Entry.pm, lib/XML/Feed/Format/Atom.pm, lib/XML/Feed/Format/RSS.pm, t/00-compile.t, t/01-parse.t, t/04-splice-atom.t, t/04-splice-rss.t, t/08-convert-summary-bug.t, t/10-mix-and-match.t, t/11-xml-base-atom.t, t/11-xml-base-rss.t, t/16-convert-mult-categories.t: remove Id tags from the times of Subversion * lib/XML/Feed/Content.pm, lib/XML/Feed/Enclosure.pm, lib/XML/Feed/Entry.pm, lib/XML/Feed/Entry/Format/Atom.pm, lib/XML/Feed/Entry/Format/RSS.pm, lib/XML/Feed/Format/Atom.pm, lib/XML/Feed/Format/RSS.pm, t/has-version.t: add version number to all the modules 2013-01-04 Dave Cross * lib/XML/Feed.pm: Bump version for release * Changes: Commit changes to Changes 2012-12-30 Gabor Szabo * Changes, lib/XML/Feed.pm: change the User Agent string 2012-07-28 Shlomi Fish * Build.PL: Add a meta_merge link to the respository. This way metacpan.org and other services will display it. 2012-07-10 Dave Cross * lib/XML/Feed.pm: Bump version for release. * lib/XML/Feed.pm, lib/XML/Feed/Format/Atom.pm, lib/XML/Feed/Format/RSS.pm: Added an image() method to Feed objects. Does something useful for RSS feeds; not for Atom feeds currently. * t/02-create.t: Fixed tests 2012-04-10 Jakob Voss * Changes, lib/XML/Feed.pm, lib/XML/Feed/Format/Atom.pm, lib/XML/Feed/Format/RSS.pm, t/02-create.t: Add support for RFC 5005 Feed Paging and Archiving in Atom feeds 2012-04-06 Dave Cross * Changes, lib/XML/Feed.pm: Bump version for release. 2012-04-05 Dave Cross * lib/XML/Feed.pm: Remove svn tag. * lib/XML/Feed.pm: Changed contact details from non-working 6A email address. 2012-03-28 sockmonk * README: Updated README file with current and tested installation instructions. Hoping to clarify the confusion reflected in RT # 53884, maybe even resolve it. https://rt.cpan.org/Public/Bug/Display.html?id=53884 2012-03-12 Dave Cross * lib/XML/Feed.pm: Bump version for release. * t/07-atom10-create.t: Fixed broken date test. * lib/XML/Feed/Entry/Format/Atom.pm: Applying the missing bit of the patch from https://rt.cpan.org/Ticket/Display.html?id=20763 2012-03-10 Dave Cross * lib/XML/Feed.pm: Bump version number for release. * Build.PL: Increase XML::Atom dependency to 0.37 - see https://rt.cpan.org/Ticket/Display.html?id=74703 2012-03-06 Gabor Szabo * MANIFEST.SKIP: fix MANIFEST.SKIP * MANIFEST: update MANIFEST file * eg/check_feed.pl: add example * lib/XML/Feed.pm, lib/XML/Feed/Entry.pm: add links to the POD 2012-02-19 Gabor Szabo * t/23-eval.t: add explicit tests for loading internal packages and failing when it does not exist * lib/XML/Feed/Entry/Format/Atom.pm, lib/XML/Feed/Entry/Format/RSS.pm, lib/XML/Feed/Format/Atom.pm, lib/XML/Feed/Format/RSS.pm: split up files to individual packages * .gitignore: ignore *.swp files 2012-02-18 Gabor Szabo * .gitignore: gitignore some generated files 2012-02-17 Gabor Szabo * lib/XML/Feed/Format/RSS.pm: add missing return call fixing the failures introduced when trying to fix 73160 * lib/XML/Feed/Format/RSS.pm: eliminate warning generated in t/16-convert-mult-categories.t 2011-12-11 Dave Cross * MANIFEST, lib/XML/Feed/Format/RSS.pm, t/22-bug73160.t, t/samples/rss10-datespaces.xml: Added tests for bug 73160. And code to make them pass. 2011-09-03 Dave Cross * Changes: Updated changed for 0.45 (oops) and 0.46. * MANIFEST, lib/XML/Feed.pm, lib/XML/Feed/Format/Atom.pm, lib/XML/Feed/Format/RSS.pm, t/20-no-enclosures.t, t/21-rss2-permalinks.t, t/samples/rss20-p.xml: Closed a few tickets from the RT queue as an excuse for a new release. Bumped to version 0.46. 2011-07-30 Dave Cross * MANIFEST, MANIFEST.SKIP, lib/XML/Feed.pm, lib/XML/Feed/Format/Atom.pm, t/18-double2.t, t/19-double3.t, t/samples/rss20-double.xml: Another round of changes to fix (and test) https://rt.cpan.org/Public/Bug/Display.html?id=44899 2011-07-16 Dave Cross * MANIFEST, lib/XML/Feed/Format/Atom.pm, t/19-double3.t, t/samples/rss10-double2.xml: Added new (currently failing) test for the double-encoding bug. 2011-04-24 Dave Cross * MANIFEST, MANIFEST.SKIP, t/18-double2.t, t/samples/rss20-double.xml: Tests to ensure that the double-encoding bug fix works. 2011-03-13 Dave Cross * t/17-double.t, t/18-double2.t, t/samples/rss10-double.xml, t/samples/rss20-double.xml: Added new tests to prove what the problem is. * t/15-odd-date.t: Force stringification so test passes. 2010-03-22 Simon Wistow * Build.PL: Force requiring HTML::Entities; * Build.PL, Changes, lib/XML/Feed.pm, lib/XML/Feed/Format/Atom.pm: Fix bug in conversion process between RSS and Atom where HTML got double encoded https://rt.cpan.org/Public/Bug/Display.html?id=44899 * MANIFEST, lib/XML/Feed/Format/Atom.pm: Fix double encoding bug? * lib/XML/Feed/Format/RSS.pm: Add updated() 2009-11-17 Simon Wistow * lib/XML/Feed/Entry.pm, t/16-convert-mult-categories.t: Fix a problem converting multiple categories thanks to Алексей Капранов (KAPPA) in bug 50125 https://rt.cpan.org/Ticket/Display.html?id=50125 * lib/XML/Feed/Format/RSS.pm: Fixing RT #47981 https://rt.cpan.org/Ticket/Display.html?id=47981 Which is due to Blogspot using unusual atom namespaced elements in short RSS feeds. * MANIFEST: Add Build.PL 2009-05-29 Simon Wistow * Changes, MANIFEST, lib/XML/Feed/Format/RSS.pm, t/15-odd-date.t, t/samples/rss10-odd-date.xml: Fix buglet to do with odd date terms https://rt.cpan.org/Ticket/Display.html?id=46494 (Joey Hess) * MANIFEST: Add Makefile.PL 2009-05-07 Simon Wistow * Build.PL, Changes, MANIFEST, lib/XML/Feed.pm, lib/XML/Feed/Format/Atom.pm, lib/XML/Feed/Format/RSS.pm, t/14-multi-enclosures.t, t/samples/atom-multi-enclosure.xml, t/samples/rss20-multi-enclosure.xml: Multiple enclosure support 2009-04-03 Simon Wistow * Changes: Merge changes * lib/XML/Feed.pm: Add a note about XML::RSS::LibXML 2009-01-25 Tatsuhiko Miyagawa * Changes: docs * lib/XML/Feed/Format/RSS.pm, t/13-category-hash-bug.t, t/samples/category-bug.xml: Fixed RSS multiple category with XML::RSS::LibXML 2008-12-11 Simon Wistow * lib/XML/Feed/Enclosure.pm, lib/XML/Feed/Entry.pm, lib/XML/Feed/Format/Atom.pm, lib/XML/Feed/Format/RSS.pm, t/13-enclosures.t, t/samples/atom-enclosure.xml, t/samples/rss20-enclosure.xml: First cut at enclosures 2008-12-10 Simon Wistow * MANIFEST: GAH * MANIFEST: Whoops again * MANIFEST: Whoops * Changes, lib/XML/Feed.pm, lib/XML/Feed/Entry.pm: Gte ready for release 2008-12-09 Simon Wistow * lib/XML/Feed/Format/RSS.pm: Fix bug with adding first category * Build.PL, Changes, lib/XML/Feed/Entry.pm, lib/XML/Feed/Format/Atom.pm, lib/XML/Feed/Format/RSS.pm, t/12-multi-categories-atom.t, t/12-multi-categories-rss.t, t/12-multi-categories.base, t/12-multi-subjects-rss.t, t/samples/atom-multiple-categories.xml, t/samples/rss-multiple-categories.xml, t/samples/rss-multiple-subjects.xml: First cut at multiple category/tag support 2008-12-01 Simon Wistow * MANIFEST.SKIP, README, lib/XML/Feed.pm, lib/XML/Feed/Content.pm, lib/XML/Feed/Entry.pm, lib/XML/Feed/Format/Atom.pm, lib/XML/Feed/Format/RSS.pm, t/00-compile.t, t/01-parse.t, t/04-splice-atom.t, t/04-splice-rss.t, t/10-mix-and-match.t, t/11-xml-base-atom.t, t/11-xml-base-rss.t: Set Id keyword on everything 2008-11-24 Simon Wistow * lib/XML/Feed/Enclosure.pm: First cut at enclosure support * lib/XML/Feed/Format/Atom.pm, lib/XML/Feed/Format/RSS.pm: Add enclosure code. * Build.PL: Update property 2008-11-21 Simon Wistow * Changes: UTF8 problem * Changes: Fix Andreas' name * Build.PL, Changes, lib/XML/Feed.pm, lib/XML/Feed/Format/RSS.pm, t/11-xml-base-rss.t: Fix base support with latest version of XML::RSS 2008-11-14 Simon Wistow * Changes: Add bug fix * lib/XML/Feed/Entry.pm, lib/XML/Feed/Format/Atom.pm, lib/XML/Feed/Format/RSS.pm: Add version to Entry * Build.PL, lib/XML/Feed/Format/Atom.pm: Fix 'base' stuff 2008-11-11 Simon Wistow * MANIFEST: Add Build.PL 2008-11-04 Simon Wistow * Changes: Add date into Changes * lib/XML/Feed/Format/RSS.pm: Cleanup * MANIFEST: Update for new status * Changes: Add note about https://rt.cpan.org/Ticket/Display.html?id=14725 2008-11-03 Simon Wistow * Build.PL, lib/XML/Feed.pm, lib/XML/Feed/Format/Atom.pm, lib/XML/Feed/Format/RSS.pm: Move to the Formats identifying what content to look at * t/00-compile.t, t/01-parse.t, t/02-create.t: Update tests * MANIFEST: Add pod*.t * Build.PL, MANIFEST, lib/XML/Feed.pm, lib/XML/Feed/Format/Atom.pm, lib/XML/Feed/Format/RSS.pm, t/00-compile.t, t/01-parse.t, t/02-create.t: Rollback r92 * Build.PL, MANIFEST, lib/XML/Feed.pm, lib/XML/Feed/Format/Atom.pm, lib/XML/Feed/Format/RSS.pm, t/00-compile.t, t/01-parse.t, t/02-create.t: Update tests * lib/XML/Feed.pm, lib/XML/Feed/Atom.pm, lib/XML/Feed/Entry.pm, lib/XML/Feed/Format/Atom.pm, lib/XML/Feed/Format/RSS.pm, lib/XML/Feed/RSS.pm: Switch to different layout 2008-10-29 Simon Wistow * lib/XML/Feed.pm, lib/XML/Feed/Content.pm, lib/XML/Feed/Entry.pm, t/pod-coverage.t, t/pod.t: Add pod and coverage tests 2008-10-24 Simon Wistow * lib/XML/Feed.pm: Add note about makign a validating URL * Changes: Add date * MANIFEST: Update MANIFEST file with new tests * lib/XML/Feed.pm: Up the version number 2008-10-23 Simon Wistow * Changes: Add xml:base work * lib/XML/Feed/RSS.pm: Fix typo * lib/XML/Feed/RSS.pm, t/11-xml-base-rss.t, t/samples/base_rss.xml: Update xml:base parsing in RSS * lib/XML/Feed/RSS.pm, t/11-xml-base-atom.t, t/11-xml-base-rss.t: Make base work * lib/XML/Feed.pm, lib/XML/Feed/Atom.pm, lib/XML/Feed/Content.pm, lib/XML/Feed/Entry.pm, lib/XML/Feed/RSS.pm, t/11-xml-base-atom.t, t/11-xml-base-rss.t, t/samples/base_atom.xml, t/samples/base_rss.xml: Initiali support for xml:base * t/04-spice-atom.t: Misnamed 2008-10-22 Simon Wistow * Changes, lib/XML/Feed.pm, lib/XML/Feed/Atom.pm, lib/XML/Feed/RSS.pm, t/04-spice-atom.t, t/04-splice-atom.t, t/04-splice-rss.t, t/04-splice.t, t/10-mix-and-match.t: Fix mixing and matching of RSS and Atom * lib/XML/Feed.pm: Up version * Changes, lib/XML/Feed.pm: Fix fetching through proxies * Changes, lib/XML/Feed.pm, lib/XML/Feed/Atom.pm, lib/XML/Feed/Entry.pm, lib/XML/Feed/RSS.pm, t/02-create.t: Add support for self linking and GeoRSS Patches from Shlomi Fish http://rt.cpan.org/Ticket/Display.html?id=39924 and Scott Gifford http://rt.cpan.org/Ticket/Display.html?id=40046 * lib/XML/Feed.pm, lib/XML/Feed/RSS.pm: Make feed validate 2008-10-16 Simon Wistow * Changes, t/09-missing-content-bug.t: Created test for http://rt.cpan.org/Ticket/Display.html?id=18810 (Ryan Tate) * Build.PL: Up the minimum requirement for XML::RSS to 1.31 http://rt.cpan.org/Ticket/Display.html?id=23588 (Andreas König ANDK) * Changes, lib/XML/Feed/RSS.pm: Correct namespace for terms in RSS http://rt.cpan.org/Ticket/Display.html?id=25393 (Kent Cowgill KCOWGILL) 2008-10-15 Simon Wistow * Changes, MANIFEST, inc/ExtUtils/AutoInstall.pm, inc/HTML/TokeParser.pm, inc/LWP.pm, inc/Module/AutoInstall.pm, inc/Module/Install.pm, inc/Module/Install/AutoInstall.pm, inc/Module/Install/Base.pm, inc/Module/Install/Build.pm, inc/Module/Install/Can.pm, inc/Module/Install/Fetch.pm, inc/Module/Install/Include.pm, inc/Module/Install/Makefile.pm, inc/Module/Install/Metadata.pm, inc/Module/Install/Win32.pm, inc/Module/Install/WriteAll.pm, inc/Test/More.pm, lib/XML/Feed.pm: Get rid of the inc directory * Build.PL: Force a non-segfaulting version of XML::LibXML * MANIFEST, MANIFEST.SKIP: Shush * lib/XML/Feed.pm: Add a note as to where to find this in subversion * t/06-atom10.t, t/07-atom10-create.t: Force stringification * Changes: Add keywords 2008-10-03 Simon Wistow * lib/XML/Feed/Atom.pm: Fix broken summary behaviour 2008-10-01 Simon Wistow * lib/XML/Feed/Atom.pm: Feed fixes * lib/XML/Feed/Atom.pm: Fix encoding problems 2008-08-22 Simon Wistow * MANIFEST, MANIFEST.SKIP, Makefile.PL: Shush * t/08-convert-summary-bug.t: Checking for conversion bug * META.yml: Generated files shouldn't be in SVN * Changes: Note the switch to module::build * Build.PL: Switch to Module::Build * lib/XML/Feed.pm: Update version * lib/XML/Feed/Atom.pm, t/01-parse.t: use wantarray for backwards compatability * lib/XML/Feed.pm: Need to actually pick up the format. Doh * Changes, lib/XML/Feed/Atom.pm: Cope with "updated" and "published" elements http://rt.cpan.org/Public/Bug/Display.html?id=20763 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=380498 (Gregor Herrmann and Joey Hess) * Changes, lib/XML/Feed/Entry.pm: Prevent empty content http://rt.cpan.org/Public/Bug/Display.html?id=29684 (Dave Rolsky DROLSKY) * Changes, lib/XML/Feed/Atom.pm, t/07-atom10-create.t: Allow accessors to make sure things validate * Changes, Makefile.PL: Force working version XML::Atom http://rt.cpan.org/Public/Bug/Display.html?id=22548 http://rt.cpan.org/Public/Bug/Display.html?id=19920 * Changes, lib/XML/Feed.pm, lib/XML/Feed/Atom.pm, lib/XML/Feed/RSS.pm: Allow passing through of initialisation options. http://rt.cpan.org/Public/Bug/Display.html?id=24729 * Changes, lib/XML/Feed.pm: Allow specification of the parsing format. Fix http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=477394 2008-08-21 Simon Wistow * lib/XML/Handler/Trees.pm: Wrong place for this * lib/XML/Handler/Trees.pm: No rpm, no cpan, no svn so we include it here 2008-04-22 Simon Wistow * Changes, MANIFEST, META.yml, lib/XML/Feed.pm, lib/XML/Feed/Atom.pm, t/04-splice.t, t/06-atom10.t, t/07-atom10-create.t, t/samples/atom-full.xml: Load XML-Feed-0.12 into trunk. * Changes, MANIFEST, META.yml, Makefile.PL, inc/Test/More.pm, lib/XML/Feed.pm, lib/XML/Feed/Atom.pm, t/05-atom10-link.t, t/samples/atom-10-example.xml: Load XML-Feed-0.11 into trunk. * Changes, META.yml, lib/XML/Feed.pm, t/samples/atom.xml: Load XML-Feed-0.10 into trunk. * Changes, META.yml, inc/ExtUtils/AutoInstall.pm, inc/HTML/TokeParser.pm, inc/LWP.pm, inc/Module/AutoInstall.pm, inc/Module/Install.pm, inc/Module/Install/AutoInstall.pm, inc/Module/Install/Base.pm, inc/Module/Install/Build.pm, inc/Module/Install/Can.pm, inc/Module/Install/Fetch.pm, inc/Module/Install/Include.pm, inc/Module/Install/Makefile.pm, inc/Module/Install/Metadata.pm, inc/Module/Install/Win32.pm, inc/Module/Install/WriteAll.pm, lib/XML/Feed.pm, lib/XML/Feed/RSS.pm, t/02-create.t: Load XML-Feed-0.09 into trunk. * Changes, MANIFEST, META.yml, Makefile.PL, README, inc/ExtUtils/AutoInstall.pm, inc/HTML/TokeParser.pm, inc/LWP.pm, inc/Module/AutoInstall.pm, inc/Module/Install.pm, inc/Module/Install/AutoInstall.pm, inc/Module/Install/Base.pm, inc/Module/Install/Build.pm, inc/Module/Install/Can.pm, inc/Module/Install/Fetch.pm, inc/Module/Install/Include.pm, inc/Module/Install/Makefile.pm, inc/Module/Install/Metadata.pm, inc/Module/Install/Win32.pm, inc/Module/Install/WriteAll.pm, lib/XML/Feed.pm, lib/XML/Feed/Atom.pm, lib/XML/Feed/RSS.pm, t/01-parse.t, t/samples/rss10-invalid-date.xml: Load XML-Feed-0.08 into trunk. * Changes, MANIFEST, META.yml, lib/XML/Feed.pm, lib/XML/Feed/Entry.pm, t/04-splice.t: Load XML-Feed-0.07 into trunk. * Changes, MANIFEST, META.yml, Makefile.PL, README, lib/XML/Feed.pm, lib/XML/Feed/Atom.pm, lib/XML/Feed/Content.pm, lib/XML/Feed/Entry.pm, lib/XML/Feed/RSS.pm, t/00-compile.t, t/01-parse.t, t/02-create.t: Load XML-Feed-0.06 into trunk. * Changes, META.yml, lib/XML/Feed.pm: Load XML-Feed-0.05 into trunk. * Build.PL, Changes, META.yml, Makefile.PL, README, inc/Module/Install.pm, inc/Module/Install/AutoInstall.pm, inc/Module/Install/Base.pm, inc/Module/Install/Build.pm, inc/Module/Install/Can.pm, inc/Module/Install/Fetch.pm, inc/Module/Install/Include.pm, inc/Module/Install/Makefile.pm, inc/Module/Install/Metadata.pm, inc/Module/Install/Win32.pm, inc/Module/Install/WriteAll.pm, lib/XML/Feed.pm, lib/XML/Feed/Atom.pm, lib/XML/Feed/Content.pm, lib/XML/Feed/Entry.pm, lib/XML/Feed/RSS.pm, t/00-compile.t, t/01-parse.t: Load XML-Feed-0.04 into trunk. * Changes, MANIFEST, META.yml, Makefile.PL, README, inc/Module/Install.pm, inc/Module/Install/Include.pm, lib/XML/Feed.pm, lib/XML/Feed/Content.pm, lib/XML/Feed/ErrorHandler.pm: Load XML-Feed-0.03 into trunk. * Changes, MANIFEST, META.yml, lib/XML/Feed.pm, lib/XML/Feed/Atom.pm, lib/XML/Feed/Content.pm, lib/XML/Feed/Entry.pm, lib/XML/Feed/RSS.pm, t/01-parse.t, t/samples/rss20-no-summary.xml: Load XML-Feed-0.02 into trunk. * Build.PL, Changes, MANIFEST, META.yml, Makefile.PL, README, inc/ExtUtils/AutoInstall.pm, inc/Module/Install.pm, inc/Module/Install/AutoInstall.pm, inc/Module/Install/Base.pm, inc/Module/Install/Build.pm, inc/Module/Install/Can.pm, inc/Module/Install/Fetch.pm, inc/Module/Install/Include.pm, inc/Module/Install/Makefile.pm, inc/Module/Install/Metadata.pm, inc/Module/Install/Win32.pm, inc/Module/Install/WriteAll.pm, lib/XML/Feed.pm, lib/XML/Feed/Atom.pm, lib/XML/Feed/Entry.pm, lib/XML/Feed/ErrorHandler.pm, lib/XML/Feed/RSS.pm, t/00-compile.t, t/01-parse.t, t/samples/atom.xml, t/samples/rss10.xml, t/samples/rss20.xml: Load XML-Feed-0.01 into trunk. * Build.PL, Changes, MANIFEST, META.yml, Makefile.PL, README, inc/ExtUtils/AutoInstall.pm, inc/Module/Install.pm, inc/Module/Install/AutoInstall.pm, inc/Module/Install/Base.pm, inc/Module/Install/Build.pm, inc/Module/Install/Can.pm, inc/Module/Install/Fetch.pm, inc/Module/Install/Include.pm, inc/Module/Install/Makefile.pm, inc/Module/Install/Metadata.pm, inc/Module/Install/Win32.pm, inc/Module/Install/WriteAll.pm, lib/XML/Feed.pm, lib/XML/Feed/Atom.pm, lib/XML/Feed/Entry.pm, lib/XML/Feed/ErrorHandler.pm, lib/XML/Feed/RSS.pm, t/00-compile.t, t/01-parse.t, t/samples/atom.xml, t/samples/rss10.xml, t/samples/rss20.xml: Make * Build.PL, Changes, MANIFEST, META.yml, Makefile.PL, README, inc/ExtUtils/AutoInstall.pm, inc/Module/Install.pm, inc/Module/Install/AutoInstall.pm, inc/Module/Install/Base.pm, inc/Module/Install/Build.pm, inc/Module/Install/Can.pm, inc/Module/Install/Fetch.pm, inc/Module/Install/Include.pm, inc/Module/Install/Makefile.pm, inc/Module/Install/Metadata.pm, inc/Module/Install/Win32.pm, inc/Module/Install/WriteAll.pm, lib/XML/Feed.pm, lib/XML/Feed/Atom.pm, lib/XML/Feed/Entry.pm, lib/XML/Feed/ErrorHandler.pm, lib/XML/Feed/RSS.pm, t/00-compile.t, t/01-parse.t, t/samples/atom.xml, t/samples/rss10.xml, t/samples/rss20.xml: Load XML-Feed-0.01 into trunk. * Build.PL, Changes, MANIFEST, META.yml, Makefile.PL, README, inc/ExtUtils/AutoInstall.pm, inc/Module/Install.pm, inc/Module/Install/AutoInstall.pm, inc/Module/Install/Base.pm, inc/Module/Install/Build.pm, inc/Module/Install/Can.pm, inc/Module/Install/Fetch.pm, inc/Module/Install/Include.pm, inc/Module/Install/Makefile.pm, inc/Module/Install/Metadata.pm, inc/Module/Install/Win32.pm, inc/Module/Install/WriteAll.pm, lib/XML/Feed.pm, lib/XML/Feed/Atom.pm, lib/XML/Feed/Entry.pm, lib/XML/Feed/ErrorHandler.pm, lib/XML/Feed/RSS.pm, t/00-compile.t, t/01-parse.t, t/samples/atom.xml, t/samples/rss10.xml, t/samples/rss20.xml: Create * Build.PL, Changes, MANIFEST, META.yml, Makefile.PL, README, inc/ExtUtils/AutoInstall.pm, inc/Module/Install.pm, inc/Module/Install/AutoInstall.pm, inc/Module/Install/Base.pm, inc/Module/Install/Build.pm, inc/Module/Install/Can.pm, inc/Module/Install/Fetch.pm, inc/Module/Install/Include.pm, inc/Module/Install/Makefile.pm, inc/Module/Install/Metadata.pm, inc/Module/Install/Win32.pm, inc/Module/Install/WriteAll.pm, lib/XML/Feed.pm, lib/XML/Feed/Atom.pm, lib/XML/Feed/Entry.pm, lib/XML/Feed/ErrorHandler.pm, lib/XML/Feed/RSS.pm, t/00-compile.t, t/01-parse.t, t/samples/atom.xml, t/samples/rss10.xml, t/samples/rss20.xml: Load XML-Feed-0.01 into trunk. libxml-feed-perl-0.52+dfsg.orig/MANIFEST.SKIP0000444000175000017500000000012712114210615017625 0ustar gregoagregoa\.tar\.gz$ \.svn \.git \.bak$ _build Build$ blib Makefile$ ^MYMETA.yml$ ^MYMETA\.json$ libxml-feed-perl-0.52+dfsg.orig/Build.PL0000444000175000017500000000341312114210615017224 0ustar gregoagregoause Module::Build; my $build = Module::Build ->new( module_name => "XML::Feed", dist_abstract => "XML Syndication Feed Support", dist_author => 'Six Apart', license => 'perl', script_files => [ ], requires => { 'Class::ErrorHandler' => 0, 'DateTime' => 0, 'DateTime::Format::Mail' => 0, 'DateTime::Format::W3CDTF' => 0, 'Feed::Find' => 0, 'HTML::Entities' => 0, 'HTML::TokeParser' => 0, 'List::Util' => 0, 'LWP::UserAgent' => 0, 'Module::Pluggable' => 0, 'URI::Fetch' => 0, 'XML::Atom' => '0.38', 'XML::LibXML' => '1.66', 'XML::RSS' => '1.47', 'Test::More' => 0, }, create_makefile_pl => 'traditional', meta_merge => { resources => { repository => "https://github.com/davorg/xml-feed", }, x_contributors => [ 'Dave Cross ', 'Jakob Voss ', 'Tatsuhiko Miyagawa ', 'Simon Wistow ', 'Gabor Szabo ', ], }, ); $build->create_build_script; libxml-feed-perl-0.52+dfsg.orig/README0000444000175000017500000000136012114210615016607 0ustar gregoagregoa$Id$ This is XML::Feed, an abstraction above the RSS and Atom syndication feed formats. It supports both parsing and autodiscovery of feeds. PREREQUISITES * Class::ErrorHandler * XML::RSS * XML::Atom * DateTime * DateTime::Format::Mail * DateTime::Format::W3CDTF * List::Util * Feed::Find * URI::Fetch INSTALLATION XML::Feed installation is straightforward. If your CPAN shell is set up, you should just be able to do % perl -MCPAN -e 'install XML::Feed' Alternatively, you can download it, unpack it, and then build it like this (using Module::Build): % perl Build.PL % ./Build installdeps % ./Build % ./Build test Then install it: % ./Build install Six Apart / cpan@sixapart.com libxml-feed-perl-0.52+dfsg.orig/eg/0000755000175000017500000000000012114210615016324 5ustar gregoagregoalibxml-feed-perl-0.52+dfsg.orig/eg/check_feed.pl0000444000175000017500000000357712114210615020733 0ustar gregoagregoause strict; use warnings; use v5.10; =head1 DESCRIPTION Given a URL of an Atom or RSS feed or a filename of an already downloaded feed, this script will try to parse it and print out what it understands from the feed. =cut use XML::Feed; my $src = shift; die "Usage: $0 FILE|URL\n" if not $src; my $source = $src; if ($src =~ m{^https?://}) { $source = URI->new($src); } else { if (not -f $source) { die "'$source' does not look like a URL and it does not exist on the file-system either.\n"; } } my $feed = XML::Feed->parse( $source ) or die XML::Feed->errstr; say 'Title: ' . ($feed->title // ''); say 'Tagline: ' . ($feed->tagline // ''); say 'Format: ' . ($feed->format // ''); say 'Author: ' . ($feed->author // ''); say 'Link: ' . ($feed->link // ''); say 'Base: ' . ($feed->base // ''); say 'Language: ' . ($feed->language // ''); say 'Copyright: ' . ($feed->copyright // ''); say 'Modified: ' . ($feed->modified // ''); # DateTime object say 'Generator: ' . ($feed->generator // ''); for my $entry ($feed->entries) { say ''; say ' Link: ' . ($entry->link // ''); say ' Author: ' . ($entry->author // ''); say ' Title: ' . ($entry->title // ''); say ' Caregory: ' . ($entry->category // ''); say ' Id: ' . ($entry->id // ''); say ' Issued: ' . ($entry->issued // ''); # DateTime object say ' Modified: ' . ($entry->modified // ''); # DateTime object say ' Lat: ' . ($entry->lat // ''); say ' Long: ' . ($entry->long // ''); say ' Format: ' . ($entry->format // ''); say ' Tags: ' . ($entry->tags // ''); say ' Enclosure: ' . ($entry->enclosure // ''); say ' Summary: ' . ($entry->summary->body // ''); say ' Content: ' . ($entry->content->body // ''); } libxml-feed-perl-0.52+dfsg.orig/t/0000755000175000017500000000000012114210615016174 5ustar gregoagregoalibxml-feed-perl-0.52+dfsg.orig/t/04-splice-atom.t0000444000175000017500000000100412114210615021010 0ustar gregoagregoause strict; use Test::More tests => 3; use XML::Feed; my $feed = XML::Feed->new('Atom'); my $other = XML::Feed->parse('t/samples/atom.xml')->convert('Atom'); $feed->splice($other); is(scalar $feed->entries, 2, '2 entries in the feed after splicing'); $feed->splice($other); is(scalar $feed->entries, 2, 'Still 2 entries after splicing again'); $other = XML::Feed->parse('t/samples/rss10.xml')->convert('Atom'); $feed->splice($other); is(scalar $feed->entries, 4, 'Now 4 entries after splicing in RSS 1.0 feed'); libxml-feed-perl-0.52+dfsg.orig/t/17-double.t0000444000175000017500000000145512114210615020063 0ustar gregoagregoause Test::More 'no_plan'; use XML::Feed; my $rss = XML::Feed->parse('t/samples/rss10-double.xml'); isa_ok($rss, 'XML::Feed::Format::RSS'); my $rss_entry = ($rss->entries)[0]; isa_ok($rss_entry, 'XML::Feed::Entry::Format::RSS'); my $rss_content = $rss_entry->content; isa_ok($rss_content, 'XML::Feed::Content'); is($rss_content->type, 'text/html', 'Correct content type'); like($rss_content->body, qr(<|<), 'Contains HTML tags'); my $atom = $rss->convert('Atom'); isa_ok($atom, 'XML::Feed::Format::Atom'); my $atom_entry = ($atom->entries)[0]; isa_ok($atom_entry, 'XML::Feed::Entry::Format::Atom'); my $atom_content = $atom_entry->content; isa_ok($atom_content, 'XML::Feed::Content'); is($atom_content->type, 'text/html', 'Correct content type'); like($atom_content->body, qr(<|<), 'Contains HTML tags'); libxml-feed-perl-0.52+dfsg.orig/t/22-bug73160.t0000444000175000017500000000122512114210615017756 0ustar gregoagregoause strict; use warnings; use Test::More; use XML::Feed; my $file = 't/samples/rss10-datespaces.xml'; my $feed = XML::Feed->parse($file); isa_ok($feed, 'XML::Feed::Format::RSS'); ok(my $date = $feed->modified, 'Got a feed modified date'); isa_ok($date, 'DateTime'); my $link = $feed->link; unlike($link, qr[^\s], 'No spaces at start of link'); unlike($link, qr[\s$], 'No spaces at end of link'); my $entry = ($feed->entries)[0]; ok(my $iss = $entry->issued, 'Got an entry issued date'); isa_ok($iss, 'DateTime'); $link = $entry->link; unlike($link, qr[^\s], 'No spaces at start of link'); unlike($link, qr[\s$], 'No spaces at end of link'); done_testing; libxml-feed-perl-0.52+dfsg.orig/t/05-atom10-link.t0000444000175000017500000000043612114210615020640 0ustar gregoagregoause strict; use XML::Feed; use Test::More; plan tests => 3; my $feed = XML::Feed->parse("t/samples/atom-10-example.xml"); is $feed->title, 'Example Feed'; is $feed->link, 'http://example.org/', "link without rel"; my $e = ($feed->entries)[0]; ok $e->link, 'entry link without rel'; libxml-feed-perl-0.52+dfsg.orig/t/21-rss2-permalinks.t0000444000175000017500000000042012114210615021627 0ustar gregoagregoause strict; use warnings; use Test::More tests => 2; use XML::Feed; my $file = 't/samples/rss20-p.xml'; my $feed = XML::Feed->parse($file); isa_ok($feed, 'XML::Feed::Format::RSS'); my $entry = ($feed->entries)[0]; is($entry->link, 'http://creograf.ru/post/regexp -js'); libxml-feed-perl-0.52+dfsg.orig/t/11-xml-base-rss.t0000444000175000017500000000261112114210615021113 0ustar gregoagregoause strict; use Test::More; use XML::Feed; use XML::RSS; plan tests => 13; my $feed = XML::Feed->parse('t/samples/base_rss.xml'); my ($entry) = $feed->entries; my $content = $entry->content; is($feed->base, "http://example.org/", "Got feed base"); is($entry->base, "http://example.org/archives/", "Got entry base"); is($content->base, "http://example.org/archives/000001.html", "Got content base"); my $xml = $feed->as_xml; my $new; ok($new = XML::Feed->parse(\$xml), "Parsed old feed"); my ($new_entry) = $new->entries; my $new_content = $entry->content; is($new->base, "http://example.org/", "Got feed base"); is($new_entry->base, "http://example.org/archives/", "Got entry base"); is($new_content->base, "http://example.org/archives/000001.html", "Got content base"); ok($feed->base("http://foo.com/"), "Set feed base"); ok($entry->base("http://foo.com/archives/"), "Set entry base"); ok($content->base("http://foo.com/archives/000001.html"), "Set content base"); is($feed->base, "http://foo.com/", "Got feed base"); is($entry->base, "http://foo.com/archives/", "Got entry base"); is($content->base, "http://foo.com/archives/000001.html", "Got content base"); libxml-feed-perl-0.52+dfsg.orig/t/pod.t0000444000175000017500000000031312114210615017136 0ustar gregoagregoa#!perl use strict; use warnings; use Test::More; eval 'use Test::Pod 1.14'; plan skip_all => 'Test::Pod 1.14 required for testing POD' if $@; all_pod_files_ok( grep { /^Boomerang/ } all_pod_files() ); libxml-feed-perl-0.52+dfsg.orig/t/10-mix-and-match.t0000444000175000017500000000141512114210615021225 0ustar gregoagregoause strict; use Test::More tests => 6; use XML::Feed; my $afeed = XML::Feed->new('Atom'); my $rfeed = XML::Feed->new('RSS'); my $atom = make_entry('Atom'); my $rss = make_entry('RSS'); ok($afeed->add_entry($atom), "Added Atom entry to Atom feed"); ok($afeed->add_entry($rss), "Added RSS entry to Atom feed"); ok($rfeed->add_entry($rss), "Added RSS entry to RSS feed"); ok($rfeed->add_entry($atom), "Added Atom entry to RSS feed"); is(scalar $afeed->entries, 2, 'Now 2 entries in Atom feed'); is(scalar $rfeed->entries, 2, 'Now 2 entries in RSS feed'); sub make_entry { my $format = shift; my $entry = XML::Feed::Entry->new($format); $entry->title("Test Title ".rand()); $entry->content("Foo"); $entry->summary("Bar"); return $entry; } libxml-feed-perl-0.52+dfsg.orig/t/23-eval.t0000444000175000017500000000146312114210615017534 0ustar gregoagregoause strict; use warnings; use Test::More tests => 8; use XML::Feed; use XML::Feed::Entry; eval { XML::Feed::Entry->new('Nofeed'); }; like $@, qr{Unsupported format Nofeed:}, 'Unsupported format'; { my $rss = XML::Feed::Entry->new('RSS'); isa_ok $rss, 'XML::Feed::Entry::Format::RSS'; my $atom = XML::Feed::Entry->new('Atom'); isa_ok $atom, 'XML::Feed::Entry::Format::Atom'; my $default = XML::Feed::Entry->new(); isa_ok $default, 'XML::Feed::Entry::Format::Atom'; } eval { XML::Feed->new('Nofeed'); }; like $@, qr{Unsupported format Nofeed:}, 'Unsupported format'; { my $rss = XML::Feed->new('RSS'); isa_ok $rss, 'XML::Feed::Format::RSS'; my $atom = XML::Feed->new('Atom'); isa_ok $atom, 'XML::Feed::Format::Atom'; my $default = XML::Feed->new(); isa_ok $default, 'XML::Feed::Format::Atom'; } libxml-feed-perl-0.52+dfsg.orig/t/15-odd-date.t0000444000175000017500000000050712114210615020265 0ustar gregoagregoa#!perl -w use strict; use Test::More tests => 3; use XML::Feed; ok (my $feed = XML::Feed->parse('t/samples/rss10-odd-date.xml'), "Parsed file"); ok (my ($entry) = $feed->entries, "Got entry"); is ($entry->issued . '',"2009-05-29T20:17:07", "Got correct issued date"); libxml-feed-perl-0.52+dfsg.orig/t/12-multi-categories-atom.t0000444000175000017500000000015012114210615023006 0ustar gregoagregoa#!perl -w use strict; use vars qw($type $field); $type = "atom"; require 't/12-multi-categories.base'; libxml-feed-perl-0.52+dfsg.orig/t/02-create.t0000444000175000017500000001132412114210615020042 0ustar gregoagregoause strict; use Test::More; use XML::Feed; use XML::Feed::Entry; use XML::Feed::Content; use DateTime; for my $format (qw( Atom RSS )) { my $feed = XML::Feed->new($format); isa_ok($feed, 'XML::Feed::Format::' . $format); like($feed->format, qr/^$format/, 'Format is correct'); $feed->title('My Feed'); is($feed->title, 'My Feed', 'feed title is correct'); $feed->link('http://www.example.com/'); is($feed->link, 'http://www.example.com/', 'feed link is correct'); $feed->description('Wow!'); is($feed->description, 'Wow!', 'feed description is correct'); is($feed->tagline, 'Wow!', 'tagline works as alias'); $feed->tagline('Again'); is($feed->tagline, 'Again', 'setting via tagline works'); $feed->language('en_US'); is($feed->language, 'en_US', 'feed language is correct'); $feed->author('Ben'); is($feed->author, 'Ben', 'feed author is correct'); $feed->copyright('Copyright 2005 Me'); is($feed->copyright, 'Copyright 2005 Me', 'feed copyright is correct'); my $now = DateTime->now; $feed->modified($now); isa_ok($feed->modified, 'DateTime', 'modified returns a DateTime'); is($feed->modified->iso8601, $now->iso8601, 'feed modified is correct'); $feed->generator('Movable Type'); is($feed->generator, 'Movable Type', 'feed generator is correct'); ok($feed->as_xml, 'as_xml returns something'); my $entry = XML::Feed::Entry->new($format); isa_ok($entry, 'XML::Feed::Entry::Format::' . $format); $entry->title('Foo Bar'); is($entry->title, 'Foo Bar', 'entry title is correct'); $entry->link('http://www.example.com/foo/bar.html'); is($entry->link, 'http://www.example.com/foo/bar.html', 'entry link is correct'); $entry->summary('This is a summary.'); isa_ok($entry->summary, 'XML::Feed::Content'); is($entry->summary->body, 'This is a summary.', 'entry summary is correct'); $entry->content('This is the content.'); isa_ok($entry->content, 'XML::Feed::Content'); is($entry->content->type, 'text/html', 'entry content type is correct'); is($entry->content->body, 'This is the content.', 'entry content body is correct'); $entry->content(XML::Feed::Content->new({ body => 'This is the content (again).', type => 'text/plain', })); isa_ok($entry->content, 'XML::Feed::Content'); is($entry->content->body, 'This is the content (again).', 'setting with XML::Feed::Content works'); $entry->category('Television'); is($entry->category, 'Television', 'entry category is correct'); $entry->author('Foo Baz'); is($entry->author, 'Foo Baz', 'entry author is correct'); $entry->id('foo:bar-15132'); is($entry->id, 'foo:bar-15132', 'entry id is correct'); my $dt = DateTime->now; $entry->issued($dt); isa_ok($entry->issued, 'DateTime'); is($entry->issued->iso8601, $dt->iso8601, 'entry issued is correct'); $entry->modified($dt); isa_ok($entry->modified, 'DateTime'); is($entry->modified->iso8601, $dt->iso8601, 'entry modified is correct'); $feed->add_entry($entry); my @e = $feed->entries; is(scalar @e, 1, 'One post in the feed'); is($e[0]->title, 'Foo Bar', 'Correct post'); is($e[0]->content->body, 'This is the content (again).', 'content is still correct'); if ($format eq 'Atom') { like $feed->as_xml, qr/This is the content/; } if ($format eq 'RSS') { like $feed->as_xml, qr{xmlns:dcterms="http://purl.org/dc/terms/"}; } $feed->self_link("http://tor.tld/my-feed.rss"); if ($format eq "RSS") { like ($feed->as_xml(), qr{\Q\E}, "Feed contains the atom:link"); } elsif ($format eq "Atom") { like ($feed->as_xml(), qr{\Q\E}, "Feed contains the atom:link"); my %rfc5005 = ( first_link => "http://tor.tld/my-feed.xml?page=1", next_link => "http://tor.tld/my-feed.xml?page=4", previous_link => "http://tor.tld/my-feed.xml?page=2", last_link => "http://tor.tld/my-feed.xml?page=99", current_link => "http://tor.tld/archive/2.xml", prev_archive_link => "http://tor.tld/archive/1.xml", next_archive_link => "http://tor.tld/archive/3.xml", ); while ( my($name,$url) = each(%rfc5005) ) { $feed->$name($url); $name =~ s/_link$//; $name =~ s/_/-/g; like ($feed->as_xml(), qr{\Q\E}, "Feed contains an RFC 5005 rel=\"$name\" link"); } } } done_testing; libxml-feed-perl-0.52+dfsg.orig/t/20-no-enclosures.t0000444000175000017500000000045612114210615021377 0ustar gregoagregoause strict; use Test::More; use XML::Feed; my @formats = qw/rss20 atom/; plan tests => 2*@formats; for my $format (@formats) { ok (my $feed = XML::Feed->parse("t/samples/$format.xml"), "Parsed $format"); my ($entry) = $feed->entries; my @enclosure = $entry->enclosure; is(@enclosure, 0); } libxml-feed-perl-0.52+dfsg.orig/t/09-missing-content-bug.t0000444000175000017500000000232612114210615022504 0ustar gregoagregoa#!perl -w use strict; use Test::More tests => 13; use_ok("XML::Feed"); my $rss_feed; ok($rss_feed = XML::Feed->new('RSS'), "Got feed"); ok($rss_feed->title('Happy Feed'), "Set feed title"); ok($rss_feed->author('Ask Bjork Tate'), "Set feed author"); ok($rss_feed->link('http://nowhere.com'), "Set feed link"); ok($rss_feed->language('en-US'), "Set feed language"); ok($rss_feed->description('not existing since who knows when'), "Set feed description"); my $rss_entry; my $content = <<'EOC'; But that's XML::RSS's problem. Oh, and this would be an XML::Feed::Content item as specced in the docs, but there is no constructor documented for XML::Feed::Content and I know this works anyway. EOC ok($rss_entry = XML::Feed::Entry->new('RSS'), "Got entry"); ok($rss_entry->title("Title is not always a required element in RSS2"), "Set entry title"); ok($rss_entry->content($content), "Set entry content"); ok($rss_entry->link('http://nowhere.com/themiddle'), "Set entry link"); ok($rss_feed->add_entry($rss_entry), "Added entry"); like($rss_feed->as_xml, qr/problem/i, "Feed has body"); libxml-feed-perl-0.52+dfsg.orig/t/12-multi-categories-rss.t0000444000175000017500000000014712114210615022663 0ustar gregoagregoa#!perl -w use strict; use vars qw($type $field); $type = "rss"; require 't/12-multi-categories.base'; libxml-feed-perl-0.52+dfsg.orig/t/12-multi-categories.base0000444000175000017500000000137612114210615022532 0ustar gregoagregoause strict; use Test::More tests => 6; use XML::Feed; $field ||= "categories"; ok(my $feed = XML::Feed->parse("t/samples/${type}-multiple-${field}.xml"), "Parsed $type file with multiple categories"); my ($entry) = $feed->entries; is_deeply( [$entry->category()], ["foo", "bar", "quux", "simon's tags"], "Got all categories"); my $xml = $feed->as_xml; ok($feed = XML::Feed->parse(\$xml), "Reparsed $type from string"); is_deeply( [$entry->category()], ["foo", "bar", "quux", "simon's tags"], "Got all categories again"); ok($entry->category("quirka fleeg"), "Added a category"); is_deeply( [$entry->category()], ["foo", "bar", "quux", "simon's tags", "quirka fleeg"], "Got new category"); libxml-feed-perl-0.52+dfsg.orig/t/01-parse.t0000444000175000017500000000472612114210615017720 0ustar gregoagregoause strict; use Test::More tests => 75; use XML::Feed; use URI; my %Feeds = ( 't/samples/atom.xml' => 'Atom', 't/samples/rss10.xml' => 'RSS 1.0', 't/samples/rss20.xml' => 'RSS 2.0', ); ## First, test all of the various ways of calling parse. my $feed; my $file = 't/samples/atom.xml'; $feed = XML::Feed->parse($file); isa_ok($feed, 'XML::Feed::Format::Atom'); is($feed->title, 'First Weblog'); open my $fh, $file or die "Can't open $file: $!"; $feed = XML::Feed->parse($fh); isa_ok($feed, 'XML::Feed::Format::Atom'); is($feed->title, 'First Weblog'); seek $fh, 0, 0; my $xml = do { local $/; <$fh> }; $feed = XML::Feed->parse(\$xml); isa_ok($feed, 'XML::Feed::Format::Atom'); is($feed->title, 'First Weblog'); $feed = XML::Feed->parse(URI->new("file:$file")); isa_ok($feed, 'XML::Feed::Format::Atom'); is($feed->title, 'First Weblog'); ## Then try calling all of the unified API methods. for my $file (sort keys %Feeds) { my $feed = XML::Feed->parse($file) or die XML::Feed->errstr; my($subclass) = $Feeds{$file} =~ /^(\w+)/; isa_ok($feed, 'XML::Feed::Format::' . $subclass); is($feed->format, $Feeds{$file}); is($feed->language, 'en-us'); is($feed->title, 'First Weblog'); is($feed->link, 'http://localhost/weblog/'); is($feed->tagline, 'This is a test weblog.'); is($feed->description, 'This is a test weblog.'); my $dt = $feed->modified; isa_ok($dt, 'DateTime'); $dt->set_time_zone('UTC'); is($dt->iso8601, '2004-05-30T07:39:57'); is($feed->author, 'Melody'); my @entries = $feed->entries; is(scalar @entries, 2); my $entry = $entries[0]; is($entry->title, 'Entry Two'); is($entry->link, 'http://localhost/weblog/2004/05/entry_two.html'); $dt = $entry->issued; isa_ok($dt, 'DateTime'); $dt->set_time_zone('UTC'); is($dt->iso8601, '2004-05-30T07:39:25'); like($entry->content->body, qr/

Hello!<\/p>/); is($entry->summary->body, 'Hello!...'); is(($entry->category)[0], 'Travel'); is($entry->category, 'Travel'); is($entry->author, 'Melody'); ok($entry->id); } $feed = XML::Feed->parse('t/samples/rss20-no-summary.xml') or die XML::Feed->errstr; my $entry = ($feed->entries)[0]; ok(!$entry->summary->body); like($entry->content->body, qr/

This is a test.<\/p>/); $feed = XML::Feed->parse('t/samples/rss10-invalid-date.xml') or die XML::Feed->errstr; $entry = ($feed->entries)[0]; ok(!$entry->issued); ## Should return undef, but not die. ok(!$entry->modified); ## Same. libxml-feed-perl-0.52+dfsg.orig/t/11-xml-base-atom.t0000444000175000017500000000256412114210615021253 0ustar gregoagregoause strict; use Test::More tests => 13; use XML::Feed; my $feed = XML::Feed->parse('t/samples/base_atom.xml'); my ($entry) = $feed->entries; my $content = $entry->content; is($feed->base, "http://example.org/", "Got feed base"); is($entry->base, "http://example.org/archives/", "Got entry base"); is($content->base, "http://example.org/archives/000001.html", "Got content base"); my $xml = $feed->as_xml; my $new; ok($new = XML::Feed->parse(\$xml), "Parsed old feed"); my ($new_entry) = $new->entries; my $new_content = $entry->content; is($new->base, "http://example.org/", "Got feed base"); is($new_entry->base, "http://example.org/archives/", "Got entry base"); is($new_content->base, "http://example.org/archives/000001.html", "Got content base"); ok($feed->base("http://foo.com/"), "Set feed base"); ok($entry->base("http://foo.com/archives/"), "Set entry base"); ok($content->base("http://foo.com/archives/000001.html"), "Set content base"); is($feed->base, "http://foo.com/", "Got feed base"); is($entry->base, "http://foo.com/archives/", "Got entry base"); is($content->base, "http://foo.com/archives/000001.html", "Got content base"); libxml-feed-perl-0.52+dfsg.orig/t/14-multi-enclosures.t0000444000175000017500000001045512114210615022120 0ustar gregoagregoa#!perl -w use strict; use Test::More; use XML::Feed; use XML::Feed::Enclosure; $XML::Feed::MULTIPLE_ENCLOSURES=1; my @formats = qw(atom rss20); plan tests => scalar(@formats)*38; foreach my $format (@formats) { ok (my $feed = XML::Feed->parse("t/samples/$format-multi-enclosure.xml"), "Parsed $format"); my ($entry) = $feed->entries; ok (my @enclosures = $entry->enclosure, "Got enclosure"); ok ($enclosures[0]->isa("XML::Feed::Enclosure"), "Object isa XML::Feed::Enclosure"); is ($enclosures[0]->type, "audio/mpeg", "Got the enclosure mime type"); is ($enclosures[0]->length, "2478719", "Got enclosure length"); is ($enclosures[0]->url, "http://example.com/sample_podcast.mp3", "Got enclosure url"); ok ($enclosures[1]->isa("XML::Feed::Enclosure"), "Object isa XML::Feed::Enclosure"); is ($enclosures[1]->type, "video/mpeg", "Got the enclosure mime type"); is ($enclosures[1]->length, "8888", "Got enclosure length"); is ($enclosures[1]->url, "http://example.com/sample_movie.mpg", "Got enclosure url"); ok (my $tmp = XML::Feed::Enclosure->new({ type => "image/jpeg" }), "Created a new enclosure"); is ($tmp->type, "image/jpeg", "Got type back"); ok ($tmp->url("http://example.com/sample_image.jpg"), "Set url"); ok ($tmp->length("1337"), "Set length"); ok ($entry->enclosure($tmp), "Set the enclosure"); ok (@enclosures = $entry->enclosure, "Got enclosure again"); ok ($enclosures[-1]->isa("XML::Feed::Enclosure"), "Object still isa XML::Feed::Enclosure"); is ($enclosures[-1]->type, "image/jpeg", "Got the enclosure mime type"); is ($enclosures[-1]->length, "1337", "Got enclosure length again"); is ($enclosures[-1]->url, "http://example.com/sample_image.jpg", "Got enclosure url again"); my $xml = $feed->as_xml; ok ($feed = XML::Feed->parse(\$xml), "Parsed xml again"); ok (@enclosures = $entry->enclosure, "Got enclosure again"); ok ($enclosures[0]->isa("XML::Feed::Enclosure"), "Object isa XML::Feed::Enclosure"); is ($enclosures[0]->type, "audio/mpeg", "Got the enclosure mime type"); is ($enclosures[0]->length, "2478719", "Got enclosure length"); is ($enclosures[0]->url, "http://example.com/sample_podcast.mp3", "Got enclosure url"); ok ($enclosures[1]->isa("XML::Feed::Enclosure"), "Object isa XML::Feed::Enclosure"); is ($enclosures[1]->type, "video/mpeg", "Got the enclosure mime type"); is ($enclosures[1]->length, "8888", "Got enclosure length"); is ($enclosures[1]->url, "http://example.com/sample_movie.mpg", "Got enclosure url"); ok ($enclosures[2]->isa("XML::Feed::Enclosure"), "Object still isa XML::Feed::Enclosure"); is ($enclosures[2]->type, "image/jpeg", "Got the enclosure mime type"); is ($enclosures[2]->length, "1337", "Got enclosure length again"); is ($enclosures[2]->url, "http://example.com/sample_image.jpg", "Got enclosure url again"); ok ($enclosures[-1]->isa("XML::Feed::Enclosure"), "Object still isa XML::Feed::Enclosure"); is ($enclosures[-1]->type, "image/jpeg", "Got the enclosure mime type"); is ($enclosures[-1]->length, "1337", "Got enclosure length again"); is ($enclosures[-1]->url, "http://example.com/sample_image.jpg", "Got enclosure url again"); } libxml-feed-perl-0.52+dfsg.orig/t/18-double2.t0000444000175000017500000000314112114210615020140 0ustar gregoagregoause strict; use warnings; use Test::More tests => 14; use XML::Feed; use File::Spec; { my $rss = XML::Feed->parse( File::Spec->catfile(File::Spec->curdir(), "t", "samples", "rss20-double.xml" ) ); # TEST isa_ok($rss, 'XML::Feed::Format::RSS'); my $rss_entry = ($rss->entries)[0]; # TEST isa_ok($rss_entry, 'XML::Feed::Entry::Format::RSS'); my $rss_content = $rss_entry->content; # TEST isa_ok($rss_content, 'XML::Feed::Content'); # TEST is($rss_content->type, 'text/html', 'Correct content type'); # TEST like($rss_content->body, qr(<|<), 'Contains HTML tags'); # TEST like($rss_content->body, qr{\QDancer}, 'Contains HTML tags'); unlike($rss->as_xml, qr{&lt;}, 'No double encoding'); my $atom = $rss->convert('Atom'); # TEST isa_ok($atom, 'XML::Feed::Format::Atom'); my $atom_entry = ($atom->entries)[0]; # TEST isa_ok($atom_entry, 'XML::Feed::Entry::Format::Atom'); my $atom_content = $atom_entry->content; # TEST isa_ok($atom_content, 'XML::Feed::Content'); # TEST TODO: { local $TODO = 'Needs more investigation'; is($atom_content->type, 'text/html', 'Correct content type'); } # TEST like($atom_content->body, qr(<|<), 'Contains HTML tags'); # TEST like($atom_content->body, qr{\QDancer}, 'Contains HTML tags'); unlike($atom->as_xml, qr{&lt;}, 'No double encoding'); } libxml-feed-perl-0.52+dfsg.orig/t/04-splice-rss.t0000444000175000017500000000100312114210615020656 0ustar gregoagregoause strict; use Test::More tests => 3; use XML::Feed; my $feed = XML::Feed->new('RSS'); my $other = XML::Feed->parse('t/samples/atom.xml')->convert('Atom'); $feed->splice($other); is(scalar $feed->entries, 2, '2 entries in the feed after splicing'); $feed->splice($other); is(scalar $feed->entries, 2, 'Still 2 entries after splicing again'); $other = XML::Feed->parse('t/samples/rss10.xml')->convert('Atom'); $feed->splice($other); is(scalar $feed->entries, 4, 'Now 4 entries after splicing in RSS 1.0 feed'); libxml-feed-perl-0.52+dfsg.orig/t/pod-coverage.t0000444000175000017500000000054412114210615020735 0ustar gregoagregoa#!perl use strict; use warnings; use Test::More; eval 'use Test::Pod::Coverage 1.04'; plan skip_all => 'Test::Pod::Coverage 1.04 required for testing POD coverage' if $@; my @modules = grep { !/(RSS|Atom)/ }Test::Pod::Coverage::all_modules(); plan tests => scalar(@modules); pod_coverage_ok($_, { also_private => [ qr/^init_empty/ ], },) for @modules; libxml-feed-perl-0.52+dfsg.orig/t/08-convert-summary-bug.t0000444000175000017500000000104112114210615022526 0ustar gregoagregoause strict; use Test::More tests => 1; use XML::Feed; use XML::Feed::Entry; my $feed = XML::Feed->new(); $feed->title('My Feed'); $feed->link('http://www.example.com/'); $feed->description('Wow!'); my $entry = XML::Feed::Entry->new(); $entry->title('Foo Bar'); $entry->link('http://www.example.com/foo/bar.html'); $entry->content('This is the content, but there is no summary.'); $entry->author('Foo Baz'); $feed->add_entry($entry); unlike($feed->convert('Atom')->as_xml(), qr{

}, 'no summary tag after converting to Atom'); libxml-feed-perl-0.52+dfsg.orig/t/12-multi-subjects-rss.t0000444000175000017500000000016112114210615022354 0ustar gregoagregoa#!perl -w use vars qw($type $field); $type = "rss"; $field = "subjects"; require 't/12-multi-categories.base'; libxml-feed-perl-0.52+dfsg.orig/t/16-convert-mult-categories.t0000444000175000017500000000075012114210615023367 0ustar gregoagregoause strict; use Test::More tests => 2; use XML::Feed; my $feed = XML::Feed->parse("t/samples/rss-multiple-categories.xml"); my ($entry) = $feed->entries; is_deeply( [$entry->category()], ["foo", "bar", "quux", "simon's tags"], "Got all categories"); my ($converted_entry) = $feed->convert('Atom')->entries; is_deeply( [$converted_entry->category()], ["foo", "bar", "quux", "simon's tags"], "All categories in place after conversion"); libxml-feed-perl-0.52+dfsg.orig/t/07-atom10-create.t0000444000175000017500000000255012114210615021147 0ustar gregoagregoause strict; use Test::More; use XML::Feed; use DateTime; my $now = DateTime->now(); my $feed = XML::Feed->new('Atom'); $feed->title("foo"); $feed->description("Atom 1.0 feed"); $feed->link("http://example.org/"); $feed->id("tag:cpan.org;xml-feed-atom"); $feed->modified($now); my $entry = XML::Feed::Entry->new('Atom'); $entry->title("1st Entry"); $entry->link("http://example.org/"); $entry->category("blah"); $entry->content("

Hello world.

"); $entry->id("tag:cpan.org;xml-feed-atom-entry"); $entry->modified($now); $feed->add_entry($entry); my $xml = $feed->as_xml; like $xml, qr!!; like $xml, qr!
!; # roundtrip $feed = XML::Feed->parse(\$xml); is $feed->format, 'Atom'; is $feed->title, "foo"; is $feed->description, "Atom 1.0 feed"; is $feed->link, "http://example.org/"; is $feed->id, "tag:cpan.org;xml-feed-atom"; is $feed->modified->iso8601, $now->iso8601; my @entries = $feed->entries; is @entries, 1; $entry = $entries[0]; is $entry->title, '1st Entry'; is $entry->link, 'http://example.org/'; is $entry->category, 'blah'; is $entry->content->type, 'text/html'; like $entry->content->body, qr!\s*

Hello world.

\s*!s; is $entry->id, "tag:cpan.org;xml-feed-atom-entry"; is $entry->modified->iso8601, $now->iso8601; done_testing(); libxml-feed-perl-0.52+dfsg.orig/t/14-enclosures.t0000444000175000017500000000474412114210615020774 0ustar gregoagregoa#!perl -w use strict; use Test::More; use XML::Feed; use XML::Feed::Enclosure; my @formats = qw(atom rss20); plan tests => scalar(@formats)*22; foreach my $format (@formats) { ok (my $feed = XML::Feed->parse("t/samples/$format-enclosure.xml"), "Parsed $format"); my ($entry) = $feed->entries; ok (my $enclosure = $entry->enclosure, "Got enclosure"); ok ($enclosure->isa("XML::Feed::Enclosure"), "Object isa XML::Feed::Enclosure"); is ($enclosure->type, "audio/mpeg", "Got the enclosure mime type"); is ($enclosure->length, "2478719", "Got enclosure length"); is ($enclosure->url, "http://example.com/sample_podcast.mp3", "Got enclosure url"); ok (my $tmp = XML::Feed::Enclosure->new({ type => "image/jpeg" }), "Created a new enclosure"); is ($tmp->type, "image/jpeg", "Got type back"); ok ($tmp->url("http://example.com/sample_image.jpg"), "Set url"); ok ($tmp->length("1337"), "Set length"); ok ($entry->enclosure($tmp), "Set the enclosure"); ok ($enclosure = $entry->enclosure, "Got enclosure again"); ok ($enclosure->isa("XML::Feed::Enclosure"), "Object still isa XML::Feed::Enclosure"); is ($enclosure->type, "image/jpeg", "Got the enclosure mime type"); is ($enclosure->length, "1337", "Got enclosure length again"); is ($enclosure->url, "http://example.com/sample_image.jpg", "Got enclosure url again"); my $xml = $feed->as_xml; ok ($feed = XML::Feed->parse(\$xml), "Parsed xml again"); ok ($enclosure = $entry->enclosure, "Got enclosure again"); ok ($enclosure->isa("XML::Feed::Enclosure"), "Object still isa XML::Feed::Enclosure"); is ($enclosure->type, "image/jpeg", "Got the enclosure mime type"); is ($enclosure->length, "1337", "Got enclosure length again"); is ($enclosure->url, "http://example.com/sample_image.jpg", "Got enclosure url again"); } libxml-feed-perl-0.52+dfsg.orig/t/00-compile.t0000444000175000017500000000023612114210615020225 0ustar gregoagregoause strict; use Test::More tests => 4; use_ok('XML::Feed'); use_ok('XML::Feed::Entry'); use_ok('XML::Feed::Format::RSS'); use_ok('XML::Feed::Format::Atom'); libxml-feed-perl-0.52+dfsg.orig/t/19-double3.t0000444000175000017500000000317212114210615020146 0ustar gregoagregoause strict; use warnings; use Test::More tests => 14; use XML::Feed; use File::Spec; { my $rss = XML::Feed->parse( File::Spec->catfile(File::Spec->curdir(), "t", "samples", "rss10-double2.xml" ) ); # TEST isa_ok($rss, 'XML::Feed::Format::RSS'); my $rss_entry = ($rss->entries)[0]; # TEST isa_ok($rss_entry, 'XML::Feed::Entry::Format::RSS'); my $rss_content = $rss_entry->content; # TEST isa_ok($rss_content, 'XML::Feed::Content'); # TEST is($rss_content->type, 'text/html', 'Correct content type'); # TEST like($rss_content->body, qr(<|<), 'Contains HTML tags'); # TEST like($rss_content->body, qr{\Q}, 'Contains HTML tags'); unlike($rss->as_xml, qr{&lt;}, 'No double encoding'); my $atom = $rss->convert('Atom'); # TEST isa_ok($atom, 'XML::Feed::Format::Atom'); my $atom_entry = ($atom->entries)[0]; # TEST isa_ok($atom_entry, 'XML::Feed::Entry::Format::Atom'); my $atom_content = $atom_entry->content; # TEST isa_ok($atom_content, 'XML::Feed::Content'); # TEST is($atom_content->type, 'text/html', 'Correct content type'); # TEST like($atom_content->body, qr(<|<), 'Contains HTML tags'); # TEST like($atom_content->body, qr{\Q}, 'Contains HTML tags'); unlike($atom->as_xml, qr{&lt;}, 'No double encoding'); } libxml-feed-perl-0.52+dfsg.orig/t/06-atom10.t0000444000175000017500000000077312114210615017712 0ustar gregoagregoause strict; use XML::Feed; use Test::More; plan tests => 7; my $feed = XML::Feed->parse("t/samples/atom-full.xml"); is $feed->title, 'Content Considered Harmful Atom Feed'; is $feed->link, 'http://blog.jrock.us/', "link without rel"; my $e = ($feed->entries)[0]; ok $e->link, 'entry link without rel'; is "".$e->category, "Catalyst", "atom:category support"; is "".$e->modified, "2006-08-09T19:07:58", "atom:updated"; is $e->content->type, 'text/html'; like $e->content->body, qr/^
/; libxml-feed-perl-0.52+dfsg.orig/t/13-category-hash-bug.t0000444000175000017500000000063612114210615022116 0ustar gregoagregoause strict; use Test::More; eval { require XML::RSS::LibXML }; plan skip_all => "XML::RSS::LibXML is required." if $@; plan tests => 20; use XML::Feed; for my $parser (qw( XML::RSS XML::RSS::LibXML )) { $XML::Feed::Format::RSS::PREFERRED_PARSER = $parser; my $f = XML::Feed->parse("t/samples/category-bug.xml"); for my $e ($f->entries) { eval { $e->category }; ok !$@, $@; } } libxml-feed-perl-0.52+dfsg.orig/t/samples/0000755000175000017500000000000012114441004017636 5ustar gregoagregoalibxml-feed-perl-0.52+dfsg.orig/t/samples/rss10-odd-date.xml0000444000175000017500000000432612114210615023014 0ustar gregoagregoa Libre.fm Bristol TN 36.595 -82.189 joeyhess's Latest Plays 2009-05-29T20:17:07+01:00 http://alpha.libre.fm/artist/Tom%20Waits/album/Bone%20Machine/track/Black%20Wings Bone Machine Tom Waits: Black Wings libxml-feed-perl-0.52+dfsg.orig/t/samples/atom-multi-enclosure.xml0000444000175000017500000000101712114210615024444 0ustar gregoagregoa Enclosure Demo 2008-10-13T07:45:39Z Attachment/Enclosure Example 2004-11-02T14:44:33 description libxml-feed-perl-0.52+dfsg.orig/t/samples/atom-full.xml0000444000175000017500000002075512114210615022271 0ustar gregoagregoa Content Considered Harmful Atom Feedhttp://blog.jrock.us/This is Jonathan Rockway's Blog, quite possibily the best blog ever. Or something. AngerWhale2006-08-10T02:43:00ZCatalyst + CacheJonathan T. Rockwayjon@jrock.usurn:guid:8D9B9CBE-27DB-11DB-B6C2-F007B8516AA52006-08-09T19:07:58Z

I recently posted this to the Template::Toolkit mailing list, but the moderator rejected it for some reason. (Probably because <jon-perl-list-templates AT jrock.us> is the address that's subscribed, not <jon AT jrock.us>.)

Anyway, here it is. I will expand on this further with actual measurements, but this will have to do for now.

Original Message

Thank you, you raise a good point that I had not fully considered. My goal is to display a dynamically generated page, but where most of the "dynamic" content is actually static for a period amount of time. (Take a news page, for example, where the list of news stories updates once an hour.)

My Reply

I have a similar problem with my blogging software. Most of the content is static, and it's kind of a waste to regenerate everything every time someone views the page. My solution to this problem is to use a Cache::FastMmap object to store the formatted HTML content of each post, keyed on the source material's MD5sum (and filetype, for reasons not relevant to this discussion :)

This results in a nice speedup, since certain HTML filters are slow (OO.org document -> HTML, for example).

I also cache full pages, after they've been assembled by TT, keyed on the md5sum of each included article and some metadata (comment count, tags, etc.) The end result is a 5-20x speed up. With Catalyst's embedded server, I can do about 5 requests per second without cache, but it goes up to about 40-50 requests/second with the cache. So obviously a speedup. (And I'm still not doing a very good job, this was just a 20 minute hack!)

For the gory details, check out the code here:

http://www.jrock.us/trac/blog_software/browser/lib/Blog/Controller/Root.pm#L105 (page cache)

and: http://www.jrock.us/trac/blog_software/browser/lib/Blog/Model/Filesystem/Item.pm#L355 (object cache)

Another caching strategy is to set dynamic pages to be cachable for say, 10 seconds, and then letting Apache's mod_cache (experimental in 2.2.3, but it works for me) do the hard work. Your application gets hit once every ten seconds to refresh Apache's cache, but all the end-user requests are handled by serving from Apache's memory cache. With mpm_worker, it's *super fast*, and a 10 second update delay isn't bad.

If your application is really slow, this will let you increase your slashdot resistance factor (as I call it) enormously. A quick ab against some cached content gave me a requests/per second rate of 1638... much better than whatever your app would do by itself.

And you don't really lose much by taking this approach, other than a 10 second delay with your articles going live... but 10 seconds is nothing if you're getting 1500 requests per second and handling it with an old PIII :)

If this info is useful to anyone else, let me know (off-list) and I'll write up a more detailed article about it :)

Quantum Physics and the Template ToolkitJonathan T. Rockwayjon@jrock.usurn:guid:BB054AF0-2601-11DB-9738-946FBD3128592006-08-07T10:44:20Z

As a programmer, you probably don't spend a lot of time thinking about the similarities between programming and quantum physics. Fortunately for us Perl users, some people do spend a lot of time thinking about physics, and they even wrap up the results in CPAN modules for us!

One such module is Quantum::Superpositions, which let me easily add some nice functionality to my blog software the other day.

As you can see (if you're looking at this article on my blog, not in an RSS reader), I have a list of tags to the left of my main content. If you click one, it shows you a list of articles that have been tagged with that tag. If you select more than one tag, you get this intersection of the two sets (tag1 AND tag2).

That's nice, but I like to use the left navigation bar to show the user where he is in addition to letting him move somewhere else. To do this, I bold the current location, and remove the link. That way, the user won't try to visit the page he's already looking at. This is pretty simple to implement for things like the "home page" or the "archives". You just check the current page, and if the link you're about to print out matches, make it bold instead. That logic looks something like this:

     [% FOREACH category = categories %]
        [% IF category == current_category %]
	   <b>[% category %]</b>
        [% ELSE %]
              [% category %]
        [% END %]
     [% END %]

Simple, and it provides excellent visual cues as to what the user is looking at.

The problem with tags, though, is that an article can have lots of them. The technique above doesn't work there; you need to do a search for each tag. Not a show stopper, but do you really want to do array searches inside the Template Toolkit? No!

And this is where Quantum::Superpositions comes to the rescue. In quantum physics, almost nothing is "certain" -- you can't tell with 100% certainty both where a particle is and what its velocity is. The state of an individual particle is in sort of a flux until you observe, and when you observe, a tangible state comes into existence.

How does this help with tags? By thinking of the set of all tags as a cloud of particles, we can apply the same principle. We don't care what all the tags are until we look at them.

So how do we do this in perl? Let's see an example:

In my Tags.pm Controller, I use the any method from Quantum::Superpositions to collapse the list of tags into a scalar:

   $c->stash->{article_tags} = any(@tags);

Then inside my Template Toolkit View, I "observe" the state as necessary (with the == operator):

     [% FOREACH tag = all_tags %]
        [% IF tag == article_tags %]
	   <b>[% tag %]</b>
        [% ELSE %]
              [% tag %]
        [% END %]
     [% END %]

As you can see, this is exactly the same as what we did when we only had one possible value. If you think about it, it's really the same thing. You just needed to think more about physics :)

Anyway, take a look at this in action:

http://blog.jrock.us/tags/%E3%83%A2%E3%83%BC%E5%A8%98%E3%80%82/music

And then add some cool navigation features to your Catalyst app!

libxml-feed-perl-0.52+dfsg.orig/t/samples/rss10-double.xml0000444000175000017500000000626712114210615022613 0ustar gregoagregoa davorg's Journal http://use.perl.org/~davorg/journal/ davorg's use Perl Journal en-us use Perl; is Copyright 1998-2006, Chris Nandor. Stories, comments, journals, and other submissions posted on use Perl; are Copyright their respective owners. 2009-04-09T12:53:36+00:00 pudge pudge@perl.org Technology hourly 1 1970-01-01T00:00+00:00 davorg's Journal http://use.perl.org/images/topics/useperl.gif http://use.perl.org/~davorg/journal/ Task::Kensho RPMs http://use.perl.org/~davorg/journal/38730?from=rss <p>One of the first concrete outputs from the <a href="http://www.enlightenedperl.org/">Enlightened Perl Organisation</a> has been <a href="http://search.cpan.org/dist/Task-Kensho/">Task::Kensho</a> - a CPAN module which exists to list a number of other CPAN modules that modern Perl programmers should consider using. if you install Task::Kensho then all of the included modules will automatically be pulled down from CPAN and installed.</p><p>I don't install my modules from CPAN. As I live in the Red Hat world, I like to install RPMs of modules. And I build RPMs for modules that aren't already available in that format (and then I <a href="http://rpm.mag-sol.com/">make them available to everyone</a>).</p><p>So last night I created an RPM for Task::Kensho. This also involved building RPMs for about half of the modules it include which didn't already exist as RPMs in the standard repostories. Those RPMs are now available from <a href="http://rpm.mag-sol.com/">my repository</a> so installing them all could be as simple as <tt>sudo yum install perl-Task-Kensho</tt>. Of course, you can also install individual packages using the appropriate <tt>yum</tt> command.</p><p>Currently the RPMs are only available for Fedora 10. I'll build versions for Centos 5 over the next couple of days.</p> davorg 2009-03-31T08:02:06+00:00 journal libxml-feed-perl-0.52+dfsg.orig/t/samples/rss20-enclosure.xml0000444000175000017500000000103612114210615023326 0ustar gregoagregoa Enclosure Demo Mon, 13 Oct 2008 03:45:39 -0400 Attachment/Enclosure Example Tue, 02 Nov 2004 09:44:33 -0500 description libxml-feed-perl-0.52+dfsg.orig/t/samples/rss20-double.xml0000444000175000017500000000622112114210615022602 0ustar gregoagregoa tag:blogger.com,1999:blog-5910101498857524639 Sun, 24 Apr 2011 08:19:48 +0000 Perl for president our $blog = new Nice::Perl; http://niceperl.blogspot.com/ noreply@blogger.com (prz) Blogger 25 1 25 tag:blogger.com,1999:blog-5910101498857524639.post-5795437297335601353 Sun, 24 Apr 2011 08:08:00 +0000 2011-04-24T10:19:48.222+02:00 perl dancer cpan CPAN Module review - Web apps When I'm developing web applications, I use those frameworks that make my work easier. The size of the webs is not big and I have been working with <a href="http://search.cpan.org/perldoc?CGI::Application">CGI::Application</a> for years. In a recent search, I have found <a href="http://search.cpan.org/perldoc?Dancer">Dancer</a>. This framework handles the routes concept (an idea from <a href="http://www.sinatrarb.com/">Ruby's Sinatra</a>); routes are paths which are binded to code. For example:<br /><br /><table bgcolor="#f0f0f0" border="1" cellpadding="7" cellspacing="0"><tbody><tr><td><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><b>get</b> '/home' =&gt; <b>sub</b> { 'Hi, this is home!' };</span></td></tr></tbody></table><br />There are a lot of plugins available (database, logging, session handling, REST, AJAX, validation, templates, WebSocket, ...) at CPAN. You can write your own plugin by subclassing <a href="http://search.cpan.org/perldoc?Dancer::Plugin">Dancer::Plugin</a>.<br /><br />The framework comes with a script that builds the skeleton of your application, with a nice structure in folders: views, libs, ... it takes seconds to start a new application.<br /><br />I &nbsp;definitely recommend <a href="http://search.cpan.org/perldoc?Dancer">Dancer</a> to you. Just install and try!<div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5910101498857524639-5795437297335601353?l=niceperl.blogspot.com' alt='' /></div> http://niceperl.blogspot.com/2011/04/cpan-module-review-web-apps.html noreply@blogger.com (prz) 0 libxml-feed-perl-0.52+dfsg.orig/t/samples/atom-multiple-categories.xml0000444000175000017500000000146212114210615025277 0ustar gregoagregoa Simon Wistow's blog 2008-12-09T06:37:07Z tag:vox.com,2006:6p00c2252555dbf219/ One Drink Too Many and a Joke Gone Too Far Test With Categories 2008-12-08T19:44:50Z 2008-12-09T06:37:07Z content libxml-feed-perl-0.52+dfsg.orig/t/samples/base_atom.xml0000444000175000017500000000225712114210615022320 0ustar gregoagregoa Sample Feed For documentation only Sample Toolkit First entry title tag:example.org,2004-04-20:/archives/000001.html 2004-04-19T07:45:00Z 2004-04-20T00:23:47Z 2004-04-20T11:56:34Z Mark Pilgrim ../about/ mark@example.org <p id="anchor1"><a href="#anchor2">skip to anchor 2</a></p> <p>Some content</p> <p id="anchor2">This is anchor 2</p> libxml-feed-perl-0.52+dfsg.orig/t/samples/rss-multiple-subjects.xml0000444000175000017500000000140312114210615024636 0ustar gregoagregoa Simon Wistow's blog http://deflatermouse.vox.com/library/posts/page/1/ Mon, 08 Dec 2008 11:44:50 -0800 Test With Categories Mon, 08 Dec 2008 11:44:50 -0800 content foo bar quux simon's tags libxml-feed-perl-0.52+dfsg.orig/t/samples/rss10-invalid-date.xml0000444000175000017500000000116112114210615023666 0ustar gregoagregoa First Weblog May 29, 2004 23:39:25 May 29, 2004 23:39:25 libxml-feed-perl-0.52+dfsg.orig/t/samples/rss10-double2.xml0000444000175000017500000000661412114210615022671 0ustar gregoagregoa RichardDawkins.net - All Content All original and aggregated news articles, audio and videos on RichardDawkins.net http://richarddawkins.net/archive/all_content/latest Neuroscientists uncover neural mechanisms of object recognition - - - medicalxpress.com <p><img src="http://s.ph-cdn.com/newman/gfx/news/2011/3-neuroscienti.jpg" width="300" class="articleImage" /><em>Certain brain injuries can cause people to lose the ability to visually recognize objects -- for example, confusing a harmonica for a cash register. Neuroscientists from Carnegie Mellon University and Princeton University examined the brain of a person with object agnosia, a deficit in the ability to recognize objects that does not include damage to the eyes or a general loss in intelligence, and have uncovered the neural mechanisms of object recognition. The results, published by Cell Press in the July 15th issue of the journal Neuron, describe the functional neuroanatomy of object agnosia and suggest that damage to the part of the brain critical for object recognition can have a widespread impact on remote parts of the cortex. These findings will force researchers to rethink basic assumptions of visual neuroscience. Credit: Carnegie Mellon University and Princeton University</em></p> <p><strong>Certain brain injuries can cause people to lose the ability to visually recognize objects — for example, confusing a harmonica for a cash register.</strong></p> <p>Neuroscientists from Carnegie Mellon University and Princeton University examined the brain of a person with object agnosia, a deficit in the ability to recognize objects that does not include damage to the eyes or a general loss in intelligence, and have uncovered the neural mechanisms of object recognition. The results, published by Cell Press in the July 15th issue of the journal Neuron, describe the functional neuroanatomy of object agnosia and suggest that damage to the part of the brain critical for object recognition can have a widespread impact on remote parts of the cortex.<br> <a href="http://medicalxpress.com/news/2011-07-neuroscientists-uncover-neural-mechanisms-recognition.html#share">Read more and watch video</a></p> Thu, 14 Jul 2011 14:36:55 +0000 http://richarddawkins.net/videos/642152-neuroscientists-uncover-neural-mechanisms-of-object-recognition http://richarddawkins.net/videos/642152-neuroscientists-uncover-neural-mechanisms-of-object-recognition Medicine libxml-feed-perl-0.52+dfsg.orig/t/samples/rss10.xml0000444000175000017500000000343012114210615021330 0ustar gregoagregoa First Weblog http://localhost/weblog/ This is a test weblog. en-us Melody 2004-05-29T23:39:57-08:00 Entry Two http://localhost/weblog/2004/05/entry_two.html Hello!... Hello!

]]>
Travel Melody 2004-05-29T23:39:25-08:00
Test http://localhost/weblog/2004/05/test.html This is a test. Why don't you come down to our place for a coffee and a chat?... This is a test.

Why don't you come down to our place for a coffee and a chat?

]]>
Sports Melody 2004-05-08T23:03:28-08:00
libxml-feed-perl-0.52+dfsg.orig/t/samples/rss20-multi-enclosure.xml0000444000175000017500000000117212114210615024457 0ustar gregoagregoa Enclosure Demo Mon, 13 Oct 2008 03:45:39 -0400 Attachment/Enclosure Example Tue, 02 Nov 2004 09:44:33 -0500 description libxml-feed-perl-0.52+dfsg.orig/t/samples/rss20.xml0000444000175000017500000000257312114210615021340 0ustar gregoagregoa First Weblog http://localhost/weblog/ This is a test weblog. en-us Copyright 2004 Sat, 29 May 2004 23:39:25 -0800 Sat, 29 May 2004 23:39:57 -0800 http://www.movabletype.org/?v=3.0D http://blogs.law.harvard.edu/tech/rss Melody Entry Two Hello!... Hello!

]]>
http://localhost/weblog/2004/05/entry_two.html Melody http://localhost/weblog/2004/05/entry_two.html Travel Sat, 29 May 2004 23:39:25 -0800
Test This is a test. Why don't you come down to our place for a coffee and a chat?... This is a test.

Why don't you come down to our place for a coffee and a chat?

]]>
http://localhost/weblog/2004/05/test.html http://localhost/weblog/2004/05/test.html Sports Sat, 08 May 2004 23:03:28 -0800
libxml-feed-perl-0.52+dfsg.orig/t/samples/rss-multiple-categories.xml0000444000175000017500000000136312114210615025146 0ustar gregoagregoa Simon Wistow's blog http://deflatermouse.vox.com/library/posts/page/1/ Mon, 08 Dec 2008 11:44:50 -0800 Test With Categories Mon, 08 Dec 2008 11:44:50 -0800 content foo bar quux simon's tags libxml-feed-perl-0.52+dfsg.orig/t/samples/atom-enclosure.xml0000444000175000017500000000064712114210615023324 0ustar gregoagregoa Enclosure Demo 2008-10-13T07:45:39Z Attachment/Enclosure Example 2004-11-02T14:44:33 description libxml-feed-perl-0.52+dfsg.orig/t/samples/base_rss.xml0000444000175000017500000000073612114210615022167 0ustar gregoagregoa Sample Feed index.html First entry title 000001.html (relative, fully-qualified) libxml-feed-perl-0.52+dfsg.orig/t/samples/rss20-no-summary.xml0000444000175000017500000000100312114210615023430 0ustar gregoagregoa First Weblog http://localhost/weblog/ This is a test weblog. Test <p>This is a test.</p> <p>Why don't you come down to our place for a coffee and a <strong>chat</strong>?</p> http://localhost/weblog/2004/05/test.html libxml-feed-perl-0.52+dfsg.orig/t/samples/atom.xml0000444000175000017500000000354112114210615021323 0ustar gregoagregoa First Weblog 2004-05-30T07:39:57Z This is a test weblog. tag:localhost,2004:/weblog//1 Movable Type Copyright (c) 2004, Melody Melody Entry Two 2004-05-30T07:39:53Z 2004-05-30T07:39:25Z tag:localhost,2004:/weblog//1.28 2004-05-30T07:39:25Z Hello!... Melody melody@example.com Travel Hello!

]]>
Test 2004-05-30T06:24:08Z 2004-05-09T07:03:28Z tag:localhost,2004:/weblog//1.1 2004-05-09T07:03:28Z This is a test. Why don't you come down to our place for a coffee and a chat?... Melody melody@example.com Sports This is a test.

Why don't you come down to our place for a coffee and a chat?

]]>
libxml-feed-perl-0.52+dfsg.orig/t/samples/atom-10-example.xml0000444000175000017500000000107212114210615023167 0ustar gregoagregoa Example Feed 2003-12-13T18:30:02Z John Doe urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6 Atom-Powered Robots Run Amok urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a 2003-12-13T18:30:02Z Some text. libxml-feed-perl-0.52+dfsg.orig/t/samples/rss20-p.xml0000444000175000017500000000122212114210615021563 0ustar gregoagregoa Some title http://creograf.ru/blog/4progr ammer Some desc ru-ru Sun, 3 Apr 2011 05:42:15 +0300 Sun, 3 Apr 2011 05:42:15 +0300 Some entryi http://creograf.ru/post/regexp -js Sun, 3 Apr 2011 05:42:12 +0300 libxml-feed-perl-0.52+dfsg.orig/lib/0000755000175000017500000000000012114210615016477 5ustar gregoagregoalibxml-feed-perl-0.52+dfsg.orig/lib/XML/0000755000175000017500000000000012114210615017137 5ustar gregoagregoalibxml-feed-perl-0.52+dfsg.orig/lib/XML/Feed.pm0000444000175000017500000003010212114210615020332 0ustar gregoagregoapackage XML::Feed; use strict; use warnings; use base qw( Class::ErrorHandler ); use Feed::Find; use URI::Fetch; use LWP::UserAgent; use Carp; use Module::Pluggable search_path => "XML::Feed::Format", require => 1, sub_name => 'formatters'; our $VERSION = '0.52'; our $MULTIPLE_ENCLOSURES = 0; our @formatters; BEGIN { @formatters = __PACKAGE__->formatters; } sub new { my $class = shift; my $format = shift || 'Atom'; my $format_class = 'XML::Feed::Format::' . $format; eval "use $format_class"; Carp::croak("Unsupported format $format: $@") if $@; my $feed = bless {}, join('::', __PACKAGE__, "Format", $format); $feed->init_empty(@_) or return $class->error($feed->errstr); $feed; } sub init_empty { 1 } sub parse { my $class = shift; my($stream, $specified_format) = @_; return $class->error("Stream parameter is required") unless $stream; my $feed = bless {}, $class; my $xml = ''; if (UNIVERSAL::isa($stream, 'URI')) { my $ua = LWP::UserAgent->new; $ua->agent(__PACKAGE__ . "/$VERSION"); $ua->env_proxy; # force allowing of proxies my $res = URI::Fetch->fetch($stream, UserAgent => $ua) or return $class->error(URI::Fetch->errstr); return $class->error("This feed has been permanently removed") if $res->status == URI::Fetch::URI_GONE(); $xml = $res->content; } elsif (ref($stream) eq 'SCALAR') { $xml = $$stream; } elsif (ref($stream)) { while (read($stream, my($chunk), 8192)) { $xml .= $chunk; } } else { open my $fh, $stream or return $class->error("Can't open $stream: $!"); while (read $fh, my($chunk), 8192) { $xml .= $chunk; } close $fh; } return $class->error("Can't get feed XML content from $stream") unless $xml; my $format; if ($specified_format) { $format = $specified_format; } else { $format = $feed->identify_format(\$xml) or return $class->error($feed->errstr); } my $format_class = join '::', __PACKAGE__, "Format", $format; eval "use $format_class"; return $class->error("Unsupported format $format: $@") if $@; bless $feed, $format_class; $feed->init_string(\$xml) or return $class->error($feed->errstr); $feed; } sub identify_format { my $feed = shift; my($xml) = @_; foreach my $class (@formatters) { my ($name) = ($class =~ m!([^:]+)$!); # TODO ugly my $tmp = $$xml; return $name if eval { $class->identify(\$tmp) }; return $feed->error($@) if $@; } return $feed->error("Cannot detect feed type"); } sub _get_first_tag { my $class = shift; my ($xml) = @_; ## Auto-detect feed type based on first element. This is prone ## to breakage, but then again we don't want to parse the whole ## feed ourselves. my $tag; while ($$xml =~ /<(\S+)/sg) { (my $t = $1) =~ tr/a-zA-Z0-9:\-\?!//cd; my $first = substr $t, 0, 1; $tag = $t, last unless $first eq '?' || $first eq '!'; } die ("Cannot find first element") unless $tag; $tag =~ s/^.*://; return $tag; } sub find_feeds { my $class = shift; my($uri) = @_; my @feeds = Feed::Find->find($uri) or return $class->error(Feed::Find->errstr); @feeds; } sub convert { my $feed = shift; my($format) = @_; my $new = XML::Feed->new($format); for my $field (qw( title link description language author copyright modified generator )) { my $val = $feed->$field(); next unless defined $val; $new->$field($val); } for my $entry ($feed->entries) { $new->add_entry($entry->convert($format)); } $new; } sub splice { my $feed = shift; my($other) = @_; my %ids = map { $_->id => 1 } $feed->entries; for my $entry ($other->entries) { $feed->add_entry($entry) unless $ids{$entry->id}++; } } sub _convert_entry { my $feed = shift; my $entry = shift; my $feed_format = ref($feed); $feed_format =~ s!^XML::Feed::Format::!!; my $entry_format = ref($entry); $entry_format =~ s!^XML::Feed::Entry::Format::!!; return $entry if $entry_format eq $feed_format; return $entry->convert($feed_format); } sub base; sub format; sub title; sub link; sub self_link; sub description; sub language; sub author; sub copyright; sub modified; sub generator; sub add_entry; sub entries; sub as_xml; sub id; sub image; sub tagline { shift->description(@_) } sub items { $_[0]->entries } # RFC 5005 sub first_link; sub last_link; sub previous_link; sub next_link; sub current_link; sub prev_archive_link; sub next_archive_link; 1; __END__ =head1 NAME XML::Feed - Syndication feed parser and auto-discovery =head1 SYNOPSIS use XML::Feed; my $feed = XML::Feed->parse(URI->new('http://example.com/atom.xml')) or die XML::Feed->errstr; print $feed->title, "\n"; for my $entry ($feed->entries) { } ## Find all of the syndication feeds on a given page, using ## auto-discovery. my @feeds = XML::Feed->find_feeds('http://example.com/'); =head1 DESCRIPTION I is a syndication feed parser for both RSS and Atom feeds. It also implements feed auto-discovery for finding feeds, given a URI. I supports the following syndication feed formats: =over 4 =item * RSS 0.91 =item * RSS 1.0 =item * RSS 2.0 =item * Atom =back The goal of I is to provide a unified API for parsing and using the various syndication formats. The different flavors of RSS and Atom handle data in different ways: date handling; summaries and content; escaping and quoting; etc. This module attempts to remove those differences by providing a wrapper around the formats and the classes implementing those formats (L and L). For example, dates are handled differently in each of the above formats. To provide a unified API for date handling, I converts all date formats transparently into L objects, which it then returns to the caller. =head1 USAGE =head2 XML::Feed->new($format) Creates a new empty I object using the format I<$format>. $feed = XML::Feed->new('Atom'); $feed = XML::Feed->new('RSS'); $feed = XML::Feed->new('RSS', version => '0.91'); =head2 XML::Feed->parse($stream) =head2 XML::Feed->parse($stream, $format) Parses a syndication feed identified by I<$stream> and returns an I obhect. I<$stream> can be any one of the following: =over 4 =item * Scalar reference A reference to string containing the XML body of the feed. =item * Filehandle An open filehandle from which the feed XML will be read. =item * File name The name of a file containing the feed XML. =item * URI object A URI from which the feed XML will be retrieved. =back I<$format> allows you to override format guessing. =head2 XML::Feed->find_feeds($uri) Given a URI I<$uri>, use auto-discovery to find all of the feeds linked from that page (using IlinkE> tags). Returns a list of feed URIs. =head2 XML::Feed->identify_format($xml) Given the xml of a feed return what format it is in (C, or some version of C). =head2 $feed->convert($format) Converts the I object into the I<$format> format, and returns the new object. =head2 $feed->splice($other_feed) Splices in all of the entries from the feed I<$other_feed> into I<$feed>, skipping posts that are already in I<$feed>. =head2 $feed->format Returns the format of the feed (C, or some version of C). =head2 $feed->title([ $title ]) The title of the feed/channel. =head2 $feed->base([ $base ]) The url base of the feed/channel. =head2 $feed->link([ $uri ]) The permalink of the feed/channel. =head2 $feed->tagline([ $tagline ]) The description or tagline of the feed/channel. =head2 $feed->description([ $description ]) Alias for I<$feed-Etagline>. =head2 $feed->author([ $author ]) The author of the feed/channel. =head2 $feed->language([ $language ]) The language of the feed. =head2 $feed->copyright([ $copyright ]) The copyright notice of the feed. =head2 $feed->modified([ $modified ]) A I object representing the last-modified date of the feed. If present, I<$modified> should be a I object. =head2 $feed->generator([ $generator ]) The generator of the feed. =head2 $feed->self_link ([ $uri ]) The Atom Self-link of the feed: L A string. =head2 $feed->entries A list of the entries/items in the feed. Returns an array containing L objects. =head2 $feed->items A synonym (alias) for <$feed-Eentries>. =head2 $feed->add_entry($entry) Adds an entry to the feed. I<$entry> should be an L object in the correct format for the feed. =head2 $feed->as_xml Returns an XML representation of the feed, in the format determined by the current format of the I<$feed> object. =head2 $feed->first_link ([ $uri ]) The Atom First-link for feed paging and archiving (RFC 5005). L =head2 $feed->last_link ([ $uri ]) The Atom Last-link for feed paging and archiving. =head2 $feed->next_link ([ $uri ]) The Atom Next-link for feed paging and archiving. =head2 $feed->previous_link ([ $uri ]) The Atom Previous-link for feed paging and archiving. =head2 $feed->current_link ([ $uri ]) The Atom Current-link for feed paging and archiving. =head2 $feed->next_archive_link ([ $uri ]) The Atom Next-link for feed paging and archiving. =head2 $feed->prev_archive_link ([ $uri ]) The Atom Prev-Archive-link for feed paging and archiving. =head1 PACKAGE VARIABLES =over 4 =item C<$XML::Feed::Format::RSS::PREFERRED_PARSER> If you want to use another RSS parser class than XML::RSS (default), you can change the class by setting C<$PREFERRED_PARSER> variable in the XML::Feed::Format::RSS package. $XML::Feed::Format::RSS::PREFERRED_PARSER = "XML::RSS::LibXML"; B this will only work for parsing feeds, not creating feeds. B Only C version 0.3004 is known to work at the moment. =item C<$XML::Feed::MULTIPLE_ENCLOSURES> Although the RSS specification states that there can be at most one enclosure per item some feeds break this rule. If this variable is set then C captures all of them and makes them available as a list. Otherwise it returns the last enclosure parsed. B C version 1.44 is needed for this to work. =back =cut =head1 VALID FEEDS For reference, this cgi script will create valid, albeit nonsensical feeds (according to C anyway) for Atom 1.0 and RSS 0.90, 0.91, 1.0 and 2.0. #!perl -w use strict; use CGI; use CGI::Carp qw(fatalsToBrowser); use DateTime; use XML::Feed; my $cgi = CGI->new; my @args = ( $cgi->param('format') || "Atom" ); push @args, ( version => $cgi->param('version') ) if $cgi->param('version'); my $feed = XML::Feed->new(@args); $feed->id("http://".time.rand()."/"); $feed->title('Test Feed'); $feed->link($cgi->url); $feed->self_link($cgi->url( -query => 1, -full => 1, -rewrite => 1) ); $feed->modified(DateTime->now); my $entry = XML::Feed::Entry->new(); $entry->id("http://".time.rand()."/"); $entry->link("http://example.com"); $entry->title("Test entry"); $entry->summary("Test summary"); $entry->content("Foo"); $entry->modified(DateTime->now); $entry->author('test@example.com (Testy McTesterson)'); $feed->add_entry($entry); my $mime = ("Atom" eq $feed->format) ? "application/atom+xml" : "application/rss+xml"; print $cgi->header($mime); print $feed->as_xml; =head1 LICENSE I is free software; you may redistribute it and/or modify it under the same terms as Perl itself. =head1 AUTHOR & COPYRIGHT Except where otherwise noted, I is Copyright 2004-2008 Six Apart. All rights reserved. =head1 SUPPORT For support contact the XML::Feed mailing list - xml-feed@perlhacks.com. =head1 SOURCE CODE The latest version of I can be found at http://github.com/davorg/XML-Feed =cut libxml-feed-perl-0.52+dfsg.orig/lib/XML/Feed/0000755000175000017500000000000012114210615020002 5ustar gregoagregoalibxml-feed-perl-0.52+dfsg.orig/lib/XML/Feed/Enclosure.pm0000444000175000017500000000225612114210615022302 0ustar gregoagregoapackage XML::Feed::Enclosure; use strict; use warnings; our $VERSION = '0.52'; use base qw( Class::ErrorHandler ); sub wrap { my $class = shift; my($c) = @_; bless { %$c }, $class; } *new = \&wrap; sub _var { my $enclosure = shift; my $var = shift; $enclosure->{$var} = shift if @_; $enclosure->{$var}; } sub type { shift->_var('type', @_) } sub length { shift->_var('length', @_) } sub url { shift->_var('url', @_) } 1; __END__ =head1 NAME XML::Feed::Enclosure - Wrapper for enclosure objects =head1 SYNOPSIS my ($enclosure) = $entry->enclosure; print $enclosure->type; =head1 DESCRIPTION I represents a content object in an I entry in a syndication feed. =head1 USAGE =head2 wrap Take params and turn them into a I object. =head2 new A synonym for I. =head2 $enclosure->url The url of the object. =head2 $enclosure->type The MIME type of the item referred to in I. =head2 $enclosure->length The length of object refereed to in I =head1 AUTHOR & COPYRIGHT Please see the I manpage for author, copyright, and license information. =cut libxml-feed-perl-0.52+dfsg.orig/lib/XML/Feed/Entry.pm0000444000175000017500000001054412114210615021443 0ustar gregoagregoapackage XML::Feed::Entry; use strict; use warnings; our $VERSION = '0.52'; use base qw( Class::ErrorHandler ); use Scalar::Util qw( blessed ); use Carp; sub wrap { my $class = shift; my($item) = @_; bless { entry => $item }, $class; } sub unwrap { $_[0]->{entry} } sub new { my $class = shift; my($format) = @_; $format ||= 'Atom'; my $format_class = 'XML::Feed::Format::' . $format; eval "use $format_class"; Carp::croak("Unsupported format $format: $@") if $@; my $entry = bless {}, join('::', __PACKAGE__, "Format", $format); $entry->init_empty or return $class->error($entry->errstr); $entry; } sub init_empty { 1 } sub convert { my $entry = shift; my($format) = @_; my $new = __PACKAGE__->new($format); for my $field (qw( title link content summary author id issued modified lat long )) { my $val = $entry->$field(); next unless defined $val; next if blessed $val && $val->isa('XML::Feed::Content') && ! defined $val->body; $new->$field($val); } for my $field (qw( category )) { my @val = $entry->$field(); next unless @val; $new->$field(@val); } $new; } sub title; sub link; sub content; sub summary; sub category; sub author; sub id; sub issued; sub modified; sub lat; sub long; sub format; sub tags { shift->category(@_) } sub enclosure; 1; __END__ =head1 NAME XML::Feed::Entry - Entry/item in a syndication feed =head1 SYNOPSIS ## $feed is an XML::Feed object. for my $entry ($feed->entries) { print $entry->title, "\n", $entry->summary, "\n\n"; } =head1 DESCRIPTION I represents an entry/item in an L syndication feed. =head1 USAGE =head2 XML::Feed::Entry->new($format) Creates a new I object in the format I<$format>, which should be either I or I. =head2 $entry->convert($format) Converts the I object into the I<$format> format, and returns the new object. =head2 $entry->title([ $title ]) The title of the entry. =head2 $entry->base([ $base ]) The url base of the entry. =head2 $entry->link([ $uri ]) The permalink of the entry, in most cases, except in cases where it points instead to an offsite URI referenced in the entry. =head2 $entry->content([ $content ]) An L object representing the full entry body, or as much as is available in the feed. In RSS feeds, this method will look first for L and L elements, then fall back to a IdescriptionE> element. =head2 $entry->summary([ $summary ]) An L object representing a short summary of the entry. Possibly. Since RSS feeds do not have the idea of a summary separate from the entry body, this may not always be what you want. If the entry contains both a IdescriptionE> element B another element typically used for the full content of the entry--either I or L--we treat that as the summary. Otherwise, we assume that there isn't a summary, and return an L object with an empty string in the I. =head2 $entry->category([ $category ]) The category in which the entry was posted. Returns a list of categories if called in array context or the first category if called in scalar context. B It's possible this API might change to have an I instead. =head2 $entry->tags([ $tag ]) A synonym (alias) for I; =head2 $entry->author([ $author ]) The name or email address of the person who posted the entry. =head2 $entry->id([ $id ]) The unique ID of the entry. =head2 $entry->issued([ $issued ]) A I object representing the date and time at which the entry was posted. If present, I<$issued> should be a I object. =head2 $entry->modified([ $modified ]) A I object representing the last-modified date of the entry. If present, I<$modified> should be a I object. =head2 $entry->wrap Take an entry in its native format and turn it into an I object. =head2 $entry->unwrap Take an I object and turn it into its native format. =head1 AUTHOR & COPYRIGHT Please see the I manpage for author, copyright, and license information. =cut libxml-feed-perl-0.52+dfsg.orig/lib/XML/Feed/Content.pm0000444000175000017500000000276312114210615021760 0ustar gregoagregoapackage XML::Feed::Content; use strict; use warnings; our $VERSION = '0.52'; use base qw( Class::ErrorHandler ); sub wrap { my $class = shift; my($c) = @_; bless { %$c }, $class; } *new = \&wrap; sub _var { my $content = shift; my $var = shift; $content->{$var} = shift if @_; $content->{$var}; } sub type { shift->_var('type', @_) } sub body { shift->_var('body', @_) } sub base { shift->_var('base', @_) } 1; __END__ =head1 NAME XML::Feed::Content - Wrapper for content objects =head1 SYNOPSIS my $content = $entry->content; print $content->body; =head1 DESCRIPTION I represents a content object in an I entry in a syndication feed. This could be a IdescriptionE> element in an RSS feed, a IcontentE> element in an Atom feed, etc. In other words, any element where knowing both the actual data and the B of data is useful. =head1 USAGE =head2 wrap Take params and turn them into a I object. =head2 new A synonym for I. =head2 $content->body The actual data. =head2 $content->type The MIME type of the content in I. This is really only useful in Atom feeds, because RSS feeds do not specify the type of content included in an entry. In RSS feeds, generally the MIME type defaults to I. =head2 $content->base The url base of the content. =head1 AUTHOR & COPYRIGHT Please see the I manpage for author, copyright, and license information. =cut libxml-feed-perl-0.52+dfsg.orig/lib/XML/Feed/Format/0000755000175000017500000000000012114210615021232 5ustar gregoagregoalibxml-feed-perl-0.52+dfsg.orig/lib/XML/Feed/Format/Atom.pm0000444000175000017500000000731312114210615022472 0ustar gregoagregoapackage XML::Feed::Format::Atom; use strict; use warnings; our $VERSION = '0.52'; use base qw( XML::Feed ); use XML::Atom::Feed; use XML::Atom::Util qw( iso2dt ); use List::Util qw( first ); use DateTime::Format::W3CDTF; use HTML::Entities; use XML::Atom::Entry; XML::Atom::Entry->mk_elem_accessors(qw( lat long ), ['http://www.w3.org/2003/01/geo/wgs84_pos#']); use XML::Atom::Content; use XML::Feed::Entry::Format::Atom; sub identify { my $class = shift; my $xml = shift; my $tag = $class->_get_first_tag($xml); return ($tag eq 'feed'); } sub init_empty { my ($feed, %args) = @_; $args{'Version'} ||= '1.0'; $feed->{atom} = XML::Atom::Feed->new(%args); $feed; } sub init_string { my $feed = shift; my($str) = @_; if ($str) { $feed->{atom} = XML::Atom::Feed->new(Stream => $str) or return $feed->error(XML::Atom::Feed->errstr); } $feed; } sub format { 'Atom' } sub title { shift->{atom}->title(@_) } sub link { my $feed = shift; if (@_) { $feed->{atom}->add_link({ rel => 'alternate', href => $_[0], type => 'text/html', }); } else { my $l = first { !defined $_->rel || $_->rel eq 'alternate' } $feed->{atom}->link; $l ? $l->href : undef; } } sub _rel_link { my $feed = shift; my $rel = shift; if (@_) { my $uri = shift; $feed->{atom}->add_link({type => "application/atom+xml", rel => $rel, href => $uri}); return $uri; } else { my $l; if ($rel eq 'self') { $l = first { !defined $_->rel || $_->rel eq 'self' } $feed->{atom}->link; ; } else { $l = first { !defined $_->rel || $_->rel eq $rel } $feed->{atom}->link; ; } return $l ? $l->href : undef; } } sub self_link { shift->_rel_link( 'self', @_ ) } sub first_link { shift->_rel_link( 'first', @_ ) } sub last_link { shift->_rel_link( 'last', @_ ) } sub next_link { shift->_rel_link( 'next', @_ ) } sub previous_link { shift->_rel_link( 'previous', @_ ) }; sub current_link { shift->_rel_link( 'current', @_ ) } sub prev_archive_link { shift->_rel_link( 'prev-archive', @_ ) } sub next_archive_link { shift->_rel_link( 'next-archive', @_ ) } sub description { shift->{atom}->tagline(@_) } sub copyright { shift->{atom}->copyright(@_) } sub language { shift->{atom}->language(@_) } sub generator { shift->{atom}->generator(@_) } sub id { shift->{atom}->id(@_) } sub updated { shift->{atom}->updated(@_) } sub add_link { shift->{atom}->add_link(@_) } sub base { shift->{atom}->base(@_) } sub author { my $feed = shift; if (@_ && $_[0]) { my $person = XML::Atom::Person->new(Version => 1.0); $person->name($_[0]); $feed->{atom}->author($person); } else { $feed->{atom}->author ? $feed->{atom}->author->name : undef; } } sub image { return; } sub modified { my $feed = shift; if (@_) { $feed->{atom}->modified(DateTime::Format::W3CDTF->format_datetime($_[0])); } else { return iso2dt($feed->{atom}->modified) if $feed->{atom}->modified; return iso2dt($feed->{atom}->updated) if $feed->{atom}->updated; return undef; } } sub entries { my @entries; for my $entry ($_[0]->{atom}->entries) { push @entries, XML::Feed::Entry::Format::Atom->wrap($entry); } @entries; } sub add_entry { my $feed = shift; my $entry = shift || return; $entry = $feed->_convert_entry($entry); $feed->{atom}->add_entry($entry->unwrap); } sub as_xml { $_[0]->{atom}->as_xml } 1; libxml-feed-perl-0.52+dfsg.orig/lib/XML/Feed/Format/RSS.pm0000444000175000017500000001163312114210615022241 0ustar gregoagregoapackage XML::Feed::Format::RSS; use strict; use warnings; our $VERSION = '0.52'; use base qw( XML::Feed ); use DateTime::Format::Mail; use DateTime::Format::W3CDTF; use XML::Atom::Util qw(iso2dt); use XML::Feed::Enclosure; use XML::Feed::Entry::Format::RSS; our $PREFERRED_PARSER = "XML::RSS"; sub identify { my $class = shift; my $xml = shift; my $tag = $class->_get_first_tag($xml); return ($tag eq 'rss' || $tag eq 'RDF'); } sub init_empty { my ($feed, %args) = @_; $args{'version'} ||= '2.0'; eval "use $PREFERRED_PARSER"; die $@ if $@; $feed->{rss} = $PREFERRED_PARSER->new(%args); $feed->{rss}->add_module(prefix => "content", uri => 'http://purl.org/rss/1.0/modules/content/'); $feed->{rss}->add_module(prefix => "dcterms", uri => 'http://purl.org/dc/terms/'); $feed->{rss}->add_module(prefix => "atom", uri => 'http://www.w3.org/2005/Atom'); $feed->{rss}->add_module(prefix => "geo", uri => 'http://www.w3.org/2003/01/geo/wgs84_pos#'); $feed; } sub init_string { my $feed = shift; my($str) = @_; $feed->init_empty; my $opts = { hashrefs_instead_of_strings => 1, }; $opts->{allow_multiple} = [ 'enclosure' ] if $XML::Feed::MULTIPLE_ENCLOSURES; if ($str) { $feed->{rss}->parse($$str, $opts ); } $feed; } sub format { 'RSS ' . $_[0]->{rss}->{'version'} } ## The following elements are the same in all versions of RSS. sub title { shift->{rss}->channel('title', @_) } sub link { my $link = shift->{rss}->channel('link', @_); $link =~ s/^\s+//; $link =~ s/\s+$//; return $link; } sub description { shift->{rss}->channel('description', @_) } sub updated { shift->modified(@_) } # This doesn't exist in RSS sub id { } ## This is RSS 2.0 only--what's the equivalent in RSS 1.0? sub copyright { shift->{rss}->channel('copyright', @_) } sub base { my $feed = shift; if (@_) { $feed->{rss}->{'xml:base'} = $_[0]; } else { $feed->{rss}->{'xml:base'}; } } ## The following all work transparently in any RSS version. sub language { my $feed = shift; if (@_) { $feed->{rss}->channel('language', $_[0]); $feed->{rss}->channel->{dc}{language} = $_[0]; } else { $feed->{rss}->channel('language') || $feed->{rss}->channel->{dc}{language}; } } sub self_link { my $feed = shift; if (@_) { my $uri = shift; $feed->{rss}->channel->{'atom'}{'link'} = { rel => "self", href => $uri, type => "application/rss+xml", }; } return $feed->{rss}->channel->{'atom'}{'link'}; } # This doesn't exist in RSS sub first_link { }; sub last_link { }; sub previous_link { }; sub next_link { }; sub current_link { }; sub prev_archive_link { }; sub next_archive_link { }; sub generator { my $feed = shift; if (@_) { $feed->{rss}->channel('generator', $_[0]); $feed->{rss}->channel->{'http://webns.net/mvcb/'}{generatorAgent} = $_[0]; } else { $feed->{rss}->channel('generator') || $feed->{rss}->channel->{'http://webns.net/mvcb/'}{generatorAgent}; } } sub author { my $feed = shift; if (@_) { $feed->{rss}->channel('webMaster', $_[0]); $feed->{rss}->channel->{dc}{creator} = $_[0]; } else { $feed->{rss}->channel('webMaster') || $feed->{rss}->channel->{dc}{creator}; } } sub modified { my $rss = shift->{rss}; if (@_) { $rss->channel('pubDate', DateTime::Format::Mail->format_datetime($_[0])); ## XML::RSS is so weird... if I set this, it will try to use ## the value for the lastBuildDate, which I don't want--because ## this date is formatted for an RSS 1.0 feed. So it's commented out. #$rss->channel->{dc}{date} = # DateTime::Format::W3CDTF->format_datetime($_[0]); } else { my $date; eval { if (my $ts = $rss->channel('pubDate')) { $ts =~ s/^\s+//; $ts =~ s/\s+$//; $date = DateTime::Format::Mail->parse_datetime($ts); } elsif ($ts = $rss->channel->{dc}{date}) { $ts =~ s/^\s+//; $ts =~ s/\s+$//; $date = DateTime::Format::W3CDTF->parse_datetime($ts); } }; return $date; } } sub image { my $self = shift; my $rss = $self->{rss}; return @_ ? $rss->image(@_) : $rss->image('url'); } sub entries { my $rss = $_[0]->{rss}; my @entries; for my $item (@{ $rss->{items} }) { push @entries, XML::Feed::Entry::Format::RSS->wrap($item); $entries[-1]->{_version} = $rss->{'version'}; } @entries; } sub add_entry { my $feed = shift; my $entry = shift || return; $entry = $feed->_convert_entry($entry); $feed->{rss}->add_item(%{ $entry->unwrap }); } sub as_xml { $_[0]->{rss}->as_string } 1; libxml-feed-perl-0.52+dfsg.orig/lib/XML/Feed/Entry/0000755000175000017500000000000012114210615021103 5ustar gregoagregoalibxml-feed-perl-0.52+dfsg.orig/lib/XML/Feed/Entry/Format/0000755000175000017500000000000012114210615022333 5ustar gregoagregoalibxml-feed-perl-0.52+dfsg.orig/lib/XML/Feed/Entry/Format/Atom.pm0000444000175000017500000001354212114210615023574 0ustar gregoagregoapackage XML::Feed::Entry::Format::Atom; use strict; use warnings; our $VERSION = '0.52'; use base qw( XML::Feed::Entry ); use XML::Atom::Util qw( iso2dt ); use XML::Feed::Content; use XML::Atom::Entry; use List::Util qw( first ); sub init_empty { my $entry = shift; $entry->{entry} = XML::Atom::Entry->new(Version => 1.0); 1; } sub format { 'Atom' } sub title { shift->{entry}->title(@_) } sub source { shift->{entry}->source(@_) } sub updated { shift->{entry}->updated(@_) } sub base { shift->{entry}->base(@_) } sub link { my $entry = shift; if (@_) { $entry->{entry}->add_link({ rel => 'alternate', href => $_[0], type => 'text/html', }); } else { my $l = first { !defined $_->rel || $_->rel eq 'alternate' } $entry->{entry}->link; $l ? $l->href : undef; } } sub summary { my $entry = shift; if (@_) { my %param; if (ref($_[0]) eq 'XML::Feed::Content') { %param = (Body => $_[0]->body); } else { %param = (Body => $_[0]); } $entry->{entry}->summary(XML::Atom::Content->new(%param, Version => 1.0)); } else { my $s = $entry->{entry}->summary; # map Atom types to MIME types my $type = ($s && ref($s) eq 'XML::Feed::Content') ? $s->type : undef; if ($type) { $type = 'text/html' if $type eq 'xhtml' || $type eq 'html'; $type = 'text/plain' if $type eq 'text'; } my $body = $s; if (defined $s && ref($s) eq 'XML::Feed::Content') { $body = $s->body; } XML::Feed::Content->wrap({ type => $type, body => $body }); } } my %types = ( 'text/xhtml' => 'xhtml', 'text/html' => 'html', 'text/plain' => 'text', ); sub content { my $entry = shift; if (@_) { my %param; my $base; my $orig_body; if (ref($_[0]) eq 'XML::Feed::Content') { $orig_body = $_[0]->body; if (defined $_[0]->type && defined $types{$_[0]->type}) { %param = (Body => $orig_body, Type => $types{$_[0]->type}); if ($param{'Type'} eq "html") { $param{'Body'} = HTML::Entities::encode_entities($param{'Body'}); } } else { } $base = $_[0]->base if defined $_[0]->base; } else { $orig_body = $_[0]; } if (!exists($param{Body})) { $param{Body} = $orig_body; } $entry->{entry}->content(XML::Atom::Content->new(%param, Version => 1.0)); # Assigning again so the type will be normalized. This seems to be # an XML-Atom do-what-I-don't-meannery. $entry->{entry}->content->body($orig_body); $entry->{entry}->content->base($base) if defined $base; } else { my $c = $entry->{entry}->content; # map Atom types to MIME types my $type = $c ? $c->type : undef; if ($type) { $type = 'text/html' if $type eq 'xhtml' || $type eq 'html'; $type = 'text/plain' if $type eq 'text'; } XML::Feed::Content->wrap({ type => $type, base => $c ? $c->base : undef, body => $c ? $c->body : undef }); } } sub category { my $entry = shift; my $ns = XML::Atom::Namespace->new(dc => 'http://purl.org/dc/elements/1.1/'); if (@_) { $entry->{entry}->add_category({ term => $_ }) for @_; return 1 } else { my @category = ($entry->{entry}->can('categories')) ? $entry->{entry}->categories : $entry->{entry}->category; my @return = @category ? (map { $_->label || $_->term } @category) : $entry->{entry}->getlist($ns, 'subject'); return wantarray? @return : $return[0]; } } sub author { my $entry = shift; if (@_ && $_[0]) { my $person = XML::Atom::Person->new(Version => 1.0); $person->name($_[0]); $entry->{entry}->author($person); } else { $entry->{entry}->author ? $entry->{entry}->author->name : undef; } } sub id { shift->{entry}->id(@_) } sub issued { my $entry = shift; if (@_) { $entry->{entry}->issued(DateTime::Format::W3CDTF->format_datetime($_[0])) if $_[0]; } else { return iso2dt($entry->{entry}->issued) if $entry->{entry}->issued; return iso2dt($entry->{entry}->published) if $entry->{entry}->published; return undef; } } sub modified { my $entry = shift; if (@_) { $entry->{entry}->modified(DateTime::Format::W3CDTF->format_datetime($_[0])) if $_[0]; } else { return iso2dt($entry->{entry}->modified) if $entry->{entry}->modified; return iso2dt($entry->{entry}->updated) if $entry->{entry}->updated; return undef; } } sub lat { my $entry = shift; if (@_) { $entry->{entry}->lat($_[0]) if $_[0]; } else { $entry->{entry}->lat; } } sub long { my $entry = shift; if (@_) { $entry->{entry}->long($_[0]) if $_[0]; } else { $entry->{entry}->long; } } sub enclosure { my $entry = shift; if (@_) { my $enclosure = shift; my $method = ($XML::Feed::MULTIPLE_ENCLOSURES)? 'add_link' : 'link'; $entry->{entry}->$method({ rel => 'enclosure', href => $enclosure->{url}, length => $enclosure->{length}, type => $enclosure->{type} }); return 1; } else { my @links = grep { defined $_->rel && $_->rel eq 'enclosure' } $entry->{entry}->link; return unless @links; my @encs = map { XML::Feed::Enclosure->new({ url => $_->href, length => $_->length, type => $_->type }) } @links ; return ($XML::Feed::MULTIPLE_ENCLOSURES)? @encs : $encs[-1]; } } 1; libxml-feed-perl-0.52+dfsg.orig/lib/XML/Feed/Entry/Format/RSS.pm0000444000175000017500000001436312114210615023345 0ustar gregoagregoapackage XML::Feed::Entry::Format::RSS; use strict; use warnings; our $VERSION = '0.52'; sub format { 'RSS ' . $_[0]->{'_version'} } use XML::Feed::Content; use base qw( XML::Feed::Entry ); sub init_empty { $_[0]->{entry} = { } } sub base { my $entry = shift; @_ ? $entry->{entry}->{'xml:base'} = $_[0] : $entry->{entry}->{'xml:base'}; } sub title { my $entry = shift; @_ ? $entry->{entry}{title} = $_[0] : $entry->{entry}{title}; } sub link { my $entry = shift; if (@_) { $entry->{entry}{link} = $_[0]; ## For RSS 2.0 output from XML::RSS. Sigh. $entry->{entry}{permaLink} = $_[0]; } else { my $link = $entry->{entry}{link} || $entry->{entry}{permaLink} || $entry->{entry}{guid}; if (defined $link) { $link =~ s/^\s+//; $link =~ s/\s+$//; } return $link; } } sub summary { my $item = shift->{entry}; if (@_) { $item->{description} = ref($_[0]) eq 'XML::Feed::Content' ? $_[0]->body : $_[0]; ## Because of the logic below, we need to add some dummy content, ## so that we'll properly recognize the description we enter as ## the summary. if (!$item->{content}{encoded} && !$item->{'http://www.w3.org/1999/xhtml'}{body}) { $item->{content}{encoded} = ' '; } } else { ## Some RSS feeds use for a summary, and some use it ## for the full content. Pretty gross. We don't want to return the ## full content if the caller expects a summary, so the heuristic is: ## if the contains both a and one of the elements ## typically used for the full content, use as summary. my $txt; if ($item->{description} && ($item->{content}{encoded} || $item->{'http://www.w3.org/1999/xhtml'}{body})) { $txt = $item->{description}; ## Blogspot's 'short' RSS feeds do this in the Atom namespace ## for no obviously good reason. } elsif ($item->{'http://www.w3.org/2005/Atom'}{summary}) { $txt = $item->{'http://www.w3.org/2005/Atom'}{summary}; } XML::Feed::Content->wrap({ type => 'text/plain', body => $txt }); } } sub content { my $item = shift->{entry}; if (@_) { my $c; if (ref($_[0]) eq 'XML::Feed::Content') { if (defined $_[0]->base) { $c = { 'content' => $_[0]->body, 'xml:base' => $_[0]->base }; } else { $c = $_[0]->body; } } else { $c = $_[0]; } $item->{content}{encoded} = $c; } else { my $base; my $body = $item->{content}{encoded} || $item->{'http://www.w3.org/1999/xhtml'}{body} || $item->{description}; if ('HASH' eq ref($body)) { $base = $body->{'xml:base'}; $body = $body->{content}; } XML::Feed::Content->wrap({ type => 'text/html', body => $body, base => $base }); } } sub category { my $entry = shift; my $item = $entry->{entry}; if (@_) { my @tmp = ($entry->category, @_); $item->{category} = [@tmp]; $item->{dc}{subject} = [@tmp]; } else { my $r = $item->{category} || $item->{dc}{subject}; my @r = ref($r) eq 'ARRAY' ? @$r : defined $r? ($r) : (); return wantarray? @r : $r[0]; } } sub author { my $item = shift->{entry}; if (@_) { $item->{author} = $item->{dc}{creator} = $_[0]; } else { $item->{author} || $item->{dc}{creator}; } } ## XML::RSS doesn't give us access to the rdf:about for the , ## so we have to fall back to the element in RSS 1.0 feeds. sub id { my $item = shift->{entry}; if (@_) { $item->{guid} = $_[0]; } else { $item->{guid} || $item->{link}; } } sub issued { my $item = shift->{entry}; if (@_) { $item->{dc}{date} = DateTime::Format::W3CDTF->format_datetime($_[0]); $item->{pubDate} = DateTime::Format::Mail->format_datetime($_[0]); } else { ## Either of these could die if the format is invalid. my $date; eval { if (my $ts = $item->{pubDate}) { my $parser = DateTime::Format::Mail->new; $parser->loose; $ts =~ s/^\s+//; $ts =~ s/\s+$//; $date = $parser->parse_datetime($ts); } elsif ($ts = $item->{dc}{date} or $ts = $item->{dcterms}{date}) { $ts =~ s/^\s+//; $ts =~ s/\s+$//; $date = DateTime::Format::W3CDTF->parse_datetime($ts); } }; return $date; } } sub modified { my $item = shift->{entry}; if (@_) { $item->{dcterms}{modified} = DateTime::Format::W3CDTF->format_datetime($_[0]); } else { if (my $ts = $item->{dcterms}{modified} || $item->{'http://www.w3.org/2005/Atom'}{updated}) { $ts =~ s/^\s+//; $ts =~ s/\s+$//; return eval { DateTime::Format::W3CDTF->parse_datetime($ts) } || eval { XML::Atom::Util::iso2dt($ts) }; } } } sub lat { my $item = shift->{entry}; if (@_) { $item->{geo}{lat} = $_[0]; } else { return $item->{geo}{lat}; } } sub long { my $item = shift->{entry}; if (@_) { $item->{geo}{long} = $_[0]; } else { return $item->{geo}{long}; } } sub enclosure { my $entry = shift; if (@_) { my $enclosure = shift; my $val = { url => $enclosure->{url}, type => $enclosure->{type}, length => $enclosure->{length} }; if ($XML::Feed::MULTIPLE_ENCLOSURES) { push @{$entry->{entry}->{enclosure}}, $val; } else { $entry->{entry}->{enclosure} = $val; } } else { my $tmp = $entry->{entry}->{enclosure}; if (defined $tmp) { my @encs = map { XML::Feed::Enclosure->new($_) } (ref $tmp eq 'ARRAY')? @$tmp : ($tmp); return ($XML::Feed::MULTIPLE_ENCLOSURES)? @encs : $encs[-1]; } return; } } 1; libxml-feed-perl-0.52+dfsg.orig/Makefile.PL0000444000175000017500000000164012114210615017702 0ustar gregoagregoa# Note: this file was auto-generated by Module::Build::Compat version 0.4003 use ExtUtils::MakeMaker; WriteMakefile ( 'NAME' => 'XML::Feed', 'VERSION_FROM' => 'lib/XML/Feed.pm', 'PREREQ_PM' => { 'Class::ErrorHandler' => 0, 'DateTime' => 0, 'DateTime::Format::Mail' => 0, 'DateTime::Format::W3CDTF' => 0, 'Feed::Find' => 0, 'HTML::Entities' => 0, 'HTML::TokeParser' => 0, 'LWP::UserAgent' => 0, 'List::Util' => 0, 'Module::Pluggable' => 0, 'Test::More' => 0, 'URI::Fetch' => 0, 'XML::Atom' => '0.38', 'XML::LibXML' => '1.66', 'XML::RSS' => '1.47' }, 'INSTALLDIRS' => 'site', 'EXE_FILES' => [], 'PL_FILES' => {} ) ; libxml-feed-perl-0.52+dfsg.orig/META.yml0000444000175000017500000000314112114210615017177 0ustar gregoagregoa--- abstract: 'XML Syndication Feed Support' author: - 'Six Apart' build_requires: {} configure_requires: Module::Build: 0.40 dynamic_config: 1 generated_by: 'Module::Build version 0.4003, CPAN::Meta::Converter version 2.120921' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 name: XML-Feed provides: XML::Feed: file: lib/XML/Feed.pm version: 0.52 XML::Feed::Content: file: lib/XML/Feed/Content.pm version: 0.52 XML::Feed::Enclosure: file: lib/XML/Feed/Enclosure.pm version: 0.52 XML::Feed::Entry: file: lib/XML/Feed/Entry.pm version: 0.52 XML::Feed::Entry::Format::Atom: file: lib/XML/Feed/Entry/Format/Atom.pm version: 0.52 XML::Feed::Entry::Format::RSS: file: lib/XML/Feed/Entry/Format/RSS.pm version: 0.52 XML::Feed::Format::Atom: file: lib/XML/Feed/Format/Atom.pm version: 0.52 XML::Feed::Format::RSS: file: lib/XML/Feed/Format/RSS.pm version: 0.52 requires: Class::ErrorHandler: 0 DateTime: 0 DateTime::Format::Mail: 0 DateTime::Format::W3CDTF: 0 Feed::Find: 0 HTML::Entities: 0 HTML::TokeParser: 0 LWP::UserAgent: 0 List::Util: 0 Module::Pluggable: 0 Test::More: 0 URI::Fetch: 0 XML::Atom: 0.38 XML::LibXML: 1.66 XML::RSS: 1.47 resources: license: http://dev.perl.org/licenses/ repository: https://github.com/davorg/xml-feed version: 0.52 x_contributors: - 'Dave Cross ' - 'Jakob Voss ' - 'Tatsuhiko Miyagawa ' - 'Simon Wistow ' - 'Gabor Szabo ' libxml-feed-perl-0.52+dfsg.orig/META.json0000444000175000017500000000477312114210615017363 0ustar gregoagregoa{ "abstract" : "XML Syndication Feed Support", "author" : [ "Six Apart" ], "dynamic_config" : 1, "generated_by" : "Module::Build version 0.4003, CPAN::Meta::Converter version 2.120921", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "XML-Feed", "prereqs" : { "configure" : { "requires" : { "Module::Build" : "0.40" } }, "runtime" : { "requires" : { "Class::ErrorHandler" : "0", "DateTime" : "0", "DateTime::Format::Mail" : "0", "DateTime::Format::W3CDTF" : "0", "Feed::Find" : "0", "HTML::Entities" : "0", "HTML::TokeParser" : "0", "LWP::UserAgent" : "0", "List::Util" : "0", "Module::Pluggable" : "0", "Test::More" : "0", "URI::Fetch" : "0", "XML::Atom" : "0.38", "XML::LibXML" : "1.66", "XML::RSS" : "1.47" } } }, "provides" : { "XML::Feed" : { "file" : "lib/XML/Feed.pm", "version" : "0.52" }, "XML::Feed::Content" : { "file" : "lib/XML/Feed/Content.pm", "version" : "0.52" }, "XML::Feed::Enclosure" : { "file" : "lib/XML/Feed/Enclosure.pm", "version" : "0.52" }, "XML::Feed::Entry" : { "file" : "lib/XML/Feed/Entry.pm", "version" : "0.52" }, "XML::Feed::Entry::Format::Atom" : { "file" : "lib/XML/Feed/Entry/Format/Atom.pm", "version" : "0.52" }, "XML::Feed::Entry::Format::RSS" : { "file" : "lib/XML/Feed/Entry/Format/RSS.pm", "version" : "0.52" }, "XML::Feed::Format::Atom" : { "file" : "lib/XML/Feed/Format/Atom.pm", "version" : "0.52" }, "XML::Feed::Format::RSS" : { "file" : "lib/XML/Feed/Format/RSS.pm", "version" : "0.52" } }, "release_status" : "stable", "resources" : { "license" : [ "http://dev.perl.org/licenses/" ], "repository" : { "url" : "https://github.com/davorg/xml-feed" } }, "version" : "0.52", "x_contributors" : [ "Dave Cross ", "Jakob Voss ", "Tatsuhiko Miyagawa ", "Simon Wistow ", "Gabor Szabo " ] }