Perl , XML::RSS parser not found, please help. (SOLVED!)

May 11, 2008
21,787
1,310
126
Hi people, i hope somebody can help me because i have zero experience with perl. My boss had a pc that logged weather information for creating comparison charts. Unfortunately, the pc died and putting the hdd in another pc resulted in a unrecoverable crash of windows. So the best as i did, i tried to install all software on another pc. And most of it is up and running again. Except for the perl script. The problem is that the colleague who wrote it all is long gone.

Although this is a linux subsection, it is actually a windows pc running national instruments cvi compiled software and perl scripts. But perl is unix based, i believe.
I have installed ActivePerl-5.22.1.2201-MSWin32-x86-64int-299574.exe
I wonder if i have to correct version because it is a 32 bit windows. It does seem to run and the ppm perl module manager says i have the XML parser and i have looked in the directories, and it is there.

This is the error message i get, see picture :

perlprut.jpg~original



The perl script.

Code:
#c:perlbinperl

# import packages
use XML::RSS;
use LWP::Simple;
use CGI;

# initialize object
$rss = new XML::RSS();

my $fname = "> c:/solar/weatherShiphol.txt"; 

($sec,$min,$hr,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$year += 1900; # Misschien wel een "milleniumbug" ingebouwd...
$mon += 1;

# get RSS data
$raw = get('http://.************************.xml'); # Removed the link, personal stuff. 

# parse RSS feed
$rss->parse($raw);

# open logfile to write results to...
open filename, $fname or die "Can't find File $fname $!\n";

# loop trough the items available within RSS feed.
foreach my $item (@{$rss->{'items'}})
{

        $title = $item->{'title'};
               
        $description = $item->{'description'};
       
        @mijnArray = split(/\|/, $description);
        
        ($temperature , $humidity , $pressure , $conditions , $winddir , $windspeed , $Updated ) = @mijnArray;
            
        print filename "[date]\n\"";
        printf filename "%02d-%02d-%02d", $mday , $mon  , $year;
        print filename "\"\n\n";

        print filename "[time]\n\"";
        printf filename "%02d:%02d:%02d", $hr , $min , $sec;
        print filename "\"\n\n";	     
        
        print filename "[location]\n\"" , $title , "\"\n\n";
        
        print filename "[wind]\n\"" , $winddir , " " , $windspeed,  "\"\n\n";
        
        print filename "[sky]\n\"" , $conditions , "\"\n\n";
        
        print filename "[temp]\n\"" , $temperature , "\"\n\n";

        print filename "[visibility]\n\"" , "" , "\"\n\n";  # 
        
        print filename "[pressure]\n\"" , $pressure , "\"\n\n";
        
        print filename "[humidity]\n\"" , $humidity, "\"\n\n";
        
}

close filename;

print "Succes!";


Does anybody know what i must do to get it to function ?
What have i forgotten ?
 
Last edited:

AnonymouseUser

Diamond Member
May 14, 2003
9,943
107
106
The programming forum might be a better place for this question, but I do see one problem. The script was last modified in 2006, so the newer version of Perl is most likely incompatible. You'll need to find a compatible version of Perl or re-write the script.
 
May 11, 2008
21,787
1,310
126
I was afraid i would have to get my head into perl script.
It should not be too hard. It is just, it is more time that i need.
Luckily, the project is not in a hurry. But it would be nice if i get it up and running before the summer starts.
 

AnonymouseUser

Diamond Member
May 14, 2003
9,943
107
106
OK, took another look and installed Dwimperl and Strawberry Perl to test it myself. Dwimperl worked without modification. For Strawberry Perl (or ActivePerl) XML::RSS** was not installed in in it's included path (eg, C:/Perl/site/lib or C:/Perl/lib).

After installing XML::RSS to either directory, you may fail with a DateTime error. Install DateTime::Format::Mail** and DateTime::Format::W3CDTF**.

If you already have all of those (RSS.pm, Mail.pm, W3CDTF.pm) in another folder and wish to keep them there, use the link I posted earlier to add the location to the perl path.

** Note: paste only the contents of the lib folder to the C:/Perl/site/lib or C:/Perl/lib folders

Dwimperl output as installed (I used a random xml file to test):

Code:
C:\solar>perl GetWeatherIvo_Ver2.pl
Use of uninitialized value in string eq at C:/Dwimperl/perl/site/lib/XML/RSS.pm
line 1033.
Use of uninitialized value in string eq at C:/Dwimperl/perl/site/lib/XML/RSS.pm
line 1154.
Succes!
C:\solar>

Strawberry Perl output:

Code:
C:\solar>GetWeatherIvo_Ver2.pl
Can't locate XML/RSS.pm in @INC (you may need to install the XML::RSS module) (@
INC contains: C:/Strawberry/perl/site/lib C:/Strawberry/perl/vendor/lib C:/Straw
berry/perl/lib .) at C:\solar\GetWeatherIvo_Ver2.pl line 4.
BEGIN failed--compilation aborted at C:\solar\GetWeatherIvo_Ver2.pl line 4.

