[15836] in Perl-Users-Digest
Perl-Users Digest, Issue: 3249 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jun 4 18:05:25 2000
Date: Sun, 4 Jun 2000 15:05:11 -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: <960156310-v9-i3249@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sun, 4 Jun 2000 Volume: 9 Number: 3249
Today's topics:
@INC <jad9@po.cwru.edu>
A question of overloading functions <sweeheng@usa.net>
Re: AAAARRRRGGHHH! Please help <nospam@devnull.com>
Re: Annoying message when opening files <dan@tuatha.sidhe.org>
Re: global chown ?? <jim@no.spam.ta>
Re: global chown ?? <elaine@chaos.wustl.edu>
Re: Have IP, want to know DNS <elaine@chaos.wustl.edu>
How do I set a file's attribute to HIDDEN? tia. ro <rogdh@iname.com>
Re: How to open another windows? <hyagillot@tesco.net>
Re: How to open another windows? <flavell@mail.cern.ch>
Re: How to open another windows? (Craig Berry)
Re: Limits on $ENV{} hash ? <dan@tuatha.sidhe.org>
Re: Make depend failed - "fork failed - too many proces <atrus@atrustrivalie.eu.org>
Re: Make depend failed - "fork failed - too many proces <atrus@atrustrivalie.eu.org>
Module Loading <atrus@atrustrivalie.eu.org>
Re: newsgroup help <elaine@chaos.wustl.edu>
Not able to run PERL script as CGI by Apache <mikes@escape.com>
Re: obfuscation scripts (Joe Smith)
Re: obfuscation scripts (Eric Smith)
Re: Oracle 8.1, Perl 5.05, DBI on Solaris 2.6 <nospam@devnull.com>
Re: Perl and SSI (David Efflandt)
Perl gurus: help a C++ programmer optimize his ways (Greg Schmidt)
Re: Perl Install on Win98 <x@x.com>
Re: Perl Install on Win98 (Joe Smith)
Re: Perl Install on Win98 <founder@pege.org>
Re: Perl to write to a text file <red_orc@my-deja.com>
RegExp Help, I Think <grichards@flashcom.net>
Re: Secure CGI session in Perl (David Efflandt)
Thank you -- http://localhost/cgi-bin/scriptname works surens@attglobal.net
Re: Win32::AdminMisc::LogonAsUser <jchajNOjcSPAM@nvcs.freeserve.co.uk.invalid>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 04 Jun 2000 16:02:00 -0500
From: "John A. Dutton" <jad9@po.cwru.edu>
Subject: @INC
Message-Id: <393AC3C8.389B1C6F@po.cwru.edu>
Does anyone know how I specify the contents of the @INC array?
John
--
http://johnadutton.com/ (currently start.cwru.edu)
senior, case western reserve university
brother, phi kappa theta fraternity
------------------------------
Date: Mon, 5 Jun 2000 02:18:14 +0800
From: "Swee Heng" <sweeheng@usa.net>
Subject: A question of overloading functions
Message-Id: <8he66b$uud$1@violet.singnet.com.sg>
I have encountered a tricky problem while deriving a subclass of the
Net::SMTP::Server::Client (NSSC) module. The problem is like this:
Consider a simplified version of the NSSC module:
package NSSC;
my %_cmds = ( DATA => &_data, MAIL => &_mail );
sub _data { # do something }
sub _mail { # do something }
sub process { $cmd = 'DATA'; &{$_cmds{$cmd}}(@argv) }
and a simplified NSSC::Subclass module:
package NSSC::Subclass
@NSSC::Subclass::ISA = qw( NSSC );
sub _data { # do something DIFFERENT };
Now, when I call NSCC::Subclass->_data(), I can "do something DIFFERENT".
But alas, the _data() method is not invoked directly. By design of the NSSC
module, it is process() that is called.
Since $_cmds{DATA} == &NSSC::_data and %_cmd, being a "my" hash variable, is
not accessible outside NSSC, the overload function &NSSC::Subclass::_data is
never invoked.
Is there anyway to sidestep the problem? Can I manipulate the symbol tables?
Swee Heng
------------------------------
Date: 4 Jun 2000 20:42:30 GMT
From: The WebDragon <nospam@devnull.com>
Subject: Re: AAAARRRRGGHHH! Please help
Message-Id: <8heevm$70n$1@216.155.33.59>
In article <MPG.139f04dbd96c1ea498ab0d@nntp.hpl.hp.com>, Larry Rosler
<lr@hpl.hp.com> wrote:
| #!/usr/bin/perl -w
| use strict;
|
| open INPUT, 'buh.data' or die "Couldn't open 'buh.data'. $!\n";
| print substr($_, 0, 1) eq '/' ? "Unknown\n" : $_ while <INPUT>;
*boggles* at the way you wrote that last line.. makes careful note of
it.. clicks onward..
nicely done.
--
send mail to mactech (at) webdragon (dot) net instead of the above address.
this is to prevent spamming. e-mail reply-to's have been altered
to prevent scan software from extracting my address for the purpose
of spamming me, which I hate with a passion bordering on obsession.
------------------------------
Date: Sun, 04 Jun 2000 18:15:06 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: Annoying message when opening files
Message-Id: <K0x_4.101598$hT2.413633@news1.rdc1.ct.home.com>
Tony Curtis <tony_curtis32@yahoo.com> wrote:
>>> On 3 Jun 2000 18:29:46 GMT,
>>> Stan Horwitz <stan@typhoon.ocis.temple.edu> said:
>> Value of <HANDLE> construct can be "0"; test with
>> defined() at ./xxx line 65535.
>> So does anyone know what this error means and how I can
>> get rid of it? If so, please let me know.
This is actually a bug (the line number thing) in 5.004 combined with an
over-zealous error. Upgrade to 5.004_05 if you can.
> You're doing something like:
> while ($line = <FILEHANDLE>) {
> ...
> }
> when you mean
> while (defined ($line = <FILEHANDLE>)) {
> ...
> }
> since a line which contains just "0" will evalute to
> false.
No it won't, since a line with just 0 on it is really "0\n". If the last
line in the file is 0 with no trailing newline, or the filehandle is tied,
or you're using record-read mode (which isn't available in 5.004_0x
anyway) you can get this, but not with a normal text file.
> Using $_ via
> while (<FILEHANDLE>) {
> ...
> }
> is the more usual idiom, this contains an implicit
> defined() test.
I think the implicit defined() got added back in as of later maintenance
versions of 5.004, but I can't recall for sure. It's not something you're
likely to trip over, though.
Dan
------------------------------
Date: Sun, 4 Jun 2000 19:26:17 +0100
From: "Jim Tench" <jim@no.spam.ta>
Subject: Re: global chown ??
Message-Id: <8he6vs$7e0$1@uranium.btinternet.com>
chown comes with a built in -R flag for just this purpose...
frank <frank@french-connexion.com> wrote in message
news:393A566B.9207001B@french-connexion.com...
> I (linux newbie) am trying to write a script that chowns all the files
> and directories belonging to "sam" in the current directory to "joe" ?
>
> Any help appreciated
> Thanx
>
------------------------------
Date: Sun, 04 Jun 2000 18:49:25 GMT
From: Elaine Ashton <elaine@chaos.wustl.edu>
Subject: Re: global chown ??
Message-Id: <B5601CF5.5625%elaine@chaos.wustl.edu>
in article 8he6vs$7e0$1@uranium.btinternet.com, Jim Tench at jim@no.spam.ta
quoth:
> chown comes with a built in -R flag for just this purpose...
No, the "R" is for recursive from the base dir and he wanted to find
everything owned by a particular user and chown them system-wide.
e.
------------------------------
Date: Sun, 04 Jun 2000 18:46:41 GMT
From: Elaine Ashton <elaine@chaos.wustl.edu>
Subject: Re: Have IP, want to know DNS
Message-Id: <B5601C51.5624%elaine@chaos.wustl.edu>
in article 393a986b$0$24016@reader2, Seansan at sean77@dds.nl quoth:
> I had a look at perl.com, but didnt find anything, just a bunch of other
> programming things to do with pinging and others.
gethostbyaddr
'perldoc perlfunc'
e.
------------------------------
Date: Sun, 04 Jun 2000 13:18:39 -0700
From: rogdh <rogdh@iname.com>
Subject: How do I set a file's attribute to HIDDEN? tia. roger
Message-Id: <jbeljs8laki7mumkcsg42r029skrq2mli3@4ax.com>
------------------------------
Date: Sun, 4 Jun 2000 21:40:06 +0100
From: "B Kemp" <hyagillot@tesco.net>
Subject: Re: How to open another windows?
Message-Id: <8hef1a$sgc$1@epos.tesco.net>
>I want to open another browser window through perl CGI. Can you tell me how
>to do this?
With Javascript, which you can print out in the html.
------------------------------
Date: Sun, 4 Jun 2000 23:33:37 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: How to open another windows?
Message-Id: <Pine.GHP.4.21.0006042329380.9872-100000@hpplus01.cern.ch>
On Sun, 4 Jun 2000, B Kemp wrote:
> >I want to open another browser window through perl CGI. Can you tell me how
> >to do this?
>
> With Javascript, which you can print out in the html.
Another reason to have javascript disabled...
------------------------------
Date: Sun, 04 Jun 2000 21:56:10 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: How to open another windows?
Message-Id: <sjlk3qk75ri29@corp.supernews.com>
Yuanqing Wu (qing@bcm.tmc.edu) wrote:
: I want to open another browser window through perl CGI. Can you tell me how
: to do this?
The same way as you do it through any other language making use of CGI, or
for that matter on a static HTML page.
--
| Craig Berry - http://www.cinenet.net/users/cberry/home.html
--*-- "You live in Los Angeles, and you are going to Reseda; we are
| all in some way or another going to Reseda someday, to die."
- Soul Coughing
------------------------------
Date: Sun, 04 Jun 2000 18:07:56 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: Limits on $ENV{} hash ?
Message-Id: <0Ww_4.101597$hT2.413633@news1.rdc1.ct.home.com>
Philip Taylor <phil.taylor@bigfoot.com> wrote:
> On Sat, 03 Jun 2000 17:54:39 GMT, Dan Sugalski <dan@tuatha.sidhe.org>
> wrote:
>>Philip Taylor <phil.taylor@bigfoot.com> wrote:
>>> I have been using the $ENV hash to set system wide parameters such as
>>> file names and other system constants. For some reason some of the
>>> values being set during the initialisation of my program are not being
>>> set. I have about set about 30 $ENV parameters abd it's seems to be
>>> the ones set last which are not acccessible from the program.
>>
>>What OS, and where aren't the elements of %ENV not being seen? In your
>>program? In children your process spawns? In the shell after your program
>>exits?
> The server s/w is Apache/1.3.9 (Unix) mod_perl/1.21 .
> My top level CGI program loads the system globals as follows:-
> do "sysconfig.pl";
> the above perl script is placed in the cgi-bin directory. a sample of
> it is below:-
> $ENV{'RZ_DB_CONFIG'} = $ENV{'RZ_DATA_PATH'} . 'config.dat';
> $ENV{'RZ_DB_DIVISION'} = $ENV{'RZ_DATA_PATH'} . 'division.dat';
> $ENV{'RZ_DB_SEASON'} = $ENV{'RZ_DATA_PATH'} . 'season.dat';
> $ENV{'RZ_DB_TABLE'} = $ENV{'RZ_DATA_PATH'} . 'table.dat';
> $ENV{'RZ_DB_TEAM'} = $ENV{'RZ_DATA_PATH'} . 'team.dat';
> $ENV{'RZ_DB_FIXTURE'} = $ENV{'RZ_DATA_PATH'} . 'fixture_DIV.dat';
> .........
> other similar lines removed for clarity
> ........
> # this bit loads user specific config daa by reading a data file
> my $fname = $ENV{'RZ_DB_CONFIG'};
> my $fname = '/home/taylorp/cgi-files/nwcsl/config.dat';
You just redeclared a variable with the same name. Naughty. -w would yell
about this, though that's always problematic when running under mod_perl.
> open (CONFIG, "< $fname");
And you know this suceeded why, exactly? Check the status of open! Might
well have failed.
> while (<CONFIG>) {
> chomp; # no new line
> s/#.*//; # no comments
> s/^\s+//; # no leading white
> s/\s+$//; # no trailing white
> next unless length; # anything left;
> my ($var,$value) = split(/\s*=\s*/, $_, 2);
> $ENV{$var} = $value;
> }
> close (CONFIG);
> The $ENV{} variables that are not loaded are those loaded by the WHILE
> loop above. I believe this is co-incidence and that it is something to
> do with a limit.
No, probably the file open failed. Is there any real reason to be jamming
these into %ENV? I mean, do any processes you spawn actually use them? If
not, don't use it as it's a waste of environment space and time. Just use
a regular global.
Dan
------------------------------
Date: Sun, 04 Jun 2000 13:42:54 -0700
From: Yann Ramin <atrus@atrustrivalie.eu.org>
Subject: Re: Make depend failed - "fork failed - too many processes"
Message-Id: <393ABF4E.C94DB7C5@atrustrivalie.eu.org>
Its a system restriction - somewhere in your system the # of processes
is limited. No idea where it is on Digital UNIX. It may have a BSD
/etc/login.conf ???
Yann
Benny Chee wrote:
>
> Hi,
>
> I tried installing perl into my Alpha D20E with
> Digital OS v4.0f and i got the following error msg
> after Configure ask me if i wanted to make depend.
>
> Seems to me that ./makedepend when into a loop and never got back.
> Can someone enlighten me on this issue.
>
> Run make depend now? [y]
> sh ./makedepend MAKE=make
> /bin/sh Makefile.SH
> Extracting Makefile (with variable substitutions)
> make depend MAKEDEPEND=
> sh ./makedepend MAKE=make
> /bin/sh Makefile.SH
> Extracting Makefile (with variable substitutions)
> make depend MAKEDEPEND=
> sh ./makedepend MAKE=make
> /bin/sh Makefile.SH
> Extracting Makefile (with variable substitutions)
> make depend MAKEDEPEND=
> sh ./makedepend MAKE=make
> /bin/sh Makefile.SH
> Extracting Makefile (with variable substitutions)
> sh: fork failed - too many processes
> *** Exit 1
> Stop.
> *** Exit 1
> Stop.
> Searching for .c files...
> Finding dependencies for av.o.
> ./makedepend: fork failed - too many processes
> cppstdin: fork failed - too many processes
> Finding dependencies for deb.o.
>
> --
> Benny Chee <bennycch@starhub.net.sg>
> ---------------
> Public Key: http://wwwkeys.pgp.net:11371/pks/lookup?op=get&search=0x8AEFF5B6
> Key fingerprint=6D35 58EE 1706 8A98 2A74 1772 C447 6603 8AEF F5B6
> ---------------
--
--------------------------------------------------------------------
Yann Ramin atrus@atrustrivalie.eu.org
Atrus Trivalie Productions www.atrustrivalie.eu.org
irm.it.montereyhigh.com
Monterey High IT www.montereyhigh.com
ICQ 46805627
AIM oddatrus
Marina, CA
"All cats die. Socrates is dead. Therefore Socrates is a cat."
- The Logician
# fortune
"To be responsive at this time, though I will simply say, and therefore
this is a repeat of what I said previously, that which I am unable to
offer in response is based on information available to make no such
statement."
--------------------------------------------------------------------
------------------------------
Date: Sun, 04 Jun 2000 13:43:34 -0700
From: Yann Ramin <atrus@atrustrivalie.eu.org>
Subject: Re: Make depend failed - "fork failed - too many processes"
Message-Id: <393ABF76.B3A8DC2@atrustrivalie.eu.org>
Its a system restriction - somewhere in your system the # of processes
is limited. No idea where it is on Digital UNIX. It may have a BSD
/etc/login.conf ???
Yann
Benny Chee wrote:
>
> Hi,
>
> I tried installing perl into my Alpha D20E with
> Digital OS v4.0f and i got the following error msg
> after Configure ask me if i wanted to make depend.
>
> Seems to me that ./makedepend when into a loop and never got back.
> Can someone enlighten me on this issue.
>
> Run make depend now? [y]
> sh ./makedepend MAKE=make
> /bin/sh Makefile.SH
> Extracting Makefile (with variable substitutions)
> make depend MAKEDEPEND=
> sh ./makedepend MAKE=make
> /bin/sh Makefile.SH
> Extracting Makefile (with variable substitutions)
> make depend MAKEDEPEND=
> sh ./makedepend MAKE=make
> /bin/sh Makefile.SH
> Extracting Makefile (with variable substitutions)
> make depend MAKEDEPEND=
> sh ./makedepend MAKE=make
> /bin/sh Makefile.SH
> Extracting Makefile (with variable substitutions)
> sh: fork failed - too many processes
> *** Exit 1
> Stop.
> *** Exit 1
> Stop.
> Searching for .c files...
> Finding dependencies for av.o.
> ./makedepend: fork failed - too many processes
> cppstdin: fork failed - too many processes
> Finding dependencies for deb.o.
>
> --
> Benny Chee <bennycch@starhub.net.sg>
> ---------------
> Public Key: http://wwwkeys.pgp.net:11371/pks/lookup?op=get&search=0x8AEFF5B6
> Key fingerprint=6D35 58EE 1706 8A98 2A74 1772 C447 6603 8AEF F5B6
> ---------------
--
--------------------------------------------------------------------
Yann Ramin atrus@atrustrivalie.eu.org
Atrus Trivalie Productions www.atrustrivalie.eu.org
irm.it.montereyhigh.com
Monterey High IT www.montereyhigh.com
ICQ 46805627
AIM oddatrus
Marina, CA
"All cats die. Socrates is dead. Therefore Socrates is a cat."
- The Logician
# fortune
"To be responsive at this time, though I will simply say, and therefore
this is a repeat of what I said previously, that which I am unable to
offer in response is based on information available to make no such
statement."
--------------------------------------------------------------------
------------------------------
Date: Sun, 04 Jun 2000 13:04:38 -0700
From: Yann Ramin <atrus@atrustrivalie.eu.org>
Subject: Module Loading
Message-Id: <393AB656.AD3AC2F9@atrustrivalie.eu.org>
Hi,
I'm trying to be able to load a module in a Perl script with use,
<module>->new(); etc. The problem is that the module name is not
hardcoded into the script. Below is some code, which obivously doesn't
work at the return, but gives an overview of what I want to do.
sub load($module) {
if ($nett_load_hash[$module] == 0) {
use vars qw($module);
$nett_load_hash[$module] = 1;
}
return $module->new();
}
The use vars qw($var) works, but I can't figure out how to return an
object. $module holds the name of the module, i.e. Nett::CLI::start or
Nett::UserInfo. I don't want to make a monster if(), since the $module
names will be fed out of a database table.
I can do this in PHP by:
$object = new $class;
Yann
--
--------------------------------------------------------------------
Yann Ramin atrus@atrustrivalie.eu.org
Atrus Trivalie Productions www.atrustrivalie.eu.org
irm.it.montereyhigh.com
Monterey High IT www.montereyhigh.com
ICQ 46805627
AIM oddatrus
Marina, CA
"All cats die. Socrates is dead. Therefore Socrates is a cat."
- The Logician
# fortune
"To be responsive at this time, though I will simply say, and therefore
this is a repeat of what I said previously, that which I am unable to
offer in response is based on information available to make no such
statement."
--------------------------------------------------------------------
------------------------------
Date: Sun, 04 Jun 2000 19:00:33 GMT
From: Elaine Ashton <elaine@chaos.wustl.edu>
Subject: Re: newsgroup help
Message-Id: <B5601F91.5626%elaine@chaos.wustl.edu>
in article 3939F9C8.3BDAB8CC@crosswinds.net, Daniel Jones at
danjones@crosswinds.net quoth:
> Does any one know how to create a perl script that gets any new messages
> posted by a news group and converts them into a html web page for
> archiving?
http://www.cpan.org/authors/id/R/RO/RONALDWS/fetch_unanswered-0.18.pl is a
script that will fetch new and unanswered messages. Converting to html would
require a bit of tweaking with a parser.
e.
------------------------------
Date: Sun, 04 Jun 2000 14:22:44 -0400
From: mike <mikes@escape.com>
Subject: Not able to run PERL script as CGI by Apache
Message-Id: <393A9E74.16219404@escape.com>
Hi,
I am trying to learn about CGI programming and wanted
to try some examples, but for some reason the scripts don't
run. I have made the scripts executable and created a path
to the executable directory. I have been able to execute
a PERL script in that directory as a test. Unless there is
a problem with the html file that calls the CGI script,
it seems that maybe running CGI programs has to be
enabled in Apache, but if so, I don't know how.
Thanks
Mike
------------------------------
Date: 04 Jun 2000 19:03:45 GMT
From: inwap@best.com (Joe Smith)
Subject: Re: obfuscation scripts
Message-Id: <393aa811$0$2987@nntp1.ba.best.com>
In article <slrn8jkj3p.g72.eric@plum.fruitcom.com>,
Eric Smith <eric@fruitcom.com> wrote:
>I know there are scripts that obfuscate your perl code by alterning variable
>names and remove white space etc. You can also convert your script into
>some kind of ascii image.
>
>I am looking for some references to the above.
unix% perldoc -q hide
C:/>perldoc perlfaq3
--
See http://www.inwap.com/ for PDP-10 and "ReBoot" pages.
------------------------------
Date: 4 Jun 2000 19:52:03 GMT
From: eric@fruitcom.com (Eric Smith)
Subject: Re: obfuscation scripts
Message-Id: <slrn8jlcqs.j8d.eric@plum.fruitcom.com>
Joe Smith posted
> In article <slrn8jkj3p.g72.eric@plum.fruitcom.com>,
> Eric Smith <eric@fruitcom.com> wrote:
> >I know there are scripts that obfuscate your perl code by alterning variable
> >names and remove white space etc. You can also convert your script into
> >some kind of ascii image.
> >
> >I am looking for some references to the above.
>
> unix% perldoc -q hide
> C:/>perldoc perlfaq3
Thank you but this woulod not suit my purposes, I am not looking for
anything that requires a second script or package to lookup the decryption
algorithm.
Just need something that will do the above so that obfuscated script runs
without pre-processing thru the perl compiler.
--
Eric Smith
eric@fruitcom.com
------------------------------
Date: 4 Jun 2000 20:36:41 GMT
From: The WebDragon <nospam@devnull.com>
Subject: Re: Oracle 8.1, Perl 5.05, DBI on Solaris 2.6
Message-Id: <8heekp$70n$0@216.155.33.59>
In article <39367F50.995DE894@indra.com>, Ron Reidy <rereidy@indra.com>
wrote:
| Mark Heaton wrote:
| >
| > I have installed all the above and when we try to make a DBI call
| > via Perl's DBI library an error occurs saying a Solaris patch is
| > required for the Java Runtime Environment (1.1.10 and 1.1.8 both
| > have the same result). From digging through Sun's website and
| > elsewhere it is clear that Solaris 2.5.1 needs a patch applied to
| > support native threads. However this is not needed for 2.6. Has
| > anyone come accross this and been able to resolve this. The error
| > is most likely in the Perl DBI lib but Oracle does not help with
| > its errors. Regards, Mark
|
| From the text, it appears you are using a perl made with threads. The
| DBI docs specifically state DBI is not thread safe.
Neither is Pern, but people still want to live there...
(:
--
send mail to mactech (at) webdragon (dot) net instead of the above address.
this is to prevent spamming. e-mail reply-to's have been altered
to prevent scan software from extracting my address for the purpose
of spamming me, which I hate with a passion bordering on obsession.
------------------------------
Date: 4 Jun 2000 18:11:19 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Perl and SSI
Message-Id: <slrn8jl6u6.5os.efflandt@efflandt.xnet.com>
On Sun, 04 Jun 2000, Robert <robertNOroSPAM@kronos.custard.org.invalid> wrote:
>I am writing a little perl script that will create page titles on
>the fly in the same way that page counters place gif image digits
>on the fly.
>
>I need to call the script using SSI with:
>
><!--#exec cgi="title.cgi" -->
>
>Does anyone know a way of taking the filename of the page that
>calls the CGI script and storing it as a string?
>
>For example, if the CGI script is called from mypage.shtml, how
>can I store "mypage.shtml" as a string in the script?
This is a webserver question and will depend upon the which webserver and
version you are using. Try temporarily substituting a simple script that
prints all the %ENV variables as the SSI and see if there is a variable
that you could use or parse:
#!/usr/bin/perl
print "Content-type: text/html\n\n<p><b>Environment:<p></b>\n";
foreach (sort keys %ENV) { print "$_ = $ENV{$_}<br>\n"; }
--
David Efflandt efflandt@xnet.com http://www.de-srv.com/
http://www.autox.chicago.il.us/ http://www.berniesfloral.net/
http://hammer.prohosting.com/~cgi-wiz/ http://cgi-help.virtualave.net/
------------------------------
Date: Sun, 04 Jun 2000 18:37:45 GMT
From: gregs@trawna.com (Greg Schmidt)
Subject: Perl gurus: help a C++ programmer optimize his ways
Message-Id: <393ea1d1.58473871@news.mtmc1.on.wave.home.com>
I've written a Perl script for searching a database and generating a table
(in HTML) based on the results. The script works, in that it finds all
applicable matches and generates validated HTML.
However, being a C/C++ programmer by training and trade, I'm sure that I'm
not using Perl as effectively as possible. There are constructs in the code
which seem natural to do, from a C-ish point of view, but are probably not
as efficient as they could be.
Also, the HTML generation is rather slow. Things are acceptable (though not
spectacular) if there are only a few hits, or if the searcher has limited
the number of hits shown on a page, but there are times when a couple of
hundred matches are listed, and this can take as long as a minute to
generate the page. Of course, many people will not wait this long.
I've used the Benchmark module to track down what is taking the time, and
have found that the bulk of the time is taken in creating the TR and TD tags
for each match. Even a simple line like
push (@cells, td (' '));
takes over a second to run 500 times. Changing to
push (@cells, "<TD> </TD>");
speeds it up significantly. There are other lines with even greater
variations. I find it hard to believe that CGI.pm would be this slow.
I'm using version 5.004 of Perl, and 2.68 of CGI.pm (1).
The search form is found at http://www.trawna.com/gregs/movies/, and the
script may be accessed directly (in its most typical form) at
http://www.trawna.com/cgi-bin/film.pl?searchstring=foo (where foo is
whatever you want to search for, and yes "foo" will actually return some
hits from the database). Rather than posting the source (800+ lines), it is
at http://www.trawna.com/gregs/movies/film.pl. To spare you from trying to
grok the entire thing, I have placed comments marked with ## on lines that I
think might be of particular note (eg. things that I think are probably less
efficient or harder to maintain than you gurus would write).
Any tips, pointers, insults, etc. appreciated. Please feel free to post any
snippets of code that you're referring to in follow-ups.
(1) With version 2.56 of CGI.pm, it slowed things down use the CGI::Pretty
module (eg. a 5 second run without would slow down to about 7 seconds with
it). I checked for the latest version, and one of the updates listed a fix
in Pretty, so I upgraded to 2.68 in the hopes that this would speed things
up. Instead, it now appears to take 7 seconds regardless of whether Pretty
is used or not.
--
Greg Schmidt (gregs@trawna.com)
Trawna Publications (http://www.trawna.com/)
Fiction Into Film List (http://www.trawna.com/gregs/movies/)
------------------------------
Date: Sun, 04 Jun 2000 18:56:43 GMT
From: "Randhier Ramharakh" <x@x.com>
Subject: Re: Perl Install on Win98
Message-Id: <LDx_4.708$GY3.86469@newshog.newsread.com>
So this program emulates perl on a win9x comp?
"Bob Gregory" <bgregory3@cs.com> wrote in message
news:393a7925@news.piro.net...
> I have tried to install Perl on my PC under Win98 in order to write and
test
> Perl scripts & programms. I downloaded Active Perl 613 für Windows 95/98
> (InstMsi.exe) from http://www.activestate.com/ActivePerl. When I execute
it
> nothing happens, i.e. no error messages, but no sign of a correct Perl
> installation. Can anyone help me get Perl installed under Win 98? My
> target server is Windows NT (private) and Unix (work)
>
>
------------------------------
Date: 04 Jun 2000 18:56:29 GMT
From: inwap@best.com (Joe Smith)
Subject: Re: Perl Install on Win98
Message-Id: <393aa65d$0$2983@nntp1.ba.best.com>
In article <393a7925@news.piro.net>, Bob Gregory <bgregory3@cs.com> wrote:
>I have tried to install Perl on my PC under Win98 in order to write and test
>Perl scripts & programms. I downloaded Active Perl 613 für Windows 95/98
>(InstMsi.exe) from http://www.activestate.com/ActivePerl. When I execute it
>nothing happens, i.e. no error messages, but no sign of a correct Perl
>installation. Can anyone help me get Perl installed under Win 98? My
>target server is Windows NT (private) and Unix (work)
I had the same problem the first time I tried it.
The web page is missing step-by-step instructions for people who are
installing perl for the first time on Win32 platforms.
There are three links for Windows, but only two of them are underlined.
It is not obvious that "Windows - Intel, 8,174 KB" is a hyperlink and
should be clicked on.
1) Go to http://www.activestate.com/Products/ActivePerl/Download.html
2a) If you don't already have an up-to-date copy of Microsoft's general
purpose installer program, click on the red Windows_95/98 link.
2b) If you've set your browser so EXE files are saved to disk instead of
executed, double-click on the downloaded InstMsi.exe. This installs the
installer and prepares your system so that you can do step 3b.
3a) In the "ActivePerl download by platform:" box, the lines there are
clickable links, even though they do not appear as such.
Click on the "Windows - Intel (8,174 KB)" link to start downloading
the actual perl files. Note: The installation is NOT a self-extracting
EXE file like many other programs. If the Microsoft Windows Installer
does not automatically start up for the .msi file, go to step 3b.
3b) Double-click on downloaded ActivePerl-5.6.0.613.msi file. This will
cause the Windows Installer to do the actual install of perl.
4) Read the docs by Start->Programs->ActivePerl->Online Documentation
or by "C:\>perldoc perldoc".
-Joe
--
See http://www.inwap.com/ for PDP-10 and "ReBoot" pages.
------------------------------
Date: Sun, 4 Jun 2000 21:14:11 +0200
From: "Mösl Roland" <founder@pege.org>
Subject: Re: Perl Install on Win98
Message-Id: <393aaa85$0$81424@SSP1NO17.highway.telekom.at>
"Randhier Ramharakh" <x@x.com> wrote in message
news:LDx_4.708$GY3.86469@newshog.newsread.com...
> So this program emulates perl on a win9x comp?
I work since 1997 with Active State Perl
on Windows.
It's even a html scripting language.
You can write
<SCRIPT LANGUAGE=PerlScript>
# here goes the perl code
</SCRIPT>
I wrote last year a software package
in PerlScript which runs only on
MSIE and Windows.
I just have to convert this software
to a browser server solution, because
a new client needs this on apple, and
PerlScript is Windows only
--
Mösl Roland http://www.pege.org
Clear targets for a confused civilization
http://www.BeingFound.com
web design and seminars
+43 699 17343674
------------------------------
Date: Sun, 04 Jun 2000 19:27:45 GMT
From: Rodney Engdahl <red_orc@my-deja.com>
Subject: Re: Perl to write to a text file
Message-Id: <8heaj2$k2n$1@nnrp1.deja.com>
In article <slrn8jjgvr.ut.tadmc@maxim.metronet.com>,
tadmc@metronet.com (Tad McClellan) wrote:
> On Sat, 03 Jun 2000 18:32:04 GMT, Bob Walton <bwalton@rochester.rr.com> wrote:
> >Rodney Engdahl wrote:
> >>
> >> In article <8hb325$d26$1@newssvr03-int.news.prodigy.com>,
> >> "Navneet Behal" <navneetbehal@bigfoot.com> wrote:
> >...
> >> open (FH, "/full/path/to/file/text.txt") || die "Cannot open text file\n";
>
> >You need a > in front of the filename to open it for writing.
>
> ... and you need to include $! in the diagnostic message.
true
>
> ... and you need to leave the newline out of the diagnostic message.
not true
>
> ... and you need to mention the name of the file in the diagnostic message.
not if I only have one file :^)
>
> :-)
>
> --
> Tad McClellan SGML Consulting
> tadmc@metronet.com Perl programming
> Fort Worth, Texas
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Sun, 4 Jun 2000 14:30:48 -0700
From: "Gabe" <grichards@flashcom.net>
Subject: RegExp Help, I Think
Message-Id: <sjlif4c75ri162@corp.supernews.com>
I have a string that will look like:
drive:\path\to\file.ext
I want just the "file.ext", how can I do this?
Thanks,
Gabe
------------------------------
Date: 4 Jun 2000 18:27:42 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Secure CGI session in Perl
Message-Id: <slrn8jl7st.5os.efflandt@efflandt.xnet.com>
On Sun, 04 Jun 2000 13:22:25 GMT, Mark P. <perl@imchat.com> wrote:
>On Sun, 04 Jun 2000 19:01:30 +0800, Maciej Mastalarczuk
><maciek@treko.net.au> wrote:
>
>>Hi Gurus,
>>
>>I am making a secure website in Perl (Apache-SSL, Redhat 6.0). There are
>>some lines below, but I think the problem is trivial.
>>
>>Description:
>>The user fetches a login page and puts username and password which are
>>POST-ed to a script called say 'login.cgi'.
>>The script validates the user and performes certain action or refuses to
>>do so if appropriate.
>>Whole site consists of many scripts and none of them should be invoked
>>without prior login.
>
> The way I do this is to insert a .htaccess file in your
>directory that looks like this.
>
>Order deny,allow
>Deny from all
>Allow from none
>
> then after login your script starts a session file and
>rebuilds this .htaccess depending on the number of open sessions.
>
>Order deny,allow
>Deny from all
>Allow from none
>Allow from 206.171.###.###
>Allow from 206.172.###.###
>
> This gives them access to anything in that directory but just
>giving out the web address to someone else will result in a 403 denied
>error. Run a cron job to check the session files and delete them after
>a certain time period and also rebuild the .htaccess file.
> The session files should contain a time stamp and the IP of
>the person logging in.
Just one thing you haven't thought of, aol-proxy, or other firewalls,
proxies or maaquerading where multiple users may appear to come from the
same IP. In fact we used to have a problem with a router out in the
internet caching all web traffic, which made all requests through it
appear to come from it. We complained to them that they should not be
caching CGI.
What is wrong with good old fashioned simple webserver authentication?
On a secure server like this all web traffic would be encrypted.
--
David Efflandt efflandt@xnet.com http://www.de-srv.com/
http://www.autox.chicago.il.us/ http://www.berniesfloral.net/
http://hammer.prohosting.com/~cgi-wiz/ http://cgi-help.virtualave.net/
------------------------------
Date: Sun, 04 Jun 2000 14:32:02 +0200
From: surens@attglobal.net
Subject: Thank you -- http://localhost/cgi-bin/scriptname works
Message-Id: <393A4C42.DC145947@attglobal.net>
Thank you all. I have been running the apache, but couldn't make it
work. David Efflandt's suggestion works for me now.
"try putting the script there and access it as
http://localhost/cgi-bin/scriptname"
#See if you have a directory like /usr/home/httpd/cgi-bin, try putting
the
#script there and access it as http://localhost/cgi-bin/scriptname
#
#For further questions see:
#
#comp.infosystems.www.authoring.cgi for CGI
#comp.infosystems.www.servers.unix for apache
#
#--
#David Efflandt efflandt@xnet.com http://www.de-srv.com/
#http://www.autox.chicago.il.us/ http://www.berniesfloral.net/
#http://hammer.prohosting.com/~cgi-wiz/ http://cgi-help.virtualave.net/
>
> I am trying to test a perl script, hello.pl in netscape browser, but it
> is not showing "Hello, World!" in the browser, the code is executed
> (showing a warning message for execution, click ok). I also change it
> hello.cgi, did't help. The sample code is below. Both files are in the
> same directory.
> How can I make it work?
> Thanks.
>
> ---hello.pl ---permission:0755-----------
> #!/usr/bin/perl -w
> use CGI qw(:standard);
> use strict;
>
> print header;
> #print "Content-type: text/html\n\n"; # didn't help
> print "<B>Hello, World!</B>";
>
> ---test.html-----------------------------
> <FORM action="hello.pl" method="get">
> <INPUT type="submit" value="Send">
> </FORM>
> -----------------------------------------
------------------------------
Date: Sun, 04 Jun 2000 12:53:56 -0700
From: John Chajecki <jchajNOjcSPAM@nvcs.freeserve.co.uk.invalid>
Subject: Re: Win32::AdminMisc::LogonAsUser
Message-Id: <037674e4.595ea6a4@usw-ex0104-033.remarq.com>
Thanks.
However, this is the same information as can be found in Dave
Roths Win32 Perl Programming book, from which the above was
derrived. In fact, the exact script used in the book does not
work either. Has anyone else actually used the LogonAsUser
function successfully?
* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 3249
**************************************