[10266] in Perl-Users-Digest
Perl-Users Digest, Issue: 3859 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Sep 30 15:08:41 1998
Date: Wed, 30 Sep 98 12:00:18 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 30 Sep 1998 Volume: 8 Number: 3859
Today's topics:
Amsterdam.pm meeting 6th October <l.brocard@elsevier.nl>
Re: an observation on why python will fail <meo@rru.com>
associative array collisions <sandy@nervana.montana.edu>
Re: BANIP <webmaster@fccjmail.fccj.cc.fl.us>
error loading a perl module teds@intex.com
Re: Getting thePerl script's directory name jesten@wdynamic.com
Re: Getting thePerl script's directory name <95ncp@eng.cam.ac.uk>
How to make the MAKE! ??? dragnovich@my-dejanews.com
Job: Web Application/Tools Developer, Newton, MA <jobs@texterity.com>
Re: KDE v. Gnome <harman@omsi14.omsi.com>
Re: LDAP FTP authentication (Peter Scott)
Re: mod_perl configuration (brian d foy)
Re: Need IP Address Sort Subroutine <uri@camel.fastserv.com>
Re: Need IP Address Sort Subroutine <jdporter@min.net>
Re: Need IP Address Sort Subroutine <jdporter@min.net>
Re: Need IP Address Sort Subroutine <uri@camel.fastserv.com>
Re: Need IP Address Sort Subroutine <jdporter@min.net>
Re: new term for illogical <eashton@bbnplanet.com>
Re: Perl Training (Derek G Jones)
Probably an easy Image vs Test question <cochise@sky.net>
Solution found: untie() and flock( LOCK_UN ) gotcha (Tramm Hudson)
Re: SRC: encrypt your Perl scripts! :-) droby@copyright.com
Re: SRC: encrypt your Perl scripts! :-) <eashton@bbnplanet.com>
Win32 <f.leefarr@zetnet.co.uk>
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 30 Sep 1998 17:58:54 +0000
From: Leon Brocard <l.brocard@elsevier.nl>
Subject: Amsterdam.pm meeting 6th October
Message-Id: <3612715E.F344834A@elsevier.nl>
Op dinsdag 6 oktober aanstaande, om 19:00 wordt in caf Maximiliaan in
Amsterdam de 2e Perl Mongers meeting gehouden.
Voor meer informatie, zie de Amsterdam Perl Mongers website op
http://amsterdam.pm.org/
Tijdens de meeting komt er in elk geval een "guru-sessie", waarin vragen
gesteld kunnen worden aan de aanwezige lokale perl guru of gurus. Voor
eventuele verdere activiteiten, zie de website.
***
The 2nd meeting of the Amsterdam Perl Mongers will take place at
7pm on Tues 6th October in Maximiliaan Cafe, Amsterdam.
For more information, check out the Amsterdam Perl Mongers website
at http://amsterdam.pm.org/
During the meeting a "guru session" will take place, where
you can ask our Perl gurus any question. For further activities,
please check the website.
Contact address: monger@amsterdam.pm.org
Come and join us!
Leon
--
Leon Brocard...............................................Perl Hacker
l.brocard@elsevier.nl...........................http://www.astray.com/
... The penalty for bigamy is having two mothers-in-law.
------------------------------
Date: Wed, 30 Sep 1998 11:39:04 -0500
From: Miles O'Neal <meo@rru.com>
Subject: Re: an observation on why python will fail
Message-Id: <36125EA8.5000F1CA@rru.com>
spam, wonderful spam!
I hate spam.
And that's why, ultimately,
python will fail.
-M
------------------------------
Date: Wed, 30 Sep 1998 10:12:58 -0700
From: Sandy Pittendrigh <sandy@nervana.montana.edu>
Subject: associative array collisions
Message-Id: <3612669A.527D4C54@nervana.montana.edu>
How does the hashing of associative array labels
work in perl?
What the chances that two unique labels will
hash to the same address?
--
/* Sandy Pittendrigh >--oO0>
* sandy@nervana.montana.edu
* http://www.nervana.montana.edu/~sandy
*/
------------------------------
Date: Wed, 30 Sep 1998 13:03:56 -0400
From: "Bill Jones, FCCJ Webmaster" <webmaster@fccjmail.fccj.cc.fl.us>
Subject: Re: BANIP
Message-Id: <3612647C.7FB899C7@fccjmail.fccj.cc.fl.us>
Marc Bissonnette wrote:
>
> Unless the HTML page being called was in fact being read by the CGI itself,
> i.e., change your root page to index.cgi and do the Perl/IP checking before the
> HTML is displayed (Assuming his server supports using index.cgi as a default
> document)
Hmm, then it would not be calling an HTML page, it would
be calling a CGI...
-Sneex-
__________________________________________________________________
Bill Jones FCCJ Webmaster | http://www.fccj.org/cgi/mail?webmaster
__________________________________________________________________
We are the CLPM... Lower your standards and surrender your code...
We will add your biological and technological distinctiveness to
our own... Your thoughts will adapt to service us...
...Resistance is futile...
------------------------------
Date: Wed, 30 Sep 1998 18:34:56 GMT
From: teds@intex.com
Subject: error loading a perl module
Message-Id: <6uttkg$1pd$1@nnrp1.dejanews.com>
Hi,
I am a newbie to Perl modules. I was trying to create my own using
SWIG and successfully built one (test.pm). I then ran perl and entered
Prompt> perl
use test;
I got an error saying
Can't find 'boot_test' symbol i ./test.dll at line 1
Compilation aborted.
I am running on NT4.0 with Perl 5.003_07.
Thanks for your help.
Ted
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Wed, 30 Sep 1998 15:52:11 GMT
From: jesten@wdynamic.com
Subject: Re: Getting thePerl script's directory name
Message-Id: <6utk3a$lp5$1@nnrp1.dejanews.com>
In article <361155E2.CB719A6E@oxsigen.com>,
Bart Thielges <bart@oxsigen.com> wrote:
> When I write applications that are actually clusters of several
> executables (a main script calls subordinate scripts), I usually
> want to make that cluster relocatable without requiring the user
> to set search paths or special environment variables. In the past
> I have done this by checking a system variable which returns the
> fully qualified path name of the script that is currently running. I
> then strip the directory portion of this path off and use it during
> subsequent calls to subordinate scripts. For example consider
> the following segment of pseudo-code :
>
> $myFileName = getExecutablePath(); # returns full filename for this
> script
> $myDirectory = dirName($myFileName); # returns directory portion
> .....
> system("perl -w $myDirectory/subtask1.pl");
>
> Does anyone know how to do this in Perl ? More specificially,
> how do I do the getExecutablePath() in Perl - I know how do
> do the rest.
>
For portability between different web servers, which do net necessarily return
the same environment variable, I often do this:
use File::Basename;
$dirname = dirname($0);
There are other methods but this has been the most consistent for me.
Jim
Jim Esten, Lead Developer, WebDynamic/
Applications Lead, StarQuest Internet Services
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Wed, 30 Sep 1998 17:24:47 +0100
From: Nigel Parker <95ncp@eng.cam.ac.uk>
Subject: Re: Getting thePerl script's directory name
Message-Id: <Pine.HPP.3.96L.980930172013.15085D-100000@club.eng.cam.ac.uk>
On Wed, 30 Sep 1998 jesten@wdynamic.com wrote:
: In article <361155E2.CB719A6E@oxsigen.com>,
: Bart Thielges <bart@oxsigen.com> wrote:
: > When I write applications that are actually clusters of several
: > executables (a main script calls subordinate scripts), I usually
: > want to make that cluster relocatable without requiring the user
: > to set search paths or special environment variables. In the past
: > [snip]
: > Does anyone know how to do this in Perl ? More specificially,
: > how do I do the getExecutablePath() in Perl - I know how do
: > do the rest.
: >
:
: For portability between different web servers, which do net necessarily return
: the same environment variable, I often do this:
:
: use File::Basename;
: $dirname = dirname($0);
:
: There are other methods but this has been the most consistent for me.
I thought that the following two evironment variables were universally
used:
$script_location = "http://$ENV{SERVER_NAME}$ENV{SCRIPT_NAME}";
You may want to add something to do with the port number using
$ENV{SERVER_PORT}, but this isn't usually necessary.
Cheers.
Nigel
--
Girton College, Cambridge, England, CB3 0JG. Tel: 0411 384803
http://welcome.to/nigels nigel.parker@iee.org
------------------------------
Date: Wed, 30 Sep 1998 15:56:35 GMT
From: dragnovich@my-dejanews.com
Subject: How to make the MAKE! ???
Message-Id: <6utkbj$mat$1@nnrp1.dejanews.com>
Ok folks !! Im back! I have perl for win (ActiveState) and I whant to install
somo modules like ::LZH, and ::FILTER but!
It say in the installing intructions it's easy! just type :
perl MakeFile.PL (I type it ! AND WORKS!!! YEA!!!)
make (command not found =4( BBbbbuuuuaaaaaa )
make install (command not found =4( BBbbbuuuuaaaaaa )
make test (command not found =4( BBbbbuuuuaaaaaa )
Ok ! Lets donwnload the Make program!
I download the GNU make distriobution !! YES!!
HoHo !!! it requieres the GNU gcc ! to compile in MSDOS/Windows !
But I try to find it and there is not GNU gcc or a Shareware, freeware, or
someting in the net! soo how can I compile it ?? Note I dont have ANY C
compiler If you know something that can substitute and the modification, it
will be very helpfull for me. (please send URL's! for that!)
------------------------
Juan Carlos Lopez
QDesigns President & CEO
http://www.qdesigns.com
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Wed, 30 Sep 1998 14:07:38 -0400
From: Jobs <jobs@texterity.com>
Subject: Job: Web Application/Tools Developer, Newton, MA
Message-Id: <3612736A.B41AFEEF@texterity.com>
Web Application/Tools Developer
Texterity is a fast-growing, development and consulting company
specializing in SGML/XML tools and services including DTD preparation,
work-flow analysis, conversion systems and services and editorial and
production systems. Texterity has designed and implemented large-scale
network-based publishing and editorial production systems. Texterity
is actively moving into the pay-per-use product market targeted at the
emerging XML sector. We are seeking a software developer to help
mature,
improve and polish our already successful application set and
participate
in developing the next successful solutions for us.
This is an opportunity to work in a small company where you will be
a strongly valued resource with a great deal of freedom to design and
build applications and tools. You need to be self-sufficient and
willing
to learn while having the strong roots and knowledge base to succeed in
that environment. We are looking for someone with a few years of
valuable
experience, and are willing to mentor the right candidate where needed.
We are extremely focused on reusable technology and elegant solutions
while keeping a strong eye on efficient work practices. We are a young
and energetic company looking for enthusiastic employees.
Required skills:
* 2-3 years Unix/Linux experience
* 2-3 years web server/CGI and HTML development experience
* 2-3 years programming experience with Perl, Java, Bourne Shell
Desirable skills:
* SGML knowledge (read/understand DTDs, instances, concepts)
* experience with SGML tools (nsgmls, OmniMark, Author/Editor)
* programming experience in Scheme, X-Windows, C, JavaScript, Lisp
* knowledge/experience with e-Commerce systems, security, transaction
processing
* knowledge/experience with text processing/parsing systems and
conversion techniques
* knowledge/experience with object-oriented databases
* knowledge/experience with composition systems
Texterity offers competitive salaries and benefits including a 401k
plan. For consideration, please send a resume to:
jobs@texterity.com
- or -
Texterity Inc.
233 Needham Street
Newton, MA 02464
Attn: Jobs
FAX: 617-527-1929
------------------------------
Date: 30 Sep 1998 10:51:52 -0700
From: Harmanjit Singh <harman@omsi14.omsi.com>
To: David Kastrup <dak@mailhost.neuroinformatik.ruhr-uni-bochum.de>
Subject: Re: KDE v. Gnome
Message-Id: <xfg3e99xzd3.fsf@omsi14.omsi.com>
David Kastrup <dak@mailhost.neuroinformatik.ruhr-uni-bochum.de> writes:
> Actually, I have just looked at the documentation coming with Perl.
> While containing sort of an introduction to Perl, a reference of
> available functions and a reasonably complete syntax seems to be
> absent.
man perlfunc, man perlsyn worked for me.
> Correct me if I'm wrong, I'd certainly would like to learn Perl as it
> is an often used language. I'd certainly like to know if there is an
> answer to my requirements short of buying some book. If there isn't,
> it seems that RMS was not so wrong about the status of good, free
> documentation still being needed for Perl.
>
I learned basic perl from a freely available 10k tutorial on the web and
later referred to perlfunc, perlop and perlsyn manpages whenever I
wanted to learn. Also, I looked at other people's code.
I tried to read the Camel book and found it much too verbose for my
purpose. Man pages etc. can be searched and are supposed to be for
reference, and hence, seem far more useful for my kind of needs.
I do think that is how one should learn a language. As in K&R, the
first chapter exposes one to almost all the basic features of the
language and then one can go on at one's own pace. Perhaps camel's
first chapter does the same, but the same purpose is served by
numerous tutorials on the web.
--
With Warm Regards,
Harmanjit Singh.
http://harman.home.ml.org
------------------------------
Date: 30 Sep 1998 18:27:55 GMT
From: psl@euclid.jpl.nasa.gov (Peter Scott)
Subject: Re: LDAP FTP authentication
Message-Id: <6utt7b$g8d@netline.jpl.nasa.gov>
> Does anyone know of a way to authenticate FTP access
> against an LDAP.
Assuming you somehow have an FTP daemon which can execute Perl
code through some kind of authentication hook, check out the
Net::LDAPapi module on CPAN.
--
This is news. This is your | Peter Scott, NASA/JPL/Caltech
brain on news. Any questions? | (psl@euclid.jpl.nasa.gov)
Disclaimer: These comments are the personal opinions of the author, and
have not been adopted, authorized, ratified, or approved by JPL.
------------------------------
Date: Wed, 30 Sep 1998 13:51:47 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: mod_perl configuration
Message-Id: <comdog-ya02408000R3009981351470001@news.panix.com>
Keywords: from just another new york perl hacker
In article <6utl92$n8n$1@nnrp1.dejanews.com>, intuitiveknowledge@yahoo.com posted:
>Your advice works fine for me. Could you explain what exactly PerlSendHeader
>is? I looked at the Apache doc and nothing was written there... Thanks in
>advance.
PerlSendHeader will take your minimal HTTP header and turn it into
a complete HTTP response header so you don't have to fool with it.
however, if you are doing that with something else too (CGI.pm, etc.)
then things will get confused.
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers needs volunteers! <URL:http://www.pm.org/to-do.html>
------------------------------
Date: 30 Sep 1998 12:17:52 -0400
From: Uri Guttman <uri@camel.fastserv.com>
Subject: Re: Need IP Address Sort Subroutine
Message-Id: <sark92ltw0f.fsf@camel.fastserv.com>
>>>>> "MR" == Michal Rutka <erhmiru@erh.ericsson.se> writes:
MR> [...]
>> use Memoize; sub pack_split { pack("C4",split(/\./,shift)) }
>> memoize 'pack_split'; @ips_sorted = sort { pack_split($a) cmp
>> pack_split($b) } @ips;
>>
MR> Hym. Never heard about Memorize. It is not present in my
MR> distribution.
it's Memoize. no R. and it is on CPAN where all of the rest of perl
resides besides your distribution.
MR> I don't have so much time to follow this group. I have some real
MR> work to do too..
then why are you posting to this group? and john was trying to help you
improve your code and speed. he just had a typo in his schwartzian (se
my earlier followup).
>> > BTW. Your 'Schwartzian' code does not work for me. I.e. lot of
>> uninitialized > values and result is empty.
>>
>> Like I said...
he had a minor bug. the transform is incredibly useful if you would take
the 5 minutes to understand it. it is general purpose and has nothing to
do with IP numbers.
MR> The point is that this thing is not portable, at least it does not
MR> work on my Sparc. Therefore I will not bother to learn about
MR> things which can cause compability problems. I put it rather on
MR> the banned syntax list. The same counts for integer conversion.
it works on all perls. study it. it will save your job some day.
and what do you mean by integer conversion being banned syntax?
uri
--
Uri Guttman Fast Engines -- The Leader in Fast CGI Technology
uri@fastengines.com http://www.fastengines.com
------------------------------
Date: Wed, 30 Sep 1998 13:27:03 -0400
From: John Porter <jdporter@min.net>
Subject: Re: Need IP Address Sort Subroutine
Message-Id: <361269E7.CF04E3B9@min.net>
For anyone who may be interested...
I have performed some benchmarks, and based on the results,
I make the following observations.
1. Michal gave the following formula for converting a dotted-quad
string into a string of four chars:
pack( "C4", split(/\./,$_) )
This is so fast that memoization has no effect.
2. The canonical way to do this conversion is:
inet_aton($_)
And it's about as fast.
3. Uri suggested using inet_ntoa to convert the sorted strings
back into dotted-quad notation:
map { inet_ntoa($_) } sort map { inet_aton($_) }
But my benchmarks indicate that this is about 18 times slower
that either of the above.
4. Using he Schwartzian Transform adds a TON of overhead no matter
what else you do, including memoize.
BTW, I had an error (bug) in my ST, which Michal ran into,
but didn't know how to diagnose.
This is how it should have looked:
@ips_sorted =
map { $_->[0] }
sort { $a->[1] <=> $b->[1] }
map { [ $_, dotted_to_int( $_ ) ] } # list REF!
@ips;
The difference is that the first map (that's the LOWER one!)
should have square brackets in it, so that it returns a
list ref, rather than a list of two things.
--
John "Many Jars" Porter
------------------------------
Date: Wed, 30 Sep 1998 13:44:30 -0400
From: John Porter <jdporter@min.net>
Subject: Re: Need IP Address Sort Subroutine
Message-Id: <36126DFE.16838FCA@min.net>
Lack Mr G M wrote:
>
> The sort uses the Orcish Maneuver (see Effective Perl at
> http://www.effectiveperl.com/) so you only call inet_aton once
> per-address, in case you have a lot of them...
The Orcish Maneuver is a nice idea.
It's basically what Memoize encapsulates... although Memoize
has lots of other nifty features, like persistent caching
to disk.
By the way, did you benchmark your solution?
I did, and my benchmarks show that the using the or-cache
actually slows down the code a tiny bit -- IN THIS CASE.
Moral: don't assume that techniques intended to speed up your
code necessarily do. use Benchmark;
--
John "Many Jars" Porter
------------------------------
Date: 30 Sep 1998 13:36:30 -0400
From: Uri Guttman <uri@camel.fastserv.com>
Subject: Re: Need IP Address Sort Subroutine
Message-Id: <saraf3htsdd.fsf@camel.fastserv.com>
>>>>> "JP" == John Porter <jdporter@min.net> writes:
JP> For anyone who may be interested...
JP> I have performed some benchmarks, and based on the results,
JP> I make the following observations.
JP> 1. Michal gave the following formula for converting a dotted-quad
JP> string into a string of four chars:
JP> pack( "C4", split(/\./,$_) )
JP> This is so fast that memoization has no effect.
JP> 2. The canonical way to do this conversion is:
JP> inet_aton($_)
JP> And it's about as fast.
JP> 3. Uri suggested using inet_ntoa to convert the sorted strings
JP> back into dotted-quad notation:
JP> map { inet_ntoa($_) } sort map { inet_aton($_) }
JP> But my benchmarks indicate that this is about 18 times slower
JP> that either of the above.
i wasn't trying to speed things up. but i wonder what is slow about
it. if inet_aton is about the same speed as pack/split, then inet_ntoa
must be a pig. maybe an unpack/join would be much faster. john could
you benchmark that and post all the results?
JP> 4. Using he Schwartzian Transform adds a TON of overhead no matter
JP> what else you do, including memoize.
i thought the anon array, derefs, etc were slow. in most cases the
savings on conversions in the sort compare wins with ST. in this case no
conversion and anon array is needed since you can convert on the fly and
still sort.
uri
--
Uri Guttman Fast Engines -- The Leader in Fast CGI Technology
uri@fastengines.com http://www.fastengines.com
------------------------------
Date: Wed, 30 Sep 1998 13:54:10 -0400
From: John Porter <jdporter@min.net>
Subject: Re: Need IP Address Sort Subroutine
Message-Id: <36127042.32518355@min.net>
Michal Rutka wrote:
>
> > > BTW your code do not
> > > work for IP 200.255.255.255. On my machine it returns -1.
> Sorry, typo, it should be 'for IP 255.255.255.255'.
Even so, I get 4294967295 on my machine.
> This is what uname says:
> SunOS erhs86 5.5.1 Generic_103640-08 sun4u sparc SUNW,Ultra-Enterprise
Mine:
SunOS pollux 5.4 generic sun4m sparc
> I don't have so much time to follow this group. I have some real work
> to do too..
I understand.
But the Schwartzian Transform is well worth knowing.
You can read about it in section 4.15 of The Perl Cookbook.
> The point is that this thing is not portable, at least it does not
> work on my Sparc. Therefore I will not bother to learn about things
> which can cause compability problems.
You are wrong to assume that the error you got was a result of
incompatibility. There was simply a bug in my code, which
would have generated an error on *any* machine.
--
John "Many Jars" Porter
------------------------------
Date: Wed, 30 Sep 1998 18:10:54 GMT
From: Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com>
Subject: Re: new term for illogical
Message-Id: <361271BC.A655C7A7@bbnplanet.com>
Uri Guttman wrote:
> i did it on purpose. it got a reaction. i do know her tag well.
A drive-by reesing.
Remember children. HappyFunBall, do not taunt! Parental supervision
required. Not recommended for children under 18. :)
> but i am glad you are using the new term!
I'll submit it to the OED review committee for their consideration to
include it in the vernacular.
e.
"All of us, all of us, all of us trying to save our immortal souls, some
ways seemingly more round-about and mysterious than others. We're having
a good time here. But hope all will be revealed soon." R. Carver
------------------------------
Date: Wed, 30 Sep 1998 15:49:49 +0100 (BST)
From: derek@scuna.dircon.co.uk (Derek G Jones)
Subject: Re: Perl Training
Message-Id: <m0zONZi-000YdMC@scuna.dircon.co.uk>
Hi,
I'd check out Learning Tree International's Perl course as well.
URL: http://www.learningtree.com/us/ilt/courses/431.htm
It's a 4-day course with *LOTS* of hands-on!
Kind regards
Derek
[P.S. I'll admit to a vested interest as I'm the author 8-) . Check out
the "new" section of my web page too for an advanced Perl training course.]
------------------------------------------------------------------------------
Derek Jones SCUNA Computer Consultancy
16 Edgedale Road, Sheffield
Computer Consultant S7 2BQ UK
SCUNA (Systems,C,UNIX,Networking,Advice) Tel: +44 (0)114 255 5524
Email: D.G.Jones@scuna.dircon.co.uk FAX: +44 (0)114 296 7846
http://ourworld.compuserve.com/homepages/scuna Mobile: +44 (0)468 300 025
------------------------------------------------------------------------------
"You're from *Cyberspace*?" "No I'm from Sheffield, I only work in Cyberspace"
------------------------------
Date: Wed, 30 Sep 1998 11:19:03 -0500
From: Steve <cochise@sky.net>
Subject: Probably an easy Image vs Test question
Message-Id: <361259F7.100D@sky.net>
I have been playing around with Perl for a very short time ... so I know
practically nothing.
I have 2 scripts.
Script #1 processes data from a form and sends the results back to the
browser and also saves some data in a text file to be used by script
#2.
Script #2 reads the data file and generates an image.
I would like Script #1 to run Script #2 so that the data in #1 doesn't
have to be placed in the text file.
- Can I include Script #2 (Content Type = Image) in Script #1 (Content
Type = Text) as a subroutine? If so how?
or
- Once Script #1 sends the data to the text file, can I launch Script #2
w/o leaving Script #1? If so ... how?
At the moment I am including in the output from Script #1 the html line
:
"<center><img src='Script #2.cgi' </center><br>";
as the method of getting the image from Script #2 but it comes up with
the previous data until I reload the page.
I'm lost and confused, so if anyone can shed some light on my dilema I
would be grateful.
Steve
------------------------------
Date: 30 Sep 1998 11:30:49 -0600
From: tbhudso@panther.cs.sandia.gov (Tramm Hudson)
Subject: Solution found: untie() and flock( LOCK_UN ) gotcha
Message-Id: <6utps9$e9s$1@panther.cs.sandia.gov>
DB_Filers,
After reading and rereading the DB_File and perltie docs, I
have found the solution to my database corrupting problem!
It is alluded to as the "untie() gotcha", but this case of
it seems to be much worse than the one mentioned.
I have a DBM database that is updated by many parallel processes
forked with my pmap() routine discussed my last posting. They
all call a write_lock() routine to lock the database as well as tie the
hash to it. They then call my unlock() after finishing their work.
However, there existed a race condition between calling unlock()
and the last reference to the tied hash going out of scope. Under
certain conditions the job that had called unlock() would be preempted
before it untied the hash. If I tried to untie the hash in the unlock
routine, -w would tell me that
untie attempted while 1 inner references still exist
So I updated the write_lock routine to return a handle to the
hash reference (ugh!). unlock() accepts this handle, makes its
own reference to the hash, undef's the handle's reference and
then untie's the hash. And -then- it unlock's the file.
The other processes fight it out to get the lock and go about their
business with updating the database, certain that no one is going
to write out the file now.
Wow. What a mess. Does anyone have any better ideas on how to
go about doing this? I've thrown in my code, just for completeness.
I'm not sure if untie'ing %db in unlock() closes all file descriptors
related to it, even the dup'ed one that we store in $db_fh. Yes, I
realize that I should make $db_fh less global, but this is a quick hack
to workaround the race condition. The routines never need more than one
database open at a time, so it works right now.
#/usr/bin/perl -w
use FileHandle;
use Fcntl ':flock';
my $db_fh;
sub write_lock
{
my $db_file = shift;
my %db;
my $db = tie( %db, 'DB_File', $db_file )
or die "Unable to tie $db_file: $!\n";
my $fd = $db->fd;
$db_fh = new FileHandle;
open( $db_fh, "+<&=$fd" ) or die "write_lock: Unable to dup fd $fd: $!\n";
#print "$$: Going for write lock...";
unless( flock( $db_fh, LOCK_EX | LOCK_NB ) ) {
warn "$$: $db_file: Waiting to take exclusive lock\n";
flock( $db_fh, LOCK_EX ) or die "read_lock: flock failed: $!\n";
}
print "$$: Holding exclusive lock on $db_file\n";
return \\%db;
}
sub unlock
{
my $db_ref = shift;
my $db = $$db_ref;
$$db_ref = undef;
untie %$db;
flock( $db_fh, LOCK_UN );
close( $db_fh );
}
__END__
Tramm
--
o hudson@cs.tulane.edu tbhudso@cs.sandia.gov O___|
/|\ http://www.cs.tulane.edu/~hudson/ H 505.266.59.96 /\ \_
<< KC5RNF @ N5YYF.NM.AMPR.ORG W 505.284.24.32 \ \/\_\
0 U \_ |
------------------------------
Date: Wed, 30 Sep 1998 15:47:38 GMT
From: droby@copyright.com
Subject: Re: SRC: encrypt your Perl scripts! :-)
Message-Id: <6utjqq$lki$1@nnrp1.dejanews.com>
In article <6urf5b$10p$1@nnrp1.dejanews.com>,
jesten@wdynamic.com wrote:
>
> ....note that the encryption fails on here documents...
>
> print <<EOF;
>
> becomes...
>
> print <<E
>
encrypt encrypt worked fine for me, and encrypt does contain a here document.
> Otherwise rather nifty....
>
Cute yes. Useful no. But there is a smiley in the subject, so I think that
was the intent.
Where's Tom? Isn't he reading this thread? Flames! I want flames!
--
Don Roby
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Wed, 30 Sep 1998 18:27:02 GMT
From: Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com>
Subject: Re: SRC: encrypt your Perl scripts! :-)
Message-Id: <36127583.2BFCEE65@bbnplanet.com>
droby@copyright.com wrote:
> # Why you'd want to distribute it, modify it, or even use it I can't really
> # imagine. It is not useful at all unless someone has used Greg Bacon's
> # encrypt script, being that this decrypts the product of his program.
> # ;-)
*giggle* Cool. :)
e.
"All of us, all of us, all of us trying to save our immortal souls, some
ways seemingly more round-about and mysterious than others. We're having
a good time here. But hope all will be revealed soon." R. Carver
------------------------------
Date: Wed, 30 Sep 1998 11:44:37 +0100
From: "Fred Leefarr" <f.leefarr@zetnet.co.uk>
Subject: Win32
Message-Id: <6utslb$odg$1@irk.zetnet.co.uk>
Hi all,
A question regarding the use of Perl on both Windows95 and NT4.0
Workstations..
I've installed Perl on both machines, and have tested a simple "print"
program from the command prompt on both. However, when I try to active the
"print" program from an HTML document, I get some strange results;
On Win95, the Perl script contents are simply listed on the screen i.e., the
program didn't execute.
On WinNT, the command prompt flashes up quickly, and then dissappears, with
no error message.
Both PWS and IIS have been configured to make sure the folders containing
the Perl scripts are executable. And I've scoured the FAQs for a solution to
the problem. It's kinda embarrassing to get stuck so early on in my Perl
career! Perhaps I should stick to gardening!
Regards,
Fred.
------------------------------
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 3859
**************************************