[17575] in Perl-Users-Digest
Perl-Users Digest, Issue: 4995 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Nov 30 06:10:36 2000
Date: Thu, 30 Nov 2000 03:10:14 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <975582613-v9-i4995@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 30 Nov 2000 Volume: 9 Number: 4995
Today's topics:
Little code needed - please help! <janekj@online.ee>
Re: Little code needed - please help! (Rafael Garcia-Suarez)
Re: Multi Recipients from email attachment script dtbaker_dejanews@my-deja.com
Re: Multi Recipients from email attachment script (Chris Fedde)
Re: Need a fast $150??? Write (or find) me a couple of (Csaba Raduly)
Re: NOONE know anything at all????(was Re: Help needed <secursrver@hotmail.com>
Re: Palm Doc converter? <secursrver@hotmail.com>
Re: Reading a csv file (furufuru)
Re: Reading a csv file <jeff@vpservices.com>
Re: Reading a csv file (Chris Fedde)
Re: Recursively load all objects in an HTML page... <bart.lateur@skynet.be>
Re: running remote programs / passing information (Chris Fedde)
Re: splitting a string into an array and preserving the <secursrver@hotmail.com>
Re: splitting a string into an array and preserving the <brian+usenet@smithrenaud.com>
Re: Substituting international characters <poec@yahoo.com>
txt files getting denied. <johngros@Spam.bigpond.net.au>
Re: txt files getting denied. <secursrver@hotmail.com>
Re: Why? <roman.stawski@fr.adp.com>
Re: Why? <johngros@Spam.bigpond.net.au>
Re: Why? <secursrver@hotmail.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 30 Nov 2000 09:14:50 +0200
From: "Janka" <janekj@online.ee>
Subject: Little code needed - please help!
Message-Id: <3a25fe20@news.infonet.ee>
Hi!
I am a beginner in the Perl. And that's why my problem
is probably simple for You.
OK. I have to do a little program which runs another
program. Condition is a weekday. Something like this:
if
current weekday is Monday or Friday
run myprog.exe
else
do nothing
That all!
Can anybody help me?
With best regards,
Janek.
------------------------------
Date: Thu, 30 Nov 2000 07:44:44 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: Little code needed - please help!
Message-Id: <slrn92c1cq.dlc.rgarciasuarez@rafael.kazibao.net>
Janka wrote in comp.lang.perl.misc:
> OK. I have to do a little program which runs another
> program. Condition is a weekday. Something like this:
>
> if
> current weekday is Monday or Friday
> run myprog.exe
> else
> do nothing
The localtime function returns an array that contains the weekday :
my $wday = (localtime)[6];
if ($wday == 1 || $wday == 5) {
system("myprog.exe") or die "Can't run myprog.exe: $!\n";
}
--
# Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
------------------------------
Date: Thu, 30 Nov 2000 05:08:43 GMT
From: dtbaker_dejanews@my-deja.com
Subject: Re: Multi Recipients from email attachment script
Message-Id: <904ncp$9mv$1@nnrp1.deja.com>
In article <t2bluebc86n65f@corp.supernews.com>,
S E <denverlynx@hotmail.com> wrote:
> Ok, so now I I have my attachments to my email. I need to figure out
how
> to send it to multiple recipients. I know I can add another 'To:'
line to
> my script to get it to another recipeint but that looks funny on the
email
> with multiple 'To:' lines. Is there a better way to do that?
>
-----------------------
I have found the same problem with MIME::Lite when using the
send('smtp') method. I am assuming it is a bug or limitation of smtp.
The Cc and Bcc do not seem to work.
You can put the whole thing in a loop and feed it one To address at a
time I guess.
I also tried out Net::SMTP and found that you could put in several
addresses in the header, but there was no way to do the Cc and Bcc, and
worse yet, it was a tricky thing to do the encoding for attachments that
MIME::Lite handles for you.
D
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 30 Nov 2000 06:28:42 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: Multi Recipients from email attachment script
Message-Id: <usmV5.19$_g6.189585920@news.frii.net>
In article <904ncp$9mv$1@nnrp1.deja.com>,
<dtbaker_dejanews@my-deja.com> wrote:
>In article <t2bluebc86n65f@corp.supernews.com>,
> S E <denverlynx@hotmail.com> wrote:
>> Ok, so now I I have my attachments to my email. I need to figure out
>how
>> to send it to multiple recipients. I know I can add another 'To:'
>line to
>> my script to get it to another recipeint but that looks funny on the
>email
>> with multiple 'To:' lines. Is there a better way to do that?
>>
>-----------------------
>
>I have found the same problem with MIME::Lite when using the
>send('smtp') method. I am assuming it is a bug or limitation of smtp.
>The Cc and Bcc do not seem to work.
>
>You can put the whole thing in a loop and feed it one To address at a
>time I guess.
>
>I also tried out Net::SMTP and found that you could put in several
>addresses in the header, but there was no way to do the Cc and Bcc, and
>worse yet, it was a tricky thing to do the encoding for attachments that
>MIME::Lite handles for you.
>
You can place multiple recipients into a single To: header by
stringing them up with commas as is described in the manual page.
You may also choose to queue the mail using the Net::SMTP module.
In this way you can address the envelope directly by using the
Net::SMTP::recipient method. Then you can put almost anything you
want into the To: header.
use warnings;
use strict;
use MIME::Lite;
use Net::SMTP;
my $data = <<'eot';
Don,
The quick red fox jumps over the lazy brown dog
The quick red fox jumps over the lazy brown dog
The quick red fox jumps over the lazy brown dog
The quick red fox jumps over the lazy brown dog
The quick red fox jumps over the lazy brown dog
Da' Management
eot
my $msg = MIME::Lite->new(
From =>'Bill Clinton <clinton@whitehouse.gov',
To =>'The Mob',
Subject =>'Helloooooo, nurse!',
Type =>'text/plain',
Data => $data,
);
my $smtp = Net::SMTP->new('localhost');
$smtp->mail('chris@fedde.littleton.co.us');
$smtp->recipient('nosuchuser@some.domain.com');
$smtp->recipient('nosuchuser@another.pm.org');
$smtp->recipient('nosuchuser@anyold.com');
$smtp->recipient('nosuchuser@splat.com');
$smtp->data();
$smtp->datasend($msg->as_string);
$smtp->quit;
--
This space intentionally left blank
------------------------------
Date: Tue, 28 Nov 2000 10:44:47 +0000 (UTC)
From: real.email@signature.this.is.invalid (Csaba Raduly)
Subject: Re: Need a fast $150??? Write (or find) me a couple of scripts and make em' work!
Message-Id: <Xns8FFA62AECquuxi@194.203.134.135>
A million monkeys weren't enough! It took merlyn@stonehenge.com
(Randal L. Schwartz) on 23 Nov 2000 to produce
<m1aeaqwlsn.fsf@halfdome.holdit.com>:
>>>>>> "Al" == Al Rosetti <al@maystreet.com> writes:
[snip]
>
>Al> An invisible counter to be used on multiple pages
>
>What's an invisible counter?
>
[snip]
A counter you didn't put on your page because you know page hit
counters are useless :-)
--
Csaba Raduly, Software Developer (OS/2), Sophos Anti-Virus
mailto:csaba.raduly@sophos.com http://www.sophos.com/
US Support +1 888 SOPHOS 9 UK Support +44 1235 559933
... you'll be the first against -Wall -W -pedantic
------------------------------
Date: Thu, 30 Nov 2000 10:24:59 GMT
From: "Ed Grosvenor" <secursrver@hotmail.com>
Subject: Re: NOONE know anything at all????(was Re: Help needed on win32::tieregistry.
Message-Id: <%VpV5.18056$II2.1785999@newsread2.prod.itd.earthlink.net>
I think you've managed to stump us all. I, like Microsoft, will promise to
get back to you, but again, like Microsoft, I'm not all that reliable, so
don't count on it. But look at the bright side.... At least we're
consistent! Anyway, I've tried a variety of things here to solve your
problem with no luck. I'm fresh out of ideas, but you never know when
lightning might strike. So good luck and if you find the answer, please
post it here. I think the rest of us would love to know.
MikeW <Mikew@here.and.now> wrote in message
news:3A251CD0.F1FB8F01@here.and.now...
>
>
> MikeW wrote:
>
> > Hi.
> > Im trying to write a perl script that will change the cdrom drive
> > letter on a windows 2000 system. Im using win32::tieregistry.
> >
> > The problem I am having is that, although i can change the DATA in the
> > registry string..(HTLM\System\mounted\devices\\dosdevices\d: )
> > denoting current drive letter for cdrom is the D: drive), I cannot
> > work out how to rename the D: in the name to R: (for eg if I want the
> > drive letter to be r:).
> > I also have to change the delimiter because the '\dosdevices\D:' bit
> > is just one single name, so..in my script I use '/' as a registry
> > delimiter, and then reference the string as
> > 'HKLM/system/MountedDevices/\DosDevices\D: (why DID miscrosoft use the
> > '\' as a part of the key name anyway???)
> > Its easy enough manually..you just right click on the key name, select
> > 'rename' and change the d: to an r:..and it works.
> > But using perl I am getting nowhere.
> > anyone any ideas?..or could point me to a suitable win32:tieregistry
> > primer?.(I find the help files that come with perl not very
> > helpfull!.)
> > many thanks
> > Mike Warren.
>
> Noone have any ideas??.
> Even microsoft 'wer'nt sure, and they'd get back to me'...2 weeks ago.
>
> Mike Warren.
>
>
>
------------------------------
Date: Thu, 30 Nov 2000 10:29:20 GMT
From: "Ed Grosvenor" <secursrver@hotmail.com>
Subject: Re: Palm Doc converter?
Message-Id: <4_pV5.18057$II2.1786417@newsread2.prod.itd.earthlink.net>
The closest thing I've seen done is a conversion of text to WML (Wireless
Markup Language) which is neatly interpreted by the palm. WML was created
using XML, so you probably already have everything you need to do this.
Other than that, no clue here.
Phil R Lawrence <prlawrence@lehigh.edu> wrote in message
news:902vf3$jgk@fidoii.CC.Lehigh.EDU...
> Hello, I'm looking for anyone who has implemented a text to palm doc
converter
> with Perl. If there's a module on CPAN I missed it in my search...
>
> Thanks,
> Phil
>
>
------------------------------
Date: Thu, 30 Nov 2000 05:33:15 GMT
From: Ryo Furue (furufuru) <furufuru@ccsr.u-tokyo.ac.jp>
Subject: Re: Reading a csv file
Message-Id: <904oqs$apl$1@nnrp1.deja.com>
In article <slrn925r3t.gbn.tadmc@magna.metronet.com>,
tadmc@metronet.com (Tad McClellan) wrote:
> Chris Darlington <c.darlington@virgin.net> wrote:
>
> >I have a .csv file which takes the following format:
>
> Do you mean "csv" or "CSV"?
>
> Where:
>
> csv: values separated with commas, commas in data
> fields prohibited
>
> CSV: like office tools dump out, with quoted fields
> containing commas/newlines, ...
Hi, this is a bit off-topic (since it doesn't have much
to do with Perl per se), but I want to know more about the
CSV format. I'm writing a Perl script (well, which I hope
makes this post barely relevent to this newsgroup :-)
to create a CSV file that is to be read by MicroSoft Access.
The problem I have is that some of the fields can possibly
contain commans, double-quotes, or newlines, or one or more
of them. How should I "escape" those special characters?
Could someone point me to a reference?
Thank you for your attention,
Ryo
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 29 Nov 2000 21:48:18 -0800
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Reading a csv file
Message-Id: <3A25EA22.F191CBC5@vpservices.com>
"Ryo Furue (furufuru)" wrote:
>
> Hi, this is a bit off-topic (since it doesn't have much
> to do with Perl per se), but I want to know more about the
> CSV format. I'm writing a Perl script (well, which I hope
> makes this post barely relevent to this newsgroup :-)
> to create a CSV file that is to be read by MicroSoft Access.
> The problem I have is that some of the fields can possibly
> contain commans, double-quotes, or newlines, or one or more
> of them. How should I "escape" those special characters?
> Could someone point me to a reference?
perlfaq4 has basic info on CSV. the modules Text::ParseWords,
Text::CSV_XS, DBD::CSV, DBD::RAM and probably some others all read and
write CSV in various ways. If you are using MS Access anyway, then
using one of the existing DBDs would save you alot of trouble in terms
of interfacing with the database. DBD::RAM will let you turn a perl
data structure into a CSV database which you can either query directly
or store as a file and go back and forth between it and an Access or
other database. If all you want is to create a CSV string from an array
of fields, use Text::CSV_XS combine() and string() methods which already
do that in a format that Access can access.
--
Jeff
------------------------------
Date: Thu, 30 Nov 2000 06:41:20 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: Reading a csv file
Message-Id: <kEmV5.20$_g6.170627072@news.frii.net>
In article <i3982t05u9jma1s7579mo48mihqm7iv9cr@4ax.com>,
Bart Lateur <bart.lateur@skynet.be> wrote:
>Jeff Zucker wrote:
>
>An example of a field it doesn't like:
>
> 17" monitor
>
This is an empty argument. A program that generates well formed
CSV files will never create this. It will create "17"" monitor"
or another variant of the escaped quotes pattern.
If your data really does contain such oddities then it is either
parsable using a simple RE, or it will require an unpredictable
number of heuristic clauses that are likely to be brittle.
--
This space intentionally left blank
------------------------------
Date: Thu, 30 Nov 2000 09:46:19 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Recursively load all objects in an HTML page...
Message-Id: <b58c2t466h23a7h135d8n3m91677pf8kf3@4ax.com>
Eli the Bearded wrote:
>$bv has the 'browser version'.
>
> if ($bv =~ /lynx/i) {
> $getframes = 1; # <FRAME>
> $getiframes = 0; # <IFRAME>
> $getlayers = 0; # <LAYER>
> $getembed = 0; # <EMBED>
> $getimages = 0; # <IMG>
> $gettrimages = 0; # background= in <TR>
[etc.]
Oops. Lots of (global) variables. I would tend to stuff this in a hash.
If you do it properly, your program could even be data driven, so that
this hash controls the behaviour of the retrieval tool. I don't know if
it can be done. I'm thinking of something like:
$get{FRAMES}{HREF} = 1;
$get{IMG}{SRC} = 1;
So, per tag (the first key), you get a list of attributes to look out
for (keys of the subhash, if the subhash even exists), and see if you
need to follow it. The way it needs to be followed, depends largely on
the kind of content. That's where I'm not sure I've done the right
thing.
--
Bart.
------------------------------
Date: Thu, 30 Nov 2000 07:04:16 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: running remote programs / passing information
Message-Id: <QZmV5.21$_g6.170607616@news.frii.net>
In article <3A22CC7E.F186F7E@lclcan.com>, Don <don@lclcan.com> wrote:
>This question is probably asked asked every other week. Is there a perl
>discussion group FAQ?
>
>I have a perl script on my web server (external network). I wish to
>have my perl script call a remote program, passing parameters, on
>another server on my internal network. This program may or may not be
>perl. I also want my program on the internal servers to pass
>information back top my perl script.
>
>I know Perl can do this but do not know how. Are there specific modules
>I need to install. What protocol is best used for this?
>
What you are talking about usually comes under the heading of distributed
computing. There are several approaches to solving such problems each
with their own merits. And while Perl can be used to implement distributed
computing systems, Distributed system architecture itself is not a Perl
topic.
Still let me lay one implementation scheme on you. Web enable the whole
thing. Put a webserver on the internal boxen (mini_httpd from acme.com
might be enough) with a group of CGI scripts as wrappers for the
programs you need there. Use LWP to collect the data
and also to push the data to the external server.
Now everything else is a simple matter of requirements. :-)
YMMV
chris
--
This space intentionally left blank
------------------------------
Date: Thu, 30 Nov 2000 10:21:39 GMT
From: "Ed Grosvenor" <secursrver@hotmail.com>
Subject: Re: splitting a string into an array and preserving the "\n"
Message-Id: <TSpV5.18050$II2.1784432@newsread2.prod.itd.earthlink.net>
Herein lies one of the greates problems with this sort of forum. There are
far too many people who get hung up on semantics. Anyone who does not
conform to the contemporary nerd standard is considered a "kiddie". Well,
the fact is that not all of us memorize the RFCs and what's really important
is our ability to communicate. So for those of you who think that su means
superuser and believe that AOL is the Internet, well, you go boys and girls!
The fact is that those who hide behind technical jargon and semantics and
would sooner criticize you for your misuse of the term "online" than answer
your question are usually the least qualified to help you. I guess what it
comes down to is that in this little world where nerds are king, all the
guys who could never get a date in high school finally have just a touch of
power. Don't let it go to your heads. You still can't get a date!
So ask away and those of us with something better to do than argue over
whether you're using an interpreter or compiler will be happy to help you
out. The rest of you can feel free to send me a postcard from the next Star
Trek convention...that is after you finish arguing over whether the
transporter moves matter or energy.
Enough of this rant. I'm going to log off the Internet now and go play in
the real world (you know, the one where FAT means you really need to eat
less). Have a happy day.
Bernie Cosell <bernie@fantasyfarm.com> wrote in message
news:upba2t8l2ka3dhjr6iq2cu4p76c2bro9vj@news.supernews.net...
> tchrist@perl.com (Tom Christiansen) wrote:
>
> } ... There's
> } no reason to kowtow to confusion by the uninformed masses. Instead,
> } inform them. Just blindly putting up with glaring inaccuracies
> } is what gets us bacteerias and noocyular missives. All the world
> } is not Texas, you know.
> }
> } "Online" hardly means "Internet". Bah. Teach the kiddies.
>
> Bah, yourself. I guess that for folks who are inflexible and rooted in
the
> past, English in general and computer-terminology in particular, must
cause
> a lot of problems because it evolves and adapts so much. For some time
> now, the *common* usage of 'online' has meant "connected to the internet"
> with more restrictive meanings [connected to a local net, or connected to
a
> particular server] as being context-dependent subsets --- the general
> unqualified [by context or otherwise] meaning of the term has grown to
> embrace the Internet [as I pointed out: look at IE, with "delete all
> offline content" and other online/offline discriminations; Agent has
> online/offline defaults; you can go visit "The Atlantic (magazine)
Online".
> And most of us dial into "Online Service Providers" and lots of us have
> accounts at "America Online", ICQ finds friends who are "online", etc,
etc,
> etc. But then, I guess all the folk that work at those companies all are
> just "kiddies" and don't know whereof they speak... But wait...
>
> What's funny is that you call anyone who uses the contemporary usage of
> 'online' (including me) a 'kiddie' [actually, in your first post you said
> "script kiddie" which has absolutely no relevance to this etymological
> discussion, unless you don't really know what "script kiddie" means and so
> just picked it as a good, nasty-sounding ad hominem to throw out]... Far
> be it for you to realize and comprehend that some folk may actually
> understand *better* than you the various meanings and nuances of computer
> jargon and that the 'kiddie' is actually *YOU*. A bit of history and
> evolution:
>
> The term online first came into usage not in the distinction between
> online/offline, but rather online versus *batch*. I wonder if there are
> many/any folk here who even know what 'batch processing' is, much less
have
> prepared a deck of cards for an overnight batch run... The word changed
> its meaning a bit in the 70s when workstations became available and the
era
> of the big-iron mainframes began to wane, and so you had the notion of
> "online documentation" [as distinguished from the books on your shelf] and
> other usages of 'online' more in line with what Tom would like the world
to
> be frozen-forever using... Online tended to mean "currently logged into a
> timesharing system" [and "going offline" was pretty much the equivalent of
> "logging off" or "logging out"], and by extension 'online' things were
> facilities and activities you could do "while online"... A clear
evolution
> from the old mainframe online/batch terminology, clearly Tom's usage, and
> it mostly made sense in a non-networked world where "your system" [the one
> you logged into] kind of defined the periphery of what you could access/do
> "while online".
>
> But, mores-the-pity for Tom and other folk stuck in the second-generation
> usage of the term 'online' [NB: *second* generation!], things have
shifted
> again: with the general-availability of the Internet [for some of us it
has
> been a thiry-year trip, but for most the internet only looks like it is
> about seven or eight years old] "online" has mostly taken on a new,
broader
> meaning.
>
> Indeed, we are in a transition period and both meanings have use, in
> context (I doubt that the very-old usage will come into vogue (or even be
> useful) again any time soon.:o)). Overall, the most *common* usage these
> days is "available via the Internet" [or with "online" meaning "connected
> to the internet", both at the user end [your mail client "going online" to
> pick up your email] and the server end ["online services", the
> research-it's "Online dictionaries", etc]].
>
> Of course, on this basis Tom's reply is *STILL* off the mark, since, as
> I've now pointed out twice, the relevant version of perlre is not "locally
> online" [sic :o)] on my system (that's how the inquiry began, right?), and
> so the *ONLY* rational interpretation of online in that context is
> "someplace on the Internet". That it might be "locally online" on *YOUR*
> system is hardly relevant or helpful to me. But then, being helpful was
> clearly not Tom's intent... it appears that being misguidedly and
> erroneously pedantic was the goal, AFAICT.
>
> As a side bar, another part of the evolution of meaning is that its
> spelling is changing. If you look in older references [e.g., the online
> (sic) Merriam-Webster dictionary] you'll see that you are advised that it
> should be hyphenated, "on-line", but OTOH, actual contemporary usage of
the
> term hasn't hyphenated it for some time now and newer references [e.g.,
the
> online (sic again) Random House dictionary and other technical-oriented
> dictionaries] have it just as a plain word 'online'.
>
> Now back to our regularly scheduled discussion of look-behind assertions
in
> this here online (sic :o) forum which I mostly participate in with an
> offline (sic again..:o) news client.
>
> /Bernie\
> --
> Bernie Cosell Fantasy Farm Fibers
> bernie@fantasyfarm.com Pearisburg, VA
> --> Too many people, too few sheep <--
>
------------------------------
Date: Thu, 30 Nov 2000 05:34:57 -0500
From: brian d foy <brian+usenet@smithrenaud.com>
Subject: Re: splitting a string into an array and preserving the "\n"
Message-Id: <brian+usenet-B5CDD6.05345730112000@news.panix.com>
In article <TSpV5.18050$II2.1784432@newsread2.prod.itd.earthlink.net>,
"Ed Grosvenor" <secursrver@hotmail.com> wrote:
> the fact is that not all of us memorize the RFCs
there's no reason to memorize them when they are so easy to find.
--
brian d foy
Perl Mongers <URL:http://www.perl.org>
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
------------------------------
Date: Thu, 30 Nov 2000 05:35:52 GMT
From: "Curtis Poe" <poec@yahoo.com>
Subject: Re: Substituting international characters
Message-Id: <YGlV5.96355$U46.3067716@news1.sttls1.wa.home.com>
I don't think you're going to particularly like this answer, but I think
you'll want to use a hash and a substitute:
my %char = ( 'è' => 'e',
'é' => 'e',
'ê' => 'e',
'ë' => 'e' );
my $test =" è é ê ë ";
$test =~ s/([èéêë])/$char{$1}/g;
print $test;
That prints " e e e e " (without the quotes).
Your tr/// has some problems. One, you don't use [] to specify a character
class and two, you don't use commas. Your translation will turn all of your
square brackets and commas into the appropriate letter.
Cheers,
Curtis
Ilian Bonev <bonev@gmc.ulaval.ca> wrote in message
news:3A25AF2F.1F2A3942@gmc.ulaval.ca...
HI,
Is there a simpler way of performing the following:
$intstring =~ tr/[è,é,ê,ë]/e/;
$intstring =~ tr/[à,á,â,ä,å]/a/;
$intstring =~ tr/[ì,í,î,ï]/i/;
$intstring =~ tr/[ò,ó,ô,õ,ö]/o/;
$intstring =~ tr/[ç]/c/;
$intstring =~ tr/[æ]/ae/;
$intstring =~ tr/[ù,ú,û,ü]/u/;
where $intstring is a string containing international characters.
Thanks in advance.
Ilian
------------------------------
Date: Thu, 30 Nov 2000 07:05:49 GMT
From: "John Boy Walton" <johngros@Spam.bigpond.net.au>
Subject: txt files getting denied.
Message-Id: <h%mV5.11757$GW5.75250@news-server.bigpond.net.au>
I created some text files and ran a script against them and I keep getting
permission denied. Here is the script.
#!e:/millenium programs/perl/bin/perl
use strict;
my $path = "C:/Program Files/G6FTP/";
my $datapath = "C:/Program Files/G6FTP/ftpdatabase/";
my $name = "";
opendir DIR, $datapath;
my $file = $path."Users.ini";
open (USERS, "+>$file");
while ( defined( $name = readdir DIR ) )
{
chomp ($name);
$file = $datapath.$name;
open BOGUS,">>$file" or die "Unopened because $!";
my $pass = <BOGUS>;
$name =~ s/.txt//;
my $value = "[".$name."]\nLogin=".$name."\n"."Pass=".$pass."\n\n";
print USERS $value;
unlink $file;
close BOGUS;
}
closedir DIR;
close USERS;
I have made no permission changes to them yet they stopped being accessible
to my scripts. Does anyone know what I did to trigger this?
------------------------------
Date: Thu, 30 Nov 2000 09:50:21 GMT
From: "Ed Grosvenor" <secursrver@hotmail.com>
Subject: Re: txt files getting denied.
Message-Id: <xppV5.18002$II2.1781708@newsread2.prod.itd.earthlink.net>
In Windows, the easiest way to get a Permission Denied error is to try to
create a file that already exists. It looks like that's what you might be
doing. Try deleting the file c:\Program Files\G6FTP\Users.ini and then
running the program. I'll bet it'll work. See, you're telling it to create
that file with Read/Write access (+>). If that file already exists (and it
probably does), then it won't be able to create it. So if you just want to
open it with write access, use > where you're using +>. Other than that, I
can't think of anything in your script that would cause that error.
Good luck!
John Boy Walton <johngros@Spam.bigpond.net.au> wrote in message
news:h%mV5.11757$GW5.75250@news-server.bigpond.net.au...
> I created some text files and ran a script against them and I keep getting
> permission denied. Here is the script.
> #!e:/millenium programs/perl/bin/perl
> use strict;
> my $path = "C:/Program Files/G6FTP/";
> my $datapath = "C:/Program Files/G6FTP/ftpdatabase/";
> my $name = "";
> opendir DIR, $datapath;
> my $file = $path."Users.ini";
> open (USERS, "+>$file");
> while ( defined( $name = readdir DIR ) )
> {
> chomp ($name);
> $file = $datapath.$name;
> open BOGUS,">>$file" or die "Unopened because $!";
> my $pass = <BOGUS>;
> $name =~ s/.txt//;
> my $value = "[".$name."]\nLogin=".$name."\n"."Pass=".$pass."\n\n";
> print USERS $value;
> unlink $file;
> close BOGUS;
>
> }
> closedir DIR;
> close USERS;
> I have made no permission changes to them yet they stopped being
accessible
> to my scripts. Does anyone know what I did to trigger this?
>
>
>
------------------------------
Date: Thu, 30 Nov 2000 09:58:05 +0100
From: Roman Stawski <roman.stawski@fr.adp.com>
Subject: Re: Why?
Message-Id: <3A26169D.3D52E1F8@fr.adp.com>
Tad McClellan wrote:
>
> Roman Stawski <roman.stawski@fr.adp.com> wrote:
> > while (<BOGUS>) { print $_; }
> >or even
> > print while <BOGUS>;
> >work just as well.
>
> Yes, but what if $_ was already being used for something else?
>
> while ( $line = <BOGUS> )
>
> also works just as well.
Point taken. Nevertheless the construct is still very useful in
short scripts where I do control $_. OK, OK, so I'm lazy!
snip...
> Yes, but there is a case where you are not at the end of file,
> and have not read a "line" (where "\n0" are the last 2 characters
> in the file, or where a one-byte file contains "0").
>
> In that case, you read a "0". Uh oh! That is a false value.
> You drop out of the loop without processing it.
I tried to reproduce the "\n0" condition before responding to the
OP. It still printed out though.
> So you _do_ need to test definedness rather than truth
> (but perl will do it even if you forget).
Ah, it's nice to know that I can rely on perl to cover my
laziness. What were Larry's 3 principal virtues again?
I agree it's best to be explicit (even though I have *very*
rarely seen the 'definedness' explicitly tested in this particular
context). I suppose it depends on whether I'm writing throw-away
code or production code. Problem is, I rarely know up front which
type of code I'm writing!
--
Roman Stawski - ADPgsi
------------------------------
Date: Thu, 30 Nov 2000 09:57:06 GMT
From: "John Boy Walton" <johngros@Spam.bigpond.net.au>
Subject: Re: Why?
Message-Id: <SvpV5.11922$GW5.76703@news-server.bigpond.net.au>
Maybe I should confess I read it here. Someone had posted how to read all
the files in a directory in response to someones query. I pinched it and
modified it to suit my needs. I just opened my file badly. Thank you
Go-Back.
"Roman Stawski" <roman.stawski@fr.adp.com> wrote in message
news:3A26169D.3D52E1F8@fr.adp.com...
> Tad McClellan wrote:
> >
> > Roman Stawski <roman.stawski@fr.adp.com> wrote:
> > > while (<BOGUS>) { print $_; }
> > >or even
> > > print while <BOGUS>;
> > >work just as well.
> >
> > Yes, but what if $_ was already being used for something else?
> >
> > while ( $line = <BOGUS> )
> >
> > also works just as well.
>
> Point taken. Nevertheless the construct is still very useful in
> short scripts where I do control $_. OK, OK, so I'm lazy!
>
> snip...
>
> > Yes, but there is a case where you are not at the end of file,
> > and have not read a "line" (where "\n0" are the last 2 characters
> > in the file, or where a one-byte file contains "0").
> >
> > In that case, you read a "0". Uh oh! That is a false value.
> > You drop out of the loop without processing it.
>
> I tried to reproduce the "\n0" condition before responding to the
> OP. It still printed out though.
>
> > So you _do_ need to test definedness rather than truth
> > (but perl will do it even if you forget).
>
> Ah, it's nice to know that I can rely on perl to cover my
> laziness. What were Larry's 3 principal virtues again?
>
> I agree it's best to be explicit (even though I have *very*
> rarely seen the 'definedness' explicitly tested in this particular
> context). I suppose it depends on whether I'm writing throw-away
> code or production code. Problem is, I rarely know up front which
> type of code I'm writing!
>
> --
> Roman Stawski - ADPgsi
------------------------------
Date: Thu, 30 Nov 2000 10:42:20 GMT
From: "Ed Grosvenor" <secursrver@hotmail.com>
Subject: Re: Why?
Message-Id: <gaqV5.18067$II2.1788036@newsread2.prod.itd.earthlink.net>
I have an idea. For those of you who insist on tearing someone a new
orifice whenever they fail to read the Perl docs, why don't you print up a
copy of the Perl docs and publish a phone number that these poor newbies can
call to get a copy.
First of all, yes, it's all in the documentation, but when it comes down to
it, those docs are not only convoluted and difficult for some to read, but
they're also about as exciting as your great grandmother's denture story
every Thanksgiving. Secondly, I'm pretty sure that in all of the hundreds
of thousands of pages that make up the Perl documentation (official and
unofficial) every one of the questions posted here could be adequetly
answered using the "docs". However, I believe that a good portion of users
of this newsgroup find it easier and more productive to shoot out a quick
question here than pour over hundreds of pages looking for that specific
answer.
So why don't we just all act in the spirit of sharing and, as a community,
stop tearing each other down for asking the "documented" questions.
Remember, there is no such thing as a stupid question. Only stupid
attitudes. So stop with the docs. Yes, it's there. Yes, he could have
looked. But he didn't. He chose to come to you for your vast knowledge and
expertise. He trusts you more than a man page. Feel special. Enjoy that
little ego boost. And get off his butt, will ya?
Have a happy day everyone.
Ren Maddox <ren.maddox@tivoli.com> wrote in message
news:m3d7fe4gzd.fsf@dhcp11-177.support.tivoli.com...
> "John Boy Walton" <johngros@Spam.bigpond.net.au> writes:
>
> > I just remembered when I first wrote the script I opened the file using
open
> > BOGUS,">$file";
> > When I ran the script it gave me an error -> BOGUS only opened for
output.
> > Would this have wiped the contents?
> > I already have the feeling yes, but would like confirmation.
>
> Consider it confirmed. It *will* do that.
>
> --
> Ren Maddox
> ren@tivoli.com
>
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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 V9 Issue 4995
**************************************