[8517] in Perl-Users-Digest
Perl-Users Digest, Issue: 2135 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Mar 19 11:17:59 1998
Date: Thu, 19 Mar 98 08:02:11 -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 Thu, 19 Mar 1998 Volume: 8 Number: 2135
Today's topics:
Re: Running CGI-Scripts on a webserver <barnett@houston.Geco-Prakla.slb.com>
Re: setuid and $0 <dboorstein@shopcfn.com>
Re: still rename probs with MS IIS (Massimo Ferrario)
times function Unix, yes, NT, no -Perl NT cotal@delphi.com
Troubles with a Canned script (Chris Peters)
Re: unpack loops (Jason Gloudon)
Re: Using perl code as a config file syntax? (Or, can r <quentin@jihad.amd.com>
Re: Using perl code as a config file syntax? (Or, can r <jdf@pobox.com>
Re: Using perl code as a config file syntax? (Or, can r (Andrew M. Langmead)
Re: Where is Comm.pl (Andrew M. Langmead)
Re: Writing Scripts <alan@consultancy-services.ferret.com>
Re: Writing Scripts <$_=qq!fearless\@NOSPAMio.com!;y/A-Z//d;print>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 19 Mar 1998 09:07:35 -0600
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
To: Ralph Moch <ralphmoch@swol.de>
Subject: Re: Running CGI-Scripts on a webserver
Message-Id: <351134B7.969083C5@houston.Geco-Prakla.slb.com>
Ralph Moch wrote:
>
> I4ve got a problem concerning cgi-scripts. I use Windows95, with an
> webserver simulation tool and perl for win95. The script runs on my home
> computer. I4ve placed it now on a webserver with an unix system. Ther
> the script doesen4t run.
> I hope somebody can give me some advise, post it her or better send me
> an email to ralphmoch@swol.de
>
> Thx Ralph
Well, not strictly a perl question, but I'll give you some things to
look at:
1. What happens when you access the script with your web browser:
a. You get the script on your screen:
i. check permissions (make the script executable)
ii. check with your isp/sysadmin to make sure the script is in a
cgi-bin
directory that the web server will respect & use.
b. You get an error message
i. check the web server error logs for what the message is.
ii. contact your isp/sysadmin for guidance on where this file lives
2. Can you successfully run the script from a command prompt?
3. Have you looked at the CGI meta faq (don't have the url, but a
search of
Dejanews (www.dejanews.com) should yield that for you.
4. Try asking in a newsgroup dedicated to issues related to your web
server
software (if a web server issue)
5. Try asking in a newsgroup dedicated to cgi issues, such as:
comp.infosystems.authoring.cgi
That should give you a good starting point.
HTH.
Dave
--
"Security through obscurity is no security at all."
-comp.lang.perl.misc newsgroup posting
------------------------------------------------------------------------
* Dave Barnett U.S.: barnett@houston.Geco-Prakla.slb.com *
* DAPD Software Support Eng U.K.: barnett@gatwick.Geco-Prakla.slb.com *
------------------------------------------------------------------------
------------------------------
Date: Thu, 19 Mar 1998 10:28:53 -0500
From: Dan Boorstein <dboorstein@shopcfn.com>
To: "Kuntal M. Daftary" <daftary@cisco.com>
Subject: Re: setuid and $0
Message-Id: <351139B5.B199807D@shopcfn.com>
Kuntal M. Daftary wrote:
>
> hi
>
> i use the following construct to get the name of the script file in most of my
> perl scripts:
>
> ($self = $0) =~ s:.*/::;
>
> recently i had to make a script setuid. and i realized that for setuid scripts
> $0 is no longer the name of the script file. in my case it became /dev/fd/4.
> or something like that.
>
> also, for specifically this script, i really need to get the name of the script
> file because i not only use it to set the $self but also stat the script to
> find out group and user ownerships and perform certain authorization checks.
as was already pointed out, the above method is unreliable for
determining the name of your script and therefore is of no use in
'stat'. instead i would suggest using the filehandle for your 'stat'
calls:
my @info = stat DATA;
__END__
this, of course, can be used to read the data in the file as well.
for your other needs it is difficult to say what the best alternative
would be. if you could enumerate them, perhaps we could help on a
case by case basis.
hope this helps,
--
# dan boorstein <dboorstein@shopcfn.com>
seek DATA,0,0;print scalar<DATA>,__END__
Just another Perl hacker,
------------------------------
Date: Thu, 19 Mar 1998 15:42:49 GMT
From: massimo@inforeti.it (Massimo Ferrario)
Subject: Re: still rename probs with MS IIS
Message-Id: <35113b06.23350155@news.protec.it>
<soul@explorer.com> wrote:
>hi, posted a while ago with renaming problems on win32 perl.
>
>i have since run the script from the perl command line and the rename
>executes as intended, though when called with identical parameters from
>a browser, $! always returns a "file not found" error.
>
>even a simple test script with hardcoded filenames produces the same
>results, correct renaming from the command line, and file not found when
>called from a browser.
I also had this problem a few days ago.
As you mention IIS, I guess you are using the ActiveState version of Perl:
the problem seems to be in PerlIS.dll and not perl.exe itself (I'm using " build
315" of ActiveState). When you install PerlIs.dll it builds an association in
the Registry between .pl files and PerlIs.dll, so when the web server 'executes'
perl script it uses the dll, not the executable perl.
The problem with rename is present only in PerlIs.dll: that's why per script
works from the command line but not when launched by the server (The guys at
ActiveState say they fixed it in build 314 ... but it is still present in 315. I
reported the bug a few days ago)
You can easily buid a workaround fot it: instead of renaming a file, just copy
it and delete the old version
Bye Massimo
------------------------------
Date: Thu, 19 Mar 1998 07:45:19 -0600
From: cotal@delphi.com
Subject: times function Unix, yes, NT, no -Perl NT
Message-Id: <6er7hi$851$1@nnrp1.dejanews.com>
The times function works well on my Unix server.
My development server running Apache under NT does not.
Does anyone use the times function in the NT perl implementation?
Are there any other functions I can call that would give me cpu elapsed time?
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Thu, 19 Mar 1998 13:17:57 GMT
From: cpeters@cinemagnetics.com (Chris Peters)
Subject: Troubles with a Canned script
Message-Id: <3514f388.8295536@news.cyburban.com>
Im hoping someone here can help me. I am a new user to the world of
PERLl/CGI and have been using some of the scripts off of the various
resources on the net to aid in my learning. Currently I am trying to
configure a meesageboard that I downloaded from Matt's Script Archive.
It is his WWWBOARD messageboard. I thought I had it correctly set.
When I try to run it I type in the name,subject,e-mail etc into the
fields and then hit the enter a post button. It thens gives me an
error message stationg that I had not entered a name. OK I re-enter
the name. It then gives me the following error:
The requested URL /~celticbard/cgi-bin/cgi-bin/wwwboard.cgi was not
found on this server.
Its frustrating to say the least! Here's how I configured the script:
$basedir = "/usr/home/celticbard/public_html/board/";
$baseurl = "~celticbard/board/";
$cgi_url = "cgi-bin/wwwboard.cgi";
$mesgdir = "messages";
$datafile = "data.txt";
$mesgfile = "test.htm";
$faqfile = "faq.htm";
$ext = "htm";
$title = "test";
I know im doing something stupid yet am at a loss as to what! I wrote
Matt about it but have gotten no reply. If there is anyone out here
who can help I would really appreciate it. Thanks in advance
NOTICE TO BULK EMAILER(S): Pursuant to US Code, Title 47, Chapter 5,
Subchapter II, 227, any and all unsolicited commercial e-mail sent to
this address is subject to a download and archival fee in the amount
of $500 US.
------------------------------
Date: Thu, 19 Mar 1998 15:01:43 GMT
From: jgloudon@manitoba.bbn.com (Jason Gloudon)
Subject: Re: unpack loops
Message-Id: <slrn6h2co6.iuk.jgloudon@manitoba.bbn.com>
In article <6eq7f7$11qe$1@nntp6.u.washington.edu>, Darwin O.V. Alonso wrote:
>
>
>I am unpacking a "$record" containing a4 strings and signed
>short variables.
>
>To load an array, @num, with the $nat signed-shorts:
>#1
> @num = unpack("x$nsk s$nat", "$record"); $nsk += 2*$nat;
>
>To load an array, @nam, with the $nat strings:
>#2
> for $i ( 0 .. $nat-1){
> @t = unpack("x$nsk a4", "$record"); push(@nam,$t[0]); $nsk += 4;
> }
>( $nat = 1244)
You can use the "x" operator to generate the unpack string.
@strings = unpack ("x$nsk" . "a4" x $nat, $record);
Jason Gloudon
------------------------------
Date: 19 Mar 1998 08:05:03 -0600
From: Quentin Fennessy <quentin@jihad.amd.com>
Subject: Re: Using perl code as a config file syntax? (Or, can require return more then one value?)
Message-Id: <xim7m5qbwts.fsf@jihad.amd.com>
>>>>> "Uri" == Uri Guttman <uri@sysarch.com> writes:
Uri> Zenin <zenin@archive.rhps.org> writes:
Uri> why not do something like this:
my %config = (
FOO => [ 'some', 'foo', 'options' ],
BAR => [ 'some', 'bar', 'options' ],
);
1 ; # needed to return true to require
Uri> the only problem is you can't set which var is being set in
Uri> the main file. it is in the required file only.
If the config file uses a consistent name then you can alias it or
assign it to another name.
Assuming more than one config file (using Perl for data structures),
if each config file uses the same name you can deal with it
mechanically. You can then assign subsequent loaded data structures
to a hash or a list.
> Zenin <zenin@archive.rhps.org> writes:
> my %config = require 'some.config';
The reason that the original line did not work is that require
does not return the data structure from the file. I do not know
of a way to provide an anonymous data structure using require
or use (or do).
--
Quentin Fennessy AMD, Austin Texas
Secret hacker rule #10 - hackers know where the manuals are
------------------------------
Date: 19 Mar 1998 09:18:57 -0500
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: Using perl code as a config file syntax? (Or, can require return more then one value?)
Message-Id: <yay6pxv2.fsf@news.concentric.net>
Zenin <zenin@archive.rhps.org> writes:
> I'm trying to use a perl file as a config file. The file would look
> something like this:
>
> (
> FOO => [ 'some', 'foo', 'options' ],
> BAR => [ 'some', 'bar', 'options' ],
> );
Have you looked into (and rejected) Data::Dumper?
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
------------------------------
Date: Thu, 19 Mar 1998 15:19:23 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Using perl code as a config file syntax? (Or, can require return more then one value?)
Message-Id: <Eq2nwB.5ov@world.std.com>
Zenin <zenin@archive.rhps.org> writes:
>I'm trying to use a perl file as a config file. The file would look
>something like this:
[stuff deleted]
> Is there any way to read a perl data stuct out of a file without
>assigning it to a variable or using this sub ref kluge?
How about creating a reference to the list value, and dereferencing
the return value from require.
[
FOO => [ 'some', 'foo', 'options' ],
BAR => [ 'some', 'bar', 'options' ],
];
my %config = @{ require 'bar.pl' };
--
Andrew Langmead
------------------------------
Date: Thu, 19 Mar 1998 15:36:44 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Where is Comm.pl
Message-Id: <Eq2op9.J8q@world.std.com>
saarg@amdocs.com (saar ginzburski) writes:
>I'm trying to download the Comm.pl module for about three days but I'm
>not able to. It's looks like the file disappear from all CPAN sites.
I'm surprised that Comm.pl has disappeared, but maybe you can take a
look at the Expect.pm module that was based on it.
You don't need to use ptys to force line buffering to solve your
problem, you just need to flush you filehandles before you call system
or backticks.
use IO::File;
STDOUT->autoflush(1);
print "This is output from PROGRAM_2.pl\n";
# or here do STDOUT->flush()
system "./PROGRAM_3.pl";
--
Andrew Langmead
------------------------------
Date: Thu, 19 Mar 1998 11:21:10 +0000
From: Alan Silver <alan@consultancy-services.ferret.com>
Subject: Re: Writing Scripts
Message-Id: <1oLZ5WAm+PE1Ew4Z@consultancy-services.com>
Steve Peters <michboy@caspers.net> wrote ...
>Okay, I got Perl 5 installed, and I installed cgi.pm on my computer. Now
>what? I have a script all written out, but I don't know how to save it as
>a .cgi or .pl file.... If anyone could give me any information whatsoever,
>tips, hints, clues, or just plain out telling me how to do it, I would be
>grateful.
>
>Steve Peters
Is it a CGI script, or just a plain Perl script to be run from a command
line ? If the former, then you need to put it somewhere where your
server can see it and where it allows CGI programs to be run. You also
need to check what extension (if any) your server expects CGI scripts to
have.
If it is a stand-alone script, then you don't need to give it any
extension. Depending on your operating system you may find it easier to
do so, but you probably don't have to. Eg, on UNIX, call it whatever you
want, make it executable and type its name (assuming it has a
#!/usr/bin/perl line at the top). On DOS, you may need to type something
like "perl script.pl" (not sure if you need a switch to tell it the
script file name).
Alan
NOTE - In order to discourage unsolicited e-mail, the address in the
header may have .ferret added. Please remove this before replying.
--
Sent By : Alan Silver
Fish Page : http://www.geocities.com/Heartland/Hills/6749/fishtank.html
It's not an optical illusion, it just looks like one
------------------------------
Date: Thu, 19 Mar 1998 06:31:07 -0800
From: "Creede Lambard" <$_=qq!fearless\@NOSPAMio.com!;y/A-Z//d;print>
Subject: Re: Writing Scripts
Message-Id: <6era3s$87i@bgtnsc03.worldnet.att.net>
Alan Silver wrote in message <1oLZ5WAm+PE1Ew4Z@consultancy-services.com>...
>Steve Peters <michboy@caspers.net> wrote ...
>Eg, on UNIX, call it whatever you
>want, make it executable and type its name (assuming it has a
>#!/usr/bin/perl line at the top). On DOS, you may need to type something
>like "perl script.pl" (not sure if you need a switch to tell it the
>script file name).
>
>Alan
No, "perl script.pl any-arguments-you-may-care-to pass" will work just fine
so long as the path to the Perl executable is in your PATH statement.
And don't forget, in MacPerl just leave a shortcut to the file on your
desktop. If you've created the file in MacPerl and it has the little camel
icon you can just double-click it or option-O to open it up. :D
--- Creede Lambard
Minister of Irregular Expressions
Programming Republic of Perl
------------------------------
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 2135
**************************************