[10663] in Perl-Users-Digest
Perl-Users Digest, Issue: 4255 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Nov 19 12:08:00 1998
Date: Thu, 19 Nov 98 09:00:23 -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 Nov 1998 Volume: 8 Number: 4255
Today's topics:
Re: /g modifier: why not 'last' out of while loop? (J.D. Laub)
Re: 500 server error <dejahvu@erols.com>
Re: any simple cookie examples? (Peter van der Landen)
Re: Bareword? (Andrew M. Langmead)
Re: CHUNK Error ronald_f@my-dejanews.com
DB_File <bwb@dowebpages.com>
Faking flock in MacPerl <dejahvu@erols.com>
get unixtime from year and yday rengels@my-dejanews.com
Re: Help with loading file into %hash? <jdf@pobox.com>
Re: Help with loading file into %hash? <J.D.Gilbey@qmw.ac.uk>
Re: Help with loading file into %hash? (Daniel Pray)
Re: Help with loading file into %hash? (Patrick Timmins)
Re: Help with loading file into %hash? dave@mag-sol.com
Re: How to call a cgi from html files automatically dave@mag-sol.com
how to execute <ours@casema.net>
Re: Install Errors: 5.005_02 on Solaris 2.6 system stevestock@my-dejanews.com
Re: Need equivalent to a sh's export command. (Thomas Jordan)
Need HELP: PerlScript <vpedrosa@ccg.uc.pt>
Re: NT security + IIS + perl droby@copyright.com
Re: Perl Array Question? Anybody... (Larry Rosler)
Perl script to automatically find dependencies <markscottwright@hotmail.com>
pod2man and Y2K (Morten Welinder)
problem with a sub-routine returning values <mallinger_jeff/mtks@mtks.cargill.com>
Problem with using Crypt with Perl on Windows NT <james@MatadorDesign.com>
Re: programing fun: trees: FlattenAt (David Alan Black)
Re: reference problem <ewinter@pop3.stx.com>
Re: Scope question for Perl (Clinton Pierce)
Re: Scope question for Perl <sgordon@kenan.com>
Re: selective list assignment? <rgoeggel@atos-group.com>
use WIN32::OLE experience with MATLAB ?? <str@zhwin.ch>
Re: Win16 DLL access (on NT) Help!!! (Bbirthisel)
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 19 Nov 1998 15:55:21 GMT
From: jdl@iasi.com (J.D. Laub)
Subject: Re: /g modifier: why not 'last' out of while loop?
Message-Id: <3654401b.0@mirage.iasi.com>
>On Wed, 18 Nov 1998, J.D. Laub wrote:
>> Why can't a 'last' be used to bail out of the loop?
In article <Pine.GSO.4.02A.9811180911310.27321-100000@user2.teleport.com>, Tom
Phoenix <rootbeer@teleport.com> wrote:
>If you did another match on the same string
>later, the pos()ition would be left in the middle, rather than at the
>start. By looping until the match fails, the iterator is reset.
That seems to be the most probable answer. Thanks, Tom! Below is my complete
test code, plus results. When the 'last' is uncommented, only the blue fish
is found in the 2nd loop.
% perl -w <<\EOF
use strict;
my ($WANT, $count) = (3, 0);
$_ = 'One fish two fish red fish blue fish';
while (/(\w+)\s+fish\b/gi) {
if (++$count == $WANT) {
print "The third fish is a $1 one.\n";
#last; # Warning: don't 'last' out of this loop
}
}
while (/(\w+)\s+fish\b/gi) {
print "2nd loop found a $1 fish.\n";
}
EOF
The third fish is a red one.
2nd loop found a One fish.
2nd loop found a two fish.
2nd loop found a red fish.
2nd loop found a blue fish.
>Of course, the iterator could be reset by assigning to pos() directly, if
>you really did want to use last. Hope this helps!
Right again. Putting "pos = 0;" either inside the 1st loop (just before the
'last') or just after the first loop lets us use a 'last' in the 1st loop
while still finding all the fish in the 2nd loop. They're all keepers! 8-)
Thanks to everyone that replied.
J.D. Laub (Laubster) |"I think you're very, very, very, very, very,
jdl@iasi.com |very, very, very, very, ..." - Flying Lizards
------------------------------
Date: Thu, 19 Nov 1998 10:25:36 -0600
From: Mary E Tyler <dejahvu@erols.com>
Subject: Re: 500 server error
Message-Id: <36544680.502B@erols.com>
Neil Prater wrote:
>
> I am writing an html page that posts data by calling a perl script. When I
> click on the submit button on the HTML page,
>
> it calls the perl script and produces my output to a file. All is fine and
> well, but I receive this error in my browser window.
>
> Can anyone give me a hint at what I need to be looking at in my perl script
> that is causing this problem?
>
> 500 Server Error
>
> The server encountered an internal error or misconfiguration and was unable
> to complete your request.
>
> Please contact the server administrator, neil.prater@ype.gmpt.gmeds.com and
> inform them of the time the error occurred ,
>
> and anything you might have done that may have caused the error.
>
> Error: httpd: malformed header from script
neil,
i'm no expert, but i just spent two days solving this problem... i am
still not sure exactly what i did to fix it... you might want to check
comp.infosystems.www.authoring.cgi for the thread "Strange CGI Problem."
Basically a 500 error means that the header your script is sending the
browser is incorrect. That's the part of the code that looks kind of
like
print "Content-type: text/plain \n\n";
there is something wrong with the header you are sending.
dejah, hope this helps
--
i trust i make myself obscure, i have need of obscurity now- robert bolt
a heated exchange of unread mail would be welcomed by all- christensen
Skating Fiction. Featuring the highly acclaimed serial On The Edge!
http://www.DejahsPrivateIce.com
------------------------------
Date: Thu, 19 Nov 1998 14:23:40 GMT
From: landen@frg.eur.nl (Peter van der Landen)
Subject: Re: any simple cookie examples?
Message-Id: <36572902.1915035235@zeus.safenet.nl>
On Mon, 09 Nov 1998 16:30:28 GMT, dtbaker_dejanews@my-dejanews.com
wrote:
>yes, I am learning to do some CGI... using perl to create on-the-fly option
>lists and such for HTML forms. While some values can be passed from one form
>to the next in VALUES, I'm finding that I need to save some "state-like"
>information in cases where one perl script may get executed later in a work
>session, etc.
>
>I have read thru the :CGI docs several times, and am really only using 2 or 3
>of the methods (param and cookie). I am slowly making sense of the docs and
>making progress in a little trial and error test routine, but "error" is the
>keyword there... ;) While the docs I've found show the syntax for the actual
>call, I think I'm not getting the big picture for correct use, and am looking
>for a little example. Always makes more sense to me to see something that
>way....
I use a different approach. When a user logs in he/she is assigned a
random cookie ( a 32 digit random hex number) . This cookie is stored
in a database on the server side where the other perl CGI scripts can
use it as a key to store or access state information. (mostly I just
store the user's login name & IP address).
The data is stored in a mySQL database which communicates with Perl
very nicely using a DBI module. The cookies expire on the server side
after a preset time. I use non-persistent cookies that the browser
forgets whenever it is shutdown.
Regards,
Peter van der Landen
---------------------------------------------------------------------
Law Faculty, L4-45, Erasmus University, Rotterdam, Holland
Tel +31-10-4082237 (home 2800956) Fax +31-10-2800957
------------------ E-mail Landen@frg.eur.nl -------------------------
------------------------------
Date: Thu, 19 Nov 1998 15:30:26 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Bareword?
Message-Id: <F2oDqr.Es5@world.std.com>
bigcheese@my-dejanews.com writes:
>What is a Bareword?
>"Bareword found where operator expected at line 39"
A bareword in perl is a sequence of alphanumeric characters that it
can't figure out any other meaning for. It treats them like they are
quoted strings.
$foo Set_to 'bar';
Set_to is a bareword.
If you made it an explicit string:
$foo 'Set_to' 'bar';
You would get a slightly different error message:
String found where operator expected at ...
So the error isn't really that you have a bareword, its just that perl
is trying to tell you that what it found when it was expecting an
operator.
As others have said, the code you posted looks syntatically
correct. (Although a bit odd with the double quoted numeric value.)
but as you work with computer languages, you'll begin to learn a
valuable lesson. Compilers and interpreters get confused when parsing
incorrect source code. They try to tell you as much as they can, but
you really have to take their error messages with a grain of salt.
They're already heading off into the weeds. Try examining the code
starting a few lines before line 39. There is probably something that
started perl in the wrong direction, but it wwasn't until line 39 that
it noticed it.
It kind of line my favorite analogy to explain fatal errors in
programs ("General Protection Error", "Core Dump", "System Error",
etc. Whatever term you are familiar with.) When someone who has no
background in computer programming asks me why a program has given
some sort of fatal error, I explain that the program is pretty much
just following its instructions, just like someone following a
path. It doesn't necessarily keep checking that the path is clear. The
event that caused the error is like someone (maybe even the program
itself) leaving a rake right in the middle of the path, with its
spokes upturned. Essentially, the program stepped on the rake, the
handle flung up, knocked him on the head, and knocked him out. Its
easy to tell when the rake flew up and hit him. (This bit of slapstick
imagery tends to make a connection to what had happened.) Its harder
to find out when the rake got left on the path.
Perl is telling you it got hit on the head with a rake. The perl
parser does a fair job of checking that the path is clear before it
walks, so usually it can tell you when the rake got put onto the
path. Sometimes its a little bit off, though.
--
Andrew Langmead
------------------------------
Date: Thu, 19 Nov 1998 15:28:48 GMT
From: ronald_f@my-dejanews.com
Subject: Re: CHUNK Error
Message-Id: <731deq$e02$1@nnrp1.dejanews.com>
In article <3652DF66.C4917C24@kenan.com>,
kelly woodhead <kwoodhead@kenan.com> wrote:
> Im new to looking at perl and wondered if anybody could let me know what
> the folowing error indicates:
>
> CHUNK ERROR 274.
>
> I guess that it is an internal perl error but can anybody actualoly tell
> me what this is?.
I also got chunk errors occasionally. In every case this was related to the
usage of a variable that was yet undefined. Did you try to run your code
with -w and use strict;?
Ronald
--
Ronald Fischer <ronald_f@my-dejanews.com>
http://ourworld.compuserve.com/homepages/ronald_fischer/
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Tue, 17 Nov 1998 18:53:57 -0600
From: Bill Binkley <bwb@dowebpages.com>
Subject: DB_File
Message-Id: <36521AA5.26F2CD2D@dowebpages.com>
I am using DB_File with some perl scripts on a Unix.
I can read and write records and now want to open the
file and read all records and write them to a flat file.
The reference book had an error on the page that showed
the loop and read and write statements, any suggestions
will be appreciated, including where I can get information
on DB_file commands.
--
Bill Binkley
Software Composers, Inc.
http://www.dowebpages.com
Go to this URL for JavaScript examples
and sample code. For JavaScript at it's
best see the "European Tour". If you
have a question about the examples, put
it in the comments of the visitors form.
------------------------------
Date: Thu, 19 Nov 1998 10:31:55 -0600
From: Mary E Tyler <dejahvu@erols.com>
Subject: Faking flock in MacPerl
Message-Id: <365447FA.6A5D@erols.com>
The Macintosh doesn't support explicit file locking so Mac Perl doesn't
either. But the unix web server that i use at my web host *does.* What
The problem stems from my inherent laziness (a virtue!). I don't want to
have to comment out the calls to flock every time I want to check syntax
or run the script on my mac. Is there a mechanism where by I can put in
some separate file somewhere something like:
sub flock($$) {} #does nothing
Then I can either comment that line out when i upload it or i can do
something even stupider and put a file with the same name as the fake
one with something like:
sub flock($$) {Blah...} #code which actually calls flock
anyone have any ideas.
Dej
--
i trust i make myself obscure, i have need of obscurity now- robert bolt
a heated exchange of unread mail would be welcomed by all- christensen
Skating Fiction. Featuring the highly acclaimed serial On The Edge!
http://www.DejahsPrivateIce.com
------------------------------
Date: Thu, 19 Nov 1998 14:12:09 GMT
From: rengels@my-dejanews.com
Subject: get unixtime from year and yday
Message-Id: <7318vd$a4g$1@nnrp1.dejanews.com>
Is there any simple way of getting the time in non leap year seconds from 1970
if you only know:
year day
year
and set seconds, hours, minutes to 0? Sort of like a slightly different
"timegm"
I'm actually just interested in getting the month and month day, but figure
this is the first step...
Thanks!
Reinhard
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 19 Nov 1998 15:01:55 +0100
From: Jonathan Feinberg <jdf@pobox.com>
To: daniel@intecomp.com (Daniel Pray)
Subject: Re: Help with loading file into %hash?
Message-Id: <m3hfvvhjcc.fsf@joshua.panix.com>
daniel@intecomp.com (Daniel Pray) writes:
> open (SHIPDB, "$basepath$delim$shipdb1") || die "Can't open file\n";
That's not a helpful error message, since it tells the user neither
the name of the file that couldn't be opened nor the reason.
"Can't open $filename for read: $!\n"
> while(<SHIPDB>){
> @shp1 = <SHIPDB>;
First you read a single line of SHIPDB into $_, then you assign the
remaining lines to @shp1. Is that really what you meant?
> close(SHIPDB);
Or die.
> while(($weight1,$rate1)=each %shp1){
There is no such thing as %shp1. You haven't created it. You should
use the -w switch.
It's hard to tell what you're trying to do. It seems like you want
something like
while (<SHIPDB>) {
chomp;
my ($key, $value) = split '\|';
$hash{$key} = $value;
}
Have you read _Learning Perl_? It's well worth the cash, and will
spare you hours of this sort of misdirection.
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf
------------------------------
Date: Thu, 19 Nov 1998 14:02:32 +0000
From: Julian Gilbey <J.D.Gilbey@qmw.ac.uk>
Subject: Re: Help with loading file into %hash?
Message-Id: <365424F8.2C791E78@qmw.ac.uk>
Daniel Pray wrote:
>
> I am trying to load a file that is pipe delimited into a hast, but it
> doesn't seem to be working right. I have tried many different methods as
> you can see in my example. I am using a print loop only to make sure that
> the hash is full, but it doesn't print anything. I will be loading four
> similar files in the same way to be used in calculating shipping.
>
> I've looked in books, but they don't have examples of this. I'm not
> getting the relationship between the %shipping and @SHIP and the $ship.
> Any help would be appreciated.
>
> Thanks,
>
> Daniel
>
> open (SHIPDB, "$basepath$delim$shipdb1") || die "Can't open file\n";
> while(<SHIPDB>){
> @shp1 = <SHIPDB>;
> # $test1{$weight1} = $rate1;
> }
OK, before we go any further, while(<SHIPDB>) reads one line of SHIPDB
into $_, but then you read the read of SHIPDB into the @shp1 array. So
you lose the first line, and the while loop only runs once. Perhaps
you mean just
@shp1 = <SHIPDB>;
with no while loop?
> close(SHIPDB);
> # @shp1 = keys %shipping1;
I'm going to ignore the commented out lines, OK?
> while(($weight1,$rate1)=each %shp1){
You haven't defined %shp1. The variables $shp1, @shp1 and %shp1 are
all independent. If you want to make the @shp1 array into a %shp1
hash, you must say %shp1=@shp1;.
That should get you a bit further.
Julian
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Julian Gilbey Email: J.D.Gilbey@qmw.ac.uk
Dept of Mathematical Sciences, Queen Mary & Westfield College,
Mile End Road, London E1 4NS, ENGLAND
-*- Finger jdg@goedel.maths.qmw.ac.uk for my PGP public key. -*-
------------------------------
Date: Thu, 19 Nov 1998 15:50:37 GMT
From: daniel@intecomp.com (Daniel Pray)
Subject: Re: Help with loading file into %hash?
Message-Id: <daniel-1911980752480001@usr33-dialup43.mix1.sacramento.cw.net>
I will try to provide a little more clarity for what I am trying to do. I
would like to load the contents of a file into a hash to be used to
reference agains another field to make calculations. This file looks like
this, but has a total of 60 records.
1|7.00
2|8.21
3|8.67
4|9.10
I would like to test the hash by printing out the whole list.
eg. print "%hash\n";
I would like it to print out like
1 7.00
2 8.21
3 8.67
4 9.10
--
dSoft Inc. http://intecomp.com/dsoft/
Software Developer and FMP and 4D Developer
intecomp.com http://intecomp.com/
Computers and Peripherals
------------------------------
Date: Thu, 19 Nov 1998 16:33:41 GMT
From: ptimmins@netserv.unmc.edu (Patrick Timmins)
Subject: Re: Help with loading file into %hash?
Message-Id: <731h95$hvr$1@nnrp1.dejanews.com>
In article <daniel-1911980428320001@usr19-dialup23.mix1.sacramento.cw.net>,
daniel@intecomp.com (Daniel Pray) wrote:
> I am trying to load a file that is pipe delimited into a hast, but it
> doesn't seem to be working right. I have tried many different methods as
> you can see in my example. I am using a print loop only to make sure that
> the hash is full, but it doesn't print anything. I will be loading four
> similar files in the same way to be used in calculating shipping.
You have to split each line into its fields, then create a hash
of hashes, with the key field in your database used as a key
for the first hash, the field names for the remaining fields as
keys for the second hash, and the values of each particular
field (which you obtain from your split, along with your key field)
assigned to the appropriate hash of hash key. eg:
while (<DATA>) {
($ssn, $name, $dob, $sex, $status) = split /\|/;
$person{$ssn}{name} = $name;
$person{$ssn}{dob} = $dob;
$person{$ssn}{sex} = $sex;
$person{$ssn}{status} = $status;
}
foreach ( sort keys %person ) {
print "ID $_ is $person{$_}{name}, who is $person{$_}{sex}\n";
print "and was born on $person{$_}{dob} and is currently\n";
print "$person{$_}{status}\n\n";
}
__DATA__
508-111-22A2|Monica Lewinsky|March 15, 1975|female|available
609-222-33B3|Kennetsh Starr|December 7, 1941|male|kicking butt
710-333-44C4|Bill Clinton|August 19, 1946|perverted|a whining coward
820-444-55E5|Hillary Clinton|an unknown date|female|a mistreated wife
this prints out:
ID 508-111-22A2 is Monica Lewinsky, who is female
and was born on March 15, 1975 and is currently
available
ID 609-222-33B3 is Kennetsh Starr, who is male
and was born on December 7, 1941 and is currently
kicking butt
ID 710-333-44C4 is Bill Clinton, who is perverted
and was born on August 19, 1946 and is currently
a whining coward
ID 820-444-55E5 is Hillary Clinton, who is female
and was born on an unknown date and is currently
a mistreated wife
Read Tom Christiansen's perldoc perldsc that comes
with your Perl, or see a relevant piece of it at:
http://www.perl.com/CPAN-local/doc/FMTEYEWTK/pdsc/pdsc-4.html ,
as well as the other files in the same directory
also, buy Tom and Nat Torkington's "The Perl Cookbook"
(published by O'Reilly and Assoc).
Patrick Timmins
$monger{Omaha}[0]
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 19 Nov 1998 16:22:57 GMT
From: dave@mag-sol.com
Subject: Re: Help with loading file into %hash?
Message-Id: <731gk7$h3l$1@nnrp1.dejanews.com>
In article <daniel-1911980428320001@usr19-dialup23.mix1.sacramento.cw.net>,
daniel@intecomp.com (Daniel Pray) wrote:
> I am trying to load a file that is pipe delimited into a hast, but it
> doesn't seem to be working right. I have tried many different methods as
> you can see in my example. I am using a print loop only to make sure that
> the hash is full, but it doesn't print anything. I will be loading four
> similar files in the same way to be used in calculating shipping.
>
> I've looked in books, but they don't have examples of this. I'm not
> getting the relationship between the %shipping and @SHIP and the $ship.
> Any help would be appreciated.
>
> Thanks,
>
> Daniel
>
> open (SHIPDB, "$basepath$delim$shipdb1") || die "Can't open file\n";
> while(<SHIPDB>){
> @shp1 = <SHIPDB>;
> # $test1{$weight1} = $rate1;
> }
Here, you seem to be confusing two different methods of reading from a file
handle.
1/ while (<SHIPDB>)
{
# Each line of SHIPDB in turn gets put in $_
# for you do do something with.
# You could, for example, do
push @shp1, $_;
# which would build an array called @shp1 where each
# element of the array is one row from SHIPDB.
}
2/ @shp1 = <SHIPDB>;
This is a simpler way to do the above. Again each element of @SHIP will
contain one row from SHIPDB. You don't need to put this in a while loop. It
does it all in one statement.
> close(SHIPDB);
> # @shp1 = keys %shipping1;
> while(($weight1,$rate1)=each %shp1){
> # print "$weight1=$rate1 %shipping1\n";
> #}
> # foreach $ship (@shp1) {
> @shp1 = split(/\|/,$ship);
> # print "$shp1[0] $shp1[1]\n";
> print "$weight1 $rate1\n";
> }
> print "</b>\n";
> if ($multiship eq 1) {
> #open (SHIPDB, "$basepath$delim$shipdb2");
> #close(SHIPDB);
> #foreach $ship (@SHIP) {
> # my(@ship2)=split(/\|/,$ship);
> # }
> #open (SHIPDB, "$basepath$delim$shipdb3");
> #close(SHIPDB);
> #foreach $ship (@SHIP) {
> # my(@ship3)=split(/\|/,$ship);
> # }
> #open (SHIPDB, "$basepath$delim$shipdb4");
> #close(SHIPDB);
> #foreach $ship (@SHIP) {
> # my(@ship4)=split(/\|/,$ship);
> # }
The rest of these samples don't work because you're using an array called
@SHIP which you haven't assigned anything to (at least not in the code that
we've seen here).
hth,
Dave...
--
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: Thu, 19 Nov 1998 16:10:36 GMT
From: dave@mag-sol.com
Subject: Re: How to call a cgi from html files automatically
Message-Id: <731ftb$gb5$1@nnrp1.dejanews.com>
In article <36540532.78346564@ftk.de>,
Frank Grocholl <fgrocholl@ftk.de> wrote:
>
> --------------A95727AEAE4A003886E5C0DB
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: 7bit
Please don't do that. This is a text-based newsgroup. Many regular (and
extremely knowledgeable contributors automatically killfile messages with MIME
attachments)
> Hello,
>
> is it possible, to call an cgi automatically from an html-file?
>
> Description:
>
> I've got a cgi that generates a calender, which will be used on three
> different servers.
> Now I want to write an html-file with an insert-point or something like
> that calls the cgi.
> It should work like "Webbot" Include from Frontpage.
>
> Could anybody help me fast???
Porpbably what you want is server side includes. Most web servers support
them. You need to ensure that they are enabled on your server. Then you can
put code like <--! exec cgi calendar.pl --> in your HTML file and the output
of the cgi script will be put at that point. You may have to rename your html
file to something.shtml in order for the server to know it has more work to
do.
This is off topic for a Perl group you should ask in the CGI group or (better)
the group for your web server.
hth,
Dave...
--
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: Thu, 19 Nov 1998 16:35:05 +0100
From: "Casema" <ours@casema.net>
Subject: how to execute
Message-Id: <731dua$12m$1@sun4000.casema.net>
Hi Helping hands,
I made this tiny little script, called stats.pl which I want executed
everytime someone requests a document.
It puts the requester's IP, Date, Time, Colordepth, Screenresolution and
platform in a database and returns no html at all. Just does as stated.
How do I call this script?
So
<HTML>
<HEAD>
<TITLE>
Testpage
</TITLE>
</HEAD>
<BODY>
This is a test page for statistics
</BODY>
This should call the stats.pl script...... how is that done?
Thanks a zillion,
Michel
------------------------------
Date: Thu, 19 Nov 1998 16:08:32 GMT
From: stevestock@my-dejanews.com
Subject: Re: Install Errors: 5.005_02 on Solaris 2.6 system
Message-Id: <731fpf$g64$1@nnrp1.dejanews.com>
In article <72f37f$4f3$1@nnrp1.dejanews.com>,
jimrsmith@unn.unisys.com wrote:
> I have a new server to build. e-3000 running Solaris 2.6.
> I installed the optional C compiler (4.2).
>
> I run Configure using defaults except for target directories. Whan I run
> make, I get the following Results: Does anyone have a suggestion ?
[bunch of stuff removed, we don't really need it]
> # make
> make: Warning: Both `makefile' and `Makefile' exist
> `sh cflags libperl.a miniperlmain.o` miniperlmain.c
> CCCMD = cc -DPERL_CORE -c -DX -O
> "./perlvars.h", line 21: invalid token: ##
> "./perlvars.h", line 21: undefined or not a type: PL_
> "./perlvars.h", line 21: syntax error before or at: Gcurinterp
> "./perlvars.h", line 21: warning: old-style declaration or incorrect type for:
> Gcurinterp
[more stuff removed]
Make sure that you're using the correct C compiler. I'd guess that perl
found Sun's workshop C compiler when it was configured, but when you ran make
/usr/ucb/cc was in your path first (it doesn't seem to be able to deal with
the perl .h files). Just make sure /opt/SUNWspro/bin is in your path before
/usr/ucb.
Steve Stock
steve@stocknet.ml.org
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 19 Nov 1998 16:22:40 GMT
From: *ace*@programmer.net (Thomas Jordan)
Subject: Re: Need equivalent to a sh's export command.
Message-Id: <36544480.695855837@news.alpha.net>
Hi Dave:
On Thu, 19 Nov 1998 09:17:22 GMT, dave@mag-sol.com wrote:
>In article <36532a40.623599749@news.alpha.net>,
> *ace*@programmer.net (Thomas Jordan) wrote:
>> How do you modify the parent shell's environment?
>>
>> $ENV{CVSROOT}="/cvsroot";
>>
>> only changes the variable in the perl process.
>>
>> The following:
>>
>> system('export CVSROOT=/cvsroot');
>>
>> doesn't seem to work either.
>
>You can't. This is nothing to do with Perl, but a feature of the operating
>system. In general a child process can't alter the environment of its parent.
>
>(You can't do it in the shell either. The export command you were trying makes
>the variable available to child processes, not the parent.)
Ok.
I was confusing export with bash's source command.
Given a file like .profile, you can mod it and then do:
. ~/.profile
and all of the export commands get reflected into the
calling process' environment.
I'm trying to do the same thing by calling a perl script
but source it's environmental changes into the calling process.
tia,
-- Tom.
===================================================
Thomas Jordan
mailto:ace -at- programmer.net
no-spam:replace -at- with @
------------------------------
Date: Thu, 19 Nov 1998 15:08:09 +0000
From: Vitor Varalonga <vpedrosa@ccg.uc.pt>
Subject: Need HELP: PerlScript
Message-Id: <36543459.F9927C1@ccg.uc.pt>
--------------663B855A5CFB961D9896D9C2
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Hi!!
I've been working with Active Server Pages and
I've been programming them with VBScript.
A friend of mine told me about PerlScript and
its advantages over VBScript or JScript.
Can anyone tell me where could I grab some
information concerning PerlScript and concerning
possible changes/upgrades to the Internet Information
Server.
Thanks in advance.
kind regards,
Vitor Pedrosa
--------------663B855A5CFB961D9896D9C2
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<TT> Hi!!</TT>
<BR><TT></TT> <TT></TT>
<P><TT> I've been working with Active Server Pages and</TT>
<BR><TT>I've been programming them with VBScript.</TT>
<BR><TT> A friend of mine told me about PerlScript and</TT>
<BR><TT>its advantages over VBScript or JScript.</TT>
<BR><TT> Can anyone tell me where could I grab some</TT>
<BR><TT>information concerning PerlScript and concerning</TT>
<BR><TT>possible changes/upgrades to the Internet Information</TT>
<BR><TT>Server.</TT><TT></TT>
<P><TT>Thanks in advance.</TT>
<BR><TT></TT> <TT></TT>
<P><TT>kind regards,</TT><TT></TT>
<P><TT>Vitor Pedrosa</TT></HTML>
--------------663B855A5CFB961D9896D9C2--
------------------------------
Date: Thu, 19 Nov 1998 16:16:23 GMT
From: droby@copyright.com
Subject: Re: NT security + IIS + perl
Message-Id: <731g82$grh$1@nnrp1.dejanews.com>
In article <72v238$8ub@news.service.uci.edu>,
"Josh Burley" <jburley@uci.edu.NOSPAM> wrote:
> Yea, I looked there already. Unfortunately, that particular FAQ deals almost
> primarily with a UNIX-based webserver. I'm using IIS. The first thing I
> thought of was that the user that perl.exe or perlIs.dll runs as a user that
> does not have read permissions... the problem is, it seems to work fine when
> anonymous access is allowed. I need people to log in to the section first,
> and then be able to run the programs.
>
> I give my user/group "Full Control" to the directory and the files, but it
> just won't execute the files.
>
It's somewhat Unix-centric in the sample answers to the questions, but most
of the questions have meaning on NT. The point of the document is that you
should ask yourself all the questions and find the answers specific to your
platform. The answers will be similar to those in the document but rephrased
for NT/IIS.
The user that the IIS server sets to running CGI appears not to have the
permissions needed. You need to answer question 3 in the "Idiot's Guide".
You'll likely get better help on finding the answer to that and in general on
how to set up your IIS server by looking for help from people who deal with
that specifically. The group microsoft.public.inetserver.iis and/or the
group comp.infosystems.www.servers.ms-windows would likely be appropriate.
If you get the server working properly and then have trouble with your Perl
programming, bring those Perl programming questions here - we're better at
handling those.
> And, hey! I _like_ Python!
Well then, perhaps you should ignore what I suggested above and just post your
IIS questions in comp.lang.python. Don't tell them I sent you.
--
Don Roby
droby@copyright.com
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 19 Nov 1998 07:23:15 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Perl Array Question? Anybody...
Message-Id: <MPG.10bdd7b9ea0f7264989915@nntp.hpl.hp.com>
[Posted to comp.lang.perl.misc and copy mailed.]
In article <730e5s$keb$1@nnrp1.dejanews.com> on Thu, 19 Nov 1998
06:34:36 GMT, Patrick Timmins <ptimmins@netserv.unmc.edu> says...
...
> if (@{$type{$header}{$key}} eq undef) {
This produces a warning if the '-w' flag is set. A more canonical way
of stating this might be:
unless (defined(@{$type{$header}{$key}})) {
...
> foreach (@rest) {
> push @{$type{$header}{$key}}, $_;
> }
This is correct, but this seems better:
push @{$type{$header}{$key}}, @rest;
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 19 Nov 1998 09:44:44 -0600
From: "Mark Wright" <markscottwright@hotmail.com>
Subject: Perl script to automatically find dependencies
Message-Id: <36543cf2.0@news2.uswest.net>
I'd like to be able to use perl without installing the full (20 meg)
package. I'm using the win32 package, and it appears that if I
install perl.exe, perl.dll and cw3230mt.dll, I've got all the
executable code I need. Now all I need is a way to recurse the
'require' statements to get the list of perl scripts/libraries I need
for my application. Is there a perl script that will do this
automatically for me?
mark.
---
Mark Wright
Blue Frog Software, Inc
mwright@pro-ns.net
------------------------------
Date: 19 Nov 1998 17:54:55 +0100
From: terra@diku.dk (Morten Welinder)
Subject: pod2man and Y2K
Message-Id: <731igv$mlk@tyr.diku.dk>
Is it just me, or is the pod2man converter broken? It contain this
code, that will invent "Year 100" in about 400 days.
-----------------------------------------------------------------------------
sub makedate {
my $secs = shift;
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($secs);
my $mname = (qw{Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec})[$mon];
return "$mday/$mname/$year";
}
-----------------------------------------------------------------------------
Morten
(Please CC responses. My news feed is currently suffering outages and
dejanews searching for responses is sub-optimal.)
------------------------------
Date: Thu, 19 Nov 1998 09:16:35 -0600
From: Jeff Mallinger <mallinger_jeff/mtks@mtks.cargill.com>
Subject: problem with a sub-routine returning values
Message-Id: <36543653.5677@mtks.cargill.com>
Hi,
I have a PERL problem I was wondering if any of you had ran into before...
As you may already know, you can run a customized sort by using the built in sort() function: done
w/ the line...
@newarray = sort my_function @oldarray;
The sort function is happy when you do your comparing and simply return a (-1,0, or 1 ... ie. <=>)
I have created a my_function routine which works just fine, with one exception: it calls another
function from the Date::Manip library - of which also has a return statement (of course, not in the
simple -1/0/or 1 format which sort is requiring).
What is happening is that sort is picking up the Date::Manip return value & croaking because it's
not the -1, 0, or 1 value that it is expecting.
Is there a way I can make the Date::Manip return value transparent to the sort function & keep it
local to my_function() ?
Thanks for you help (in advance) -j
------------------------------
Date: 19 Nov 1998 11:34:43 -0500
From: James Cameron <james@MatadorDesign.com>
Subject: Problem with using Crypt with Perl on Windows NT
Message-Id: <x767cb1w0s.fsf@server.matadordesign.com>
Hi,
We've come across an error message we have never seen before. Someone
installing our web calendar software (WebEvent) had problems when it
tried to create the username and password. We use the built-in crypt
function and they received an error message along the lines of:
crypt is not installed due to excessive paranoia
Does anyone know exactly where this error message is coming from and
the best solution?
Thanks for any and all your help.
-James Cameron
Matador Design, Inc.
http://www.MatadorDesign.com
------------------------------
Date: 19 Nov 1998 10:17:05 -0500
From: dblack@pilot.njin.net (David Alan Black)
Subject: Re: programing fun: trees: FlattenAt
Message-Id: <731cph$4ut$1@pilot.njin.net>
Hello -
"Xah" <xah@best.com> writes:
>This week's fun on programing trees: Write the function FlattenAt.
>Here's the specs:
>#_____ FlattenAt _____ _____ _____ _____
>=pod
>B<FlattenAt>
>FlattenAt(tree, positionIndex) returns a modified version of given tree
>where the node (subtree) at positionIndex is moved up to its
>parent generation (flattened).
>Related: Flatten, Sequence, xxxxx.
>Example:
>FlattenAt(['a', ['b']], [1]); # returns ['a', 'b'].
>FlattenAt(['a', 'b'], [0]); # xxxxx returns 0 and prints "Error: position
>[0] of tree has no parts and cannot be flattened".
>FlattenAt([[8,['a']], [3] ], [0]); # returns [8, ['a'], [3] ]
>FlattenAt([ [8, ['a']], [3] ], [0,1]); # returns [ [8, 'a'], [3] ]
Well, here's a stab at it - in the hope of flushing out whoever might
have a really elegant way of doing it:
#!/usr/local/bin/perl -w
sub FlattenAt {
my ($tree, $d) = @_;
my $depth = '[' . (join '][', @$d) . ']';
my $offset = pop @$d;
my $parent = '[' . (join '][', @$d) . ']';
eval "splice \@{\$tree->$parent}, $offset, 1, \@{\$tree->$depth}";
return $tree;
}
my $tree = [ [8, ['a']], [3, ['b', ['c', 'd'], 4], 5] ];
my $flat = FlattenAt($tree, [1,1,1]);
print @{$flat->[1][1]} # prints bcd4
__END__
>This one should be simple. I'll post my solution on Saturday.
>Folks, respond if you like seeing these things, because I'm beginning
>to feel that there's no interest.
Now that you've learned to wrap lines, there might be more response :-)
David Black
dblack@pilot.njin.net
------------------------------
Date: Thu, 19 Nov 1998 09:05:24 -0500
From: "Eric Winter" <ewinter@pop3.stx.com>
Subject: Re: reference problem
Message-Id: <7318nh$e2f@post.gsfc.nasa.gov>
When read in from a file, the characters are just that - characters. If you
want to print the value of the hash element, you are, in essence, executing
code created at run-time. Therefore, you need to use eval().
HTH
Eric
<snip>
>But if I do the following:
>
>$hash{test} = "Fred";
>open INF, "test.dat" or die "$!";
>$line = <INF>;
>chop $line;
>($dummy, $name, $value) = split /\t/, $line;
>print "$value\n";
>
>Where test.dat contains
>fred bill $hash{test}\n
>
>Then I get "$hash{test}" output!
------------------------------
Date: Thu, 19 Nov 1998 14:36:39 GMT
From: cpierce1@mail.ford.com (Clinton Pierce)
Subject: Re: Scope question for Perl
Message-Id: <36542c06.600304802@news.ford.com>
On 18 Nov 1998 22:56:29 GMT, "Allan M. Due" <due@murray.fordham.edu>
wrote:
>Please ignore this post. It was a long day and my wiring seems loose.
>
>John Porter wrote in message <365323FD.EAF97B1E@min.net>...
>
>[snip of all the relevent, meaningful information]
>
>>Get used to declaring all your variables with 'my', and you should be
>>happy.
>
>
>Finally, the seemingly endless search for the source of deep, genuine,
>lasting happiness is at an end. The truth is revealed! No more
>psychotherapy, no more gurus, no more self-help books, no more religious
>retreats, no more beating of breasts and gnashing of teeth. In then end,
>like all fundamental truths, the path to happiness can be summed up in one
>simple word: my.
>
>I tremble in the epiphany.
But you knew this already. From the time you were first able to speak
you knew this. Toddlers don't get depressed, they don't get ulcers,
they don't have heart conditions. They discover this simple truth early
on. First is "Mama", then probably "Dada", maybe "Cookie" or "toy".
And then they discover how to keep their happiness:
"MINE!"
"MINE!"
"MINE!"
Repeat as necessary until the other functions leave your varibles alone.
------------------------------
Date: Thu, 19 Nov 1998 10:52:25 -0500
From: Seth Gordon <sgordon@kenan.com>
Subject: Re: Scope question for Perl
Message-Id: <36543EB9.52D6EDFA@kenan.com>
"Allan M. Due" wrote:
> In then end,
> like all fundamental truths, the path to happiness can be summed up in one
> simple word: my.
Ayn Rand would be proud.
--
perl -le'$m="r 0rJaa.u0cksthe";$c=967150;s/$/substr$m,($i\
+=$c%2?4:1)%=16,1or$i-2?"no":"Perl h"/e while$c>>=1;print'
== seth gordon == sgordon@kenan.com == standard disclaimer ==
== documentation group, kenan systems corp., cambridge, ma ==
------------------------------
Date: Thu, 19 Nov 1998 15:46:32 +0100
From: "Ronald Gvggel" <rgoeggel@atos-group.com>
Subject: Re: selective list assignment?
Message-Id: <731bc8$2e0$1@news.pop-stuttgart.de>
Marty Landman schrieb:
>
> I want a 'pretty' way to assign selective variables from a list, i.e. I
> want to code the equivalent of
>
> ($not1,$not2,$not3,$hh,$mm,$ss,$zz) = `date`;
>
(undef, undef, undef, $hh, $mm, $ss, $zz) = `date`;
or
($sec, $min, $hour, undef, $mon, $year) = localtime;
Ronald
------------------------------
Date: Thu, 19 Nov 1998 15:20:58 +0100
From: Guido Steiner <str@zhwin.ch>
Subject: use WIN32::OLE experience with MATLAB ??
Message-Id: <3654294A.E446BD09@zhwin.ch>
I realy hope, that somebody reads this.
I try to start the MATLAB command window. Well starting the application
with
$obj= new Win32::OLE 'Matlab.Application' || die "CreateObject : $!";
works, but the MATLAB window just appears in the taskbar and it is not
possible to verify for example the following command
$result=$obj->Execute("surf(peaks)")
This script fragments do not provokate any errors, but the launched
application doesn't stay on top and herewith visible.
Is there anybody who has got experience with the Win32::OLE preferably
in connection with Matlab ?
Which commands do I have to use, when I want to get a visible command
window ? In general : is that possible or do I have to apply a differnt
method ?
Any help would be most appreciated.
Many thanks for answers and
best wishes to everybody reading this and who is programming scripts
with PERL !!
Guido
------------------------------
Date: 19 Nov 1998 15:00:36 GMT
From: bbirthisel@aol.com (Bbirthisel)
Subject: Re: Win16 DLL access (on NT) Help!!!
Message-Id: <19981119100036.25774.00000065@ng150.aol.com>
Hi Andrey:
>How do I access Win16 DLLs from Perl (on Win'95 or WinNT platform) ?
>Will Win32API do it?
Yes. Make sure you get the binary which matches your perl version.
For 5.005, the Activestate site. For 5.003/5.004, Aldo Calpini's site. Works
on Win95, Win98 and NT.
Module is "Win32::API". "Win32API" is a CPAN Namespace.
-bill
Making computers work in Manufacturing for over 25 years (inquiries welcome)
------------------------------
Date: 12 Jul 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 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
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 4255
**************************************