[6970] in Perl-Users-Digest
Perl-Users Digest, Issue: 595 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jun 10 09:17:12 1997
Date: Tue, 10 Jun 97 06:00:42 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Tue, 10 Jun 1997 Volume: 8 Number: 595
Today's topics:
Berkely DB Files - Apache, Perl and Linux (Mike Sleath)
Re: calling a command or program from Perl? (Abigail)
Re: filehandle/seek/sysread??? (Andrew M. Langmead)
Re: Find and Replace (David Richards)
help (Huanan)
Howto: Read Excel via ODBC <ben-jacob_ron@jpmorgan.com>
Re: Introductory Comparison of Perl and Python (Gary Capell)
Re: Major perl problem (Lack Mr G M)
Re: Missing operator before 0? <c.evans@clear.net.nz>
Re: Netscape .db files (Andrew Henry)
Re: Netscape .db files (Brendan O'Dea)
Re: newbie: flat file tabulating question (Kjetil Skotheim)
OO perl slow? (Peter Lees)
Re: Open and print HTML file insside CGI script (Masked due to spammers)
Re: Parsing Comma Delemited Text DataBase <daveh@dhcs.demon.co.uk>
Re: Perl and Database (Kjetil Skotheim)
Re: PERL sorting algorithm (Kjetil Skotheim)
Re: Printing Prime Numbers (Steffen Beyer)
Problems w/matching a header and printing the following jmack@p3.net
problems with perl5.004 on AIX 3.2.5 <sr@pc-plus.de>
Problems with Win32::ODBC ?! <alz@gse.de>
Reading Excel via ODBC (na)
Re: Suppressing Echo to STDOUT? (Abigail)
where is mistake? <sasha@comac.spb.ru>
Re: where is mistake? (A. Deckers)
Re: Windows 3.1 / Perl 4 or 5 (Petr Prikryl)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 10 Jun 1997 10:44:52 +0100
From: mike@guardian.co.uk (Mike Sleath)
Subject: Berkely DB Files - Apache, Perl and Linux
Message-Id: <mike-1006971044520001@bong.guardian.co.uk>
I am using Apache 1.2 and Linux 2.X (RedHat 4.1). I am attempting to use
Berkeley DB files for authorization, using perl scripts and DB_File to
manage three databases. I also have it locking (well, not locking the
actual database, because that looks awful, but using lock files) so that
there is no simultaneous access. Here's my problem. During testing, when
we are adding to the databases, at some indeterminite time, suddenly one
of the databases will lose 20-70 entries. Another point, one of the other
ones will lose them. Obviously this is not workable for a user database
(I keep losing them!).
I am using three databases for a fairly normal reason, I could change to
two easily (I just didn't think about it at the time) by changing to a
username = password,groups system. But the other database (questionnaire
results) needs to remain separate.
Has anyone else had this experience or is anyone able to help me at all?
I stole a good bit of code from the dbmmanage script which comes with the
Apache support code and am using Perl 5.003.
------------------------------
Date: Tue, 10 Jun 1997 06:41:50 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: calling a command or program from Perl?
Message-Id: <EBJrxq.Kz9@nonexistent.com>
Sasha Titov (sasha@comac.spb.ru) wrote on 1379 September 1993 in
<URL: news:AA7JEdpOb2@comac.spb.ru>:
++ Hi!
++ I've got a programm on Perl (e.g. program_1.pl)
++ I want to call and running a system command or other programm
++ (writing on awk, bash or Perl) from my program_1.pl
++ For example how can I call system command "cp" (copy) or
++ call "program2.pl" from my main "programm1.pl"?
Lookup system(), exec(), open(), and qx() (aka ``) in your
favourite appearance of the manual.
Abigail
--
perl5.004 -wMMath::BigInt -e'$^V=new Math::BigInt+qq;$^F$^W783$[$%9889$^F47$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W98$^F76777$=56;;$^U=$]*(q.25..($^W=@^V))=>do{print+chr$^V%$^U;$^V/=$^U}while$^V!=$^W'
------------------------------
Date: Mon, 9 Jun 1997 13:07:47 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: filehandle/seek/sysread???
Message-Id: <EBIF50.BwC@world.std.com>
nobody@nowhere.com, abuse@aol.com (Masked due to spammers) writes:
>I'm trying to write my own perl script to handle searching a '\n'
>delimited textfile. The database consists of 170,000 records, each
>record is between 9 and 25 fields long. Each field is on it's own
>line in the file, and each record is seperated by a line-character
>(\n).
>With 5,000 records, this is pretty fast, but with 170,000 records it's
>too slow to be useful.
Can you switch from a text file to some sort of database?
If not, can you create a second "index" file that has the offset to
the beginning of each record in your text database? You could read the
index file to find the offset, then seek to that offset in the text
database.
--
Andrew Langmead
------------------------------
Date: 10 Jun 1997 04:39:54 GMT
From: dr@ripco.com (David Richards)
Subject: Re: Find and Replace
Message-Id: <5nilqq$8s$1@gail.ripco.com>
In article <865914830.19266@dejanews.com>, <gannon@hallconsulting.com> wrote:
>I am a non-perl programmer looking for for a script that will search a
>directory (and sub-directories) for a specified text string and replace it
>with another. The script also needs to be able to take wild-cards and to
>remove strings completely (without replacing them with anything). If
>anyone knows of such a script I would be grateful.
>
>I would also be willing to pay someone $25 (negotiable) to create such a
>script. Please reply by email as my usenet access is limited. Thanknyou.
I ran across a program that fits most of your needs in one of these
newsgroups a couple months back- it's called 'treesed' and was written by
Rick Jansen, at http://www.sara.nl/rick/
I'm sure Rick would appreciate any financial reward you might want to give
him for his efforts.
--
David Richards Ripco, since Nineteen-Eighty-Three
My opinions are my own, IRS withstanding Public Access in Chicago
Proud to be the 5,000th least-important Shell/SLIP/PPP/UUCP/ISDN/Leased
usenet-abuser, by the unofficial GSUA. (773) 665-0065 !Free Usenet/E-Mail!
------------------------------
Date: 10 Jun 1997 05:59:05 GMT
From: huanan@bigfoot.com (Huanan)
Subject: help
Message-Id: <huanan-2708561833480001@psymg-148.anu.edu.au>
Where is the best Perl site for beginners?
Thanks in advance.
******************************************************************
Huanan
Email:huanan@bigfoot.com
"I like UNIX as well as Macintosh."
******************************************************************
------------------------------
Date: Mon, 09 Jun 1997 13:00:39 -0400
From: Ron Ben-Jacob <ben-jacob_ron@jpmorgan.com>
Subject: Howto: Read Excel via ODBC
Message-Id: <339C36B7.6928@jpmorgan.com>
Does anybody have an example? I want to read an etire column of a
specific worksheet in a multi-worksheet XL97 using Win32?
Or and OLE sample?
------------------------------
Date: 10 Jun 97 08:33:32 GMT
From: gary@pgrad.cs.su.oz.au (Gary Capell)
Subject: Re: Introductory Comparison of Perl and Python
Message-Id: <gary.865931612@cs.su.oz.au>
Graham Matthews <graham.matthews@maths.anu.edu.au> writes:
>Personally I like 0 based indexing since it allows you to implement
>"circular indices" quite straightforwardly using mod.
Me too :-)
--
http://www.cs.su.oz.au/~gary/
------------------------------
Date: Tue, 10 Jun 1997 13:19:52 BST
From: gml4410@ggr.co.uk (Lack Mr G M)
Subject: Re: Major perl problem
Message-Id: <1997Jun10.131952@ukwit01>
In article <01bc74d5$2c8c9cc0$994837a6@cyriac>, "Negative Creep" <gcyriac@internetMCI.com> writes:
|> I just made a script that opens a file and writes one email to it. Then it
|> redirects the page, everything works fine but it doesn't write to the file.
|> There are no error messages it redirects and everything. Perl should give
|> an error if it can't write to a file.
perl does give an error if it can't write to a file, but your code
doesn't check for any errors!
|> open(FILE,">>/mnt/web/guide/mav/nc/dvdepot/emails.txt");
|> print FILE "$email\n";
|> close(FILE);
|> print "location: http://mav.net/nc/dvdepot/thankyou.html\n\n";
See? No checks here for errors at all. It is your responsibility to
check for them and act in a way that *you* think is appropriate.
|> I didn't use the end/begin script in the real file. The is a legitameant
|> perl script. It should work on any server after naming it .cgi and modding
|> the file to 755. WHAT IS WRONG, I AM SO FRUSTRATED.!
I suggest you do the following:
1) Look at the error logs for your Web server, just in case that shows
anything.
2) Check that the Web server (ie. the id that the server runs under) can
a) See /mnt/web/guide/mav/nc/dvdepot/emails.txt on the system where
the server is running and
b) Has write access to the file.
----------- Gordon Lack ----------------- gml4410@ggr.co.uk ------------
The contents of this message *may* reflect my personal opinion. They are
*not* intended to reflect those of my employer, or anyone else.
------------------------------
Date: 09 Jun 1997 22:53:55 +1200
From: Carey Evans <c.evans@clear.net.nz>
Subject: Re: Missing operator before 0?
Message-Id: <873eqs3v3w.fsf@psyche.evansnet>
Ralf Naegele <naegele@she.de> writes:
> With same perl scripts I get the following message:
>
> Number found where operator expected at (eval 173) line 1, near ") 0"
> (Missing operator before 0?)
This is line 1 (probably the only line) of a string being eval'ed. If
you're not using `eval' in your own script, something you `use' or
`require' must be. It might be the SelfLoader or AutoLoader.
> Line 1 looks like
> #!/usr/bin/perl
-w
Might give you some other helpful warnings.
> After this warning the scripts are running normal.
>
> Any idea what this message means?
For what it means, see perldiag(1).
--
Carey Evans <*> c.evans@clear.net.nz
"Lies, damn lies, and computer documentation."
------------------------------
Date: 10 Jun 1997 10:14:33 +0100
From: ahenry@dircon.co.uk (Andrew Henry)
Subject: Re: Netscape .db files
Message-Id: <5nj5tp$l0o@tdc.dircon.co.uk>
In article <r8td8q28k7d.fsf@trek.cs.princeton.edu>,
Daniel Wang <danwang@trek.CS.Princeton.EDU> wrote:
>
>Anyone know what format the netstape .db files are in? Anyone have a perl
>script that will let me play with them?
http://www.perl.com/CPAN/authors/id/NEILB/Netscape-History-1.002.tar.gz
http://www.perl.com/CPAN/authors/id/SREZIC/Netscape-Cache-0.32.tar.gz
--
Andrew Henry
ahenry@dircon.co.uk
------------------------------
Date: 10 Jun 1997 08:20:46 GMT
From: bod@compusol.com.au (Brendan O'Dea)
Subject: Re: Netscape .db files
Message-Id: <5nj2ou$7qu$1@diablo.compusol.com.au>
In article <5nimra$dpa@fridge-nf0.shore.net>,
Nathan V. Patwardhan <nvp@shore.net> wrote:
>Daniel Wang (danwang@trek.CS.Princeton.EDU) wrote:
>
>: Anyone know what format the netstape .db files are in? Anyone have a perl
>: script that will let me play with them?
>
>I dunno. Berkeley db, maybe?
FWIW, they do appear to be Berkeley hashes:
#!/usr/bin/perl
# Show Netscape history file
use DB_File;
tie %hist, 'DB_File', "$ENV{HOME}/.netscape/history.db", O_RDONLY
or die "Can't open history file";
while (($k, $v) = each %hist)
{
$url = substr $k, 0, -1; # key is null terminated
$date = unpack 'l', $v; # appears to be native time_t
print "$url => " . (localtime $date), "\n";
}
Regards,
--
Brendan O'Dea bod@compusol.com.au
Compusol Pty. Limited (NSW, Australia) +61 2 9809 0133
------------------------------
Date: 10 Jun 1997 12:12:49 GMT
From: kjetil.skotheim@usit.uio.no (Kjetil Skotheim)
Subject: Re: newbie: flat file tabulating question
Message-Id: <5njgc1$kq9$1@ratatosk.uio.no>
In article <5ngtgg$omp@storm.cycor.ca>, cmartin@cycor.ca says...
>
>Hi folks !
>
>I have a web page form that users submit a number of fields (date, name,
>location, problem, comments) to a flat file, separated by "|". I have another
>script which then reads in the file, and prints it in a html table. No
>problem..... However, i would lilke to be able to have another script that
>would read the file and summarize the results. For example, there are about
>10 locations to choose from, and for each location, there are about 10
>problems to choose from. I would like it to do a report such as "for each
>location, there are so many of this problem type reported". The script is to
>do this for all locations, tabulating the number of each problem reported.
>
while(<FILE>){
my($date,$name,$location,$problem,$comment)=split("|");
$num_prob_loc{$location}{$problem}++;
}
for $l (sort keys %num_prob_loc){
print "Location: $l\n";
for(sort keys %{$num_prob_loc{$l}}){
printf("Problem: %-30s Times: %5d\n",
$_,$num_prob_loc{$l}{$_});
}
}
------------------------------
Date: 10 Jun 1997 06:30:17 GMT
From: peter@junior.next.com.au (Peter Lees)
Subject: OO perl slow?
Message-Id: <5nis9p$b02@inferno.mpx.com.au>
Keywords: OO, object oriented, programming method
g'day
i've been writing a few perl programs using fairly strict OO,
and am concerned that they run verrrrry slowly. i've been
doing all the "good" things like using object methods to
get attribute values ( ie $object->variable() rather than just
$object::variable or $object->{'variable'})
has anyone come across similar problems?
can anyone suggest some sources for writing _good_ and _fast_
OO perl? or does anyone have suggestions on best practice?
cheers
p
(emailed copies of responses *greatly* appreciated)
--
Peter Lees (peter@next.com.au) - Technical Manager, Next Online
tel: +61 2 9310 1433 * fax: +61 2 9310 1315 * http://www.next.com.au
"You can have a day off when you're dead, Baldrick, and not before..."
------------------------------
Date: Mon, 09 Jun 1997 00:30:14 GMT
From: nobody@nowhere.com, abuse@aol.com (Masked due to spammers)
Subject: Re: Open and print HTML file insside CGI script
Message-Id: <339b4e54.20493760@nntp.idsonline.com>
abigail@fnx.com (Abigail) Said this:
>Andrew McNaughton (andrew@squiz.co.nz) wrote on 1376 September 1993 in
><URL: news:andrew-0706971855010001@banjo.actrix.gen.nz>:
>++ In article <338d9825.1132556@saluki-news.siu.edu>, ddutta@siu.edu (Deepak
>++ Dutta) wrote:
>++
>++ >for each $filein (@filein) {
>++ > print $filein;
>++ >}
>++
>++ foreach (@filein) {print};
>
>print @filein;
>
>
>
Why even load down your memory by loading it into an array?
open (HTML, "htmlfile.htm");
while (<HTML>)
{
print $_;
}
close (HTML);
------------------------------
Date: Tue, 10 Jun 97 09:37:18 GMT
From: Dave Hodgkinson <daveh@dhcs.demon.co.uk>
Subject: Re: Parsing Comma Delemited Text DataBase
Message-Id: <865935438snz@dhcs.demon.co.uk>
In article <5nfj6o$1ar@panix.com> clay@panix.com "Clay Irving" writes:
>
> I'd be inclined to use the Text::CSV module:
>
OK, I've searched CPAN for this, which points you to
Joseph N Hall, who claims on his home page that the
module is not released yet.
Any offers on where to find it?
TIA,
Dave
--
If you want more sax by Boris Vanderlek press '8' on your CD player.
If you want more sax by Dulfer, press '9'.
If you don't like sax players, press '10' and dance your ass off.
Please, make your choice now.
------------------------------
Date: 10 Jun 1997 12:40:01 GMT
From: kjetil.skotheim@usit.uio.no (Kjetil Skotheim)
Subject: Re: Perl and Database
Message-Id: <5njhv1$lca$2@ratatosk.uio.no>
In article <339BC388.5094@mci2000.com>, howard.yen@mci2000.com says...
>
>I have a 2 part question
>
>1. I need to build a web site that will handle hundreds of thousands
> of users. Which database/interface should I use considering it
> needs to work with Perl on UNIX.
dunno
>
>2. How fast is Perl exactly comparing to C, C++ and Java.
> If someone can scale it from 1 to 10 where 10 being the fastest.
C and C++ are compiled into CPU-code, Perl and Java are compiled
into some virtual CPU(?), software-CPU maybe. So in theory C/C++ is
faster. But in practice I think perl often will be just as fast if
one dont do "wrong" things. Because perl have so much optimized
built-in string handling, hashes and regexps which will be faster
than most people make the effort to implement themselves in C.
Faster programming and running.
Java dont have built-in regexp and hashes as far as I know. Which is
very disapointing.
>
>
>hy
--
ks
------------------------------
Date: 10 Jun 1997 12:52:31 GMT
From: kjetil.skotheim@usit.uio.no (Kjetil Skotheim)
Subject: Re: PERL sorting algorithm
Message-Id: <5njimf$lca$3@ratatosk.uio.no>
In article <339D466E.1770@nortel.ca>, rjdavis@nortel.ca says...
>
>Hi,
> I have a text file containing a list,
> each entry containing a number followed by a letter
> (person's initial) followed by their last name (surname), e.g.:
>
>
> 1 J Bloggs
> 2 C Cat
> 3 D Jones
> 4 P Smith
>
> etc.
>
> I would like to sort this list by last name (surname).
>
> Can people tell me about any sorting algorithms
> that I could use/modify to do this job?
>
> Please reply to me by e-mail as well to the newsgroup.
>Cheers,
>Rob.
open(F,"list");
while(<F>){ chop; push(@list,$_) }
close F;
print
join "\n",
map {$$_[0]}
sort {$$a[1] cmp $$b[1]}
map {[$_,surname($_)]}
@list;
sub surname{$_[0]=~/^\d+\s+\S+\s+(.+)$/;$1;}
See ftp://ftp.sunet.se/pub/lang/perl/CPAN/doc/FMTEYEWTK/sort.html
------------------------------
Date: 10 Jun 1997 07:20:34 GMT
From: sb@en.muc.de (Steffen Beyer)
Subject: Re: Printing Prime Numbers
Message-Id: <5niv82$iem$1@en1.engelschall.com>
Randal Schwartz <merlyn@stonehenge.com> wrote:
> >>>>> "Darryl" == Darryl Caldwell <darrylc@eznet.com> writes:
> Darryl> It took me a night to think about it to get it to work. I'm
> Darryl> curious if there are more efficient approaches. I am really
> Darryl> interested in algorithms -- one of my weaker areas. I wouldn't
> Darryl> have been able to come up with anything on the spot. I would
> Darryl> appreciate any comments. Thanks.
> Well, here's a way that scales nicely as the data size gets larger,
> thanks to some help from string-ish ops:
> my $max = 50000;
> my $primes = "\xff" x $max; # initially, they're all possibly prime
> print "primes:";
> for my $guess (2..$max) {
> next unless vec($primes, $guess - 1, 8);
> print " $guess"; # found one!
> my $mask = ("\xff" x ($guess - 1))."\x00";
> $mask .= $mask while length($mask) < length($primes);
> $primes &= $mask; # remove multiples
> }
> print "\n";
> Took a minute to find primes under 50,000 on my sparc. Scale as
> necessary.
An even faster way is using my "Bit::Vector" module and the "primes.pl"
program that comes along with it.
The algorithm used is known as the "Seave of Erathostenes" and is probably
the same as above, but since the module is entirely written in C (and
linked to Perl via the XS interface) and a lot of thinking has gone into
making it as efficient as possible, it is probably much faster than the
solution above.
You can find this module on my web server
http://www.engelschall.com/u/sb/download/
or on any CPAN ftp server.
If you are interested in more algorithms, see the last issue of Scientific
American (May 1997) for lots of primality tests (Mathematical Recreations,
pages 82-84).
Yours,
--
Steffen Beyer <sb@sdm.de> http://www.engelschall.com/u/sb/
"There is enough for the need of everyone in this world,
but not for the greed of everyone." - Mahatma Gandhi
>> Unsolicited commercial email goes directly to /dev/null <<
------------------------------
Date: Tue, 10 Jun 1997 01:51:20 -0600
From: jmack@p3.net
Subject: Problems w/matching a header and printing the following text
Message-Id: <865925020.25210@dejanews.com>
I have text files I'd like to convert to HTML pages. In this text file
there are multiple headings/sections and a few paragraphs after each
heading. I'm interested in only a few sections in the file and that
sections content, I can chuck all the rest. Example of the text file:
UNIX (section heading)
blah blah blah (text I want to put into HTML page)
DOS (section heading I don't care about)
blah blah blah (text I can bypass)
UNIX
blah blah blah (more text I want to put into HTML)
I've tried variations of the following to match a heading (UNIX in this
case) and grab that sections text, and quit grabbing when a new section
comes up:
while (<>) {
if (/^UNIX/) {
print OUTFILE;
}
}
How do I keep on printing (to a file or an array) after I
match /^UNIX/ and quit printing when I reach the next heading DOS (or any
other heading I don't want).
Thanks for any pointers
John Mack
jmack@p3.net
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: Tue, 10 Jun 1997 09:47:08 +0200
From: Stephen Riehm <sr@pc-plus.de>
Subject: problems with perl5.004 on AIX 3.2.5
Message-Id: <339D067C.167E@pc-plus.de>
Hi,
While running the tests for the perl installation on an AIX 3.2.5
machine, the first test in lib/timelocal fails, perl actually dumps
core! I've tried compiling with perl's malloc, and with AIX's malloc,
but that doesn't seem to solve the problem.
Has anyone else encountered this problem, any workarounds or sollutions?
Thanks in advance,
Steve
// __________________________ ._ o ________________________________
\\\\ Stephen Riehm / //\. Stephen.Riehm@pc-plus.de
//// pc-plus ' \>> | Phone: +49 89 45566 148
\\ 81539 Munich, Germany \\ ` Fax: +49 89 45566 113
------------------------------
Date: Tue, 10 Jun 1997 12:24:56 +0200
From: Alexandre Ziablitsev <alz@gse.de>
Subject: Problems with Win32::ODBC ?!
Message-Id: <339D2B78.CD@gse.de>
Hi!
I am trying to access an Oracle database on the NT 3.51 server from
Win95 through Win32::ODBC and either get a "Runtime exception error:"
or my computer just halt.
What we have is: Oracle 7.3.2.2.1 and the Oracle ODBC driver
version 1.15.3.1.0A
I've tryed also the Intersolv ODBC driver (v.2.11 32-bit Oracle7)-
the same result
Any help would be appreciated. Thank you.
Alex
------------------------------
Date: Mon, 09 Jun 1997 14:24:17 GMT
From: na@na.na (na)
Subject: Reading Excel via ODBC
Message-Id: <339c1102.3147812@news.ny.jpmorgan.com>
Does anybody have a sample to read all cells of a particular column
from one workbook of a multi workbook Excel 97 spreadsheet via
Perl/Win32/ODBC ?
Or maybe via OLE?
Thanks
------------------------------
Date: Tue, 10 Jun 1997 06:39:47 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Suppressing Echo to STDOUT?
Message-Id: <EBJruC.IIs@nonexistent.com>
Eli the Bearded (usenet-tag@qz.little-neck.ny.us) wrote on 1379 September
1993 in <URL: news:5nii9e$nhm$1@news.netusa.net>:
++ Abigail <abigail@fnx.com> wrote:
++
++ > perl5.004 -wMMath::BigInt -e'$=new Math::BigInt+qq;$$783$[$%9889$47$|88768$596577669$%$5$3364$[$$$|838747$[8889739$%$|$673$%$98$76777$=56;;$=$]*(q.25..($=@))=>do{print+chr$%$;$/=$}while$!=$'
++
++ This just prints garbage when I run it.
Odd. I just copied & pasted the text you quoted and it works fine for me.
But you _do_ need 5.004. It will not run in 5.003, and it will not run in
5.005 either. (Well, it will run, but print garbage). Oh, and you do need
a system where the maximum system file descriptor equals 2, but that
seems to be pretty common.
++ And, you do know that <caret><char>
++ works just as well as the real control characters, right? Think about the
++ poor sap trying to read this on his hardcopy device.
No, I didn't know. I'll change the signature tomorrow.
Abigail
--
JAPH under repairs.
------------------------------
Date: 10 Jun 1997 14:46:17 +0400
From: Sasha Titov <sasha@comac.spb.ru>
Subject: where is mistake?
Message-Id: <AA-1Jdp8c2@comac.spb.ru>
My examle is:
"example.cgi"
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "Checking \n";
system("cp /etc/hosts /home/htpd/cgi-bin/hosts.new");
system("cat /etc/hosts");
It works in shell, of course. Then I want this works
as cgi script in Web-server. But when I running it, I see:
"Server Error
The server encountered an internal error or
misconfiguration and was unable to complete your
request.
Please contact the server administrator, root@localhost
and inform them of the time the error occured, and
anything you might have done that may have caused the
error "
What's wrong in my example?
Thanks
Sasha
------------------------------
Date: 10 Jun 1997 11:07:40 GMT
From: deckers@man.ac.uk (A. Deckers)
Subject: Re: where is mistake?
Message-Id: <slrn5pqdbr.j7q.deckers@news.rediris.es>
In <5njc1o$fqq@news-central.tiac.net>,
Mike Stok <mike@stok.co.uk> wrote:
>In article <AA-1Jdp8c2@comac.spb.ru>, Sasha Titov <sasha@comac.spb.ru> wrote:
>>My examle is:
>>"example.cgi"
>>
>>#!/usr/bin/perl
>>print "Content-type: text/html\n\n";
>>print "Checking \n";
>>system("cp /etc/hosts /home/htpd/cgi-bin/hosts.new");
>>system("cat /etc/hosts");
>>
>>It works in shell, of course. Then I want this works
>>as cgi script in Web-server. But when I running it, I see:
>
>One thing you might want to to is set
>
> $| = 1;
That and checking file permissions, which is the classic cause of the
"it works from the shell but not when called from the browser"
syndrome.
Alain
--
Perl information: <URL:http://www.perl.com/perl/>
Perl archive: <URL:http://www.perl.com/CPAN/>
Perl FAQ: <URL:http://www.perl.com/CPAN/doc/FAQs/FAQ/>
>>>>>>>>>>>>> NB: comp.lang.perl.misc is NOT a CGI group <<<<<<<<<<<<<<
------------------------------
Date: 10 Jun 1997 09:41:57 GMT
From: prikryl@dcse.fee.vutbr.cz (Petr Prikryl)
Subject: Re: Windows 3.1 / Perl 4 or 5
Message-Id: <5nj7h5$ihs$1@boco.fee.vutbr.cz>
Zac (cgsystem@dircon.co.uk) wrote:
>I have read a mountain of information regarding Perl but nothing seems
>to address my confusion. I am a 486 / Windows 3.11 user, and have
>never seen a Unix Operating System.
Perl is a programming language which was designed at
Unix platform, but which was also ported to other platforms -- like
to your Windows.
>I understand that I can write a perl script in pure text (in Windows,
>Notepad for example) and upload it to a CGI directory, and it would
>run. Is that correct?
Perl has no direct relation to CGI and vice versa. Perl is
a programming language designed mainly for processing of texts.
CGI (Common Gateway Interface) defines how the WWW server can
launch some external programs for doing some operations asked
by a WWW client.
CGI scripts are basically programs to be launched. They can be
just shell scripts (related namely to the Unix -- they are similar
to DOS batch files in principle), they can be binary programs
(e.g. compiled by C compiler), or they can be any other executable
files. The Perl scripts (i.e. programs) are often used for CGI
programming because Perl is very suitable for crunching the text --
which is typical for CGI scripts.
>Other information (book: "60 Minute Guide to CGI programming with Perl
>5" by Robert Farrell) seems to suggest that Even though I am a windows
>3.11 user, I will still need to download a programme called Perl 5.
>If Perl is a pure text language, why do I need a Programme which I
>presume is a compiler of some sort. If I then find this programme and
>am able to run it on my Windows 3.11 operating system, will it still
>run on my Service Providers Unix Platform.
If you run a WWW server, then it recognizes the subdirectory where
all the CGI scripts are located. The scripts has to be executable,
which means that they have to be executable binary programs or
you have to have an interpreter which do the actions prescribed
in a text file (like shell, Perl, or any other kind of interpreter).
I have no experience with running WWW server under Windows 3.11
(I would never try to do it for performance and other reasons even
if it was possible). Only to make the things clear -- you have
to run WWW server on the same machine where the CGI scripts are
located. Yes, you need a Perl interpreter at the same place because
the Perl scripts must be interpreted. And no, you will not be able
to run your own Perl scripts through WWW unles you ask your provider
to place them in the Unix machine where WWW server sits. The WWW
server is not able to execute any program on your machine.
>Would also be grateful to discover where I might find this programme
>that is able to run on Windows 3.11
I personally use Perl on my (DOS/Windows) computer for other purpose
than for CGI scripts -- just for crunching texts. For that purpose
(and for learning Perl) I am satisfied with Ilya Zakharevich port
of Perl 5. You can find references at
http://www.fee.vutbr.cz/~prikryl/tools.html
You can find there also the description of how to install it under
DOS:
http://www.fee.vutbr.cz/~prikryl/ilya5004.txt
Notice that it has limited functionality because it was designed
for OS/2 and it does not implement all the functions in DOS/Win.
See you,
Petr
--
Petr Prikryl (prikryl@dcse.fee.vutbr.cz) http://www.fee.vutbr.cz/~prikryl/
TU of Brno, Dept. of Computer Sci. & Engineering; tel. +420-(0)5-7275 218
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.misc (and this Digest), send your
article to perl-users@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.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 595
*************************************