LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-12-2012, 01:01 PM   #1
ted_chou12
Member
 
Registered: Aug 2010
Location: Zhongli, Taoyuan
Distribution: slackware, windows, debian (armv4l GNU/Linux)
Posts: 430
Blog Entries: 30

Rep: Reputation: 2
xml::rss fetch rss variables


I remember that you could use perl rss xml to fetch the variables in a rss feed easily:
Code:
#!/usr/bin/perl -w
 use strict;

 use XML::RSS;
 my $rss = XML::RSS->new( version => 0.9 );

 chomp( my $channel_title = <DATA> );
 chomp( my $channel_link = <DATA> );
my $rss = XML::RSS->new();

	my $channel = $rss->{pubDate};
	my $image   = $rss->{image};

echo $channel{[0]}
But I got the following error
Code:
sh-3.1# /mnt/sda1/script/blogrss.sh
Can't locate XML/RSS.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.
10.0 /usr/local/share/perl/5.10.0 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/
5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl .) at /mnt/sda1/script/blogrs
s.sh line 3.
BEGIN failed--compilation aborted at /mnt/sda1/script/blogrss.sh line 3.
sh-3.1# /mnt/sda1/script/blogrss.sh
Can't locate XML/RSS.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.
10.0 /usr/local/share/perl/5.10.0 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/
5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl .) at /mnt/sda1/script/blogrs
s.sh line 4.
BEGIN failed--compilation aborted at /mnt/sda1/script/blogrss.sh line 4.
sh-3.1#
Does thsi mean there are some necessary updates? If so what commands should i put?
Thanks,
Ted
 
Old 02-12-2012, 03:52 PM   #2
ted_chou12
Member
 
Registered: Aug 2010
Location: Zhongli, Taoyuan
Distribution: slackware, windows, debian (armv4l GNU/Linux)
Posts: 430

Original Poster
Blog Entries: 30

Rep: Reputation: 2
This alternative lib works:
Code:
#!/usr/bin/perl

use LWP::Simple;
use XML::RSS;
use HTML::Strip;

binmode(STDOUT, ":utf8");

#my $url = "http://feeds.gawker.com/gizmodo/full";
my $url = "http://rss.slashdot.org/Slashdot/slashdot";

$hs = HTML::Strip->new();

my $rss = XML::RSS->new();
my $data = get( $url );
$rss->parse( $data );

my $channel = $rss->{channel};
#my $title   = $channel->{title};
#my $link    = $channel->{link};
#my $desc    = $channel->{description};

foreach my $item ( @{ $rss->{items} } )
{
  my $link  = $item->{link};
  my $title = $item->{title};
  my $desc  = $item->{description};
  
  print $title, "\n", $hs->parse($desc), "\n\n\n";
}

$hs->eof;
Thanks,
Ted
 
Old 02-13-2012, 03:48 AM   #3
chiragrk
Member
 
Registered: Nov 2009
Location: India
Distribution: Xandros, Ubuntu
Posts: 74

Rep: Reputation: 16
"Can't locate XML/RSS.pm" means you haven't installed RSS.pm module. As a result the functions used will not execute. Please see if you can download this perl module and/or install it.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to read RSS with XMl::Simple android2009 Programming 1 09-26-2010 08:14 PM
g++ Atom/RSS XML parsing library marf Linux - General 1 05-24-2008 01:39 PM
LXer: Expand RSS Capabilities with RSS Extensions LXer Syndicated Linux News 0 08-22-2006 10:54 AM
RSS link problems with XML Nylex LQ Suggestions & Feedback 10 08-21-2005 12:51 PM
rss/xml scripts for irc spooge Linux - Networking 0 02-26-2005 12:49 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:27 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration