[29551] in Perl-Users-Digest
Perl-Users Digest, Issue: 795 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Aug 25 21:09:43 2007
Date: Sat, 25 Aug 2007 18:09:06 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sat, 25 Aug 2007 Volume: 11 Number: 795
Today's topics:
Re: better and great hash <tadmc@seesig.invalid>
great and better hash eval <john.swilting@wanadoo.fr>
Re: great and better hash eval (aka ? the Platypus)
Re: great and better hash eval anno4000@radom.zrz.tu-berlin.de
Re: How to install WIN32::CGI on ActiveState Perl insta <rkb@i.frys.com>
Re: How to install WIN32::CGI on ActiveState Perl insta <rvtol+news@isolution.nl>
Re: perhaps you forgot to load "URI"? xhoster@gmail.com
Program Dies after 60 or so Iterations of Loop <hal@thresholddigital.com>
Read out .htaccess password <bart@nijlen.com>
Re: Regular expression use anno4000@radom.zrz.tu-berlin.de
Re: socket error <rvtol+news@isolution.nl>
Re: Starting with SOAP <perl4hire@softouch.on.ca>
Re: Starting with SOAP <perl4hire@softouch.on.ca>
Re: Starting with SOAP xhoster@gmail.com
Re: Starting with SOAP <perl4hire@softouch.on.ca>
Re: UTF-8 problem <hjp-usenet2@hjp.at>
Re: UTF-8 problem <vachkov@math.tu-berlin.de>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 25 Aug 2007 13:10:53 GMT
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: better and great hash
Message-Id: <slrnfd0acp.agm.tadmc@tadmc30.sbcglobal.net>
john swilting <john.swilting@wanadoo.fr> wrote:
>
> I would wish to store the result of the loop while in a list.
perldoc -f push
> I must make
> how?
>
> #!/usr/bin/perl -w
>
> use strict;
> use warnings;
>
> my %Conf;
> $Conf{XferMethod} = 'rsync';
> $Conf{XferLogLevel} = 1;
> $Conf{RSyncShareName} = '___1___';
> $Conf{ClientNameAlias} = '___2___';
my @list;
> while(my($clef, $valeur) = each (%Conf)) {
> print "$clef => $valeur","\n";
push @list, "$clef => $valeur\n";
> }
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
------------------------------
Date: Sun, 26 Aug 2007 01:26:42 +0200
From: john swilting <john.swilting@wanadoo.fr>
Subject: great and better hash eval
Message-Id: <46d0bab4$0$27379$ba4acef3@news.orange.fr>
I do not understand .i start the deboguor ,is the file test.dat is well
execute.in the file main.pl the loop while does not seem to function
correctly. one only value is returned to me before keys. it appears
infinite
##########################################################################
#main.pl
##########################################################################
#!/usr/bin/perl
require "ouvre_fichier.pl";
$f = "test.dat";
%fh = ouvre_fichier($f);;
while(( $clef,$valeur) = each %fh){
print $clef;
keys %fh;
}
########################################################################
#ouvre_fichier.pl
########################################################################
!/usr/bin/perl
sub ouvre_fichier {
open ($F, $_[0]) || die "impossible d ouvrir le fichier : $!";
while($ligne =<$F>){
$str.= $ligne;
}
eval $str;
}
$f = 'test.dat';
while(1){
eval {
ouvre_fichier($f);#si ouvre fichier echoue, le programme ne se termine pas
};##et à mon avis c la dernier veleur utliser
last unless $@; #pas d erreur on sort de la boucle
print "$f est absent. entrez un nouveau nom de fichier $f";
chomp ($f = <STDIN>);
}
1
#######################################################################
#test.dat
#######################################################################
$Conf{XferMethod} = 'rsync';
$Conf{XferLogLevel} = '1';
$Conf{RSyncShareName} = '___1___';
$Conf{ClientNameAlias} = '___2___';
------------------------------
Date: Sun, 26 Aug 2007 00:07:10 GMT
From: "David Formosa (aka ? the Platypus)" <dformosa@usyd.edu.au>
Subject: Re: great and better hash eval
Message-Id: <slrnfd1i0n.26q.dformosa@localhost.localdomain>
On Sun, 26 Aug 2007 01:26:42 +0200, john swilting <john.swilting@wanadoo.fr> wrote:
> I do not understand .i start the deboguor ,is the file test.dat is well
> execute.in the file main.pl the loop while does not seem to function
> correctly. one only value is returned to me before keys. it appears
> infinite
> ##########################################################################
> #main.pl
> ##########################################################################
> #!/usr/bin/perl
>
> require "ouvre_fichier.pl";
> $f = "test.dat";
> %fh = ouvre_fichier($f);;
> while(( $clef,$valeur) = each %fh){
> print $clef;
> keys %fh;
>}
Hashes have an iterator, this is used by each, values and keys to step
though the hash. By calling keys at the bottem of your while loop
your resetting the iterator and causing yourself to go into an
infinite loop.
------------------------------
Date: 26 Aug 2007 00:27:42 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: great and better hash eval
Message-Id: <5jbvnuF3tn8n5U1@mid.dfncis.de>
john swilting <john.swilting@wanadoo.fr> wrote in comp.lang.perl.misc:
> I do not understand .i start the deboguor ,is the file test.dat is well
> execute.in the file main.pl the loop while does not seem to function
> correctly. one only value is returned to me before keys. it appears
> infinite
> ##########################################################################
> #main.pl
> ##########################################################################
> #!/usr/bin/perl
>
> require "ouvre_fichier.pl";
> $f = "test.dat";
> %fh = ouvre_fichier($f);;
> while(( $clef,$valeur) = each %fh){
> print $clef;
> keys %fh;
What is the call to "keys %fh" for? It does nothing useful but messes
up the iteration.
> }
The call to "keys %fh" resets the iterator that controls the behavior
of "each". Instead of giving you the next key/value pair it gives you
the first one again. That leads to the endless loop you're observing.
Remove the line, then the loop will work as expected.
> ########################################################################
> #ouvre_fichier.pl
> ########################################################################
> !/usr/bin/perl
> sub ouvre_fichier {
> open ($F, $_[0]) || die "impossible d ouvrir le fichier : $!";
> while($ligne =<$F>){
> $str.= $ligne;
> }
> eval $str;
> }
> $f = 'test.dat';
> while(1){
> eval {
> ouvre_fichier($f);#si ouvre fichier echoue, le programme ne se termine pas
> };##et à mon avis c la dernier veleur utliser
> last unless $@; #pas d erreur on sort de la boucle
> print "$f est absent. entrez un nouveau nom de fichier $f";
> chomp ($f = <STDIN>);
> }
>
> 1
> #######################################################################
> #test.dat
> #######################################################################
> $Conf{XferMethod} = 'rsync';
> $Conf{XferLogLevel} = '1';
> $Conf{RSyncShareName} = '___1___';
> $Conf{ClientNameAlias} = '___2___';
From your usage the function ouvre_fichie() is supposed to set up
a hash. As far as I can see without running it, it returns the
single value "___2___", in an incredibly convoluted manner.
Anno
------------------------------
Date: Sat, 25 Aug 2007 07:53:17 -0700
From: Ron Bergin <rkb@i.frys.com>
Subject: Re: How to install WIN32::CGI on ActiveState Perl instaled on Windows XP?
Message-Id: <1188053597.910711.89880@x40g2000prg.googlegroups.com>
On Aug 25, 12:52 am, "Bond" <tris...@vvv.xls> wrote:
> Not from PPM, but on web address:http://search.cpan.org/~jdb/libwin32-0.27/OLE/lib/Win32/OLE.pm
>
> "Sisyphus" <sisyph...@nomail.afraid.org> wrote in message
>
> news:46cf2be9$0$13999$afc38c87@news.optusnet.com.au...
>
>
>
> > "Bond" <B...@james.bond> wrote in message
> >news:fam25p$no8$1@ss408.t-com.hr...
> >> How to install WIN32::CGI on ActiveState Perl instaled on Windows XP?
>
> > Does such a module exist ? I couldn't find it anywhere.
>
> > Cheers,
> > Rob
WIN32::CGI is not the same as the WIN32::OLE module that you pointed
to.
C:\>ppm install http://www.bribes.org/perl/ppm/Win32-OLE.ppd
Downloading Win32-OLE-0.1703...done
Unpacking Win32-OLE-0.1703...done
Generating HTML for Win32-OLE-0.1703...done
Installing to site area...done
21 files installed
------------------------------
Date: Sat, 25 Aug 2007 23:25:11 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: How to install WIN32::CGI on ActiveState Perl instaled on Windows XP?
Message-Id: <faqdpb.1cs.1@news.isolution.nl>
Ron Bergin schreef:
> Bond:
>> Sisyphus:
>>> Bond:
>>>> How to install WIN32::CGI on ActiveState Perl instal[l]ed on
>>>> Windows XP?
>>>
>>> Does such a module exist ? I couldn't find it anywhere.
>>
>> Not from PPM, but on web address:
>> http://search.cpan.org/~jdb/libwin32-0.27/OLE/lib/Win32/OLE.pm
>
> WIN32::CGI is not the same as the WIN32::OLE module
> that you pointed to.
The name of that module is not WIN32::OLE but Win32::OLE, right?
--
Affijn, Ruud
"Gewoon is een tijger."
------------------------------
Date: 25 Aug 2007 16:02:57 GMT
From: xhoster@gmail.com
Subject: Re: perhaps you forgot to load "URI"?
Message-Id: <20070825120258.751$Fb@newsreader.com>
"John" <john1949@yahoo.com> wrote:
> >
> > and then when i executed it the answer is:
> >
> > SOAP::Lite::call: ()
> > SOAP::Serializer::envelope: ()
> > Can't locate object method "new" via package "URI" (perhaps you forgot
> > to load "URI"?) at /usr/perl5/5.6.1/lib/HTTP/Request.pm line 82.
> >
> > so any idea suggestions or something useful, sorry but i am desperate
> > jeje... thanks for advanced
> >
>
> Hi
>
> I had a similar problem when we moved to a new server.
>
> Can't locate object method "new" via package "SOAP::Packager::MIME"
> (perhaps you forgot to load "SOAP::Packager::MIME"?) at
> /usr/lib/perl5/site_perl/5.8.6/SOAP/Lite.pm line 3241.
>
> At first, we thought that the package MIME was missing but once we
> re-installed
> SOAP Lite (force installation) it was OK.
This is because there are two SOAP::Packager modules, one part of
SOAP and one part of SOAP::Lite. SOAP::Lite's defines MIME internally,
and SOAP's doesn't. So if SOAP::Lite loads SOAP's version, it fails. When
you reinstalled, either SOAP::Lite's module overwrite SOAP's, or it was
installed into a place that came earlier in @INC.
http://search.cpan.org/src/KBROWN/SOAP-0.28/lib/SOAP/Packager.pm
http://search.cpan.org/src/BYRNE/SOAP-Lite-0.69/lib/SOAP/Packager.pm
> It might be that package URI is missing, but, my guess a fresh
> installation odf SOAP::Lite will fix it.
I bet the OP's problem is similar. Instead of loading a SOAP::Lite module
which has a "use URI" in it, it loads a same-named SOAP module which
doesn't have "use URI" in it.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: Sat, 25 Aug 2007 21:07:47 -0400
From: Hal Vaughan <hal@thresholddigital.com>
Subject: Program Dies after 60 or so Iterations of Loop
Message-Id: <i-KdnWQuLpP_T03bnZ2dneKdnZydnZ2d@comcast.com>
I found the old time radio shows a the Interet Archives, so I wrote a
program to scan the shows, then the episodes and let me list the ones I
wanted to download. The program then goes through the list of files and
downloads each file (most are MP3, some are Ogg). Files are at least a few
megabytes in length. The problem is that after about 60 or so downloads
(it varies), my computer (running Linux, Ubuntu Fiesty Fawn) slows down for
about 30 minutes (not an exaggeration), then the program stops with
a "Killed!" statement.
I've included the loop below with comments. My best thought is that there's
an issue with reusing variables or something I'm not doing that would make
garbage collection work well. What can I do to keep it from slowing down
the computer and dying regularly?
Thanks!
Hal
---------
sub downloadfiles {
my ($total, $idx, $num, @data, @line, %done);
#Get the list of already downloaded files and convert to an array in another
# module, then convert them to an array so I can quickly tell if a file has
# been downloaded.
@data = filetoarray($donefile);
foreach (@data) {
@line = split(/\t/, $_);
$done{pop(@line)} = 1;
}
#Get an array of the files to download (kill the first line,
# its column titles)
@data = filetoarray($showfile);
$total = $#data;
$idx = 0;
shift(@data);
foreach (@data) {
#Get is whether or not to get the file, other variables are
# self explanitory
my ($get, $show, $episode, $file, $url) = split(/\t/, $_);
my ($data, $loc);
$idx++;
if ($_ =~ /^#/) {next;}
if (!$_) {next;}
if ($get) {
#If it's flagged to download, see if it has been downloaded already
if ($done{$url}) {
print "Already downloaded file: $show: $episode\n";
next;
}
#Make the name of the file we're writing data to
$loc = catfile($fileroot, $show, $file);
$loc =~ s/ //g;
$loc =~ s/,//g;
#Makes sure any non-existent directories in the path name are
# created
makedirpath($loc);
$num = " ".$idx;
$num = substr($num, length($num) - length($total));
print "Downloading file ".$num." of $total: $show: $episode\n";
#Download the file with WWW::Mechanize
#Isn't $data reinitialized each loop? Could old copies not be cleared
#by garbage collector?
$data = getpage($url);
open(OUT, ">$loc");
print OUT $data;
close OUT;
#Use lltag to create appropriate tags for the file
filetagmod($loc, $show, $episode);
open(DOWN, ">>$donefile");
print DOWN "$show\t$episode\t$loc\t$url\n";
close DOWN;
}
}
return;
}
------------------------------
Date: Sat, 25 Aug 2007 06:56:49 -0700
From: Bart Van der Donck <bart@nijlen.com>
Subject: Read out .htaccess password
Message-Id: <1188050209.762316.216270@z24g2000prh.googlegroups.com>
Hello,
When browser requests a directory that is secured by .htaccess user/
pass, I can read out the username in a Perl script with
$ENV{'REMOTE_USER'}.
I've been looking for a similar way to know the password.
Since this password is sent unencrypted from the browser and reaches
server in plain text, I suppose it must be possible to know it somehow
in perl ?
Thanks,
--
Bart
------------------------------
Date: 25 Aug 2007 14:29:25 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: Regular expression use
Message-Id: <5jasm5F3tgqdqU1@mid.dfncis.de>
John W. Krahn <krahnj@telus.net> wrote in comp.lang.perl.misc:
> Nick Maclaren wrote:
> > In article <famlj0$33k$1@mlucom4.urz.uni-halle.de>,
> > Mirco Wahab <wahab-mail@gmx.net> writes:
> > |>
> > |> Using complex regular expressions is like tank destruction
> > |> with contact charges glued on them. Only a few people
> > |> will even survive the first "usage", but survivors will
> > |> then eventually be able to destroy almost every tank with
> > |> tremendous speed and precision.
> >
> > I must remember that! It is nicely put.
>
> I couldn't understand it. (An old Centurion trooper.)
Me neither. The word "nicely" isn't the first thing it brings to
mind.
Anno
------------------------------
Date: Sat, 25 Aug 2007 15:34:29 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: socket error
Message-Id: <fapic6.1mo.1@news.isolution.nl>
jis schreef:
> my $sock = new IO::Socket::INET (
> PeerAddr => '144.xxx.31.142',
> PeerPort => '9000',
> Proto => 'tcp',
> );
> die "Could not create socket: $!\n" unless $sock;
It is easy to combine that:
my $sock = IO::Socket::INET->new(
PeerAddr => '144.xxx.31.142',
PeerPort => '9000',
Proto => 'tcp',
) or die "Could not create socket: ($!) ($@)\n";
--
Affijn, Ruud
"Gewoon is een tijger."
------------------------------
Date: Sat, 25 Aug 2007 10:15:48 -0400
From: Amer Neely <perl4hire@softouch.on.ca>
Subject: Re: Starting with SOAP
Message-Id: <ROWzi.578$k22.392@read2.cgocable.net>
David Formosa (aka ? the Platypus) wrote:
> On Thu, 23 Aug 2007 10:45:44 -0400, Amer Neely <perl4hire@softouch.on.ca> wrote:
>
> [...]
>
>> You have it pretty much right. I built a form for a client, who now
>> wants to take that data and pass it to another server so it can be used
>> to update a page there. I don't own the receiving code (the SOAP
>> server?) but the owner suggested SOAP as a means to do this. Hence my
>> immersion into SOAP.
>
> If you have a choice here I would strongly recomend against using
> SOAP. Almost every implementation of SOAP uses a mutually
> imcompatable subset of the soap standard. Cross platform soap support
> is a pain.
>
You know, I'm sort of finding that out myself. I added a simple twist to
my 'working' code and it didn't work.
I'm going to investigate alternatives (Mechanize ?) for this little project.
--
Amer Neely
w: www.webmechanic.softouch.on.ca/
Perl | MySQL programming for all data entry forms.
"Others make web sites. We make web sites work!"
------------------------------
Date: Sat, 25 Aug 2007 10:20:26 -0400
From: Amer Neely <perl4hire@softouch.on.ca>
Subject: Re: Starting with SOAP
Message-Id: <bTWzi.580$k22.0@read2.cgocable.net>
Ian Wilson wrote:
> Amer Neely wrote:
>> (thanks to the examples provided by xhoster I believe)
>
> Sigh.
>
> :-)
Woops, yes, I see now that it was yourself :) All these indents ....
Actually, I'm going to investigate an alternative to SOAP (Mechanize ?)
for this little project. From some other posts here, and my own limited
experience, it seems SOAP maybe isn't quite suited for cross-platform work.
--
Amer Neely
w: www.webmechanic.softouch.on.ca/
Perl | MySQL programming for all data entry forms.
"Others make web sites. We make web sites work!"
------------------------------
Date: 25 Aug 2007 16:14:48 GMT
From: xhoster@gmail.com
Subject: Re: Starting with SOAP
Message-Id: <20070825121450.446$Gp@newsreader.com>
Amer Neely <perl4hire@softouch.on.ca> wrote:
> David Formosa (aka ? the Platypus) wrote:
> > On Thu, 23 Aug 2007 10:45:44 -0400, Amer Neely
> > <perl4hire@softouch.on.ca> wrote:
> >
> > [...]
> >
> >> You have it pretty much right. I built a form for a client, who now
> >> wants to take that data and pass it to another server so it can be
> >> used to update a page there. I don't own the receiving code (the SOAP
> >> server?) but the owner suggested SOAP as a means to do this. Hence my
> >> immersion into SOAP.
> >
> > If you have a choice here I would strongly recomend against using
> > SOAP. Almost every implementation of SOAP uses a mutually
> > imcompatable subset of the soap standard. Cross platform soap support
> > is a pain.
> >
>
> You know, I'm sort of finding that out myself. I added a simple twist to
> my 'working' code and it didn't work.
>
> I'm going to investigate alternatives (Mechanize ?) for this little
> project.
But if the other end of the project insists on using SOAP, how will
Mechanize get around that insistence? Have you convinced the other person
to give up on SOAP as well?
I think what you have is fundamentally a political problem (or at least,
that is what it is when I've run into it). The guy on the other end says
SOAP will be "easier". This is true in a sense. By drawing a little box
around his program and declaring everything outside that box to be someone
else's problem, he makes it easier *for him*. If he can get away with
that, then Mechanize isn't going to help you as it can't pierce the box.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: Sat, 25 Aug 2007 13:52:41 -0400
From: Amer Neely <perl4hire@softouch.on.ca>
Subject: Re: Starting with SOAP
Message-Id: <a_Zzi.586$k22.122@read2.cgocable.net>
xhoster@gmail.com wrote:
> Amer Neely <perl4hire@softouch.on.ca> wrote:
>> David Formosa (aka ? the Platypus) wrote:
>>> On Thu, 23 Aug 2007 10:45:44 -0400, Amer Neely
>>> <perl4hire@softouch.on.ca> wrote:
>>>
>>> [...]
>>>
>>>> You have it pretty much right. I built a form for a client, who now
>>>> wants to take that data and pass it to another server so it can be
>>>> used to update a page there. I don't own the receiving code (the SOAP
>>>> server?) but the owner suggested SOAP as a means to do this. Hence my
>>>> immersion into SOAP.
>>> If you have a choice here I would strongly recomend against using
>>> SOAP. Almost every implementation of SOAP uses a mutually
>>> imcompatable subset of the soap standard. Cross platform soap support
>>> is a pain.
>>>
>> You know, I'm sort of finding that out myself. I added a simple twist to
>> my 'working' code and it didn't work.
>>
>> I'm going to investigate alternatives (Mechanize ?) for this little
>> project.
>
> But if the other end of the project insists on using SOAP, how will
> Mechanize get around that insistence? Have you convinced the other person
> to give up on SOAP as well?
>
> I think what you have is fundamentally a political problem (or at least,
> that is what it is when I've run into it). The guy on the other end says
> SOAP will be "easier". This is true in a sense. By drawing a little box
> around his program and declaring everything outside that box to be someone
> else's problem, he makes it easier *for him*. If he can get away with
> that, then Mechanize isn't going to help you as it can't pierce the box.
>
> Xho
>
Yes, I think that is the situation I'm into. I've asked for more
clarification from the other party, I've been operating kind of blind so
far.
--
Amer Neely
w: www.webmechanic.softouch.on.ca/
Perl | MySQL programming for all data entry forms.
"Others make web sites. We make web sites work!"
------------------------------
Date: Sat, 25 Aug 2007 23:04:38 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: UTF-8 problem
Message-Id: <slrnfd16b9.7fo.hjp-usenet2@zeno.hjp.at>
On 2007-08-21 22:23, Todor Vachkov <vachkov@math.tu-berlin.de> wrote:
> Hello all,
>
> I'm trying to convert an exported xml file into a perl data structre with the XML::LibXML modul.
> Thus I got this error message:
>
>>Entity: line 315442: parser error : Input is not proper UTF-8, indicate
>>encoding !
>>Bytes: 0xE2 0x26 0x6C 0x74
>
> I thought the solution would be:
>
>>open(my $fh, "< :encoding(utf8)" ,'/foodir/export.xml');
Don't do this. XML-files contain an indication of their encoding, you
should treat them as binary files
open(my $fh, "< :raw" ,'/foodir/export.xml');
and let the XML parser do the rest.
It that doesn't work, the encoding stored in the file is probably
wrong, either because the generating software was buggy or because
someone already incorrectly converted the file. You may have luck by
fixing the encoding (it should be in the first line which looks like
this:
<?xml version="1.0" encoding="UTF-8" ?>
If the encoding is missing, UTF-8 is assumed).
--
_ | Peter J. Holzer | I know I'd be respectful of a pirate
|_|_) | Sysadmin WSR | with an emu on his shoulder.
| | | hjp@hjp.at |
__/ | http://www.hjp.at/ | -- Sam in "Freefall"
------------------------------
Date: Sun, 26 Aug 2007 00:59:10 +0200
From: Todor Vachkov <vachkov@math.tu-berlin.de>
Subject: Re: UTF-8 problem
Message-Id: <5jbqhtF3t3540U1@mid.dfncis.de>
Peter J. Holzer wrote:
> On 2007-08-21 22:23, Todor Vachkov <vachkov@math.tu-berlin.de> wrote:
>> Hello all,
>>
>> I'm trying to convert an exported xml file into a perl data structre with
>> the XML::LibXML modul. Thus I got this error message:
>>
>>>Entity: line 315442: parser error : Input is not proper UTF-8, indicate
>>>encoding !
>>>Bytes: 0xE2 0x26 0x6C 0x74
>>
>> I thought the solution would be:
>>
>>>open(my $fh, "< :encoding(utf8)" ,'/foodir/export.xml');
>
> Don't do this. XML-files contain an indication of their encoding, you
> should treat them as binary files
>
> open(my $fh, "< :raw" ,'/foodir/export.xml');
>
> and let the XML parser do the rest.
>
> It that doesn't work, the encoding stored in the file is probably
> wrong, either because the generating software was buggy or because
> someone already incorrectly converted the file. You may have luck by
> fixing the encoding (it should be in the first line which looks like
> this:
>
> <?xml version="1.0" encoding="UTF-8" ?>
>
> If the encoding is missing, UTF-8 is assumed).
>
Thanks for your reply Peter!
I'm using now XML::Smart and so I don't have the UTF-8 problem anymore.
The file has the declaration
<?xml version="1.0" encoding="UTF-8" ?>
As I already mentioned, it contains source code from perl scripts and I
found out that some of them are iso-8859-1 encoded. Especially the german "Umlaute" made some trouble as you know;)
Greetings,
Todor
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V11 Issue 795
**************************************