// Installed XML::RSS

C:\solar>GetWeatherIvo_Ver2.pl
Can't locate DateTime/Format/Mail.pm in @INC (you may need to install the DateTi
me::Format::Mail module) (@INC contains: C:/Strawberry/perl/site/lib C:/Strawber
ry/perl/vendor/lib C:/Strawberry/perl/lib .) at C:/Strawberry/perl/lib/XML/RSS/P
rivate/Output/Base.pm line 9.
BEGIN failed--compilation aborted at C:/Strawberry/perl/lib/XML/RSS/Private/Outp
ut/Base.pm line 9.
Compilation failed in require at C:/Strawberry/perl/lib/XML/RSS.pm line 9.
BEGIN failed--compilation aborted at C:/Strawberry/perl/lib/XML/RSS.pm line 9.
Compilation failed in require at C:\solar\GetWeatherIvo_Ver2.pl line 4.
BEGIN failed--compilation aborted at C:\solar\GetWeatherIvo_Ver2.pl line 4.

// Installed DateTime::Mail

C:\solar>GetWeatherIvo_Ver2.pl
Can't locate DateTime/Format/W3CDTF.pm in @INC (you may need to install the Date
Time::Format::W3CDTF module) (@INC contains: C:/Strawberry/perl/site/lib C:/Stra
wberry/perl/vendor/lib C:/Strawberry/perl/lib .) at C:/Strawberry/perl/lib/XML/R
SS/Private/Output/Base.pm line 10.
BEGIN failed--compilation aborted at C:/Strawberry/perl/lib/XML/RSS/Private/Outp
ut/Base.pm line 10.
Compilation failed in require at C:/Strawberry/perl/lib/XML/RSS.pm line 9.
BEGIN failed--compilation aborted at C:/Strawberry/perl/lib/XML/RSS.pm line 9.
Compilation failed in require at C:\solar\GetWeatherIvo_Ver2.pl line 4.
BEGIN failed--compilation aborted at C:\solar\GetWeatherIvo_Ver2.pl line 4.

// Installed DateTime::W3CDTF

C:\solar>GetWeatherIvo_Ver2.pl
Use of uninitialized value in string eq at C:/Strawberry/perl/lib/XML/RSS.pm lin
e 1031.
Use of uninitialized value in string eq at C:/Strawberry/perl/lib/XML/RSS.pm lin
e 1152.
Succes!
C:\solar>
 
Last edited:
May 11, 2008
21,787
1,310
126
Thank you for looking into it.

I have an EWENT USB to IDE/SATA adapter and connected the old HDD. I copied the perl directory with all sub directories and i am going to try and see how far i get.


After that, i can test the data acquisition card and add some debug code into the cvi program to test if it still works.

Thanks for the help. :)
 
May 11, 2008
21,787
1,310
126
Yahoo. I got it running.

I compared the perl directories of the old hdd from the crashed pc with the new activeperl installation on the new pc.
I noticed that i was missing the "RSS.pm" from the activateperl installation.
I copied from the perl directory of the old hdd from the crashed pc the file "RSS.pm" and copied it to the directory "C: \perl\lib\XML\" .
After enabling the internet connection, the script does run succesfully.
It does seem weird because i checked with the ppm manager and it seemed installed. I guess i misinterpreted.

I think because it does not work for you is because i removed the http website link. And the script expects that link or it will give an error.
The website must contain the words that the perlscript is looking for.
There are no error handlers in the script. The first time i tried to run it, the cmd window was flooded with error messages. But after enabling the internet connection it worked.
 
Last edited:
May 11, 2008
21,787
1,310
126
I was kind of curious why i could not find the RSS.pm with te activeperl package.

From the activeperl version, there is the PPM perl package manager.

And when it starts, it only shows the installed packages and not what is available. I also did not have an internet connection when i tried the ppm for the first time. This time while having an internet connection, i hovered above all the buttons(balloon with text) to see what they do and this time i got a list with all available packages when clicking one of the buttons. And lo and behold, there it was... The XML ::RSS module.

So i removed the RSS.pm file that i copied and i let the PPM install the RSS module. And after some time, it was installed and now it works as well.

Thank you for the help. :thumbsup:
 
Last edited: