[11656] in Perl-Users-Digest
Perl-Users Digest, Issue: 5256 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Mar 30 10:14:53 1999
Date: Tue, 30 Mar 99 07:00:26 -0800
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, 30 Mar 1999 Volume: 8 Number: 5256
Today's topics:
Re: 404 Not Found Check?? <debot@xs4all.nl>
catching stdout to an array <phase@lantic.co.za>
Re: catching stdout to an array (Sam Holden)
Re: catching stdout to an array (Tad McClellan)
Change data of file <ex5316@netvigator.com>
Control C's still a problem! <horizon@internetexpress.com.au>
Re: Control C's still a problem! (Bart Lateur)
Re: Control C's still a problem! <Tony.Curtis@vcpc.univie.ac.at>
Re: Control C's still a problem! (Sam Holden)
Re: Control C's still a problem! <fabascal@gredos.cnb.uam.es>
Re: File isn't locked, but Perl says it is? sstarre@my-dejanews.com
File Locking with dbmopen <Colin@Chaplin.sol.co.uk>
Finding the amount of RAM in a remote machine kalikste@uiuc.edu
forms and parameters <"rhrh@hotmail.com,or,rhardicr"@ford.com>
Re: Getting parent process's environment variable to ch <droby@copyright.com>
Guestbook Blank Entry solidice@my-dejanews.com
Re: Identify Drive Letter <Philip.Newton@datenrevision.de>
Internal Timer <alyong@mbox3.singnet.com.sg>
mget & mput ? <tolliver@Snoopy.UCIS.Dal.Ca>
Re: need help in file I/O sstarre@my-dejanews.com
Re: Ok, I got Perl to run but... <dave@mag-sol.com>
Re: OLE automation <camerond@mail.uca.edu>
Re: opinions on buying updated Learning Perl book? (Jim Britain)
Re: opinions on buying updated Learning Perl book? <zenin@bawdycaste.org>
Re: opinions on buying updated Learning Perl book? <jdf@pobox.com>
Re: Password change cgi script (Tom Gerstel)
Re: Password change cgi script (Sam Holden)
Re: Perl/DBI/MS-Access: Problems inserting an integer.. (Jacqui Caren) (Jacqui Caren)
Protecting Scripts from Privacy <mwatkins@promotion4free.com>
Re: Protecting Scripts from Privacy (Sam Holden)
Re: Protecting Scripts from Privacy (Tad McClellan)
Re: PWS, Win95, CGI and Perl (Robzenuk)
strange ERROR mssg <mbakker@atmm.nl>
Re: Use of uninitialized value at ... why? <fabascal@gredos.cnb.uam.es>
Re: Use of uninitialized value at ... why? <Philip.Newton@datenrevision.de>
Win32::FileSecurity (Christopher Spence)
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 30 Mar 1999 13:13:26 +0200
From: Frank de Bot <debot@xs4all.nl>
Subject: Re: 404 Not Found Check??
Message-Id: <3700B1D6.E74A345E@xs4all.nl>
Yup there is. You can download it here:
http://server10.hypermart.net/fscripts/
Steven Bott wrote:
> Is there a simple way with Perl to check whether a file exists at all??
>
> I want to do something like this:
>
> if (I get a 404 Response Header) {
> print "Location: www......\n\n";
> }
>
> or
>
> if (a file exists) {
> print "Location: www......\n\n";
> }
> else {
> print "Location: www......\n\n";
> }
>
> Is something like that possible? If it is, what do I put in the ( )??
>
> Any help would be greatly appreciated!
>
> Thank You,
>
> Steven Bott
> sbott@earthlink.net
--
My Email : debot@xs4all.nl
Homepages : - http://www.debot.nl/ppi/
- More coming up....
------------------------------
Date: Tue, 30 Mar 1999 13:10:32 +0200
From: Phase <phase@lantic.co.za>
Subject: catching stdout to an array
Message-Id: <3700B128.EC353322@lantic.co.za>
greets :))
alrighty...i seriously need help with catching all output from stdout,
using perl, and then storing it to an array, like this:
function traps stdout (all output from stdout goes to an array);
..
another program runs dumping all its output to stdout, and gets piped
into an array OR in as in my case, I'm using the eval() function to
evaluate code input by the user.
..
function restores stdout to normal, so i can dump the newly formatted
output (from the array) to the screen.
the idea is for a kinda cgi script...it takes an html file and parses
for a certain tag. if that tag is found then the code that is contained
in the tag, is executed as perl code. any other text is just dumped to
stdout so the webserver can grab it. the problem is that it reads the
tag, and pushes all output into a buffer. if the perl code in the tag
contains a print function, that is printed immediately (before the
buffer is dumped), instead of at the tag's position.
i know that's kind of a long explanation, but, well, i need an answer
;))
cheers, and thanks in advance...
Jus
------------------------------
Date: 30 Mar 1999 13:49:01 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: catching stdout to an array
Message-Id: <slrn7g1lid.eaa.sholden@pgrad.cs.usyd.edu.au>
On Tue, 30 Mar 1999 13:10:32 +0200, Phase <phase@lantic.co.za> wrote:
>greets :))
>
>alrighty...i seriously need help with catching all output from stdout,
>using perl, and then storing it to an array, like this:
>
>function traps stdout (all output from stdout goes to an array);
>..
>another program runs dumping all its output to stdout, and gets piped
>into an array OR in as in my case, I'm using the eval() function to
>evaluate code input by the user.
>..
>function restores stdout to normal, so i can dump the newly formatted
>output (from the array) to the screen.
If that is all you want then just read the documentation in perlop about
either qx or ``.
If you must do all that junk even though perl has a built in way to do
what you want anyway, then read up on on tieing filehandles in perltie.
>
>the idea is for a kinda cgi script...it takes an html file and parses
>for a certain tag. if that tag is found then the code that is contained
>in the tag, is executed as perl code. any other text is just dumped to
>stdout so the webserver can grab it. the problem is that it reads the
>tag, and pushes all output into a buffer. if the perl code in the tag
>contains a print function, that is printed immediately (before the
>buffer is dumped), instead of at the tag's position.
You could solve the whole problem with a simple $|=1 then...
It would be a good idea to read the documentation and learn some
perl before programming with it.
--
Sam
the Emacs editor is horrible
--Linus Torvalds
------------------------------
Date: Tue, 30 Mar 1999 03:22:41 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: catching stdout to an array
Message-Id: <hk1qd7.v98.ln@magna.metronet.com>
Phase (phase@lantic.co.za) wrote:
: I'm using the eval() function to
: evaluate code input by the user.
: ...
: the idea is for a kinda cgi script...it takes an html file and parses
: for a certain tag. if that tag is found then the code that is contained
: in the tag, is executed as perl code.
So you are either:
1) likely to attract the attention of the Bad Guys
(i.e. doing that is a serious potential security problem)
or
2) you are using taint checking to protect your system
Right?
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 30 Mar 1999 22:22:54 +0800
From: Alex <ex5316@netvigator.com>
Subject: Change data of file
Message-Id: <3700DE3D.60DB0D6E@netvigator.com>
Hi,
I've a question.
After I open the file, then change the data. How can I save the new data
to the file ?
Thank you
Alex
------------------------------
Date: Tue, 30 Mar 1999 21:51:18 +1000
From: Mick <horizon@internetexpress.com.au>
Subject: Control C's still a problem!
Message-Id: <3700BAB6.C41798C0@internetexpress.com.au>
Hi...
I cannot seem to catch a ^C (control c), while my program is executing.
As you can see (From the code), I've read the FAQ on it, but can't get
it to work!
What I wanted to do was, while waiting for user input from STDIN, if a
control-C or control-Z is pressed, this is ignored, so the user cannot
exit from the program.
Code simplified -
#Get all signal names
use Config;
defined $Config{sig_name} || die "No sigs?";
foreach $name (split(' ', $Config{sig_name})) {
$signo{$name} = $i;
$signame[$i] = $name;
$i++;
}
print STDOUT "Please enter text: ";
while($month=<STDIN>){
$SIG{INT} = \&catch_zap;
}
sub catch_zap {
my $signame = shift;
$shucks++;
die "Somebody sent me a SIG$signame";
}
Thanks for any replies!
Mick
--
------------------------------
Date: Tue, 30 Mar 1999 12:09:13 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Control C's still a problem!
Message-Id: <3700bc7e.11030422@news.skynet.be>
Mick wrote:
>I cannot seem to catch a ^C (control c), while my program is executing.
>As you can see (From the code), I've read the FAQ on it, but can't get
>it to work!
>What I wanted to do was, while waiting for user input from STDIN, if a
>control-C or control-Z is pressed, this is ignored, so the user cannot
>exit from the program.
Well I've modified your code a little. This is the WHOLE program:
print STDOUT "Please enter text: ";
$SIG{INT} = \&catch_zap;
while(<STDIN>){
print;
}
print "Done.\n";
print "$shucks zaps caught.\n" if $shucks;
sub catch_zap {
my $signame = shift;
$shucks++;
warn "Somebody sent me a SIG$signame";
# not "die"!
}
The result I get is that if the user presses ctrl-C (or ctrl-<break>),
and THEN <enter>, I get a nice message: "Somebody sent me a SIGINT".
Yours did that too, but the die() caused the program to quit.
And second: pressing ctrl-Z is not a signal. It simply flags a EOF to
your main loop (the condition for while()), so the program terminates
normally.
Bart.
------------------------------
Date: 30 Mar 1999 14:22:09 +0200
From: Tony Curtis <Tony.Curtis@vcpc.univie.ac.at>
Subject: Re: Control C's still a problem!
Message-Id: <834sn3i2vi.fsf@vcpc.univie.ac.at>
Re: Control C's still a problem!, Bart
<bart.lateur@skynet.be> said:
Bart> And second: pressing ctrl-Z is not a
Bart> signal. It simply flags a EOF to your main
Really? It cranks out a SIGTSTP for me...
Bart> loop (the condition for while()), so the
Bart> program terminates normally.
That's C-d for me. Depends on terminal settings and
which type of system you're using.
hth
tony
--
Tony Curtis, Systems Manager, VCPC, | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien. | <URI:http://www.vcpc.univie.ac.at/>
"You see? You see? Your stupid minds! | private email:
Stupid! Stupid!" ~ Eros, Plan9 fOS.| <URI:mailto:tony_curtis32@hotmail.com>
------------------------------
Date: 30 Mar 1999 13:52:54 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Control C's still a problem!
Message-Id: <slrn7g1lpm.eaa.sholden@pgrad.cs.usyd.edu.au>
On Tue, 30 Mar 1999 12:09:13 GMT, Bart Lateur <bart.lateur@skynet.be> wrote:
>Mick wrote:
>
>And second: pressing ctrl-Z is not a signal. It simply flags a EOF to
>your main loop (the condition for while()), so the program terminates
>normally.
Sends a STOP signal in my shell.
--
Sam
Basically, avoid comments. If your code needs a comment to be
understood, it would be better to rewrite it so it's easier to
understand. --Rob Pike
------------------------------
Date: Tue, 30 Mar 1999 15:01:41 +0100
From: Federico Abascal <fabascal@gredos.cnb.uam.es>
Subject: Re: Control C's still a problem!
Message-Id: <3700D945.233DF5A5@gredos.cnb.uam.es>
Mick wrote:
> Hi...
> I cannot seem to catch a ^C (control c), while my program is executing.
I don't know if it's right but is how I do, and it works. Here is the
code:
$SIG{'INT'}='myEND';
sub myEND { exit -1; }
sub END {
print "\nProgram by Fulanito\n";
}
So, I END is called both when the program terminates or when the user
press Control+C (exit calls END)
Federico.
------------------------------
Date: Tue, 30 Mar 1999 12:11:49 GMT
From: sstarre@my-dejanews.com
Subject: Re: File isn't locked, but Perl says it is?
Message-Id: <7dqf20$a22$1@nnrp1.dejanews.com>
Yes, pmessage::SayError displays an HTML Error message and exits. Most vexing
isn't it? I'm thinking of trying FILE:: locking instead as flock doesn't seem
to work as advertized. The file being locked is local on a unix system.
Thanks for the inquiry.
In article <1dpe2wt.ezwnsrkq04ajN@p125.tc3.state.ma.tiac.com>,
rjk@linguist.dartmouth.edu (Ronald J Kimball) wrote:
> <sstarre@my-dejanews.com> wrote:
>
> > User 1 locks the file, copies it to a temp file minus his record, then
copies
> > it back..
> >
> > User 2 gets a message that says "you cant lock this file".
> >
> > Instead, some concurrent update takes place that clobbers the file. The
lockF
> > and lockT procedures should have errored if a lock wasn't possible, so
> > apparently Perl is allowing 2 users to "exclusively" lock this file.
>
> > if ($_[0])
> > {$r=flock(F, LOCK_SH) ||
> > pmessage::SayError("file", "lock- could not shlock F, try again");}
> > else
> > {$r=flock(F, LOCK_EX) ||
> > pmessage::SayError("file", "lock- could not exlock F, try again");
> > }
>
> Does pmessage::SayError() exit the program after outputting the error
> message?
>
> If not, the script will continue even though the locking failed. File
> locking in Perl is advisory rather than mandatory.
>
> --
> _ / ' _ / - aka -
> ( /)//)//)(//)/( Ronald J Kimball rjk@linguist.dartmouth.edu
> / http://www.tiac.net/users/chipmunk/
> "It's funny 'cause it's true ... and vice versa."
>
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Tue, 30 Mar 1999 14:51:43 +0100
From: "Colin Chaplin" <Colin@Chaplin.sol.co.uk>
Subject: File Locking with dbmopen
Message-Id: <7dql0f$sgs$1@phys-ma.sol.co.uk>
Hi all,
I've written a web-enabled database thingy, and thought it might be a good
idea to lock the file before punters start using it. Locking text files is
no problem, but I had a heck of a job finding anything about locking
dbmfiles using dbmopen. In fact, some stuff was contradictory !
Here is a snippet of my code - what do you think - will it work - any better
options ?
open (OUTFILE,$filename . ".db");
flock (OUTFILE,2);
dbmopen(%OUTFILE,$filename,0644);
$OUTFILE{$userid} = join
("\t",$name,$email,$url,$urldes,$addr1,$addr2,$addr3,$pcode,$tel,$pword,@opt
ions);
dbmclose (%OUTFILE);
flock(OUTFILE,8);
Cheers
Colin
------------------------------
Date: Tue, 30 Mar 1999 14:43:15 GMT
From: kalikste@uiuc.edu
Subject: Finding the amount of RAM in a remote machine
Message-Id: <7dqnu1$hk7$1@nnrp1.dejanews.com>
Hey all-
I have written a perl script that queries remote servers for configuration
information from the registry. My script works, except for the fact that I
can't find a way to get the information on the amount of RAM on the remote
machine. It seems to me that there should be a registry key with this
information, but I have looked and looked to no avail. I am not limited to a
registry solution, I just need SOME way to get the amount of RAM from the
remote machine. Any tips?
Thanks,
jeff
please reply via email.
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Tue, 30 Mar 1999 13:08:03 +0100
From: Richard H <"rhrh@hotmail.com,or,rhardicr"@ford.com>
Subject: forms and parameters
Message-Id: <7dqeq2$sge5@eccws1.dearborn.ford.com>
Hi,
I have an script which generates an input form and also processes the
requests. The input form has ~15 fields, when the user wants to go back
to the form I want these to still be selected, but removable with the
reset button.
Problem: i cant use history(-x) as i'm paging backwards and forwards
i cant seem to use CGIs query_string as it keeps getting longer and
longer!!
Any Ideas for efficiently coding this?
Thanks
Richard H
------------------------------
Date: Tue, 30 Mar 1999 14:25:29 GMT
From: Don Roby <droby@copyright.com>
Subject: Re: Getting parent process's environment variable to change when running a perl script
Message-Id: <7dqmsg$gll$1@nnrp1.dejanews.com>
In article <MPG.116a2c5d5bdabca59897ed@nntp.hpl.hp.com>,
lr@hpl.hp.com (Larry Rosler) wrote:
> [Posted and a courtesy copy sent.]
>
> In article <3700277A.8A20BFC3@attws.com> on Mon, 29 Mar 1999 17:23:06 -
> 0800, Timothy Trinh <timothy.trinh@attws.com >says...
> > I am currently running perl5 on WinNT4.0 inside of a Z-Shell. From what
> > I understand, when ever you run a perl script, it is run in a child
> > process. In the child process, you can access all the environment
> > variables and make any modification to them within the child process.
> > When the script is done executing any modification you have made to the
> > environment variable does not affect the parent process. How can I get
> > the modification or creation of environment variables to stick to the
> > parent process?
>
> perlfaq8: "I {changed directory, modified my environment} in a perl
> script. How come the change disappeared when I exited the script? How
> do I get my changes to be visible?"
>
Which says:
<quote>
Unix
In the strictest sense, it can't be done -- the script executes as a
different process from the shell it was started from. Changes to a process
are not reflected in its parent, only in its own children created after the
change. There is shell magic that may allow you to fake it by eval()ing the
script's output in your shell; check out the comp.unix.questions FAQ for
details. </quote>
While certainly true, this isn't a real helpful answer to someone who wants
to fake it in NT. (I couldn't find the Unix answer in the
comp.unix.questions FAQ for that matter, though I assume it's hiding there
somewhere.) Is there an appropriate NT FAQ to reference? Is similar fakery
even possible in NT?
Certainly if it can be done, it takes some sort of shell trickery, which may
or may not be possible using Z-shell ported to NT, or on NT using some other
port of a Unix shell, or even (blech) in DOS. I don't know the answer. I'd
suspect it can be done in a port of one of the Bourne shells, but don't use
one on NT.
Anyway the question isn't answered in the FAQ in this context.
--
Don Roby
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Tue, 30 Mar 1999 12:34:08 GMT
From: solidice@my-dejanews.com
Subject: Guestbook Blank Entry
Message-Id: <7dqgc0$b0s$1@nnrp1.dejanews.com>
When I post to my guestbook, I get a blank entry on the return page. Since
the guestbook uses multicolored <TABLES> to display data, it is kinda
anonying. I'm not really sure, which variable in the visitorbook.pl, I should
delete to remove this. Any ideas, would be appreciated.
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Tue, 30 Mar 1999 11:28:27 +0200
From: Philip Newton <Philip.Newton@datenrevision.de>
Subject: Re: Identify Drive Letter
Message-Id: <3700993B.5CA38A8B@datenrevision.de>
DMSbclar wrote:
>
> I need to be able to identify the CD-ROM drive letter of a client's PC from a
> web page that is housed on a HPUX server. I wrote a beautiful function in
> VBScript, but it cannot be processed on a UNIX server. I have noted a few
> things that may work (GetCwd() or Path_Translated), but alas I do not know
> anything about PERL yet.
>
> Is there hope?
I doubt it. This sounds as if you want to execute a Perl CGI script on
your Unix machine, in which case it can't know anything about the client.
After all, the client may not even have *any* filesystem at all (just
a browser in ROM, perhaps). If you want to find something out about the
client, you need code that executes on the client (e.g. JavaScript which
is interpreted by the browser, or VBScript as you said if the person
uses MSIE). PerlScript might work as well, but depends on the client
having Perl installed on his computer.
Cheers,
Philip
------------------------------
Date: Tue, 30 Mar 1999 21:53:24 -0800
From: "Alvin Yong" <alyong@mbox3.singnet.com.sg>
Subject: Internal Timer
Message-Id: <7dql3v$ih4$1@mawar.singnet.com.sg>
Hi,
I need some urgent help in perl...I wonder if I cld use an internal timer
function or code one so I can execute my main program every 5 mins, do I
have resort to writing a very large loop or do I have to use an external
scheduler program to automate that.....also can I open a connection to a
Unix server and execute unix commands on it while my program sits on an NT
server...I need help pls !!!
al
------------------------------
Date: 30 Mar 1999 13:50:21 GMT
From: Graham Tolliver <tolliver@Snoopy.UCIS.Dal.Ca>
Subject: mget & mput ?
Message-Id: <7dqkqt$c09$1@News.Dal.Ca>
I'd like a soloution to my problem, my script is unable
to perform the mget & mput functions because they're not
incorporated in the Net::FTP.
Does any one have suggestion, that would allow me to handle
multiple files.
Here's my script:
#!/local/bin/perl
#
use Net::FTP;
$ftp = Net::FTP->new("ServerName");
print "Logging in to ServerName\n";
$ftp->login("username","password");
$ftp->cwd("/dir/dir/");
@filelist = $ftp->ls;
foreach (@filelist) {print "$_\n";}
print "Getting files\n";
$ftp->prompt;
$ftp->mget("*.html");
$ftp->mput("/dir/dir/*.htm");
$ftp->quit;
Thanks, ever so much.
Graham,
------------------------------
Date: Tue, 30 Mar 1999 12:24:54 GMT
From: sstarre@my-dejanews.com
Subject: Re: need help in file I/O
Message-Id: <7dqfqg$ai3$1@nnrp1.dejanews.com>
Dear Fang (gotta love that name dude!):
Try opening with open(FILE2,">>temp.dat");
instead? I think you're zapping your file each time. Even better- just leave
the file open and close it wheh you're done writing to it?
-S
In article <Pine.GSO.3.96.990329150130.20388A-100000@pollux.cse.Buffalo.EDU>,
Fang Yuan <fangyuan@cse.buffalo.edu> wrote:
> Hi,
> I am a beginner in using perl. I have the following program.
>
> my $i;
> for ($i=0;$i<10;$i++){
> test($i);
> }
>
> sub test{
> my ($in)=@_;
> open(FILE2,">temp.dat");
> printf FILE2 ("$in");
> close(FILE2);
> }
>
> I want to put 0-9 into file temp.dat, but only 9 is there. How can I
> modify it?
>
> Thanks for your reply,
> Fang
>
>
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Tue, 30 Mar 1999 14:24:28 GMT
From: Dave Cross <dave@mag-sol.com>
Subject: Re: Ok, I got Perl to run but...
Message-Id: <7dqmqj$gil$1@nnrp1.dejanews.com>
In article <7dpm0m$gkj$1@camel15.mindspring.com>,
"Go Play, BNice" <bbyrdsong@bnicewd.com> wrote:
> Using IIS4,
> It seems like I don't need to put commands like print "<HTML>";, blah, blah
> because when I execute the script now, it shows all the commands but not the
> html code. I created the famous Hello World and this is what I got when I
> ran it:
>
> print; print; print; print;
>
> Hello World
>
> print; print;
>
> Something to that effect. So I went back to the file and took out all the
> Perl commands and just left the html code there. I resaved the file,
> helloworld.pl, launch the browser and executed the script. This time I got
> "Hello World" sitting at the top of the page. I don't understand. I used
> no Perl command but got Hello World out of it anyway. Could someone please
> explain to me what in the hell is going on?
Your web server (if that's not too strong a term to use for IIS4) isn't
configured correctly to run CGI scripts. It's just displaying the file as
text/plain.
You can probably get advice about configuring IIS to run CGI scripts from one
of the microsoft.public.* newsgroups or comp.infosys.www.servers.windows.
Your best bet, however, would be to get the Windows version of Apache from
<http://www.apache.org> and install that in place of IIS. It's faster, it's
cheaper (free), it doesn't crash and it comes configured to run CGI as
standard.
hth,
Dave...
--
Dave Cross
Magnum Solutions Ltd: <http://www.mag-sol.com/>
London Perl M[ou]ngers: <http://london.pm.org/>
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Tue, 30 Mar 1999 08:16:59 -0600
From: Cameron Dorey <camerond@mail.uca.edu>
To: Bob Daly <bdaly@averstar.com>
Subject: Re: OLE automation
Message-Id: <3700DCDB.D1AACAAA@mail.uca.edu>
Well, I would check the archives of the perl-win32-users mailing list at
www.activestate.com. Several of us have been working with Word and
discussing (a.k.a. getting help from Jan Dubois) there recently, and we
have by and large posted our final scripts for tasks after debugging. I
don't remember any mail merges being discussed specifically, though. Jan
had a very good article in TPJ#10 on OLE, the gist of which was you are
translating things from VB to Perl. If you go through the examples in
the docs and on the list on Excel, those on the mailing list on Word,
and compare them with the VB (macros) from the VBA editor in Word, it
isn't too hard to make it work, although it probably will take not a
little bit of experimentation.
This would probably be a good mailing list for you to consider
subscribing to, IMHO.
Cameron
camerond@mail.uca.edu
Bob Daly wrote:
>
> Does anyone know a good source for examples on how to do OLE automation
> (in Win32::OLE), specifically concerning MS Word?
>
> I want a Perl script to do an on the fly mail merge in Word, filling
> merge fields of a document using a Perl generated text file. This is
> not that complicated, I just can't find any example code anywhere (I've
> found some for Excel, but not Word).
>
> Thanks,
>
> Bob Daly
------------------------------
Date: Tue, 30 Mar 1999 10:30:20 GMT
From: jbritain@home.com (Jim Britain)
Subject: Re: opinions on buying updated Learning Perl book?
Message-Id: <3700a6dd.17748024@news>
On Tue, 30 Mar 1999 02:22:18 -0500, "Theodore C. Belding"
<streak@umich.edu> wrote:
>I have the first edition of the O'Reilly Learning Perl book by
>Schwartz. I was wondering if there was any good reason to buy the
>second edition if I'm not interested in CGI programming right now.
>Specifically, has the second edition been updated significantly for 5.0,
>enough that I should buy it? Thanks!
It's thicker, and has bigger print (easier to read as you age).
Better balance in a snowstorm, when shifting books to the upwind side.
Now refers to "Associative Arrays" as "Hashes", for added confusion.
Small, but significant code updates to match Perl 5.
------------------------------
Date: 30 Mar 1999 11:13:47 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: opinions on buying updated Learning Perl book?
Message-Id: <922792479.421710@thrush.omix.com>
Theodore C. Belding <streak@umich.edu> wrote:
: I have the first edition of the O'Reilly Learning Perl book by Schwartz.
: I was wondering if there was any good reason to buy the second edition if
: I'm not interested in CGI programming right now. Specifically, has the
: second edition been updated significantly for 5.0, enough that I should
: buy it? Thanks!
Nah, I wouldn't bother. Learning Perl is a great starter book, but
once you've started you don't need another one, 2nd ed or not. It's
not really a reference book that you should keep upto date.
Get yourself a copy of the Blue Camel (aka Programming Perl 2nd ed)
instead, and/or "Advanced Perl Programming". Both will offer far
more value for your dollar if you've already got a copy of Learning
Perl any edition.
--
-Zenin (zenin@archive.rhps.org)
Yah, Emacs is a good OS, but I prefer FreeBSD.
------------------------------
Date: 30 Mar 1999 09:58:25 -0500
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: opinions on buying updated Learning Perl book?
Message-Id: <m3yakfnhwu.fsf@joshua.panix.com>
Zenin <zenin@bawdycaste.org> writes:
> Learning Perl is a great starter book, but once you've started
> you don't need another one, 2nd ed or not. It's not really a
> reference book that you should keep upto date.
[snip]
> Get yourself a copy of the Blue Camel (aka Programming Perl
> 2nd ed) instead
Keep in mind that the camel book is itself rather out-of-date with
respect to the features of contemporary perls. The only up-to-date
reference is the documentation set that comes with perl.
The camel does remain one of the best technical books I've ever read,
though. It's up there with The Little Lisper and Knuth, for sheer
reading pleasure.
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf
------------------------------
Date: Tue, 30 Mar 1999 14:40:40 GMT
From: tgerstel@world.std.com (Tom Gerstel)
Subject: Re: Password change cgi script
Message-Id: <F9Ewrs.LsJ@world.std.com>
inaignani@my-dejanews.com writes:
>I am trying to write a cgi script for a group of users in my server. The
>script should be able to change the password for the respective user by
>calling 'passwd' program. Is there any script already existing? I am on
>Linux.
Generally a really bad idea. Most web servers run under a user with
limited access rights (nobody,httpd) so that the web server can't
be exploited. Writing a CGI that is SUID'd to root (which is
what you'll need to do to change passwords as you've described)
is a huge security risk.
It's possible, and I don't mean this to sound condescending
(it does--but that's not the intent), but if yoy don't know
how to do it yourself, you probably
shouldn't embark upon trying to do it. It requires *TERRBILY*
careful doing and even so should be avoided.
It's kind of like storing the dynomite and the blast caps in the
same box and hoping that it doesn't explode. Sure, they probably
won't, but I wouldn't want to be the one having to explain
that large explosion back in the dynomite shed.
--
Tom Gerstel tom.gerstel@turner.com
Senior Webmaster tgerstel@world.std.com
CNN Interactive http://cnn.com/
Bringing a world of news to the World Wide Web
------------------------------
Date: 30 Mar 1999 14:49:10 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Password change cgi script
Message-Id: <slrn7g1p36.foe.sholden@pgrad.cs.usyd.edu.au>
On Tue, 30 Mar 1999 14:40:40 GMT, Tom Gerstel <tgerstel@world.std.com> wrote:
>inaignani@my-dejanews.com writes:
>
>>I am trying to write a cgi script for a group of users in my server. The
>>script should be able to change the password for the respective user by
>>calling 'passwd' program. Is there any script already existing? I am on
>>Linux.
>
>Generally a really bad idea. Most web servers run under a user with
>limited access rights (nobody,httpd) so that the web server can't
>be exploited. Writing a CGI that is SUID'd to root (which is
>what you'll need to do to change passwords as you've described)
>is a huge security risk.
Using 'passwd' was mentioned, if that is done with Expect.pm or
similar then a suid root CGI is not required. The sending of plain
text passwords through numerous proxy servers is probably required
though...
--
Sam
Remember that the P in Perl stands for Practical. The P in Python
doesn't seem to stand for anything.
--Randal Schwartz in <8cemsabtef.fsf@gadget.cscaper.com>
------------------------------
Date: Tue, 30 Mar 1999 11:06:38 GMT
From: Jacqui.Caren@ig.co.uk (Jacqui Caren) (Jacqui Caren)
Subject: Re: Perl/DBI/MS-Access: Problems inserting an integer...
Message-Id: <F9EMv3.6IF@ig.co.uk>
In article <7dcvfb$i8t5@eccws1.dearborn.ford.com>,
Richard H <"rhrh@hotmail.com,or,rhardicr"@ford.com> wrote:
>> $cursor = $dbh->prepare(q{SELECT * FROM EMP WHERE EMPID = ?})
>> || die $dbh->errstr;
>> $cursor->execute($employeeID);
>>
>> $cursor->execute(int($employeeID));
>
>This looks wrong, you're using the excute method on a number with no
>sql?
The $cursor represents a prepared SQL statement, so it is correct.
You may use the execute method to pass bind variables.
>though that may be my understanding of DBi thats wrong
>the variable may need to have been interpolated for the prepare step?
It may be that the Access ODBC driver cannot handle bind variables
at all? If this is the case then I would have expected the
prepare to fail. Please note my error handling below...
$employeeID = 21;
$cursor = $dbh->prepare('SELECT * FROM EMP WHERE EMPID = ?');
die $dbh->errstr if $dbh->err;
$cursor->execute($employeeID);
die $dbh->errstr if $dbh->err;
...
$cursor->finish();
die $dbh->errstr if $dbh->err;
If this still fails try adding $dbh->debug(2); before the
prepare - if you still have problems contact the dbi-users
mailing list and someone should be able to help. Do not
contact the DBI or DBD::ODBC author directly.
Jacqui
--
Email: Jacqui.Caren@ig.co.uk http://www.ig.co.uk/
Fax : +44 1483 419 419 http://www.perlclinic.com/
Phone: +44 1483 424 424 http://www.perl.co.uk/
Paul Ingram Group Ltd,140A High Street,Godalming GU7 1AB United Kingdom
------------------------------
Date: Tue, 30 Mar 1999 13:54:54 +0100
From: "Mike Watkins" <mwatkins@promotion4free.com>
Subject: Protecting Scripts from Privacy
Message-Id: <#ZygHzqe#GA.309@nih2naae.prod2.compuserve.com>
Hi there,
I'm sure some of you have had this problem, so I thought I would ask. Is
there anyway way to protect your CGI scripts which you sell from being
pirated?
Thanks,
Mike
------------------------------
Date: 30 Mar 1999 13:56:11 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Protecting Scripts from Privacy
Message-Id: <slrn7g1lvr.eaa.sholden@pgrad.cs.usyd.edu.au>
Mike Watkins <mwatkins@promotion4free.com> wrote:
>Hi there,
>
>I'm sure some of you have had this problem, so I thought I would ask. Is
>there anyway way to protect your CGI scripts which you sell from being
>pirated?
The same way the rest of the software world, music world, video world, etc
deals with it.
The simplest way is to not do business with people you don't trust enough
to believe they will follow whatever license you sell them under.
--
Sam
Simple rule: include files should never include include files.
--Rob Pike
------------------------------
Date: Tue, 30 Mar 1999 03:03:49 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Protecting Scripts from Privacy
Message-Id: <5h0qd7.v98.ln@magna.metronet.com>
Mike Watkins (mwatkins@promotion4free.com) wrote:
: I'm sure some of you have had this problem,
So then it is very likely to be a Frequently Asked Question...
: so I thought I would ask. Is
Bzzzzt!!
"so I thought I would see if it is a Frequently Asked Question"
*that* is what you should have thought...
... and done.
Perl FAQ, part 3:
"How can I hide the source for my Perl program?"
: there anyway way to protect your CGI scripts which you sell from being
: pirated?
Put a license on it.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 30 Mar 1999 14:11:34 GMT
From: robzenuk@aol.com (Robzenuk)
Subject: Re: PWS, Win95, CGI and Perl
Message-Id: <19990330091134.17741.00000046@ng15.aol.com>
Well, I would like to thank everyone that sent in a post and words of advice.
Sorry again for a post in the wrong place. Thanks, Jon your suggestion made me
try what ended up working.
It turned out to be a real simple solution that required absolutely no changes
(verified by uninstalling PWS and Perl and starting over again). I was able to
remove all entries under ScriptMap. It looks like, the default entries under
HKEY_CLASSES_ROOT added during the Perl install (509) handle everything.
Apparently, under NT it is completely acceptable to use *.pl scripts as CGI
scripts. As I mentioned in my first post, I simply installed PWS on my NT
machine (at work) and reinstalled Perl and took all the suggested default
associations. A Form pointing to a CGI script with a *.pl extension worked
fine in this situation.
Under Windows95 (at home), the *.pl association does not work for CGI scripts
(or I couldn't make it work, even with ScriptMap entries). Only the *.plx
extension works. Once I changed the form to point to a *.plx version of the
same script, everything worked great!
I probably should have tried this earlier. I mistakenly assumed the *.plx
extension was only required if ActiveX was being used. Unfortunately, my
assumptions were re-enforced when the *.pl extension worked on NT. But we
all know what assume means...
Unless I have done something weird on my machine (which I guess is always a
possibility), this could be a real simple addition to the perlwin32faq to help
others avoid the confusion and gyrations I went through.
Rob
------------------------------
Date: Tue, 30 Mar 1999 16:32:03 +0200
From: Marc Bakker <mbakker@atmm.nl>
Subject: strange ERROR mssg
Message-Id: <3700E063.786313FB@atmm.nl>
Hi all
I got this error message upon compiling (perl -c) my code:
Illegal character \015 (carriage return) at get_top_ten.pl line 2.
(Maybe you didn't strip carriage returns after a network transfer?)
I see nothing unusual at line 2 - and yes, there is a CR.
What does it mean?
Marc,
zmbakker@xs4all.nl
------------------------------
Date: Tue, 30 Mar 1999 09:55:26 +0100
From: Federico Abascal <fabascal@gredos.cnb.uam.es>
Subject: Re: Use of uninitialized value at ... why?
Message-Id: <3700917E.7F0B1A72@gredos.cnb.uam.es>
Ala Qumsieh wrote:
> Show us some more code.
Some more code:
#!/usr/local/bin/perl -w
#CONSTANTS:
#Nombres de fichero
*tmpname=\ "/tmp/~tempFile.$$";
*resultname=\ "/tmp/~resultx1.dat.$$";
#Array params
*ev=\0;
*lo=\1;
*nr=\2;
*db=\3;
#Array pr
*na=\0; #nombre de la seq.
*se=\7; #secuencia que ha alineado. La seq mas larga de todas las que
han aparecido.
$SIG{'INT'}='FIN';
$|=1;
&main;
sub main {
my $inputFile = $ARGV[0];
my @params = @ARGV[1..4];
my $outputFile = $ARGV[5];
my @homologues;
my @results;
my $buffer = "";
my @pr;
my $contQuerys = 0;
local(*iFhandle);
local(*oFhandle);
open iFhandle, $inputFile or die "Couldn't open $inputFile: $!\n";
#open(iFhandle, $inputFile);
open(oFhandle, ">$outputFile");
$pr[$na]=<iFhandle>;
while(<iFhandle>) {
$buffer = $_;
if($buffer =~ /^>/ || eof(iFhandle)) {
if(eof(iFhandle)) { $pr[$se] = $pr[$se] . $buffer; }
$contQuerys++;
&runB(\@pr, \@params, \@homologues, \@results, \*oFhandle,
$contQuerys);
$prot[$na]=$buffer;
$prot[$se] = "";
} else { $pr[$se] = $pr[$se] . $buffer; }
}
print "\n";
close oFhandle;
close iFhandle;
}
I don't so the functions runB, FIN, and I supose something else.
The warning contiunes so, what's the problem?
Thanks
Federico
------------------------------
Date: Tue, 30 Mar 1999 11:23:05 +0200
From: Philip Newton <Philip.Newton@datenrevision.de>
Subject: Re: Use of uninitialized value at ... why?
Message-Id: <370097F9.671AB62D@datenrevision.de>
Federico Abascal wrote:
>
> my($var1, $var2, $var3);
> isn't correct?
It is correct. my($var1); is also correct, but slightly unusual. If you
have just one variable, you usually leave out the parentheses, but if
you want to declare multiple variables in one line, you need the
parentheses. And if you want to initialise them all at once, you
(probably) need parentheses around the right side as well, e.g.
my($var1, $var2, $var3) = ("string", 234, \@array); .
Cheers,
Philip
------------------------------
Date: Tue, 30 Mar 1999 14:07:25 GMT
From: cspence@delphi-tech.com (Christopher Spence)
Subject: Win32::FileSecurity
Message-Id: <3700da38.586144731@news1-wcom.uu.net>
How do I get this to add securities from DOMAIN X instead of local
computer domain. Local Computer is a member of Domain X, but it wants
to create users based off of LocalComputerDomain.
while (<USERLIST>)
{
chomp;
next if /^$/;
$HomeDirectory = $HomeRoot . '\\' . $_;
# Create User Directories
@args = ("mkdir", $HomeDirectory);
system(@args) == 0;
# Call Win32::FileSecurity Module
use Win32::FileSecurity qw(Set MakeMask);
# Create Full Access Mask
$FullAccessMask = MakeMask( qw(FULL GENERIC_ALL) );
$hash{Administrator} = $FullAccessMask;
$hash{$_} = $FullAccessMask;
Set($HomeDirectory, \%hash);
# Delete user from hash
delete $hash{$_};
# Increase user count
$UserCount++;
}
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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 5256
**************************************