[19125] in Perl-Users-Digest
Perl-Users Digest, Issue: 1320 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jul 17 21:05:45 2001
Date: Tue, 17 Jul 2001 18:05:10 -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: <995418309-v10-i1320@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 17 Jul 2001 Volume: 10 Number: 1320
Today's topics:
Re: about image::Magick quality. <mjcarman@home.com>
Apache::DBI-connections apparently not re-used (Marc Stadelmann)
Re: Array Contents modification? (E.Chang)
Re: chomp <dbe@wgn.net>
Re: extracting a range of lines from a text file <ren@tivoli.com>
FAQ: What is undump? <faq@denver.pm.org>
Re: Hard DBI question (isterin)
How do I get information from a web page (Bubba)
Re: How do I get information from a web page <krahnj@acm.org>
Re: How to determine email quoting & level (Tad McClellan)
Re: How to run Perl on MS-DOS (Tim Hammerquist)
Re: How to run Perl on MS-DOS (Tim Hammerquist)
How to time out on a socket read <svillan@mediaone.net>
Re: Including flock in code while developing in Windows <dbe@wgn.net>
Re: Including flock in code while developing in Windows <jeff@vpservices.com>
Is ActivePerl a good debugger? (Joe Chung)
Re: lib files stopped working <tony_curtis32@yahoo.com>
Need help with array assignment for Bulkmail list (Shiv Kapoor)
Re: Perl or PHP? <mjericho.nospam@gmx.net>
Quota and grace time alexander@newald.de
Re: Replacing a specific line <james@zephyr.org.uk>
Re: Ternary Conditional Operator Question <krahnj@acm.org>
Re: Ternary Conditional Operator Question <ren@tivoli.com>
testing cgi scripts with Indigo Perl and Apache <stephen.p.harris@worldnet.att.net>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 17 Jul 2001 16:49:42 -0500
From: Michael Carman <mjcarman@home.com>
Subject: Re: about image::Magick quality.
Message-Id: <3B54B2F6.1257C3E7@home.com>
stephh wrote:
>
> In article <3B54586F.D8109779@home.com>, Michael Carman
> <mjcarman@home.com> wrote:
>
> > sub mysub {
> > my %args = (
> > foo => 'alpha',
> > bar => 'beta',
> > baz => 42,
> > @_,
> > );
> >
> > print "foo/bar/baz = $arg{foo}/$arg{bar}$arg{baz}\n";
> > }
>
> OK, but I do't get how you pass the values to %args. Can you write
> down the line getting @_ ?
The my %args = (...) *is* the line getting @_. Admittedly, I thought
that this was fiendishly clever the first time I saw it, so I can
understand some initial confusion.
You're probably used to seeing hashes intialized using the "fat comma"
or "comma arrow" syntax. Syntactically, => is just a comma. The only
thing special about it is that it will automatically quote barewords on
the left side. So saying this:
my %args = (foo => 'alpha');
is no different than saying this:
my %args = ('foo', 'alpha');
That right side of the second one looks a lot like a list, doesn't it?
Well, it is. When Perl turns a list into a hash, it turns each pair of
elements (at indices 0/1, 2/3, etc.) into key/value pairs. If you go the
other direction and flatten a hash, Perl will turn each key/value pair
into adjacent array elements.
Once you realize that you can represent a hash with a list, you can also
write the above as:
my @array = ('foo', 'alpha');
my %args = @array;
It looks like it should be a error -- trying to copy an array into a
hash -- but it's not. Perl treats @array as a flattened hash and copies
it into %args as such. This is what we're doing in the sub above, except
that we're also specifying default values for anything that's not given
in the array passed in. The my %args = (...) copies the contents of @_
into the hash as key/value pairs.
Maybe an example will help. Let's say that you call mysub(foo => 'zap').
The first line of the sub will be parsed like this:
my %args = (
foo => 'alpha',
bar => 'beta',
baz => 42,
foo => 'zap', # This is the contents of @_
);
Notice how there are two key/value pairs for foo? The first one is the
default. The second is the one provided in @_. By placing @_ at the end
of the initialization of %args, anything it contains will overwrite the
defaults hard-coded above it.
-mjc
------------------------------
Date: 17 Jul 2001 16:10:33 -0700
From: mst@stamax.ch (Marc Stadelmann)
Subject: Apache::DBI-connections apparently not re-used
Message-Id: <425651d.0107171510.146e7c5f@posting.google.com>
Dear community,
I have installed Apache::DBI and can observe 'new connect's in the
Apache
logfile for every process starting up (PerlChildInitHandler works!).
All those connections show up in MySQL (with 'show processlist') as
well.
So far so good.
But when my CGI-script executes, it does NOT re-use any of those
connections.
The Apache-log is silent, no 'reusing connection' or so, and MySQL
actually
shows a NEW connection-ID for my CGI-script that executes my SQL.
I have searched all of deja-news, but do not find any explanation.
Many thanks for any pointers.
-----------------
perl is 5.005
mod_perl 1.21
Apache::DBI 0.88
My httpd.conf PerlRequire is obviously correct (or else I would not
have
the initial connections)
my script.pl is a 'normal' cgi-bin/script and does work fine, except
that it does not re-use the DB-connections.
------------------------------
Date: Tue, 17 Jul 2001 22:06:55 GMT
From: echang@netstorm.net (E.Chang)
Subject: Re: Array Contents modification?
Message-Id: <Xns90E1B8D06B039echangnetstormnet@207.106.93.86>
"PaAnWa" <paanwa@hotmail.com> wrote in
<tl96rfko6r2658@corp.supernews.com>:
> **sigh**
When you reply to an article, leave the attribution so other readers
know to whom you are responding. And any key text that that clarifies
your point - no need to snip everything. Articles are not a person-to-
person communication, but person-to-group, and not everyone will have
been following the thread.
> Clearly my PERL abilities are FAR below yours.....perhaps this will
> clear things up:
Don't worry, your intent was clear to most of us - to illustrate what
the array elements were. The spaces you chose to use were a better
delimiter than a comma, under the circumstances. If your original list
were assigned to an array variable using the qw operator, the
appropriate one for space-delimited data, there would be no error.
@Booklets = qw("\"AB\"," "\"BC\"," "\"CD\"," "\"DE\"," "\"EF\"");
print "@Booklets";
produces the output "\"AB\"," "\"BC\"," "\"CD\"," "\"DE\"," "\"EF\""
without error.
> @Bklt=();
> if (param('AB') ne "") {@Bklt = (@Bklt,"\"AB\",");}
Have you read the other responses to your question? If the only reason
for adding the escaped quotes and commas is to print into a CSV text
file later, then simply wait until later to add them and just use
@Bklt = (@Bklt,"AB"); Why complicate matters?
> My array contains 5 such elements. I need to know how to later,
> given a particular condition to be true, convert (in this case)
> "\"AB\"," into "AB".
> Is this answerable?
If you really, really insist on it,
foreach (@Booklets) {
$_ = (/\b(.*)\b/)[0];
}
print "@Booklets"; now produces
AB BC CD DE EF
--
EBC
------------------------------
Date: Tue, 17 Jul 2001 17:22:40 -0700
From: "$Bill Luebkert" <dbe@wgn.net>
Subject: Re: chomp
Message-Id: <3B54D6D0.1795F3E2@wgn.net>
derelixir wrote:
>
> Thank you for all the replies but I think most probably the text file
> that I'm reading from
> is not terminated by "\n".
> the chomp works fine and it will print only the "87".
> The problem is I'm not sure which character actually terminates my
> line in this text file (without the "^M"):
>
> A Famosa Golf Resort,,MS,15,30,21,87,16,29,23,87,17,29,21,87,18,27,21,87,19,29,22,87,20,27,22,87
> A Famosa Water World,,MS,15,30,21,87,16,29,23,87,17,29,21,87,18,27,21,87,19,29,22,87,20,28,24,87
> Aachen,,DL,15,19,9,87,16,18,9,87,17,21,14,87,18,18,13,87,19,17,14,82,20,20,15,87
>
> I've already tried - $/="\r\n"; but it doesn't chomp as well.
> Is there a way I could identify what character is actually used to
> terminate line in my text file?
> I'm using UNIX and reading the text file also from UNIX.
Try using 'od -t x1 <filename>' to dump the file and see what is actually there in hex.
--
,-/- __ _ _ $Bill Luebkert ICQ=14439852
(_/ / ) // // DBE Collectibles Mailto:dbe@todbe.com
/ ) /--< o // // http://dbecoll.webjump.com/ (Free site for Perl)
-/-' /___/_<_</_</_ Castle of Medieval Myth & Magic http://www.todbe.com/
------------------------------
Date: 17 Jul 2001 17:22:19 -0500
From: Ren Maddox <ren@tivoli.com>
Subject: Re: extracting a range of lines from a text file
Message-Id: <m3snfvqjqc.fsf@dhcp9-161.support.tivoli.com>
On Tue, 17 Jul 2001, cberry@cinenet.net wrote:
> Ren Maddox (ren@tivoli.com) wrote:
> :
> : perl -ne "print if 300_000 .. 400_000; last if $. == 400_000"
>
> If you're going to do that, it's probably more efficient to avoid
> the range operator and do a simple $. compare:
>
> perl -ne "print if $. >= 300_000; last if $. == 400_000"
True, two compares is better than three. For that matter, one is
better than two for this first part of the file:
perl -ne "next if $. < 300_000; print; last if $. == 400_000"
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: Wed, 18 Jul 2001 00:17:02 GMT
From: PerlFAQ Server <faq@denver.pm.org>
Subject: FAQ: What is undump?
Message-Id: <2A457.1$pQ2.170753024@news.frii.net>
This message is one of several periodic postings to comp.lang.perl.misc
intended to make it easier for perl programmers to find answers to
common questions. The core of this message represents an excerpt
from the documentation provided with every Standard Distribution of
Perl.
+
What is undump?
See the next question on ``How can I make my Perl program run faster?''
-
Documents such as this have been called "Answers to Frequently
Asked Questions" or FAQ for short. They represent an important
part of the Usenet tradition. They serve to reduce the volume of
redundant traffic on a news group by providing quality answers to
questions that keep coming up.
If you are some how irritated by seeing these postings you are free
to ignore them or add the sender to your killfile. If you find
errors or other problems with these postings please send corrections
or comments to the posting email address or to the maintainers as
directed in the perlfaq manual page.
Answers to questions about LOTS of stuff, mostly not related to
Perl, can be found by pointing your news client to
news:news.answers
or to the many thousands of other useful Usenet news groups.
Note that the FAQ text posted by this server may have been modified
from that distributed in the stable Perl release. It may have been
edited to reflect the additions, changes and corrections provided
by respondents, reviewers, and critics to previous postings of
these FAQ. Complete text of these FAQ are available on request.
The perlfaq manual page contains the following copyright notice.
AUTHOR AND COPYRIGHT
Copyright (c) 1997-1999 Tom Christiansen and Nathan
Torkington. All rights reserved.
This posting is provided in the hope that it will be useful but
does not represent a commitment or contract of any kind on the part
of the contributers, authors or their agents.
03.15
--
This space intentionally left blank
------------------------------
Date: 17 Jul 2001 18:03:49 -0700
From: isterin@hotmail.com (isterin)
Subject: Re: Hard DBI question
Message-Id: <db67a7f3.0107171703.438324cf@posting.google.com>
Actually I am not sure what dbi-users you subscribe to, but 99% of the
posts there are on-topic. All OT posts are directed somewhere else.
We have discussed this with the more active users on the list, and
though we used to answer OT questions and then direct them, as many
people in the newsgroups are doing, we no longer do that, but rather
direct them without anwering, since answering and then redirecting
later results in post like this "I know this is OT, but if you could
help....." and so on. You should really sign up again. Very little
OT is going on now.
Ilya
nobull@mail.com wrote in message news:<u9snfwn6ip.fsf@wcl-l.bham.ac.uk>...
> isterin@hotmail.com (isterin) writes:
>
> > Why not post on the dbi-user group list.
>
> I can suggest one possible "why". Because it's even more full of
> off-topic noise than the newsgroups!
>
> I tried subscribing for a week but I found the s:n ratio (c. 1:10)
> unbarable.
>
> Is there any chance that dbi-user could become comp.lang.perl.dbi? At
> least then it would be easy to redirect off-topic threads to a more
> appropriate forum.
------------------------------
Date: 17 Jul 2001 16:24:21 -0700
From: mynewsserver@yahoo.com (Bubba)
Subject: How do I get information from a web page
Message-Id: <eb779695.0107171524.227da747@posting.google.com>
I am looking for a simple perl script that would allow me to get the
contents of a web page and print it to a file. Anyone know if this is
possible?
Thanks in advance
------------------------------
Date: Tue, 17 Jul 2001 23:44:22 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: How do I get information from a web page
Message-Id: <3B54CDD1.A1E06D8C@acm.org>
Bubba wrote:
>
> I am looking for a simple perl script that would allow me to get the
> contents of a web page and print it to a file. Anyone know if this is
> possible?
perl -MLWP::Simple -e'getstore( "http://somewhere.com", "somefile.html"
)'
John
--
use Perl;
program
fulfillment
------------------------------
Date: Tue, 17 Jul 2001 18:57:58 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: How to determine email quoting & level
Message-Id: <slrn9l9gnm.a65.tadmc@tadmc26.august.net>
* Tong * <sun_tong@users.sourceforge.net> wrote:
>I'm trying to use the following RE to identify quote email lines:
I'd do it the way Damian did it:
http://search.cpan.org/doc/DCONWAY/Text-Autoformat-1.04/lib/Text/Autoformat.pm
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 17 Jul 2001 23:11:26 GMT
From: tim@vegeta.ath.cx (Tim Hammerquist)
Subject: Re: How to run Perl on MS-DOS
Message-Id: <slrn9l9i6s.va1.tim@vegeta.ath.cx>
Me parece que Jim Monty <monty@primenet.com> dijo:
> Tim Hammerquist <timmy@cpan.org> wrote:
> > [tim@vegeta ~]$ cd /mnt/c/My\ D<Tab>/LongOne<Tab><CR>
> >
> > bash's autocomplete is so nice when cruising the MS file structure!
>
> Windows NT and 2000 have similar path/file name completion. Set
> the value of the REG_DWORD CompletionChar in the registry key
> HKEY_CURRENT_USER\Software\Microsoft\Command Processor to, say, 9
> (TAB key). This works well for navigating Windows-ish "folders"
> with names containing spaces.
I don't have either NT or 2000, but it still bugs me that everything
seems to require modifying the registry.
Just a personal complaint. =)
--
You are utterly the stupidest, most self-centered, appallingest excuse
for an anthropomorphic personification on this or any other plane!
-- Death, The Sandman
------------------------------
Date: Tue, 17 Jul 2001 23:19:56 GMT
From: tim@vegeta.ath.cx (Tim Hammerquist)
Subject: Re: How to run Perl on MS-DOS
Message-Id: <slrn9l9imp.va1.tim@vegeta.ath.cx>
Me parece que Harri Haataja <harri@haataja.net> dijo:
> Tim Hammerquist wrote:
> >I can sometimes feel my IQ dropping when in COMMAND.COM or CMD.EXE.
> >Does that happen to you too? =)
>
> Well, it's not nearly as embarrassing as when you after a session in
> those brain-fart by typing "dir" into a real shell or such.
Yeah, my linux .bashrc came stock with
alias dir=ls
When I am asked to fix a friends system when their Win9x crashes, I
constantly find myself doing this:
C:\> ls Program\ Files # as if I were cruising FATFS via /mnt/c
Bad command or file name.
C:\> dir "my documents"
C:\> less somefile.txt
Bad command or file name.
C:\> type somefile.txt | more # pray that more is present
I have to buy a US$100 bash environment to be able to consistently use
*nix commands in DOS/Win32.
</gripe> =)
--
You're quite free to convert your strings to byte arrays and do the
entire pattern tree by hand in pure logic code if you'd like. By the
time you finish most of the rest of us will be doing contract work on
Mars.
-- Zenin on comp.lang.perl.misc
------------------------------
Date: Tue, 17 Jul 2001 22:56:01 GMT
From: Sofia Villanueva <svillan@mediaone.net>
Subject: How to time out on a socket read
Message-Id: <3B54C35A.FDF38878@mediaone.net>
Folks:
I followed the advice in the perlipc man page for a timing out a
response using SIG{ALRM} and alarm. Their example works great. The
problem is when I replace the
$input=<>;
with a
$input=<$socket>;
or any of the other reading methods, such as getline, read, recv, etc.
Basically I am attempting to protect reads/writes from timeouts (which I
am taking to be a hangup from the client). I wonder if I am being a bit
more cautious than I need to here.
Server implemented using Net::TCP or IO::Socket::INET. Testing with a
telnet machine port .
Thanks
Joe
email: landman DELETE_THIS at mediaone dot net
------------------------------
Date: Tue, 17 Jul 2001 17:28:37 -0700
From: "$Bill Luebkert" <dbe@wgn.net>
Subject: Re: Including flock in code while developing in Windows for Unix??
Message-Id: <3B54D835.1686461C@wgn.net>
Mark Grimshaw wrote:
>
> Bart Lateur wrote:
> >
> > David Coppit wrote:
> >
> > >Happily Windows can do flock for 5.6.0 versions and better.
> >
> > AFAIK, NT only. It still barfs on Win9x.
> >
> > --
> > Bart.
>
> I've just done the same thing for a friend of mine: writing (on WinNT
> ActiveState) an OOP package that opens/closes and locks database
> files/ancilliary files and passing it on to my friend who uses Win98 -
> eventually it'll all go on UNIX. Hence I needed to test the operating
> system to see whether I can use flock. Given that flock works on
> WinNT/2000 but not Win9x and that $^O reports 'MSWin32' on both, is
> there any way to tell the two apart from within perl?
Try using some of this:
print "Win32::IsWin95(): ", Win32::IsWin95(), "\n";
print "Win32::IsWinNT(): ", Win32::IsWinNT(), "\n";
or
use Win32;
my ($string, $major, $minor, $build, $ID) = Win32::GetOSVersion();
print "string=$string, major=$major, minor=$minor, build=$build, ID=$ID\n";
my $osname = 'Unknown';
if ($ID == 2) {
if ($major == 5) {
$osname = 'Win2K';
} elsif ($major <= 4) {
$osname = 'WinNT';
} else {
$osname = 'Beyond Win2K';
}
} elsif ($ID == 1) {
if ($major > 4 or ($major == 4 and $minor > 0)) {
$osname = 'Win98';
} else {
$osname = 'Win95';
}
} elsif ($ID == 0) {
$osname = 'Win32s';
}
print "OS = '$osname'\n";
--
,-/- __ _ _ $Bill Luebkert ICQ=14439852
(_/ / ) // // DBE Collectibles Mailto:dbe@todbe.com
/ ) /--< o // // http://dbecoll.webjump.com/ (Free site for Perl)
-/-' /___/_<_</_</_ Castle of Medieval Myth & Magic http://www.todbe.com/
------------------------------
Date: Tue, 17 Jul 2001 17:42:33 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Including flock in code while developing in Windows for Unix??
Message-Id: <3B54DB79.9FA8A441@vpservices.com>
Mark Grimshaw wrote:
>
> I've just done the same thing for a friend of mine: writing (on WinNT
> ActiveState) an OOP package that opens/closes and locks database
> files/ancilliary files and passing it on to my friend who uses Win98 -
> eventually it'll all go on UNIX. Hence I needed to test the operating
> system to see whether I can use flock. Given that flock works on
> WinNT/2000 but not Win9x and that $^O reports 'MSWin32' on both, is
> there any way to tell the two apart from within perl?
But if you want to test for flock(), why not test for flock() instead of
testing for the OS? What about other OSs that don't support flock()?
The simplest thing is to do an eval on flock() as I suggested earlier in
this thread. That will give you a HAS_FLOCK constant on all OSs that
support flock() and won't on those that do not support it and you don't
even have to know which is which. Portable code shouldn't be OS
dependendant or need to test for OS. Code that works only on Windows
and *nix is not portable code. (though obviously, it's a good start
:-)).
--
Jeff
------------------------------
Date: Tue, 17 Jul 2001 22:57:21 GMT
From: m_010@yahoo.com (Joe Chung)
Subject: Is ActivePerl a good debugger?
Message-Id: <3b54c0ea.105610078@enews.newsguy.com>
Is ActivePerl a good perl debugger? compare to the standard unix perl
debugger like ptkdb or perl -d
ActivePerl looks more user friendly.
------------------------------
Date: 17 Jul 2001 17:19:29 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: lib files stopped working
Message-Id: <87lmlntczy.fsf@limey.hpcc.uh.edu>
>> On Tue, 17 Jul 2001 21:36:28 GMT,
>> "Geoff Crenshaw" <gbcren@mediaone.net> said:
> I have several scripts which make use of a couple of
> small libraries. They "used" to work just fine, then all
> of a sudden -- WHOMP! Now they don't work at all, I just
> keep getting 500 errors.
500? I take it that is from the HTTP server, which means
this is a stealth CGI question (please try to be explicit
about what you are doing).
> #!/usr/bin/perl
#!/usr/bin/perl -w
use strict;
> require "cooklib.pl";
> require "cartlib.pl";
500 means "internal server error". This usually means
that the server is not able to handle your program as a
CGI execution. For more information, do any or all of:
1. look at the server's error log
2. run the program on the command-line
3. ask in a newsgroup devoted to the web server you are using
4. ask in a newsgroup devoted to CGI (comp.infosystems.www.authoring.cgi)
If you want a wild guess, I would say that when executing
as CGI, your program cannot find these libraries from its
restricted environment and is barfing, thus causing the
web server to barf too.
hth
t
--
Beep beep! Out of my way, I'm a motorist!
------------------------------
Date: 17 Jul 2001 15:30:20 -0700
From: shiv10@yahoo.com (Shiv Kapoor)
Subject: Need help with array assignment for Bulkmail list
Message-Id: <92140d34.0107171430.21ddfb89@posting.google.com>
I am trying to install Mail::Bulkmail on our system. However, I think
I have a problem with the array assignments when I use MAILMERGE
(Bulkmail works fine if I just send an array of email addresses). I
have tried to read the module's documentation many times, but I'm
still stuck. Can anyone please help? My code is found below --
Shiv
---- CODE HERE ---
#!/usr/bin/perl -w
use Mail::Bulkmail;
@record1 = ['email@somewhere.com','101'];
@record2 = ['shiv@somewhere.com','102'];
push (@list,[@record1]);
push (@list,[@record2]);
$ref_array =\@list;
$bulk = Mail::Bulkmail->new(
LIST => $ref_array,
Smtp => 'mail.somewhere.com',
From => 'me@here.com',
Subject => 'This is the third test message!',
Message => 'Here is the text of my message for Id: ID!'
) or die "Cannot create object!";
$bulk->merge({'BULK_MAILMERGE'=>["BULK_EMAIL","ID"]});
$bulk->bulkmail or die "Cannot mail!";
print Mail::Bulkmail->error();
1;
------------------------------
Date: Wed, 18 Jul 2001 09:41:52 +0930
From: "Martin Jericho" <mjericho.nospam@gmx.net>
Subject: Re: Perl or PHP?
Message-Id: <9j2k9j$lu8fg$1@ID-15346.news.dfncis.de>
----- Original Message -----
From: "Chris" <someone@home.com>
Newsgroups: comp.lang.perl.misc
Sent: Wednesday, July 18, 2001 7:23 AM
Subject: Re: Perl or PHP?
> On Wed, 18 Jul 2001 00:08:06 +0930, "Martin Jericho"
> <mjericho.nospam@gmx.net> wrote in comp.lang.perl.misc:
>
> >1. What are the main differences/advantages between perl and PHP? As I
> >understand it, PHP is used inline in HTML and perl is purely a CGI
language.
> >In that case, what is the advantage of perl over PHP?
>
> Web servers can use quite a variety of languages to generate dynamic
> content. In some cases they call an external program and pass connection
> info using a predefined API (CGI) and send the program's output directly
> to the client, while in other cases the interpreter is embedded within the
> server and interprets codes embedded within a prototype HTML document
> (shtml).
>
> PHP is a scripting language that is exclusively (AFAIK) interpreted by the
> web server. It has no other use other than to generate web pages. It
> performs this task well.
It can also be used as a CGI agent or standalone scripting tool.
> Perl is a general-purpose scripting language. It can be launched (CGI) or
> embedded (eperl, mason) to generate web content.
Is this (eperl or mason) as nicely integrated as with PHP?
> Perl can also be used
> without a web server to run batch, text-interactive or GUI programs.
I have also noticed that a first-release adaptation of the GTK+ toolkit (for
writing GUI apps) has been released for PHP. Looks a bit experimental
though. http://gtk.php.net/.
> Perl
> is rapidly replacing bash/sh shell scripts as the main scripting language
> used to maintain Linux computers.
Has something been done about the problem that the perl interpreter is too
"fat"? Is it loaded into common memory now or some other trick?
> Other languages to consider for use on web servers are Python, Ruby and
> Java (for all platforms) and VisualBasic Script (for Microsoft IIS ASP
> pages).
(snip)
The basic thrust of my question was to find out (from a perl advocate's
perception) why PHP was even invented when it seems that they are so
similar, perl can do everything it can, and has been around for so much
longer.
Any comments from someone who knows both?
------------------------------
Date: Wed, 18 Jul 2001 00:09:32 +0200
From: alexander@newald.de
Subject: Quota and grace time
Message-Id: <s2d2j9.cj6.ln@newald.homeip.net>
Hello,
I've got some problems setting the grace time for user quotas with Perl.
I use:
Perl 5.6.0
Quota 1.3.4
I use Quota::setqlim(..,1) and thought it should set the grace time to
7 days but the grace time is set to 1 sec. Giving higher values as 1
results in a grace time of 0 days (edquota -t)
All other functions are working.
Thanks for any hint,
Alexander Newald
--
Alexander Newald alexander@newald.de
Wunstorfer Strasse 72 www.newald.de
Germany - 30453 Hannover
------------------------------
Date: Tue, 17 Jul 2001 23:35:41 +0100
From: James Coupe <james@zephyr.org.uk>
Subject: Re: Replacing a specific line
Message-Id: <wpisXv+92LV7EwJd@gratiano.zephyr.org.uk>
In message <3b54ace7.364814287@news>, mc <nospam@home.com> writes
>> if ($memsettings[($i-1)] != '') {
>> print FILE "$memsettings[($i-1)]\n";
>> } else {
>> print FILE "\n";
>> }
>>
>
>Is this your actual code? You're missing a closing double quote in
>the first line above but I'd think this wouldn't get past the
>compiler.
The first line has two single quotes.
--
James Coupe PGP Key: 0x5D623D5D
EBD690ECD7A1F
She twirled a lock of hair around her forefinger and smiled B457CA213D7E6
faintly. "Actually, I'd settle for a small Greek." 68C3695D623D5D
------------------------------
Date: Tue, 17 Jul 2001 22:49:09 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Ternary Conditional Operator Question
Message-Id: <3B54C12F.8324A4BB@acm.org>
Jonathan Cunningham wrote:
>
> Ok folks.
>
> I'm usually pretty good at figuring this stuff out, but this one is
> really kicking my @$$.
>
> I'm trying to see if $slash =~ m{/} is a match, and then I want to do
> a substitution on $_ depending on the outcome of the match. I've
> tried a million ways to parenthesize, but no luck.
>
> Could someone out there please let me know why this doesn't work:
>
> # @_ == ('d:/some/path');
> # $slash == '';
You've set the value of $slash to the null string so it will never match
m{/}.
> for(@_) {
> $slash =~ m{/} ? s{\\}{/}g : s{/}{\\}g;
This doesn't make much sense. If the string has a slash in it then
change all back-slashes to slashes. However, if the string has _no_
slashes in it then change the slashes (which aren't there) to
back-slashes.
> # This doesn't work either...
> # ($slash =~ m{/}) ? s{\\}{/}g : s{/}{\\}g;
> }
>
> I'm hoping this is going to be a "duh" moment for me.
You think?
John
--
use Perl;
program
fulfillment
------------------------------
Date: 17 Jul 2001 16:19:59 -0500
From: Ren Maddox <ren@tivoli.com>
Subject: Re: Ternary Conditional Operator Question
Message-Id: <m3wv57qmm8.fsf@dhcp9-161.support.tivoli.com>
On 17 Jul 2001, dawfun@seanet.com wrote:
> Ok folks.
>
> I'm usually pretty good at figuring this stuff out, but this one is
> really kicking my @$$.
>
> I'm trying to see if $slash =~ m{/} is a match, and then I want to
> do a substitution on $_ depending on the outcome of the match. I've
> tried a million ways to parenthesize, but no luck.
>
> Could someone out there please let me know why this doesn't work:
>
> # @_ == ('d:/some/path');
> # $slash == '';
>
> for(@_) {
> $slash =~ m{/} ? s{\\}{/}g : s{/}{\\}g;
>
> # This doesn't work either...
> # ($slash =~ m{/}) ? s{\\}{/}g : s{/}{\\}g;
> }
>
> I'm hoping this is going to be a "duh" moment for me.
Seems to work fine for me -- perhaps the problem is actually somewhere
else? You didn't actually say in what way this failed. Can you give
a complete script that demonstrates the problem?
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: Tue, 17 Jul 2001 22:42:42 GMT
From: "Stephen Harris" <stephen.p.harris@worldnet.att.net>
Subject: testing cgi scripts with Indigo Perl and Apache
Message-Id: <Cb357.41317$C81.3457653@bgtnsc04-news.ops.worldnet.att.net>
HI,
I am very new and want to report how well Indigo Perl
works for the benefit of others of my ilk. This program
helps you check by browser to see if your scripts work.
I got one warning message about needing eapi enabled.
So I fixed it by downloading the following file:
"mod_perl-1.25_1.3.20-eapi.tar.gz" from:
ftp://theoryx5.uwinnipeg.ca/pub/ppmpackages/x86/
and used the contained mod_perl.so to replace the
smaller mod_perl.so found in "C:\Indigo Perl\modules"
So it works great! I got the regular Apache installation
to work by using perl.exe in #!/perl/bin/perl.exe rather
than the just #!/perl/bin which I had expected to work.
I used the standalone installation for Windows 98
which is not the default "service" installation.
Network Domain: localhost
Server Name: localhost
Adminstrators email address: you@your.address
(I used admin@mymachinename)
Finally, I made a directory in C:\progra~1\apache~1
\apache called "www" in order to have a place to
store the new scripts. That requires editing the httpd.conf
file and changing both DocumentRoot and <Directory> .
DocumentRoot "C:/progra~1/apache~1/apache/www"
<Directory "C:/progra~1/apache~1/apache/www"
For convenience I used Notepad to make kilapche.bat
"apache -k shutdown" and saved it with apache.exe at:
C:\Program Files\Apache Group\Apache
I opened Windows Explorer and right-clicked on
apache.exe and made a shortcut and drug it to the desktop.
Then right-clicked kilapche.bat and made another shortcut
which I drug to the desktop; to start and stop processes.
The content of this post is meant for other newcomers as
I mentioned in the first line of this post. I think the content
merges over three newsgroups: comp.lang.perl.misc
comp.infosystems.www.authoring.cgi and
comp.infosystems.www.servers.ms-windows (also unix)
and I post to this newsgroup because it was here that I
first looked for information about perl and cgi scripts.
It took me about four hours of reading faqs and old posts
on Google to find out these details. I thought it would be
nice, especially for students, to have the information
gathered in one place and to paraphrase the saying "this is
as good a day to die as any" this is a good a place as any
to summarize my findings. IMHO, you may have your HO.
(straying off topic into the realm of answering questions):
I was a little annoyed to find so many people thinking that
someone had made them god so that other people would
care about their judgments. Newcomers are seldom able
to draw such fine distinctions and the experts who correct
where they ought to post are often in disagreement with the
experts who monitor postings to the newly recommended
"appropriate" newsgroup. Topics are not usually that well-
defined. I got tired of reading usenet cops golden opinions.
Cochise,
Stephen
------------------------------
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 1320
***************************************