[15791] in Perl-Users-Digest
Perl-Users Digest, Issue: 3204 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue May 30 09:10:24 2000
Date: Tue, 30 May 2000 06:10:14 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <959692213-v9-i3204@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 30 May 2000 Volume: 9 Number: 3204
Today's topics:
Re: Perl, system and Cron <e8825393@stud2.tuwien.ac.at>
Re: Perl, system and Cron <claytons@americasm01.nt.com>
Re: Question: Fileupload using cgi-lib.pl (Bart Lateur)
Reading files into a list- faster? <webqueen@my-deja.com>
Re: Reading files into a list- faster? <andkaha@my-deja.com>
Re: scoping trouble with nested structures nobull@mail.com
Re: seeking method to encode email addresses in web pag <thunderbear@bigfoot.com>
Re: Translate foreign characters to English (Lou Hevly)
Re: Translate foreign characters to English (Lou Hevly)
using Test and Test::Harness for unit testing my code? <psrchisholm@my-deja.com>
Re: Weird script behaviour called from a web page. (Thaddeus L. Olczyk)
www.macperl.com seems to be dead. anyone know anything? <nospam@devnull.com>
Re: www.macperl.com seems to be dead. anyone know anyth <webmaster@ostas.lu.se>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 30 May 2000 12:37:34 +0200
From: "e8825393" <e8825393@stud2.tuwien.ac.at>
Subject: Re: Perl, system and Cron
Message-Id: <8h05lf$9p7$1@news.tuwien.ac.at>
thanx john - the problem is, that not I am opening a file but linux does on
entering the quota-command to modify the quota.
And the user-wrights-problem - if the script is started by cron from user
root - does'nt it have the same rights as root ?
<johnqxu@my-deja.com> wrote in message news:8gnev9$8b1$1@nnrp1.deja.com...
> When cron job is set,the current directory is in your root directory.
> Thus, if you open file under current directory and that file is not
> under user root, then this file can not be opened. Try to set a
> directory for you temp file and hope it solve your problem.
>
> However, I have a similar problem and haven't have a solution yet.
> I have a confiuration file which "include" by "require" in my perl file.
> The configuration file is in the same directory with perl program. It
> worked fine. When I set up my cron job, the configuration file just can
> not be found by perl default path. I know if I put all confiuration
> parameters within my perl program, I can solve the problem. But I don't
> want to do so because configuration file has some user ID and password
> as well as some web site related information that I want to make them
> available only to system administrator group. Also, I don't know where
> this probgram will be installed by user so directory to this
> configuration file should be confiurable. So my problem is, how can I
> separate confiuration parameters from perl program and still use cron
> job and don't have to put directory infomation in my perl program?
>
> Anybody has idea how to do that?
>
> In article <B5522D83.4B71%elaine@chaos.wustl.edu>,
> Elaine Ashton <elaine@chaos.wustl.edu> wrote:
> > in article 8ggldf$316$1@news.tuwien.ac.at, e8825393 at
> > e8825393@stud2.tuwien.ac.at quoth:
> > > everything works fine (from commandline), since I try to run the
> script from
> > > Cron, then no changes were made and on trying to debug the script,
> I found
> > > out, that the Temp-File is not opened.
> >
> > Have you tried reading the logs? cron generally logs errors and/or
> sends
> > output to the user via mail. Are you running it as the same user as
> your
> > cron? What are the permissions on the directory where the tmpfile
> should be
> > opened? Have you tried running with -w and possibly Carp?
> >
> > e.
> >
> >
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
------------------------------
Date: Tue, 30 May 2000 07:34:11 -0400
From: Clayton Scott <claytons@americasm01.nt.com>
Subject: Re: Perl, system and Cron
Message-Id: <3933A733.F847625A@americasm01.nt.com>
e8825393 wrote:
>
> thanx john - the problem is, that not I am opening a file but linux does on
> entering the quota-command to modify the quota.
> And the user-wrights-problem - if the script is started by cron from user
> root - does'nt it have the same rights as root ?
Yes, but it doesn't have the same Environment. If your script
relies on any environment variables you'll have to set them from
within your script.
--
Clayton Scott
------------------------------
Date: Tue, 30 May 2000 09:51:10 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Question: Fileupload using cgi-lib.pl
Message-Id: <393386b6.3179223@news.skynet.be>
David Efflandt wrote:
>Maybe the problem you have with 'CGI.pm' is that it is not 'cgi.pm', but
>maybe case doesn't matter on a Windows box.
It does. When doing "use cgi;", the file will be loaded, but the import
step will fail because the package name is "CGI", not "cgi", which is
where "use" will look for it.
--
Bart.
------------------------------
Date: Tue, 30 May 2000 11:55:43 GMT
From: webqueen, queen of the web <webqueen@my-deja.com>
Subject: Reading files into a list- faster?
Message-Id: <8h0a7o$3gh$1@nnrp1.deja.com>
Is it more efficient to read a file into a list then operate on
it, rather than reading it line-by-line?
So is:
@l=<F>;
close F;
foreach (@l) {operate}
faster than
while <F> {operate}
close F;
I usually read into a list since arrays offer advantages as far as
working with them (easy to move forward and backward, to hashify it,
etc) but I also think at least in some implementations it should be
faster since it would seem that @l=<F>; could be done with a block
transfer in an efficient implementation.
Thoughts?
Thanks,
WQ
--
Time is nature's way of preventing everything from happening at once.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 30 May 2000 11:59:55 GMT
From: Andreas Kahari <andkaha@my-deja.com>
Subject: Re: Reading files into a list- faster?
Message-Id: <8h0afj$3hp$1@nnrp1.deja.com>
You could try it with the Benchmark package...
perldoc Benchmark
The first way is bad (relatively speaking) because it will eat more
memory, especially if the file is large.
/A
In article <8h0a7o$3gh$1@nnrp1.deja.com>,
webqueen, queen of the web <webqueen@my-deja.com> wrote:
> Is it more efficient to read a file into a list then operate on
> it, rather than reading it line-by-line?
>
> So is:
> @l=<F>;
> close F;
> foreach (@l) {operate}
>
> faster than
> while <F> {operate}
> close F;
>
> I usually read into a list since arrays offer advantages as far as
> working with them (easy to move forward and backward, to hashify it,
> etc) but I also think at least in some implementations it should be
> faster since it would seem that @l=<F>; could be done with a block
> transfer in an efficient implementation.
>
> Thoughts?
>
> Thanks,
> WQ
>
> --
> Time is nature's way of preventing everything from happening at once.
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>
--
# Andreas Kähäri, <URL:http://hello.to/andkaha/>.
# All junk e-mail is reported to the
# appropriate authorities, no exceptions.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 30 May 2000 12:28:34 +0100
From: nobull@mail.com
Subject: Re: scoping trouble with nested structures
Message-Id: <u9puq45lb1.fsf@wcl-l.bham.ac.uk>
"Mariska" <mariska@excite.nl> writes:
> But i have a foo in a subroutine which i will use in a nested block in the
> same sub.
So no action is required. Inner blocks can access lexically scoped
variables from their enclosing blocks directly.
> And in that case i get a new foo.
Only if you ask for one.
> I know how to pass vars between subs.
> i do it with $new=&sub($foo). But how do i dop this with a if then block?
> $new=if ($foo ne "") {
> do something
> } will not get the results from the code in this block into $new.
You realy appear to be asking two independant questions. One of which
is probably predicated on a misconception.
To use a statement (such as if (EXPR) BLOCK) in an expression context
you wrap it in do{}.
$new= do {
if ($foo ne "") {
# do something
}
}
You can't pass a formal parameter list into a do{} block.
If you really want an inline subroutine with parameters then you can
do that too:
$new= sub {
my ($foo) = @_;
if ($foo ne "") {
# do something that changes $foo
}->($foo)
}
# Original value of $foo back again
However this is probably confusing and you should note that the RHS of
a my() assignment is evaluated using the variable bindings before the
the my().
$new= do {
my $foo = $foo; # Create a copy of $foo
if ($foo ne "") {
# do something that changes $foo
}
}
# Original value of $foo back again
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Tue, 30 May 2000 09:51:05 +0200
From: =?iso-8859-1?Q?Thorbj=F8rn?= Ravn Andersen <thunderbear@bigfoot.com>
Subject: Re: seeking method to encode email addresses in web page forms
Message-Id: <393372E9.A3FD20D3@bigfoot.com>
"Godzilla!" wrote:
> > > year for an exceptionally busy site at
> > > 274 hits per day. In 30 years, a 15 minute
>
> > These guys ship out 40 million ads a day:
>
> > http://valueclick.com/about.html
>
> > Which code do you think they will use?
>
> I believe valueclick has no need to
> mung email addresses as is the topic
> of this thread.
But you don't _know_, do you?
Perhaps something else needs to be munged. Every time. Whatever, I
would consider _THAT_ a fast site. Not a minute 274 hits/day.
> Do you have an example which is actually
> related to this thread's topic? Might
> be better if you start a new thread for
> your off-topic post.
If I needed to encode anything in a websession, I would use a secure
connection. Anything else is just wasting time.
--
Thorbjørn Ravn Andersen "...plus...Tubular Bells!"
http://bigfoot.com/~thunderbear
------------------------------
Date: Tue, 30 May 2000 12:45:50 GMT
From: lou@visca.com (Lou Hevly)
Subject: Re: Translate foreign characters to English
Message-Id: <3933d596.14969140@news.uni-stuttgart.de>
nospam.newton@gmx.li (Philip 'Yes, that's my address' Newton) wrote:
>On Mon, 29 May 2000 09:12:36 GMT, lou@visca.com (Lou Hevly) wrote:
>
>> $ascii =~ s/æ|Æ/ae/g;
>> $ascii =~ s/Á|Â|À|Å|Ã|Ä|á|â|à|å|ã|ä/a/g;
>> $ascii =~ s/Ç|ç/c/g;
>> $ascii =~ s/Ð|ð/d/g;
>> $ascii =~ s/É|Ê|È|Ë|é|ê|è|ë/e/g;
>> $ascii =~ s/Í|Î|Ì|Ï|í|î|ì|ï/i/g;
>[etc.]
>
>Why don't you use character classes?
>
> $ascii =~ s/[ÁÂÀ...ä]/a/g;
>
>and so on.
True. Hadn't thought of it. Thanks for the tip!
--
All the best,
Lou Hevly
lou@visca.com
http://www.visca.com
------------------------------
Date: Tue, 30 May 2000 12:49:23 GMT
From: lou@visca.com (Lou Hevly)
Subject: Re: Translate foreign characters to English
Message-Id: <3933d61d.15104005@news.wanadoo.es>
vek@pharmnl.ohout.pharmapartners.nl (Villy Kruse) wrote:
>On Mon, 29 May 2000 09:12:36 GMT, Lou Hevly <lou@visca.com> wrote:
>
>
>>Here's a subroutine that will do this; it also converts caps to small
>>letters, so you may have to modify it if that isn't what you want:
>>
>
>Depending on the language in question you might need a different
>translation than the one given below
>
>The comon German substitutions are:
>
>ä => ae
>ö => oe
>ü => ue
>ß => ss
>
>For exampel you might see the city name Köln spelled as Koeln
>and München spelled as Muenchen.
Good point. I actually use this sub for Latin languages, but I figured
as long as I was doing it I might as well do it for all the chars up
to 255. My main purpose was to create files names from user input.
--
All the best,
Lou Hevly
lou@visca.com
http://www.visca.com
------------------------------
Date: Tue, 30 May 2000 10:58:52 GMT
From: Paul S R Chisholm <psrchisholm@my-deja.com>
Subject: using Test and Test::Harness for unit testing my code?
Message-Id: <8h06t6$136$1@nnrp1.deja.com>
Are the Test and Test::Harness modules only for testing Perl itself? Or
can I use them to write unit tests for my own code?
I get the general idea of the modules: I build test cases (which
perhaps send output in a particular form to stdout or stderr), and at
some time I call &runtests (?), which executes all my test cases. I
can't get quite enough details out of the module POD files to figure
out more specifics. Am I looking in the wrong place? (Or even barking
up the wrong tree?) --PSRC
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 30 May 2000 08:07:49 GMT
From: olczyk@interaccess.com (Thaddeus L. Olczyk)
Subject: Re: Weird script behaviour called from a web page.
Message-Id: <393475d7.355450093@nntp.interaccess.com>
On Mon, 29 May 2000 09:57:10 +0000, rh@dragon.internal.gxn.net ()
wrote:
>In article <3930fc42.193253765@nntp.interaccess.com>,
> olczyk@interaccess.com (Thaddeus L. Olczyk) writes:
>> System: Linux (Mandrake 7.0)
>> Server:Apache
>[snip]
>>
>> #!/usr/bin/perl
>> system 'perl fullscript2name',@args
>[snip]
>> I've cut and paste the first line from script1 to script2.
>
>I got caught a few times with cut and paste in X11 where 'invisible'
>characters appear or other nonsense happend. Remove the first line,
>"write" it from scratch and try it again.
>
>Hope this helps.
>
>K.
I did more I deleted all but the first line
and then carefully wrote it by hand.
I deleted all the lines and cut and paste the first line from a
working script.
Finally I notice that the non-working script had a (DOS) in the left
side of my emacs status line, and the working scripts did not.
I guess this dos minor mode generates dos style newlines which
are considered junk. I've posted to the emacs group and
asked how to shut off this mode, hopefully that fixes it.
------------------------------
Date: 30 May 2000 12:08:33 GMT
From: The WebDragon <nospam@devnull.com>
Subject: www.macperl.com seems to be dead. anyone know anything?
Message-Id: <8h0b01$a8h$0@216.155.32.164>
subject line says all.
--
send mail to mactech (at) webdragon (dot) net instead of the above address.
this is to prevent spamming. e-mail reply-to's have been altered
to prevent scan software from extracting my address for the purpose
of spamming me, which I hate with a passion bordering on obsession.
------------------------------
Date: Tue, 30 May 2000 14:15:47 +0200
From: Jimmy Lantz <webmaster@ostas.lu.se>
Subject: Re: www.macperl.com seems to be dead. anyone know anything?
Message-Id: <3933B0F3.1A23E842@ostas.lu.se>
I think the server is down, I've tried to access it several times...
/ Jimmy L.
The WebDragon wrote:
>
> subject line says all.
>
> --
> send mail to mactech (at) webdragon (dot) net instead of the above address.
> this is to prevent spamming. e-mail reply-to's have been altered
> to prevent scan software from extracting my address for the purpose
> of spamming me, which I hate with a passion bordering on obsession.
------------------------------
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 3204
**************************************