[8347] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 1964 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Feb 24 12:38:20 1998

Date: Tue, 24 Feb 98 09:00:28 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 24 Feb 1998     Volume: 8 Number: 1964

Today's topics:
        awk -> Perl on Win32 (Ed Avis)
    Re: CGI with Perl HTTP1.0 501 error <ericlim@pacific.net.sg>
        CGI.pm a part of Perl (was Re: Cookies) (Richard Bellavance)
        Creating files on the server <sgilliar@cmp.com>
        HELP Please - DLL Function <mattdb@syntrillium.com>
    Re: Help: using chop($1) in this script.... (Jeffrey R. Drumm)
    Re: Help: using chop($1) in this script.... <cdkaiser@delete.these.four.words.concentric.net>
    Re: I really need your help. <barnett@houston.Geco-Prakla.slb.com>
    Re: if (-d $filename) in Win32 <Peter.Kruse@psychologie.uni-regensburg.de>
    Re: if (-d $filename) in Win32 (Andrew M. Langmead)
    Re: IIS4 Header problem <Peter.Kruse@psychologie.uni-regensburg.de>
    Re: Job opening for CGI programmer <Jacqui.Caren@ig.co.uk>
        language translation <heather@multilang.com>
    Re: Law-enforcement apps ? <fty@utk.edu>
        musings on autoincrement (Kevin B Cohen)
    Re: musings on autoincrement (Kevin B Cohen)
    Re: Need some advice <putney@visi.com>
    Re: Need some advice <tchrist@mox.perl.com>
    Re: Perl and Databases <Jacqui.Caren@ig.co.uk>
        Phantom Write Operation <dchavez@horizonint.com>
    Re: Problem of passing two hashes to a function ?! Does <Geert.Roovers@POBoxes.com>
    Re: Problem of passing two hashes to a function ?! Does <ebohlman@netcom.com>
    Re: Problem of passing two hashes to a function ?! Does (Clinton Pierce)
        Read on closed filehandle ? <prl2@lehigh.edu>
    Re: Read on closed filehandle ? <prl2@lehigh.edu>
    Re: Safely running one-liners (Steve Linberg)
        Stored Procedures & Win32::odbc <keefner@kinetic.com>
    Re: The Ineffable Tom C. <knoxb@pecc.co.uk>
    Re: Year 10000 Compliance (Binyamin Dissen)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Tue, 24 Feb 1998 15:26:57 GMT
From: epa@datcon.co.uk (Ed Avis)
Subject: awk -> Perl on Win32
Message-Id: <34f2e5d9.17154366@news-direct>

I'm using Perl for Win32 - but it doesn't seem to come with the awk to
Perl translator.

Where can I get this from?

--
Ed Avis


------------------------------

Date: Tue, 24 Feb 1998 22:54:44 +0800
From: Eric Lim <ericlim@pacific.net.sg>
Subject: Re: CGI with Perl HTTP1.0 501 error
Message-Id: <34F2DF34.EF125D28@pacific.net.sg>



Eric Bohlman wrote:

> The most likely cause of your problem is that your mouse is getting hungry
> and running out of energy.  Crumble some cheese on your mousepad each
> night.  It may take a couple of days for your script to start working.
> While you're waiting, you might have fun going over to DejaNews and
> reading the articles in comp.infosystems.www.authoring.cgi.


No much of advise you can give but just plain bullshitting. I had solved it
though. Thanks

--
email : ericlim@pacific.net.sg
Eric Lim




------------------------------

Date: 24 Feb 1998 11:04:36 -0500
From: charlot@CAM.ORG (Richard Bellavance)
Subject: CGI.pm a part of Perl (was Re: Cookies)
Message-Id: <6cur2k$q7@ocean.CAM.ORG>

In article <Eov3zK.Gpx@world.std.com>,
Andrew M. Langmead <aml@world.std.com> wrote:
>
>INSTALLATION
>       CGI is a part of the base Perl installation.  However, you
>       may need to install a newer version someday.  Therefore:
> 
>
>I personally feel it was a poor choice, but apparently the decision
>has been made. "CGI.pm" is now as much of a part of perl as <string.h>
>is a part of C.
>

I feel the same way.  The Perl gurus try very hard to distinguish Perl from
CGI, and then they make CGI.pm part of the base Perl distribution...  Granted,
it's more convenient, especially considering that a lot of new Perl
installations are for CGI programming anyway.  But wouldn't it be a Good 
Thing to "force" new users to go through www.perl.com and CPAN to get it ?
Once there, who knows, they might even see the FAQ !

Richard.
-- 
Richard Bellavance -- charlot@cam.org -- http://www.cam.org/~charlot/
    "All along this path I tread  /  My heart betrays my weary head
     With nothing but my love to save / From the cradle to the grave"
                                 (Eric Clapton, "From the cradle")


------------------------------

Date: Tue, 24 Feb 1998 11:33:12 -0500
From: Steve Gilliard <sgilliar@cmp.com>
Subject: Creating files on the server
Message-Id: <34F2F647.CA487136@cmp.com>

I have a perl program that creates individual
files on the server for each user that enters
data.  I moved this script from one site that had
no problems with creating the individual files
with my login name on the server.  Since I
switched to another UNIX server the files are now
being created with the owner of "nobody".  Is
there a simple way for me to change my program so
that it will create the files with the ownership
that I have for my directories ?

Any help is greatly appreciated.

Steve

*remove the x after com to send email.





------------------------------

Date: 24 Feb 1998 08:24:01 -0700
From: "Matt Bieber" <mattdb@syntrillium.com>
Subject: HELP Please - DLL Function
Message-Id: <01bd4135$9cf02d60$7676400c@primenet.primenet.com>

I'm sure this question has been answered before, but I cannot find info
anywhere. On one of our machines I'm using Perl for Win32 on NT and would
like to call a function from a custom DLL. But I cannot find out how to do
so. Does anyone know of a module or way of importing a function from a DLL
in Perl?

Thanks very much,

Matt


------------------------------

Date: Tue, 24 Feb 1998 14:17:12 GMT
From: drummj@mail.mmc.org (Jeffrey R. Drumm)
Subject: Re: Help: using chop($1) in this script....
Message-Id: <34f2cf72.934205656@news.mmc.org>

On Tue, 24 Feb 1998 13:33:43 +0100, Craig <craig@skybound.demon.nl> wrote:

>Hi,
>
>I'm kind of new to Perl, and I've been using this script below. I can't
>figure out what the chop($1) is there for in line 38 (search_output)
>procedure. I left it out and it worked fine. I'm using Windows 95 and
>Perl5.
>
>Can anybody help?
>
>Greetings, 
>Craig.

(icky code deleted)

Actually, the chop($1) was in the &count_results subroutine, not
&search_output.

And it doesn't do anything at all, other than generate an error message if
you're using the -w flag (but you don't appear to be . . . and you should).

I suspect it's a typo; the $1 should've been a $i, and the chop would remove
the last character from the string (normally a newline in Unix, a CRLF combo in
the DOS/Windows world). chomp() would be safer, removing only whatever $/
(input record separator) is set to.

There are other problems with the script, the most glaring of which is that the
return values of the file open calls aren't checked. Finally, if you're
planning on doing much CGI development, get CGI.pm from:

http://www.perl.com/CPAN-local/modules/by-module/CGI/CGI.pm-2.37b26.tar.gz

-- 
                               Jeffrey R. Drumm, Systems Integration Specialist
                       Maine Medical Center - Medical Information Systems Group
                                                            drummj@mail.mmc.org
"Broken? Hell no! Uniquely implemented!" - me


------------------------------

Date: 24 Feb 1998 16:20:17 GMT
From: Cameron Kaiser <cdkaiser@delete.these.four.words.concentric.net>
Subject: Re: Help: using chop($1) in this script....
Message-Id: <6cus01$9hv@examiner.concentric.net>

Craig <craig@skybound.demon.nl> writes:

>I'm kind of new to Perl, and I've been using this script below. I can't
>figure out what the chop($1) is there for in line 38 (search_output)
>procedure. I left it out and it worked fine. I'm using Windows 95 and
>Perl5.

You mean count_results, right?

>####
>sub count_results {
> foreach $i (@indata) {
>  chop($1);
>  ($name,$city,$province,$country) = split (/\|/,$i);
>  

I think this should be chop($i), not chop($1).

Anyway, you're right, it will probably work fine without the chop ...
if you don't care that $country will have a newline in it. The database
you quote earlier in the script, which I have not quoted here, alas, terminates
records with newlines.

It looks like the script doesn't care about it or not, but if you wanted
to be a little more restrictive about what you chop (chop doesn't care
what the last character is), try chomp($i) instead.

--
Cameron Kaiser
cdkaiser at concentric dot net (it hasn't helped the spam yet though)
*** visit the Spectre Server at www.sserv.com
*** C64 software lives! www.computerworkshops.home.ml.org


------------------------------

Date: Tue, 24 Feb 1998 08:12:30 -0600
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: I really need your help.
Message-Id: <34F2D54E.4BD90746@houston.Geco-Prakla.slb.com>

Seong Y. Kim wrote:
> 
> I have a big problem with my perl sub routine.
> 
> My sub routine will search all of the html files within /home/bunny
> directory that has the names of users.
> After certain numbers of users, the output says "can't open /home/bunny/
> username".   I should be able to open them.
The permissions are set correctly?  The script is being run as you or as
setuid someone else?  Does the script have your access rights, or
someone else's?

> I don't really know what's wrong with my sub routine.  Please help me.
> Thanks.
<snip>

>     else {
>          print "can't open dir $locdir\n";
Including the "$!" variable here might tell you something useful, like
the OS error return code.  "Permission denied" is a rather helpful thing
to known in such a case.


-- 
"Security through obscurity is no security at all."
		-comp.lang.perl.misc newsgroup posting

------------------------------------------------------------------------
* Dave Barnett               U.S.: barnett@houston.Geco-Prakla.slb.com *
* DAPD Software Support Eng  U.K.: barnett@gatwick.Geco-Prakla.slb.com *
------------------------------------------------------------------------


------------------------------

Date: 24 Feb 1998 14:14:39 +0100
From: Peter Kruse <Peter.Kruse@psychologie.uni-regensburg.de>
Subject: Re: if (-d $filename) in Win32
Message-Id: <m3btvx16ww.fsf@arnulf.de>

In my version of CGI.pm (2.36) Lincoln Stein makes some effort to find
out the path separator for different platforms.  Are you saying he
would not have to?

	pete

In article <Eou8JL.5p8@world.std.com> aml@world.std.com (Andrew
M. Langmead) writes: 

> Bill Jones <webmaster@fccj.cc.fl.us> writes:
> 
> >Hmmm, maybe I missed something, but
> >either should work, IE -
> 
> Yes, both Jonothan and myself were agreeing that it would work. My
> correction was just to the statement that "perl fixes" the path
> separator "on all platforms." In truth, Perl just passes the strings
> given to it to the operating system, and the MS-DOS kernel treats
> forward and back slashes iterchagably.
> 
> Then Jonathan said that he didn't understand, COMMAND.COM treats the
> forward slash as a option specifier. I then wrote this post trying to
> explain how COMMAND.COM is not the operating system itself, just a
> program that makes calls to the operating system.
> 
> I'm sorry that my message did not do a good job of explaining my
> point. If you have a moment, could you point out where in my post I
> give the mistaken impression that only forward slashes (or only
> backslashes I'm not sure which one you though I was arguing for) would
> work. If I see where my writing was unclear, it may help me to avoid
> similar mistakes in the future.
> 
> By the way, your code has a bug. Since you put the string c:\Temp in a
> double quoted string, backslash escapes are interpreted. This turns
> "c:\Temp" into the same thing "c:Temp" (Since "\T" is not a known
> escape sequence, the single backslash is simply removed.) This means
> that if you run the code from a directory that has a subdirectory name
> "Temp" then it will work, but the two tests are only equal when the
> script is run in the root directory.
> 
> If your script had used a lower case "t", the bug would have been even
> more apparent. Since it would have turned "c:\tmp" into the
> characters, "c", ":", a tab character, "m", and "p". Since I believe a
> tab characters is not valid in file and directory names under MS-DOS
> and similar Microsoft developed operating systems, it couldn't match
> any directory.
> 
> 
> >#!perl -w
> 
> >print 'I am looking for C:\/(?)Temp' . "\n\n";
> 
> >print 'Found it as C:/Temp!     ' if (-d "c:/Temp");
> 
> >print 'Still there as C:\Temp...' if (-d "c:\Temp");
> 
> -- 
> Andrew Langmead
> 
-- 
-rw-r--r--   1 pete   users   0 Jan  8 16:40 .signature


------------------------------

Date: Tue, 24 Feb 1998 16:14:32 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: if (-d $filename) in Win32
Message-Id: <Eow549.Hyw@world.std.com>

Peter Kruse <Peter.Kruse@psychologie.uni-regensburg.de> writes:

>In my version of CGI.pm (2.36) Lincoln Stein makes some effort to find
>out the path separator for different platforms.  Are you saying he
>would not have to?

No, I'm saying that on Windows either path separator is
acceptable. Sice the list of Operating Systems that CGI.pm checks is
not limited limited to just Windows and Unix, yes, he needs to check.

Also, since the path separator is available as $CGI::SL, and a user
may use it in a call to system() or something that may be infected by
COMMAND.COM. He is probably best off using the one that will cause the
least amount of problems. (Since he has already taken care of the
double backslashing which is the major problem with using the MS-DOS
specific backslash.
-- 
Andrew Langmead


------------------------------

Date: 24 Feb 1998 14:18:57 +0100
From: Peter Kruse <Peter.Kruse@psychologie.uni-regensburg.de>
Subject: Re: IIS4 Header problem
Message-Id: <m3afbh16pq.fsf@arnulf.de>

A better newsgroup for this question would be
comp.infosystems.www.authoring.cgi . I guess you should read about
no parsed headers, since IIS expects all cgi-programs to be
nph-scripts (AFAI).

	pete

In article <34F279D7.FE1E07C1@cepharmacy.snu.ac.kr> cepharm
<webmaster@cepharmacy.snu.ac.kr> writes: 

> 
> Hi. I have a trouble.
> 
> I wrote a BBS CGI on Linux machine. It worked well.
> And one month later, when I tried to use it on WindowsNT(IIS 3.0), I
> experienced failure.
> 
> Netscape showed a dialog saying "will you save this link? or pick an
> application...",
> and MSIE showed MIME header like "Content-type: text/html" at the top of
> document.
> 
> When I told it to my senior, he told me to add "HTTP1.0/ 200 OK" http
> header,
> And I did it, and worked well. At least I thought.
> 
> But..
> 
> Having installed Internet Information Server 4.0, and MSIE 4.0, I
> experienced another
> failure. Netscape 4.0 works well, but MSIE 4.0 showed the header,
> "HTTP1.0/ 200 OK Content-type: text/html " at the top of document.
> 
> Is this the bug of MSIE 4.0 ?
> 
> - scgyong@nownuri.net -
> 
> 
-- 
-rw-r--r--   1 pete   users   0 Jan  8 16:40 .signature


------------------------------

Date: Tue, 24 Feb 1998 15:48:46 GMT
From: Jacqui Caren <Jacqui.Caren@ig.co.uk>
Subject: Re: Job opening for CGI programmer
Message-Id: <Eow3xA.7nD@ig.co.uk>

In article <MPG.f415422f67cfa1298968a@rc.sdstate.edu>,
Daniel Cody <codyd@NOSPAM.cc.sdstate.edu> wrote:
>A position has opened up
>... of VRML, CGI, and ActiveX programming.

So spamming to perl newsgroups is going to help you find this?

>Will need to write 2-4 articles per month 

Ah ha! Another desperate editor/author who wants content...

Try to 

 * advertise in the ads groups ONLY.
 * Stay out of the off-topic groups.
 * Don't post commercial ads from edu addresses.
   It reflects badly upon the institution as they
   are then seen as being associated with your
   misguided activities.

>-- 
>Daniel Cody
>-Webmaster-
>South Dakota State University
>http://marvin.sdstate.edu


-- 
Email: Jacqui.Caren@ig.co.uk  http://www.ig.co.uk/
Fax  : +44 1483 419 419       http://www.perlclinic.com/
Phone: +44 1483 424 424       http://www.perl.co.uk/
Paul Ingram Group Ltd,140A High Street,Godalming GU7 1AB United Kingdom



------------------------------

Date: Tue, 24 Feb 1998 09:18:19 -0700
From: "Heather B. Hamilton" <heather@multilang.com>
Subject: language translation
Message-Id: <34F2F2CB.3E93@multilang.com>

Japanese translation, Chinese translation, Korean translation, and
Arabic translation are Multilang's premiere services for website, email,
and database translation/localization. Perl scripted text is also
possible! 

Multilang uses double-byte operating systems equipped to handle Asian
language characters.  Translations are performed and proofread by native
speakers.  Don't let the language barrier prevent your site from
reaching the rest of the planet.

Multilang's competitive prices cover quality translations and
professional project management.

Visit us at http://www.multilang.com


------------------------------

Date: Tue, 24 Feb 1998 09:42:47 -0500
From: Jay Flaherty <fty@utk.edu>
Subject: Re: Law-enforcement apps ?
Message-Id: <34F2DC66.108CE1C1@utk.edu>

John W. Austin wrote:

> I have found Perl to be much better-suited to my task than 90% of the
> C++ code in this
> application and am curious as  to whether there is anyone else in the
> Perl world-domination conspiracy who is working on law-enforcement
> problems.

 I work for the University of Tennessee - Knoxville and we finished a
project last year funded by CTAC (Counter-drug Technical Assessment Center)
to provide advanced information technology to law enforcement. The first
phase was in West Florida (Tampa/St. Pete's). The idea was to get law
enforcement agencies to share information. We got five county sheriff's
offices connected via ATM and set up secure web servers at each site
connected via this ATM intranet. The applications included:

1. Whosinit - Web Hierarchical Operational Security: INternal InTerface.
This is an application written entirely in perl that controls access to
case files. Case access control is granular. It can be granted to an
individual officer, group (squad), or even groups of groups (division).
Users are defined, added to groups, cases defined and access determined via
the web interface.

2. DataMining - This is a web interface to Wais-sf databases of arrest
narratives written entirely in perl. Access is granted on a case by case
basis via Whosinit. The narratives are written in their word processor of
choice and filtered into text files readable by Wais-sf.

3. Image Archive - Web interface to an online archive of of images
associated with active and closed cases. This application is also written
entirely in perl. Access is controlled via Whosinit on a case by case
basis. Images are viewed, uploaded, thumbnails created, and archived
properly, all via the web interface. Comments can be added by anyone with
access to the image which is then indexed by Wais-sf and searchable via
DataMiner.

4. Link Analysis - a 3D graphical analysis tool used to graphically
represent criminal associations (links) between individuals being
investigated. This is written in C.

We are also working with various organizations to provide secure, wireless,
information networking. This is done via a web interface. We use modified
versions of 1-3 above.

And finally, we are working on developing a web based booking/retrieval
system written almost entirely in perl to be used by law enforcement.
--
**********************************************************************
Jay Flaherty                                               fty@utk.edu
"Once in awhile you get shown the light, in the strangest of places if
you look at it right" - R. Hunter
**********************************************************************




------------------------------

Date: 24 Feb 1998 10:28:55 -0500
From: kcohen@julius.ling.ohio-state.edu (Kevin B Cohen)
Subject: musings on autoincrement
Message-Id: <6cuovn$ilq@julius.ling.ohio-state.edu>


hi, 

just a few thoughts on the autoincrement operator, in the spirit of
sharing what we learn from our little mistakes.

the autoincrement operator, which looks like ++$foo or $foo++, has the
very friendly property of working on strings, as well as on numbers.
you're probably familiar with usage like

    $foo = 5;
    ++$foo; # $foo now = 6

well, the autoincrement operator will also increment alphabetical
values.  thus, you can have code like the following:

    $bar = 'a';
    ++$bar; # $bar now = 'b'

today i needed to mess about with some files, finding text files in a
daughter directory and moving them up to the parent directory.  i knew
that there might be duplicate names, though, so i checked against a
hash of the files i'd found so far before moving any file to its new
location, figuring that if i found a duplicate, i'd change the
filename:
    
    if(exists($hash{$filename})) {
        # change the filename
    }

my filenames are all of the form \d{7}\w.txt---that is, seven digits,
a letter, and the extension ".txt".  this looked to me like a perfect
use for the autoincrement operator.  i figured that i would peel off
the extension, increment the filename, put the extension back on, and
check the hash again:

    until (!exists($hash{$filename})) {
        ($file, $extension) = /(\w+)(\.\w+)/;
        ++$file;
        $file .= $extension;
    }

    # then add its name to the hash, and move it

i expected that something like 0551212A.txt would become 0551212B.txt,
while 0000000j.txt would become 0000000k.txt.  but, that's not what i
got at all.  instead, the new filenames for these examples were
5551213.txt and 1.txt.  yikes!  what happened?

consulting the blue camel book (programming perl, 2nd ed., wall,
christiansen, and schwartz), p. 79, i discovered that my variables
were not of a sort that can be autoincremented the way that i thought
they oughta.  to quote:


"The autoincrement operator has a little extra built-in magic to it.
If you increment a variable that is numeric, or that has ever been
used in a numeric context, you get a normal increment.  If, however,
the variable has only been used in string contexts since it was set,
and has a value that is not null and matches the pattern
/^[a-zA-Z]*[0-9]*$/, the increment is done as a string...."

the salient point here, of course, is that autoincrement wants a
string with letters first, and i fed it something with numbers.  

this is not a complaint---rather, an observation.  in the past i have
been very happy to take advantage of perl's laid-back attitude towards
accepting character-containing strings and treating them like numbers.
(for instance, in perl you can have a scalar containing something like

     $scalar = "5-year-old male asthmatic"

and if you then evaluate it in a conditional, e.g.

   if ($scalar < 18) { $age = "pediatric"}
   elsif ($scalar >= 18) {$age = "adult"}

you'll get the Right Thing, i.e. $age = adult.)

no, not a complaint---just a musing on an obscure point of Perl.

kevin


------------------------------

Date: 24 Feb 1998 10:36:21 -0500
From: kcohen@julius.ling.ohio-state.edu (Kevin B Cohen)
Subject: Re: musings on autoincrement
Message-Id: <6cupdl$iqh@julius.ling.ohio-state.edu>

Two typos/brainos:


In article <6cuovn$ilq@julius.ling.ohio-state.edu>,
Kevin B Cohen <kcohen@julius.ling.ohio-state.edu> wrote:


>my filenames are all of the form \d{7}\w.txt---that is, seven digits,
>a letter, and the extension ".txt".  this looked to me like a perfect

should be \d{7}\w\.txt.   what i originally wrote matches seven
digits, any single thing, and the characters "txt".

>
>you'll get the Right Thing, i.e. $age = adult.)

the Right Thing is not $age = adult, but $age = pediatric.


kevin



------------------------------

Date: Tue, 24 Feb 1998 14:18:19 GMT
From: "Jeffrey S. Putney" <putney@visi.com>
Subject: Re: Need some advice
Message-Id: <34F2D6E6.C9E1E8B7@visi.com>

Brad Grove wrote:
> 
> Hi all
> 
> I am reasonably new to PERL and have managed to develop some rather useful
> scripts for our company web site. We do not have our own server, but use an
> ISP (virtiual server) which probably makes things a little more difficult
> when debugging.
> 
> My problem is this:
> 
> I have developed a bulk emailing script which will read our web database and
> email each of our customers in the database. For each record in the
> database, it simply checks for a valid email address etc and passes the data
> with the results of the form (passed from a browser) to the ISP's mail
> program. It seems to work well except it does not send any response back to
> the browser until the script has completed. If the email list is long, then
> the browser times out and seems to end the script without me knowing just
> what was sent.

Many times the web server will wait until the cgi script exits to
complete the page.  To get around this behavior, you want to return as
quickly as possible.  You might want to try something like:

<Create the entire web page>

if (fork()) {
	exit(0);
} else {
	<check addrs & send email>
}

--Jeff


------------------------------

Date: 24 Feb 1998 14:23:00 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Need some advice
Message-Id: <6cul44$mqs$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    "Jeffrey S. Putney" <putney@visi.com> writes:
:if (fork()) {
:	exit(0);
:} else {
:	<check addrs & send email>
:}

You forgot to deal with your dup'd descriptors.

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com

    Perl programming is an *empirical* science!  
	    --Larry Wall in <10226@jpl-devvax.JPL.NASA.GOV>


------------------------------

Date: Tue, 24 Feb 1998 15:57:47 GMT
From: Jacqui Caren <Jacqui.Caren@ig.co.uk>
Subject: Re: Perl and Databases
Message-Id: <Eow4CB.7qC@ig.co.uk>

In article <6b81mg$p09@su102w.ess.harris.com>,
J. Shawn Pope <jpope@harris.com> wrote:
>I have been teaching myself to write Perl scripts over the past few days.  I am using 
>Perl 5 on UNIX.  I need to query an Oracle database that resides on a Windows NT 
>machine.  I have downloaded a module called Oraperl that can act as an ODBC for 
>databases however, I have been having difficulties understanding it.  Do you have to 
>use a module such as this or can you embedd SQL statements in a Perl script?  

Get the perl build from G. Sarathay's www.perl.com/CPAN/ area.

Look at http://www.hermetica.com/technologia/DBI/ - the home of DBI!

perl, DBI and DBD::Oracle (+Oraperl.pm) will work under both NT and unixen.

You should not need to compile anything, but you will need to install
parts of oracle (client SQLnet etc) and configure things first.

Your other options are

DBD:;ODBC - again unix or NT you then use an ODBC driver to connect to
oracle.

or 
Win32::ODBC - from dave roth's wen site or via CPAN...
This is activestate perl specific and is aimed at providing
full ODBC functionality.

harris.com? I don't know about a Vulcan port or perl or DBI though. :-)

Jacqui
-- 
Email: Jacqui.Caren@ig.co.uk  http://www.ig.co.uk/
Fax  : +44 1483 419 419       http://www.perlclinic.com/
Phone: +44 1483 424 424       http://www.perl.co.uk/
Paul Ingram Group Ltd,140A High Street,Godalming GU7 1AB United Kingdom



------------------------------

Date: Tue, 24 Feb 1998 09:52:07 -0700
From: "Dale Chavez" <dchavez@horizonint.com>
Subject: Phantom Write Operation
Message-Id: <6cutsi$ae0$0@dosa.alt.net>

Hi All,

I'm  using the following code to read variables from a form and then write
them out to an ASCII file.  Everything works great, except that if the user
inputs a hard carriage return in a <textarea> text box, the script creates a
new file file name based on the text from the new line they entered.  For
example, if they hit CR, then type "this is line two", the file created is
called "this is line two.txt".

Any ideas what I've done wrong?

thanks,
Dale

#!/usr/bin/perl
require ("/perl5/bin/cgi-lib.pl");
print "content-type: text/html\n\n";

read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
       @pairs = split(/&/, $buffer);

       foreach $pair (@pairs) {
          ($name, $value) = split(/=/, $pair);
          $value =~ tr/+/ /;
          $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",
          hex($1))/eg;
          $value =~ s/~!/ ~!/g;
          $FORM{$name} = $value;
       }



open(outf, ">test.txt");
print outf "$FORM{'examples'}|$FORM{'comments'}\n";
close(outf);





------------------------------

Date: Tue, 24 Feb 1998 15:02:06 +0100
From: Geert Roovers <Geert.Roovers@POBoxes.com>
Subject: Re: Problem of passing two hashes to a function ?! Doesn't work.
Message-Id: <34F2D2DE.6AB0@POBoxes.com>

hi

This problem is described in "Perl 5 by Example" (There is an on-line
version available at http://www.affy.com/p5be), chapter 8. The solution
appears to be that you put a backslash infront of each hash in the
function call. I cannot test this, because I -still - do not have Perl
5.

Wow... been working on Perl for a week, and already been helpful *L* (no
sarcasm intended)

Greetings,

Geert Roovers


Alfred P. Bartholomai wrote:
> 
> SUBJECT: Problem of passing two hashes to a function ?! Doesn't work.
> 
> [..]The result is that when I pass two hashes to a function. The first hash
> is a composite of the first and second hash. The second hash passed is
> empty.
> Why ?


------------------------------

Date: Tue, 24 Feb 1998 13:59:01 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Problem of passing two hashes to a function ?! Doesn't work.
Message-Id: <ebohlmanEovyuD.GG3@netcom.com>

Alfred P. Bartholomai <apb.freddyb@mailexcite.com> wrote:
: SUBJECT: Problem of passing two hashes to a function ?! Doesn't work.

When you pass two or more hashes or arrays to a function, they get 
"flattened" into a single array.  perldoc perldata followed by perldoc 
perlref will tell you all about this, and also tell you how to use 
references to accomplish what you're trying to do.



------------------------------

Date: 24 Feb 1998 14:05:14 GMT
From: cpierce1@cp500.fsic.ford.com (Clinton Pierce)
To: apb.freddyb@mailexcite.com
Subject: Re: Problem of passing two hashes to a function ?! Doesn't work.
Message-Id: <6cuk2q$qbc1@eccws1.dearborn.ford.com>

In article <34F2D3AD.B2091680@mailexcite.com>,
	"Alfred P. Bartholomai" <apb.freddyb@mailexcite.com> writes:
>SUBJECT: Problem of passing two hashes to a function ?! Doesn't work.
>
> [...]
>
>----------------------------
>The result is that when I pass two hashes to a function. The first hash
>is a composite of the first and second hash. The second hash passed is
>empty.
>Why ?

At least you're descriptive.  And observant.  Too bad not dilligent.

Try the following places:

* The Perl FAQ  (ALWAYS BEFORE POSTING), 'cause this is an FAQ.
  Look for the section entitles "How can I pass/return a..."

* The Perl man pages, specifically perlref.  (Using references.)

* The Camel Book.  Don't have it?  Get it.  Read chapter 4, and two 
  pages into the chapter, you have your answer.  No excuse for posting
  here having not at least browsed the Camel first.

-- 
+------------------------------------------------------------------------+
|  Clinton A. Pierce    |   "If you rush a Miracle Man,   | http://www.  |
|  cpierce1@ford.com    |     you get rotten miracles"    | dcicorp.com/ |
| fubar@ameritech.net   |--Miracle Max, The Princess Bride| ~clintp      |
+------------------------------------------------------------------------+
GCSd-s+:+a-C++UALIS++++P+++L++E---t++X+b+++DI++++G++e+>++h----r+++y+++>y*



------------------------------

Date: Tue, 24 Feb 1998 09:39:30 -0500
From: "Phil R Lawrence" <prl2@lehigh.edu>
Subject: Read on closed filehandle ?
Message-Id: <6cum34$195g@fidoii.cc.Lehigh.EDU>

Can someone help me spot where and why the FH gets closed?

Code:

<snip!>
open TEL_BILL, "</u/blah/perl/blech.lst"
    or die "can't open blech.lst";
my $count = 0;
until ($count == 5) {
    $_ = <TEL_BILL>;
    $count = push @buffer, $_;
}
while (<TEL_BILL>) {    # FH is closed here, error occurs.  Why closed?
    <snip!>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Phil R Lawrence               phone: 610-758-3051
Programmer / Analyst      e-mail: prl2@lehigh.edu
194 Lehigh University Computing Center
E.W. Fairchild - Martindale, Bldg. 8B
Bethlehem, PA  18018
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~





------------------------------

Date: Tue, 24 Feb 1998 10:00:55 -0500
From: "Phil R Lawrence" <prl2@lehigh.edu>
Subject: Re: Read on closed filehandle ?
Message-Id: <6cunb9$1g7c@fidoii.cc.Lehigh.EDU>

Sorry, FH was closed by a sub called from inside the while block (It was
snipped out of the original mssg so no one could have helped me anyway.)

Thanks!

Phil R Lawrence wrote in message <6cum34$195g@fidoii.cc.Lehigh.EDU>...
>Can someone help me spot where and why the FH gets closed?
<snip!>
>while (<TEL_BILL>) {    # FH is closed here, error occurs.  Why closed?
>    <snip!>
>




------------------------------

Date: Tue, 24 Feb 1998 11:16:56 -0500
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: Safely running one-liners
Message-Id: <linberg-2402981116560001@projdirc.literacy.upenn.edu>

In article <6cttr7$arm$1@client3.news.psi.net>, abigail@fnx.com wrote:

> Danny Aldham (danny@lennon.postino.com) wrote on 1638 September 1993 in
> <URL: news:6ctlft$3st$1@lennon.postino.com>:
> ++ X-Newsreader: TIN [version 1.2 PL2]
> ++ 
> ++ A lot of posters here have .sigs that include perl one liners.
> ++ Is there a safe way to run them, and be assured that they wont
> ++ damage and/or erase files?  (or e-mail off my shadow file)
> 
> Just make sure you understand it ;)

I nominate Abigail for best response of the year with this one.  Come to
think of it, I nominate it for best response of next year, too.

-- 
Steve Linberg                  |    National Center on Adult Literacy
Systems Programmer etc.        |           University of Pennsylvania
linberg@literacy.upenn.edu     |        http://www.literacyonline.org


------------------------------

Date: Tue, 24 Feb 1998 15:46:20 GMT
From: "Craig A. Keefner" <keefner@kinetic.com>
Subject: Stored Procedures & Win32::odbc
Message-Id: <34F2E9D5.14D6B845@kinetic.com>

Any ODBC driver should be able to handle stored procedures. For example:

        $db->Sql( " {call StoredProcName( param1, param2, ...)} ");
        $db->Sql( " {call StoredProcName } ");
        $db->Sql( " {?= call StoredProcName(param1)} ");

I only have one question.  Can some of the parameters in the list be
return parameters using win32:odbc?

i.e.

$db->Sql( " {call StoredProcName( param_in1, param_in2, param_out1, param_out2,
param_out3...)}
");

I am running active ware 5.003_07 perl

Craig





------------------------------

Date: Tue, 24 Feb 1998 14:17:44 +0000
From: Brendan Knox <knoxb@pecc.co.uk>
Subject: Re: The Ineffable Tom C.
Message-Id: <34F2D688.4A1B4790@pecc.co.uk>

John Callender wrote:
 
> At the same time, the "value" of Tom's participation in the group for a
> given user varies greatly depending on that user's level of
> sophistication. For newbies, sarcastic one-liners, even if they include
> references to the appropriate manpages, probably do more harm than good
> (unless one defines driving newcomers away from the group as a "good").

Let's face it, you need a sense of humour to use Perl.  Tom's sarcastic
one-liners scare those not robust enough to handle the incredible levels
of humour that Perl can induce.  Besides, anyone who is incapable or
unwilling to even attempt to consult the manpages, or any of the
numerous
online documents about Perl, shouldn't really be using computers.  This
isn't to say that driving newcomers away is good, not all newcomers are
lazy and need to be spoonfed.  

> Personally, I'd rather see him stay. But if he can't take even this much
> heat, he shouldn't be in the kitchen -- and he certainly shouldn't be
> the one turning up the flames on those most susceptible to being burned.

Maybe we should form comp.lang.perl.newbies.  Your opinion will change
when you see such newbies ask the same question week after week.  Why
should any of us have to refrain from being sarcastic to people that
haven't
tried to find out themselves?  Furthermore, if anyone is hurt to the
point
of dismissing Perl and/or this newgroup to sarcasm, then you really have
to
wonder what type of person they are.  Perhaps if they can't take the
heat,
they too should get out of the kitchen.

That said, I understand your opinion, but I don't agree with it.  Most
of the 
newbies in any newsgroup have never taken the time to bother looking at
any 
form of documentation be it manpages, online web pages, textfiles or
books.
If they have tried, I'd be quite amazed, as most of this stuff is easy
to find
and easy to understand.  If it isn't... well that's a whole other rant
about
people being allowed to access programming languages and interpreted
scripting
tools. :>

Cheers,
Brendan


------------------------------

Date: Tue, 24 Feb 1998 16:27:18 GMT
From: Binyamin_Dissen@theoffice.net (Binyamin Dissen)
Subject: Re: Year 10000 Compliance
Message-Id: <34f8d2eb.81126564@news.netvision.net.il>

On Fri, 20 Feb 1998 15:53:11 GMT mkeesan@kenan.com (Morris M. Keesan) wrote:

:>On Fri, 20 Feb 1998 00:45:36 +0100, Colin Dooley <colin@medit3d.com>
:>wrote:
:>>I'm looking forward to the year 10000 problem with interest.


:>>Everybody is spending billions converting their software to use
:>>four digit dates, and they're gonna have to do it all over again
:>>in the year 9999....



:>>Don't laugh! Jewish and Chinese computers must be nearing this
:>>deadline already...

:>It depends on your definition of "nearing".  Jewish computers are in the
:>year 5758 right now, which gives us more than 4000 years before we need
:>to start worrying about Y10K, 

Not a problem. There will be no need for computers come the year 6000, if
indeed we must wait that long.

--
Binyamin_Dissen@theoffice.net
Binyamin Dissen <bdissen@netvision.net.il>


------------------------------

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V8 Issue 1964
**************************************

home help back first fref pref prev next nref lref last post