[22979] in Perl-Users-Digest
Perl-Users Digest, Issue: 5199 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jul 9 21:17:48 2003
Date: Wed, 9 Jul 2003 18:15:53 -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 Wed, 9 Jul 2003 Volume: 10 Number: 5199
Today's topics:
Re: Help with Perl Script <mbudash@sonic.net>
Re: Help with Perl Script <wsegrave@mindspring.com>
Re: Help with Perl Script <wsegrave@mindspring.com>
Re: Help with Perl Script <yyyy@yyy.com>
Re: Help with Perl Script (Sara)
Re: Help with Perl Script <wsegrave@mindspring.com>
How do I apply the search and replace routine so that i <shotoku.taishi@virgin.net>
Re: How do I apply the search and replace routine so th <emschwar@pobox.com>
Re: How do I apply the search and replace routine so th <glex_nospam@qwest.net>
Re: How do I clone a structure? <abigail@abigail.nl>
Re: How do I clone a structure? <mjcarman@mchsi.com>
Re: How do I clone a structure? <mjcarman@mchsi.com>
Re: How do I clone a structure? <tassilo.parseval@rwth-aachen.de>
Re: how to convert all invalid UTF-8 sequences to numer (Shambo)
Re: how to convert all invalid UTF-8 sequences to numer <emschwar@pobox.com>
Re: how to convert all invalid UTF-8 sequences to numer <flavell@mail.cern.ch>
Re: how to convert all invalid UTF-8 sequences to numer <flavell@mail.cern.ch>
How to do SSL FTP? <b.gaber@pwgsc.gc.ca>
Re: How to do SSL FTP? <glex_nospam@qwest.net>
How to parse html table <servis3@net.hr>
Re: How to parse html table <tim@vegeta.ath.cx>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 08 Jul 2003 17:23:04 GMT
From: Michael Budash <mbudash@sonic.net>
Subject: Re: Help with Perl Script
Message-Id: <mbudash-C8CD62.10230508072003@typhoon.sonic.net>
In article <3f0a8eb6.1296893375@news.cis.dfn.de>,
helgi@decode.is (Helgi Briem) wrote:
> On Mon, 07 Jul 2003 23:30:42 GMT, "Robert" <yyyy@yyy.com> wrote:
>
> >Any help on this would be great since its a free script there is no support.
> >I have a website on a win2k server running MSFP 2002 extensions. The script
> >should create a html file on the fly but it won't. The script is one of
> >those post card scripts that sends an e-mail and a link to the card. All
> >works fine except for the card creation. The e-mail it sends contains a link
> >but when clicked you get the 404 error.
>
> Your veeblefetzer may have developed a winkle
> in its frobnitzer.
uh-oh... here we go again with "Robert"'s (the o.p) snappy comebacks...
sure glad _i_ killfiled him!
--
Michael Budash
------------------------------
Date: Tue, 8 Jul 2003 17:40:13 -0500
From: "William Alexander Segraves" <wsegrave@mindspring.com>
Subject: Re: Help with Perl Script
Message-Id: <befhd9$lg2$1@slb6.atl.mindspring.net>
"Robert" <yyyy@yyy.com> wrote in message
news:ConOa.184174$nr.8348239@twister.southeast.rr.com...
> Any help on this would be great since its a free script there is no
support.
> I have a website on a win2k server running MSFP 2002 extensions. The
script
> should create a html file on the fly but it won't. The script is one of
> those post card scripts that sends an e-mail and a link to the card. All
> works fine except for the card creation. The e-mail it sends contains a
link
> but when clicked you get the 404 error.
> Anybody PLEASE HELP
> Robert
Robert,
One of the reasons you haven't succeeded in finding help is that you've
shown no evidence of what you've tried and what didn't work. I'm providing
information below, which, if accurate for your situation, is information you
could have provided in your first posting, thereby avaoiding a lot of wasted
bandwidth and aggravation.
"Help with Perl Script" and "... but it won't" are not diagnoses that would
get you anywhere, even with a Google or Google Groups search.
I tried a Google Groups search and found a likely candidate for what you're
trying to do, which if I'm correct, is a laudable pursuit.
http://www.falconbrigade.com/card.html
Is that yours?
Having found there (from the source) that card.cgi is the script, I did a
Google search for "perl postcard script card.cgi" and found, among others,
http://bignosebird.com/carchive/cardcgi.shtml
Now, I've looked at the Script and Readme Files' links on the above-cited
page. If "CARD.CGI: A Virtual Greeting Card Server Script" is the script
with which you're having trouble, I'd suggest you read the posting
guidelines first, and then ask questions that are compliant with said
guidelines.
You may wish to pop a nice pill before you ask again. Please keep in mind
that what you write will be inscribed on the Google archives, always ready
to show anyone who inquires about you information you might prefer was not
available.
Good luck with your postcard script.
Cheers.
Bill Segraves
------------------------------
Date: Wed, 9 Jul 2003 01:29:32 -0500
From: "William Alexander Segraves" <wsegrave@mindspring.com>
Subject: Re: Help with Perl Script
Message-Id: <begcrd$ffg$1@slb6.atl.mindspring.net>
"William Alexander Segraves" <wsegrave@mindspring.com> wrote in message
news:befhd9$lg2$1@slb6.atl.mindspring.net...
> "Robert" <yyyy@yyy.com> wrote in message
> news:ConOa.184174$nr.8348239@twister.southeast.rr.com...
> > Any help on this would be great since its a free script there is no
> support.
> > I have a website on a win2k server running MSFP 2002 extensions. The
> script
> > should create a html file on the fly but it won't. The script is one of
> > those post card scripts that sends an e-mail and a link to the card. All
> > works fine except for the card creation. The e-mail it sends contains a
> link
> > but when clicked you get the 404 error.
> > Anybody PLEASE HELP
> > Robert
<snip>
> http://www.falconbrigade.com/card.html
>
> Is that yours?
>
Never mind. The above site likely has the same problem you're having. I
tried the script there, receiving an E-mail with the link
http://falconbrigade.com/cards/jul9-728801936.html
I get "HTTP 404 - File not found", same as you did. This does not
necessarily mean the file is not being generated; but rather it might
indicate the subdirectory "cards" is not in the correct location or does not
have correct permissions, i.e., same as those of the directory that contains
your HTML.
Note that this is not a Perl problem, which might explain why you found
little or no interest here. If you'd like to create a subdirectory "cards"
in the directory that contains your HTML (same directory path as card.html)
and put the above card in it, I'd be glad to check the link from the E-mail
I've already received.
IMO, it's even a stretch to call it a CGI problem. Regardless, I'd suggest
you move this (civil) thread over to comp.infosystems.www.authoring.cgi,
where you'll likely find help with configuring your script.
Cheers!
Bill Segraves
------------------------------
Date: Wed, 09 Jul 2003 10:22:26 GMT
From: "Robert" <yyyy@yyy.com>
Subject: Re: Help with Perl Script
Message-Id: <C1SOa.245695$jp.6831654@twister.southeast.rr.com>
Thanks for the help it does appear to be a permissions issue. And yes that
is my site. You're good.
I'll take this up with my hosting company.
Thanks again
"William Alexander Segraves" <wsegrave@mindspring.com> wrote in message
news:begcrd$ffg$1@slb6.atl.mindspring.net...
> "William Alexander Segraves" <wsegrave@mindspring.com> wrote in message
> news:befhd9$lg2$1@slb6.atl.mindspring.net...
> > "Robert" <yyyy@yyy.com> wrote in message
> > news:ConOa.184174$nr.8348239@twister.southeast.rr.com...
> > > Any help on this would be great since its a free script there is no
> > support.
> > > I have a website on a win2k server running MSFP 2002 extensions. The
> > script
> > > should create a html file on the fly but it won't. The script is one
of
> > > those post card scripts that sends an e-mail and a link to the card.
All
> > > works fine except for the card creation. The e-mail it sends contains
a
> > link
> > > but when clicked you get the 404 error.
> > > Anybody PLEASE HELP
> > > Robert
> <snip>
> > http://www.falconbrigade.com/card.html
> >
> > Is that yours?
> >
>
> Never mind. The above site likely has the same problem you're having. I
> tried the script there, receiving an E-mail with the link
>
> http://falconbrigade.com/cards/jul9-728801936.html
>
> I get "HTTP 404 - File not found", same as you did. This does not
> necessarily mean the file is not being generated; but rather it might
> indicate the subdirectory "cards" is not in the correct location or does
not
> have correct permissions, i.e., same as those of the directory that
contains
> your HTML.
>
> Note that this is not a Perl problem, which might explain why you found
> little or no interest here. If you'd like to create a subdirectory "cards"
> in the directory that contains your HTML (same directory path as
card.html)
> and put the above card in it, I'd be glad to check the link from the
E-mail
> I've already received.
>
> IMO, it's even a stretch to call it a CGI problem. Regardless, I'd suggest
> you move this (civil) thread over to comp.infosystems.www.authoring.cgi,
> where you'll likely find help with configuring your script.
>
> Cheers!
>
> Bill Segraves
>
>
>
>
------------------------------
Date: 9 Jul 2003 05:41:35 -0700
From: genericax@hotmail.com (Sara)
Subject: Re: Help with Perl Script
Message-Id: <776e0325.0307090441.4a85262a@posting.google.com>
.
.
.
(amusing thread removed for brevity)
ch might explain why you found
> little or no interest here. If you'd like to create a subdirectory "cards"
> in the directory that contains your HTML (same directory path as card.html)
> and put the above card in it, I'd be glad to check the link from the E-mail
> I've already received.
>
> IMO, it's even a stretch to call it a CGI problem. Regardless, I'd suggest
> you move this (civil) thread over to comp.infosystems.www.authoring.cgi,
> where you'll likely find help with configuring your script.
>
> Cheers!
>
> Bill Segraves
Hey guys on a related note I have this script that won't work. I don't
have the code for it but I think it's Perl. Can someone tell me how to
fix it?? Oh and you all are a bunch of unhelpful nitwits!
Thanks a lot have a nice day!
*DUCK*
-Gx
------------------------------
Date: Wed, 9 Jul 2003 11:32:53 -0500
From: "William Alexander Segraves" <wsegrave@mindspring.com>
Subject: Re: Help with Perl Script
Message-Id: <behgmv$j2d$1@slb9.atl.mindspring.net>
"Sara" <genericax@hotmail.com> wrote in message
news:776e0325.0307090441.4a85262a@posting.google.com...
<snip>
> Hey guys on a related note I have this script that won't work.
We'd really like to help you, if you would simply provide enough clues for
us to tell what is your real problem.
> I don't
> have the code for it but I think it's Perl.
Hmm. You *have* this script; but you *don't* have the code for it? What
happens when you run
perl -c script.pl
from the command line?
> Can someone tell me how to
> fix it??
Yes, there are many people who can tell you how to fix it. Some of them are
frequent contributors to this newsgroup.
> Oh and you all are a bunch of unhelpful nitwits!
>
Let's see if I understand your logic. You have a problem which you
steadfastly refuse to describe to me. I am not able to glean enough relevant
clues from your posting to improve on your definition of the problem; so I
am an unhelpful nitwit.
Why not jump right to the namecalling? You could save a lot of aggravation
and get yourself killfiled more quickly.
> Thanks a lot have a nice day!
>
You, too.
> *DUCK*
Quack!
------------------------------
Date: Wed, 9 Jul 2003 23:27:07 +0100
From: "Shotoku Taishi" <shotoku.taishi@virgin.net>
Subject: How do I apply the search and replace routine so that it works?
Message-Id: <bei4rs$gh8$1@newsg3.svr.pol.co.uk>
#!/usr/bin/perl-w
$DIR = ".";
$hello = "hello.txt";
open(OUTPUT,">$DIR/$hello") or
die("Can't open $DIR/$hello : $!\n");
my @a = qw(
hello.exp
hallo.exp
Hola.exp
Ciao.exp
);
foreach $a (@a) {
print OUTPUT <<EOT;
file=$a log=$a\.log
EOT
}
The above generates a file hello.txt with the following output:
file=hello.exp log=hello.exp.log
file=hallo.exp log=hallo.exp.log
file=Hola.exp log=Hola.exp.log
file=Ciao.exp log=Ciao.exp.log
but I would like the output to be
file=hello.exp log=hello.log
file=hallo.exp log=hallo.log
file=Hola.exp log=Hola.log
file=Ciao.exp log=Ciao.log
How would I do this using the simple search and replace routine?
I have tried
s/\.exp\./\./g;
but the output does not seem to change.
How do I apply the search and replace routine so that it works?
Thank you in advance.
Michael
------------------------------
Date: 09 Jul 2003 16:47:27 -0600
From: Eric Schwartz <emschwar@pobox.com>
Subject: Re: How do I apply the search and replace routine so that it works?
Message-Id: <etobrw3b9mo.fsf@wormtongue.emschwar>
"Shotoku Taishi" <shotoku.taishi@virgin.net> writes:
> The above generates a file hello.txt with the following output:
<snip>
> file=Ciao.exp log=Ciao.exp.log
>
> but I would like the output to be
<snip>
> file=Ciao.exp log=Ciao.log
>
> How would I do this using the simple search and replace routine?
>
> I have tried
> s/\.exp\./\./g;
> but the output does not seem to change.
That's correct. Your regex says, "find a dot, the letters e, x, p,
and then a dot, and replace it with a dot." Your variable $a doesn't
have a pattern that matches that, so nothing is changed.
> How do I apply the search and replace routine so that it works?
This is a very common problem. So common, that someone has written a
module that does the work for you.
perldoc File::Basename
to find out the details.
-=Eric
--
Come to think of it, there are already a million monkeys on a million
typewriters, and Usenet is NOTHING like Shakespeare.
-- Blair Houghton.
------------------------------
Date: Wed, 09 Jul 2003 17:58:44 -0500
From: "J. Gleixner" <glex_nospam@qwest.net>
Subject: Re: How do I apply the search and replace routine so that it works?
Message-Id: <Y51Pa.65$z21.64151@news.uswest.net>
Shotoku Taishi wrote:
[...]
> foreach $a (@a) {
> print OUTPUT <<EOT;
> file=$a log=$a\.log
> EOT
> }
[...]
> I have tried
> s/\.exp\./\./g;
> but the output does not seem to change.
>
> How do I apply the search and replace routine so that it works?
Need to apply your substitution on something, using =~, otherwise it
only operates on $_.
foreach my $a (@a)
{
my $log = $a;
$log =~ s/\.exp\./\./;
print OUTPUT "file=$a log=$log.log\n";
}
foreach (@a)
{
print OUTPUT "file=$_ ";
s/\.exp\./\./; # $_ is operated on
print OUTPUT "log=$_.log\n";
}
------------------------------
Date: 08 Jul 2003 15:11:27 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: How do I clone a structure?
Message-Id: <slrnbglnov.ei7.abigail@alexandra.abigail.nl>
Bernie Cosell (bernie@fantasyfarm.com) wrote on MMMDXCVIII September
MCMXCIII in <URL:news:3aclgvcsvoumo5o46lp7t7eo7p1fvlqek7@library.airnews.net>:
!! "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de> wrote:
!!
!! } I don't see where Perl data structures are recursive. A recursive data
!! } structure is for instance a linked list as we know it from C. In Perl
!! } structures are usually not recursive but simply nested iteratively
!! } (hash-ref in an array-ref in a hash etc).
!!
!! How about:
!! my %hash;
!! $hash{myself} = \%hash ;
That's cyclic, which is not necessarely the same as recursive.
!! or
!! my (@a, @b) ;
!! $a[0] = \@b ;
!! $b[0] = \@a ;
!!
!! That 'recursion' is actually no different than the way any other language
!! implements and deals with recursive data structures
Oh, sure it is. In Perl, recursive datastructures are either cyclic,
or finite. Some languages (include Perl6 if it ever arrives) allow
for *infinite*, recursive datastructures.
For instance, in languages with lazy evaluation, is often possible
to define something like:
a = [1 : a]
which is a infinite list of ones.
Abigail
--
#!/opt/perl/bin/perl -w
$\ = $"; $; = $$; END {$: and print $:} $SIG {TERM} = sub {$ := $_}; kill 15 =>
fork and ($; == getppid and exit or wait) foreach qw /Just another Perl Hacker/
------------------------------
Date: Tue, 08 Jul 2003 10:17:34 -0500
From: Michael Carman <mjcarman@mchsi.com>
Subject: Re: How do I clone a structure?
Message-Id: <beenag$in51@onews.collins.rockwell.com>
On 7/8/2003 8:34 AM, Greg Bacon wrote:
> In article <bedord$qu9$1@nets3.rz.RWTH-Aachen.DE>,
> Tassilo v. Parseval <tassilo.parseval@post.rwth-aachen.de> wrote:
>
> : the answer to this FAQ says:
> :
> : [...] The Storable module, found on CPAN, provides a function
> : called "dclone" that recursively copies its argument.
> :
> : So there the recursion is clearly targeted towards the implementation.
>
> How so? The FAQ recommends one of the following:
>
> use Data::Dumper;
> print Dumper \%eg_some_hash;
>
> use Storable qw(dclone);
> $r2 = dclone($r1);
>
> There is no recursion at this level, i.e., from the FAQ-asker's
> perspective, and the FAQ-asker doesn't care whether Data::Dumper::Dumper
> and Storable::dclone are recursive or iterative. He just wants to print
> or copy some data structure.
Hmm... maybe. After some thought, I can see both sides of this.
If you think of nested data structures as being "recursive" then the
question should read
"How do I print out or copy a recursive data structure?"
But if you think "I have a complex data struture and want to print it,
but I don't know how. I think I should use recursion," then the question
should read
"How do I recursively print out or copy a data structure?"
In which case you *are* looking for a recursive algorithm. It just
happens that the answer you find is to use a module; the implementation
of which may or may not use the algorithm you were looking for.
Using "recursive" to describe the data structure is almost certainly a
semantic error, but that's not important IMHO. What is important is
figuring out what question the person who needs this answer is likely to
ask.
My vote is for the second phrasing because:
* perldoc -q doesn't much care either way,
* I'm guessing that the second situation is the more likely.
* The wording of the first question could be misleading to a novice
(if they read to much into it).
* The wording of the first question looks wrong to a non-novice.
-mjc
------------------------------
Date: Tue, 08 Jul 2003 10:24:57 -0500
From: Michael Carman <mjcarman@mchsi.com>
Subject: Re: How do I clone a structure?
Message-Id: <beenoa$kvm2@onews.collins.rockwell.com>
On 7/7/2003 6:46 PM, John Brock wrote:
>>>: tadmc@augustmail.com (Tad McClellan) writes:
>>>: >
>>>: > Your Question is Asked Frequently:
>>>: >
>>>: > How do I print out or copy a recursive data structure?
>
> I still think "clone" is the most appropriate term, and I don't
> understand why the FAQ didn't use it. Maybe the FAQ question
> predates the popular use of the word "clone"?
I think it depends on your background. To me, "copy" comes to mind
first. Only after 'perldoc -q copy' came up empty would I think to
search for something like "clone" instead. The word "clone" makes me
think of sheep named "Dolly" and evil twins bent on killing me and
assuming my identity...
I (and othes) have long had the thought bumping around in the back of my
head that the FAQ entries need a meta-keyword section that could provide
alternate search terms. e.g. this question might include "copy,"
"clone," and "nested." Unfortunately, doing this would a helluva lot of
work, due to both the sheer size of the FAQ and the difficulty in coming
up with the right "novice verbage" for search terms.
-mjc
------------------------------
Date: 8 Jul 2003 18:54:09 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: How do I clone a structure?
Message-Id: <bef40h$fkh$1@nets3.rz.RWTH-Aachen.DE>
Also sprach Greg Bacon:
> In article <bedord$qu9$1@nets3.rz.RWTH-Aachen.DE>,
> Tassilo v. Parseval <tassilo.parseval@post.rwth-aachen.de> wrote:
>
>: Also sprach Greg Bacon:
>:
>: > Even the humble array can be viewed as being a recursive data structure,
>: > but the questions elicit very different answers:
>: > [...]
>:
>: @_ is just an array, it's not a recursive data structure. I don't see
>: how it can be viewed as such.
>
> It depends on your perspective. You mentioned C equivalent, but how
> about the O'Caml equivalent, in which a list is recursively defined as
> the first element (the head) followed by the rest of the list (the
> tail)?
Well, ok, in terms of functional languages, most things are recursive
this or that way. I wonder how many Perl programmers think in O'Caml or
Haskell. Functional programmers will also tell you that a for-loop is
much more natural when done recursively while I think it's neither
natural for the machine (who needs a push-down automata to turn this
into iteration) nor for humans (who lack the infrastracture of an
inbuilt frame-stack).
>: Certainly they aren't. If they were, there'd be no point in discussing
>: them. ;-) And indeed, that was my point: if one insists on using the
>: term at all, it should line up with 'print' and not with
>: 'data-structure' for the reasons given above. Btw, the answer to this
>: FAQ says:
>:
>: [...] The Storable module,
>: found on CPAN, provides a function called "dclone" that
>: recursively copies its argument.
>:
>: So there the recursion is clearly targeted towards the implementation.
>
> How so?
It says 'recursively copies'...that already infers an image in my head
of something like
sub walk_array {
print "[\n";
for (@_) {
walk_array(@$_), next if ref($_) eq 'ARRAY';
walk_hash(%$_), next if ref($_) eq 'HASH';
...
print $_, "\n";
}
print "]\n";
}
But as you wrote later: This is of no concern to the FAQ-user.
> If the question should be worded as you suggest, where do these answers
> show how to recursively print or copy data structures?
They'd have to be added. :-) I am not dogmatic on that at all. Perl has
gotten away with this FAQ for a long time and users have probably been
able to live with it. Leaving it as it is does no harm even though I
still think that the wording of the FAQ isn't technically correct in a
strict sense.
Tassilo
--
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval
------------------------------
Date: 9 Jul 2003 13:14:38 -0700
From: shambo_p@yahoo.com (Shambo)
Subject: Re: how to convert all invalid UTF-8 sequences to numeric equivalent?
Message-Id: <72190192.0307091214.25531d60@posting.google.com>
After MUCH self-educating on encoding, XML and good old Perl, I've
gained a lot of ground. Since these XML files will ultimitely be
displayed in a web browser, I realized that ASCII was the best
encoding, and all non-ASCII characters would have to be mapped to
their numeric equivalent.
I did find a module which would do exactly what I was looking for
(more on that below), but could not get it to work properly, so I've
resorted to searching for all non-ASCII characters, and mapping them
myself. Not that hard. Still will try to get those modules working.
"Alan J. Flavell" <flavell@mail.cern.ch> wrote in message
> - convert the data to utf-8 coding before feeding it to the parser,
> since that's evidently what the parser expects by default.
This is where I was getting hung up first, not knowing really what
encoding meant, and completely missing the fact that symbols such as £
can be represented in UTF-8.
> | Unknown open() mode '>:outf8' [...]
>
> Something wrong, see?
Ouch, duh, yes I do see it. Should be "utf8" instead of "outf8".
> Did you ever confirm that you really _are_ using Perl 5.8 ?
Perl 5.8 is in use. All modules are up to date as well.
> I'm confident that Perl already has the mapping table waiting for you
> to use it, if only you'd try to focus in on the issues.
I've found this to be true with the XML::UM module. It will take an
input stream and convert what it can to ASCII. Whatever doesn't
convert to ASCII, it converts to the numeric equivalent, based on the
XML::Encoding maps.
From the XML::UM synopsis:
# Create the encoding routine
my $encode = XML::UM::get_encode (
Encoding => 'US-ASCII',
EncodeUnmapped => \&XML::UM::encode_unmapped_dec);
# Convert a string from UTF-8 to the specified Encoding
my $encoded_str = $encode->($utf8_str);
However, the module seemed to have difficulty finding the paths to the
XML::Encoding maps, even tho I declared it in the script just as the
module instructed. I will continue to troubleshoot that particular
problem.
> You're just not giving us enough concrete detail here to be able to
> advise you with actual code. Can't you put a sample of your input on
> a web page or something, so that we at least know what we're talking
> about?
So the code I've resorted to using looks like:
$string =~ s/\xA3/\£\;/g;
which would convert a £ to its numeric equivalent. This gets past the
parser, and also allows the character to be displayed in a web
browser.
I found a vastly helpful tutorial on encoding within Perl at
http://www.xml.com/pub/a/2000/04/26/encodings/index.html. Along with
exaplaining lots and lots about encoding, and how to encode within
Perl, it highlights modules such as XML::DOM, XML::UM and XML::Code,
all of which seem to be able to do what I (think I) want to do.
From the XML::Code synopsis:
This module is an experimental module, encoding various XML strings
from UTF-8
to ASCII + Unicode entities. Everything that is not pure ASCII (US) is
encoded
as &#<nnn>;
Still trying to get these modules to work, but I at least have a
solution to work with. I do intend to get these modules working.
------------------------------
Date: 09 Jul 2003 14:37:28 -0600
From: Eric Schwartz <emschwar@pobox.com>
Subject: Re: how to convert all invalid UTF-8 sequences to numeric equivalent?
Message-Id: <etoof03bfnb.fsf@wormtongue.emschwar>
shambo_p@yahoo.com (Shambo) writes:
> After MUCH self-educating on encoding, XML and good old Perl, I've
> gained a lot of ground. Since these XML files will ultimitely be
> displayed in a web browser, I realized that ASCII was the best
> encoding, and all non-ASCII characters would have to be mapped to
> their numeric equivalent.
One of the big advantages of XML is that it's completely independant
of display format. Optimising for one presentation format might well
make it more difficult to implement another later on.
Just a thought.
-=Eric
--
Come to think of it, there are already a million monkeys on a million
typewriters, and Usenet is NOTHING like Shakespeare.
-- Blair Houghton.
------------------------------
Date: Wed, 9 Jul 2003 23:08:25 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: how to convert all invalid UTF-8 sequences to numeric equivalent?
Message-Id: <Pine.LNX.4.53.0307092302170.30230@lxplus095.cern.ch>
On Wed, Jul 9, Eric Schwartz inscribed on the eternal scroll:
> shambo_p@yahoo.com (Shambo) writes:
> > After MUCH self-educating on encoding, XML and good old Perl, I've
> > gained a lot of ground. Since these XML files will ultimitely be
> > displayed in a web browser, I realized that ASCII was the best
> > encoding, and all non-ASCII characters would have to be mapped to
> > their numeric equivalent.
This is a total non-sequitur. Web browsers support a whole range of
document codings; while it's certainly a _legal_ option to represent
all characters by means of &-notation (e.g &#number;) using nothing
more interesting than us-ascii, there is surely no _need_ to do so.
Indeed, XML is perfectly happy with utf-8, and so is any halfways
decent current web browser.
> One of the big advantages of XML is that it's completely independant
> of display format. Optimising for one presentation format might well
> make it more difficult to implement another later on.
I've no argument with that, but I don't see what relevance it has to
the above. The hon Usenaut is talking about how individual unicode
characters might be represented in source code, not about any detail
of their visual presentation.
Come to that, neither of the issues are closely on-topic for
comp.lang.perl.misc, so I won't pursue that avenue.
cheers
------------------------------
Date: Wed, 9 Jul 2003 23:25:22 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: how to convert all invalid UTF-8 sequences to numeric equivalent?
Message-Id: <Pine.LNX.4.53.0307092308350.30230@lxplus095.cern.ch>
On Wed, Jul 9, Shambo inscribed on the eternal scroll:
> > You're just not giving us enough concrete detail here to be able to
> > advise you with actual code. Can't you put a sample of your input on
> > a web page or something, so that we at least know what we're talking
> > about?
>
> So the code I've resorted to using looks like:
>
> $string =~ s/\xA3/\£\;/g;
You haven't addressed the question, though. Here you're showing what
you reckon to be part of a solution, but you still haven't shown us
what your input data is like.
Is it encoded in utf-8 ? iso-8859-1 ? (Windows-1252> shudder),
utf-16LE or what?? If you won't show us, and you're not sure
yourself, it's hard to advise.
> I found a vastly helpful tutorial on encoding within Perl at
> http://www.xml.com/pub/a/2000/04/26/encodings/index.html. Along with
> exaplaining lots and lots about encoding, and how to encode within
> Perl,
But that's targetted at Perl 5.6 , where you still had to invoke
the encoding modules explicitly. You're only making things (a bit)
more complicated for yourself by doing that, when with Perl 5.8
you can do it with the i/o encoding layers.
As the article says: both XML and Perl are quite happy to work
with unicode characters. The possible motivation for resorting to
&-notations would be when you have to tangle with non-XML applications
which might not be unicode-capable. If you have such a constraint, I
must admit I don't recall you saying so. And XML-based tools can map
between unicode characters and &-notation for you without fuss, if the
need arises.
> However, the module seemed to have difficulty finding the paths to
> the XML::Encoding maps, even tho I declared it in the script just as
> the module instructed.
I'm not personally famliar with that module, but in the 3-year-old
article that you cited, there's some notes on that very problem, did
you see?
> it highlights modules such as XML::DOM, XML::UM and XML::Code,
> all of which seem to be able to do what I (think I) want to do.
>
> From the XML::Code synopsis:
> This module is an experimental module, encoding various XML strings
> from UTF-8
> to ASCII + Unicode entities. Everything that is not pure ASCII (US) is
> encoded
> as &#<nnn>;
Well, if you're more comfortable with that, and can get it to work,
it's not technically wrong. I just don't think it's the way I'd want
to do it myself, and particularly with the features that 5.8 contains.
But maybe there's still features of your situation that you haven't
shown yet, that makes it a preferable approach for you.
good luck
------------------------------
Date: Wed, 09 Jul 2003 13:51:57 -0400
From: Brian <b.gaber@pwgsc.gc.ca>
Subject: How to do SSL FTP?
Message-Id: <3F0C563C.592682A4@pwgsc.gc.ca>
I am able to use Net::FTP fine. I have new requirements to create
secure FTP using SSL. SSH or SCP is not suitable due to FTP server.
How do I create SSL FTP?
Thanks.
------------------------------
Date: Wed, 09 Jul 2003 15:41:34 -0500
From: "J. Gleixner" <glex_nospam@qwest.net>
Subject: Re: How to do SSL FTP?
Message-Id: <m5%Oa.48$z21.53776@news.uswest.net>
Brian wrote:
> I am able to use Net::FTP fine. I have new requirements to create
> secure FTP using SSL. SSH or SCP is not suitable due to FTP server.
> How do I create SSL FTP?
>
> Thanks.
>
Net::SFTP
------------------------------
Date: Tue, 8 Jul 2003 23:53:22 +0200
From: "petro" <servis3@net.hr>
Subject: How to parse html table
Message-Id: <befeij$k60$1@bagan.srce.hr>
I would like to parse html table retriving table[$row][$column] information.
------------------------------
Date: 8 Jul 2003 17:26:28 -0700
From: Tim Hammerquist <tim@vegeta.ath.cx>
Subject: Re: How to parse html table
Message-Id: <slrnbgmo7k.2ao.tim@vegeta.ath.cx>
petro graced us by uttering:
> I would like to parse html table retriving table[$row][$column]
> information.
[ strongly resisting urge to respond with "And?" ]
Sounds like a simple enough task. What have you tried? Where
have you looked? I'd like to assume you've already searched both
the CPAN and google groups for relevant information, but
somethings telling me not to make that assumption.
Try searching here:
http://search.cpan.org/
http://groups.google.com/
...and if that doesn't help, or you've already done this, try
reposting with more information.
Cheers,
Tim Hammerquist
--
Appreciation is a wonderful thing:
It makes what is excellent in others belong to us as well.
-- Voltaire
------------------------------
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.
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 V10 Issue 5199
***************************************