[8181] in Perl-Users-Digest
Perl-Users Digest, Issue: 1799 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Feb 3 17:12:48 1998
Date: Tue, 3 Feb 98 14:00:30 -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, 3 Feb 1998 Volume: 8 Number: 1799
Today's topics:
A Question <vchandra@mail.delcoelect.com>
Re: A regex problem <Peter.Kruse@psychologie.uni-regensburg.de>
A Scoping Related Question <vchandra@mail.delcoelect.com>
Re: A Scoping Related Question (Chip Salzenberg)
Re: A Scoping Related Question (Chris Nandor)
Advice on my Shopping Cart System <MetatonCSI@worldnet.att.net>
Re: can variables be generated on the fly (Chip Salzenberg)
Re: Crazy Idea (Chip Salzenberg)
Destroying any and all elments of an array.. how? (Jeff)
Re: Destroying any and all elments of an array.. how? (Mike Stok)
Re: Destroying any and all elments of an array.. how? (Abigail)
Good Perl editors <weyus@worldnet.att.net>
Re: Good Perl editors <xxTony.Curtis@vcpc.univie.ac.at>
Re: Good Perl editors <sweiss@best.com>
Re: Help! ~ operator doesn't work! (Chip Salzenberg)
Help: gethostbyaddr() (Phil Romig)
Re: Help: gethostbyaddr() (Chip Salzenberg)
Re: How Do I Tell Whether a Key Is Valid for an Associa (Kevin M Simonson)
Re: How Do I Tell Whether a Key Is Valid for an Associa (Chip Salzenberg)
Re: How write to a file using "format" & "write" ? <xxTony.Curtis@vcpc.univie.ac.at>
Re: How write to a file using "format" & "write" ? <malunjkars@aol.com>
Re: I am female, blonde and stupid! (Chip Salzenberg)
Re: Install ques: perl modules on RH Linux <xxTony.Curtis@vcpc.univie.ac.at>
Re: Install ques: perl modules on RH Linux (Jonathan Stowe)
Re: keyboard INPUT (Chip Salzenberg)
Re: LOW LEVEL PERL HELP (Jonathan Stowe)
Re: LOW LEVEL PERL HELP (Jonathan Feinberg)
Re: m/pattern/o -- when to use? <mph@pobox.com>
Re: Module design question (use Exporter vs require Exp <jay@rgrs.com>
Re: New core dump on long-working troff2html (Chip Salzenberg)
Perl and Databases <jpope@harris.com>
Re: Perl Signals (Please Help) <jay@rgrs.com>
Re: Perl upload function <rootbeer@teleport.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 03 Feb 1998 15:25:09 -0500
From: "V. Chandrasekhar" <vchandra@mail.delcoelect.com>
Subject: A Question
Message-Id: <34D77D25.6D65@mail.delcoelect.com>
I am running Version 5.004 of Perl.
I have format statements such as the following, in a program:
format Line1 =
@<<<<<<<< @<<< KPH (@<<<MPH) @<<<<<<<<<<<<<<<<<<<<<<<<
$testNumber,$kmh, $mph, $testDescription
.
If I run this program with "strict subs" in use,
I get a compiler error (Bareword "Line1" not allowed).
I can off course turn 'subs' off in this section of the
code. Is this the only way to avoid this error ?
Page 168 of the blue Camel book has a format named
Nice_Output. Would the compiler complain about that also,
if "strict subs" was in use ? Should I even bother about
turning the strict subs option on ?
Thanks and regards,
V.Chandrasekhar
------------------------------
Date: 03 Feb 1998 15:23:00 +0100
From: Peter Kruse <Peter.Kruse@psychologie.uni-regensburg.de>
Subject: Re: A regex problem
Message-Id: <m3iuqw22ez.fsf@arnulf.de>
how about:
while(<>) {
while(s/(<h3>[^<]*)<p>/$1/gi){}
print;
}
which assumes that <h3> and </h3> are not separated by newline.
pete
In article <34D5CEF3.2060@tietogroup.com> Kari Marttila
<Kari.Marttila.@tietogroup.com> writes:
> Is there a way to remove certain tags inside another tags? E.g.
>
> <H3>Nok aat <p>esit le <p>na <p>rean <p></H3>No<p> <H3> asdf <p> </H3>
> =>
> <H3>Nok aat esit le na rean </H3>No<p> <H3> asdf </H3>
>
> In this example I wanted to remove all "<p>" tags only if they were
> inside a string delimited by "<H3>..</H3>" tags.
>
> I have tried several ways without success.
>
> Kari.Marttila@tietogroup.com
>
--
-rw-r--r-- 1 pete users 0 Jan 8 16:40 .signature
------------------------------
Date: Tue, 03 Feb 1998 16:11:41 -0500
From: "V. Chandrasekhar" <vchandra@mail.delcoelect.com>
Subject: A Scoping Related Question
Message-Id: <34D7880D.706D@mail.delcoelect.com>
I am using Perl 5.004.
I have a program that I first wrote and tested under Perl 4.
I am in the process of getting this to work under Perl 5.004.
Also, I am reviewing the blue Camel book and am trying to get
into good habits for future programs.
My 'main' sets several variables. It calls several subroutines.
Even though main's variables are global, in each subroutine call,
I explicitly pass variables used. I do this so that it will be
obvious what variables are used in the subroutine. At times this
is a pain and I am not sure, it is worth the trouble - I could
say in documentation what variables are being passed. I have a
subroutine call which looks like this:
&writeHeaderLines(
$testNumber, $kmh, $mph, $testDescription,
$locDescript, $comp, $units, $scaleFactor,
$testDivision, $testLoc, $testDate,
$vehicleBuildNum, $vehicleCode,
$vehicleDescription,
$processingDate, $processingVersion, $processingTime,
$seq, $channelNum, $channelPolarity, $filterClass,
$timeOfFirstDataPoint, $timeIncrement, $totalNumberofSamples,
$timeDuration,
$max, $maxUnit, $min, $minUnit, $transCalVal, $err,
$transxPosition, $transyPosition, $transzPosition,
$obs
) ;
The subroutine looks like this:
sub writeHeaderLines
{
local(
$testNumber, $kmh, $mph, $testDescription,
$locDescript, $comp, $units, $scaleFactor,
$testDivision, $testLoc, $testDate,
$vehicleBuildNum, $vehicleCode,
$vehicleDescription,
$processingDate, $processingVersion, $processingTime,
$seq, $channelNum, $channelPolarity, $filterClass,
$timeOfFirstDataPoint, $timeIncrement, $totalNumberofSamples,
$timeDuration,
$max, $maxUnit, $min, $minUnit, $transCalVal, $err,
$transxPosition, $transyPosition, $transzPosition,
$obs ) = @_ ;
< snip>
}
When I specify use strict 'vars', perl expects a specific
package name for each of the global variables. (I only have one
package - main.) I realize that this can be resolved either
by declaring each a 'my' variable or by referring to them as
$::testNumber , for instance. Since I have only one package, I
am not sure that it is worth turning 'vars' on, unless I am
missing something.
I appreciate constructive comments related to these
scoping/style issues.
Thanks and regards.
V.Chandrasekhar
------------------------------
Date: Tue, 03 Feb 1998 21:39:32 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: Re: A Scoping Related Question
Message-Id: <6b82u4$s5r$1@cyprus.atlantic.net>
According to "V. Chandrasekhar" <vchandra@mail.delcoelect.com>:
> When I specify use strict 'vars', perl expects a specific
>package name for each of the global variables.
"Well don't do that, then."
The C<use strict> pragmas are designed to be used from the time a
program is started. If you're converting a Perl 4 program, don't
bother. However, the "-w" option is still a good idea, IMO.
--
Chip Salzenberg - a.k.a. - <chip@pobox.com>
"Boy, is it ever dark." "I hope they don't get a moonburn." // MST3K
-> Ask me about Perl training and consulting <-
Like Perl? Want to help out? The Perl Institute: www.perl.org
------------------------------
Date: Tue, 03 Feb 1998 16:38:25 -0500
From: pudge@pobox.com (Chris Nandor)
Subject: Re: A Scoping Related Question
Message-Id: <pudge-0302981638260001@ppp-29.ts-1.kin.idt.net>
In article <34D7880D.706D@mail.delcoelect.com>, "V. Chandrasekhar"
<vchandra@mail.delcoelect.com> wrote:
# When I specify use strict 'vars', perl expects a specific
# package name for each of the global variables. (I only have one
# package - main.) I realize that this can be resolved either
# by declaring each a 'my' variable or by referring to them as
# $::testNumber , for instance. Since I have only one package, I
# am not sure that it is worth turning 'vars' on, unless I am
# missing something.
Do you have a reason not to use my() instead of local()? local() means
one thing: save a global (package) variable, and restore its value at the
end of the dynamic scope. my() means to create a new lexical variable
that dies at the end of the lexical scope.
Probably, my() is what you want anyway.
HTH,
--
Chris Nandor mailto:pudge@pobox.com http://pudge.net/
%PGPKey=('B76E72AD',[1024,'0824 090B CE73 CA10 1FF7 7F13 8180 B6B6'])
#== New Book: MacPerl: Programming for the Rest of Us ==#
#== Publishing Date: Early 1998. http://www.ptf.com/macperl/ ==#
------------------------------
Date: 3 Feb 1998 20:46:29 GMT
From: "William Lapides" <MetatonCSI@worldnet.att.net>
Subject: Advice on my Shopping Cart System
Message-Id: <6b7vn5$pan@bgtnsc03.worldnet.att.net>
Please check out, if you will, http://jimgraygallery.com
It is my latest version of my shopping cart script, and Id love suggestions
and comments on it.
It is the first Full CGI I have ever written, and would love to have it
cartiqued!, Thanks!
Other places where older versions of the script are:
http://gatlinburlier.com
http://young-again.com
------------------------------
Date: Tue, 03 Feb 1998 21:10:35 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: Re: can variables be generated on the fly
Message-Id: <6b817p$ruh$1@cyprus.atlantic.net>
According to ehood@medusa.acs.uci.edu (Earl Hood):
>Maybe for variables, but can be handy for subroutines. For many of the
>cases where references are needed, soft references are not needed.
>However, they do have there uses, especially when obtaining a reference
>to an object can be quite troublesome if you restict your self to hard
>references only.
And obtaining hard references is difficult exactly when?
--
Chip Salzenberg - a.k.a. - <chip@pobox.com>
"Boy, is it ever dark." "I hope they don't get a moonburn." // MST3K
-> Ask me about Perl training and consulting <-
Like Perl? Want to help out? The Perl Institute: www.perl.org
------------------------------
Date: Tue, 03 Feb 1998 21:08:27 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: Re: Crazy Idea
Message-Id: <6b813q$rto$1@cyprus.atlantic.net>
According to Larry D'Anna <ldanna@hotmail.com>:
>m{
> \d+
> | (?:
> \(
> (?RECURSE)
> \)
> )
> | (?:
> (?RECURSE)
> [-+*/]
> (?RECURSE)
> )
>}x
Actually, the plan is more like:
$pat = qr{
\d+
| (?:
\(
(?d $pat)
\)
)
| (?:
(?d $pat)
[-+*/]
(?d $pat)
)
}x ;
Not in 5.005, maybe in 5.006.
--
Chip Salzenberg - a.k.a. - <chip@pobox.com>
"Boy, is it ever dark." "I hope they don't get a moonburn." // MST3K
-> Ask me about Perl training and consulting <-
Like Perl? Want to help out? The Perl Institute: www.perl.org
------------------------------
Date: Tue, 03 Feb 1998 19:32:20 GMT
From: dilcher@cueva.nospam.com (Jeff)
Subject: Destroying any and all elments of an array.. how?
Message-Id: <34d7703d.11668549@news.mindspring.com>
Can someone tell me the most efficient way to destroy any and all
elements that are contained within an array? This seems like it
should be a simple matter, but I don't have an idea of how to do this.
Thanks!!
-Jeff
(when replying, remove nospam from address)
------------------------------
Date: 3 Feb 1998 15:47:08 -0500
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Destroying any and all elments of an array.. how?
Message-Id: <6b7voc$1l5$1@stok.co.uk>
In article <34d7703d.11668549@news.mindspring.com>,
Jeff <dilcher@cueva.nospam.com> wrote:
>Can someone tell me the most efficient way to destroy any and all
>elements that are contained within an array? This seems like it
>should be a simple matter, but I don't have an idea of how to do this.
you can say
undef @array;
which will destroy the array and its elements which aren't referenced
elsewhere (they get cleaned up when their reference count goes to 0). Any
memory freed like this isn't returned to the OS, but is returned to a pool
which perl can reuse.
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@colltech.com | Collective Technologies (work)
------------------------------
Date: 3 Feb 1998 21:35:29 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Destroying any and all elments of an array.. how?
Message-Id: <6b82j1$nds$1@client3.news.psi.net>
Jeff (dilcher@cueva.nospam.com) wrote on 1617 September 1993 in
<URL: news:34d7703d.11668549@news.mindspring.com>:
++ Can someone tell me the most efficient way to destroy any and all
++ elements that are contained within an array? This seems like it
++ should be a simple matter, but I don't have an idea of how to do this.
{ # Start of a new block.
my @array = (); # First use of @array.
.... # Using @array.
} # End of block. @array goes out of scope. The garbage collecter will
# take care of it, removing the array if nothing refers to it, destroying
# the elements if nothing points to them.
Abigail
--
perl -we '%_ = map {local $_ = $_; y/a-z/n-za-m/; ($_, $_)} @_ = map {lc} <>;\n print grep {$_{$_}} @_' < /usr/dict/words
------------------------------
Date: Tue, 03 Feb 1998 13:28:39 -0600
From: Wes Gamble <weyus@worldnet.att.net>
Subject: Good Perl editors
Message-Id: <6b7raj$2nu@bgtnsc03.worldnet.att.net>
Hi all,
I am beginning to reacquaint myself with Perl and I was interested if
there were a preferred editor(s) that people out in Perl-land use for
coding. I have downloaded a demo copy of Codewright, but it doesn't
seem to have built in support for Perl right off the bat (has anyone
created rules for Codewright to edit Perl to their satisfaction, or
knows how that might be done).
I am quite adept at vi, so please none of those comments - however, I'd
like to have something that automatically indents, italicizes, etc. to
make my code easier to scan through quickly.
Any ideas are welcomed.
Thanks,
Wes Gamble
------------------------------
Date: 03 Feb 1998 20:41:26 +0100
From: Remove xx to reply <xxTony.Curtis@vcpc.univie.ac.at>
Subject: Re: Good Perl editors
Message-Id: <7xsoq0mq6x.fsf@beavis.vcpc.univie.ac.at>
Re: Good Perl editors, Wes <weyus@worldnet.att.net> said:
Wes> Hi all, I am beginning to reacquaint myself with Perl
Wes> and I was interested if there were a preferred
Wes> editor(s) that people out in Perl-land use for coding.
Wes> comments - however, I'd like to have something that
Wes> automatically indents, italicizes, etc. to make my code
Wes> easier to scan through quickly.
emacs (presumably both the `x' and `g' species :-)
Wes> Any ideas are welcomed.
I prefer $EDITOR
Just use whichever makes you most productive.
tony
------------------------------
Date: Tue, 03 Feb 1998 13:09:27 -0800
From: Sam Weiss <sweiss@best.com>
To: Remove xx to reply <xxTony.Curtis@vcpc.univie.ac.at>
Subject: Re: Good Perl editors
Message-Id: <34D78787.1036@best.com>
Remove xx to reply wrote:
>
> Re: Good Perl editors, Wes <weyus@worldnet.att.net> said:
>
> Wes> Hi all, I am beginning to reacquaint myself with Perl
> Wes> and I was interested if there were a preferred
> Wes> editor(s) that people out in Perl-land use for coding.
>
> Wes> comments - however, I'd like to have something that
> Wes> automatically indents, italicizes, etc. to make my code
> Wes> easier to scan through quickly.
>
> emacs (presumably both the `x' and `g' species :-)
>
> Wes> Any ideas are welcomed.
>
> I prefer $EDITOR
>
> Just use whichever makes you most productive.
>
> tony
What is $EDITOR? is that part of perl, or something I download
somwhere? if so, what is the ftp site?
I'm running linux, so unless it's native, I'll have to recompile it.
Sam
------------------------------
Date: Tue, 03 Feb 1998 21:21:17 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: Re: Help! ~ operator doesn't work!
Message-Id: <6b81rt$s0n$1@cyprus.atlantic.net>
According to sgilley@netexp.net:
>In experimenting with the bop.t test, we found that this statement:
>
> printf("%x\n", ~0xdead);
>
>returned the value 7FFFFFFF.
There are some workarounds that are used for casting negative values
to floats on systems that are broken that way. Maybe your config.sh
says that $d_castneg is 'define' when it should be 'undef'.
--
Chip Salzenberg - a.k.a. - <chip@pobox.com>
"Boy, is it ever dark." "I hope they don't get a moonburn." // MST3K
-> Ask me about Perl training and consulting <-
Like Perl? Want to help out? The Perl Institute: www.perl.org
------------------------------
Date: 3 Feb 1998 21:20:48 GMT
From: romig@cse.unl.edu (Phil Romig)
Subject: Help: gethostbyaddr()
Message-Id: <6b81ng$ksl@crcnis3.unl.edu>
Can anyone provide me with an example of how to use gethostbyaddr().
I'd like to write a simple routine which converts from internet "dot"
address to hostnames. I have tried a number of variations of the
following and I can't seem to get the format for the address parameter
right.
$dot = "129.93.1.1";
$addr = pack "CCCC", split /\./, $dot;
$name = gethostbyaddr($addr, AF_NET) or die "gethostname failed";
print $name;
Anyone have any ideas or examples?
thanks
Phil
romig@cse.unl.edu
------------------------------
Date: Tue, 03 Feb 1998 21:40:35 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: Re: Help: gethostbyaddr()
Message-Id: <6b8302$s6c$1@cyprus.atlantic.net>
According to romig@cse.unl.edu (Phil Romig):
> $dot = "129.93.1.1";
> $addr = pack "CCCC", split /\./, $dot;
> $name = gethostbyaddr($addr, AF_NET) or die "gethostname failed";
> print $name;
Don't mess with pack() for these purposes. Use the utility functions
in the Socket extension. That's why they're there.
--
Chip Salzenberg - a.k.a. - <chip@pobox.com>
"Boy, is it ever dark." "I hope they don't get a moonburn." // MST3K
-> Ask me about Perl training and consulting <-
Like Perl? Want to help out? The Perl Institute: www.perl.org
------------------------------
Date: 3 Feb 1998 20:38:39 GMT
From: simonsen_nospam@skopen.dseg.ti.com (Kevin M Simonson)
Subject: Re: How Do I Tell Whether a Key Is Valid for an Associative Array?
Message-Id: <6b7v8f$ogb@sf18.dseg.ti.com>
Keywords: key defined exists
Joe Gottman <joegottman@nospam.worldnet.att.net> posted the following
(with a little editting done to his comments to fit them on the screen):
= To see the difference, do the following
= %foo = ();
= $foo{'bar'} = undef();
=
= print "defined\n" if defined($foo{'bar'});
= #Will not print, $foo{'bar'} equals undefined value.
= print "exists\n" if exists($foo{'bar'});
= #Will print. 'bar' IS a key of the hash %foo.
This worked fine on one machine, but when I tried to execute it on the
machine I need to run it on I get:
h48^h/simonson/Thanos} cat JoeOrig
#!/usr/local/bin/perl
%foo = ();
$foo{'bar'} = undef();
print "defined\n" if defined($foo{'bar'});
#Will not print, $foo{'bar'} equals undefined value.
print "exists\n" if exists($foo{'bar'});
#Will print. 'bar' IS a key of the hash %foo.
h48^h/simonson/Thanos} JoeOrig
syntax error in file JoeOrig at line 6, next 2 tokens "exists("
Execution of JoeOrig aborted due to compilation errors.
h48^h/simonson/Thanos}
I also noticed that there's no reference to function "exists" in ei-
ther of the two reference books on Perl (both by Randal Schwartz) I have at
my disposal. Is "exists" not a part of standard Perl?
What I really need to know is whether I can build an associative array
in such a way that I can apply a function to that array keying off some key
word, and determine if I have ever associated that key word with the array.
If "defined" is the way for me to go, then the question comes down to this:
if I have never assigned a value to "$Hmm{'Abc'}" before, and yet evaluate
"defined ($Hmm{'Abc'})", can I count on it to return a false value? And if
I have assigned a (defined) value to "$Hmm{'Abc'}" before, can I count on
it to return a true value?
Page 136 of the camel book seems to indicate that I can count on this
kind of performance. What do all of you think?
As always, my address is "smnsn@skopen.dseg.ti.com"; feel free to send
me mail or post to this thread. Thanks in advance for any input.
---Kevin Simonson
-------------------------------------------------------------------------
Reverence To send me mail, remove "_nospam" and
the eternal. all the vowels from my login name.
------------------------------
Date: Tue, 03 Feb 1998 21:37:14 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: Re: How Do I Tell Whether a Key Is Valid for an Associative Array?
Message-Id: <6b82pq$s4i$1@cyprus.atlantic.net>
Keywords: key defined exists
According to simonsen_nospam@skopen.dseg.ti.com (Kevin M Simonson):
> syntax error in file JoeOrig at line 6, next 2 tokens "exists("
> Execution of JoeOrig aborted due to compilation errors.
That's Perl 4. Upgrade.
> I also noticed that there's no reference to function "exists" in ei-
>ther of the two reference books on Perl (both by Randal Schwartz) I have at
>my disposal. Is "exists" not a part of standard Perl?
Those are Perl 4 books. Buy new ones, or check the online docs first.
--
Chip Salzenberg - a.k.a. - <chip@pobox.com>
"Boy, is it ever dark." "I hope they don't get a moonburn." // MST3K
-> Ask me about Perl training and consulting <-
Like Perl? Want to help out? The Perl Institute: www.perl.org
------------------------------
Date: 03 Feb 1998 20:24:33 +0100
From: Remove xx to reply <xxTony.Curtis@vcpc.univie.ac.at>
Subject: Re: How write to a file using "format" & "write" ?
Message-Id: <7xu3agmqz2.fsf@beavis.vcpc.univie.ac.at>
Re: How write to a file using "format" & "write" ?, Joey
<j.garcia@lmco.com> said:
Joey> I want to mail a formatted report and I am using the
Joey> "format" and "write" command, but that outputs the
Joey> data to the STDOUT. How can I have it write to a file
Joey> for emailing? Please be specific, thanks!
perldoc -f format
perldoc -f write
hth,
tony
------------------------------
Date: Tue, 03 Feb 1998 11:31:54 -0800
From: Sanjay <malunjkars@aol.com>
To: Joey Garcia <j.garcia@lmco.com>
Subject: Re: How write to a file using "format" & "write" ?
Message-Id: <34D770AA.451C@aol.com>
Joey Garcia wrote:
>
> I want to mail a formatted report and I am using the "format" and
> "write" command, but that outputs the data to the STDOUT. How can I
> have it write to a file for emailing? Please be specific, thanks!
>
> Joey G.
here's sample untested code :
....
open (FILE, ">file_to_be_emailed") || die "Can't create ..\n";
select(FILE);
#you may want to select your format headers etc.
write;
...
close(FILE);
#send email using file_to_be_emailed
-------------------------------------------------------------------
Even better, just open a pipe to sendmail like:
....
open(MAIL, "/usr/local/lib/sendmail -t -OIgnoreDots -f '$sender'");
print MAIL "From: $sender\n";
print MAIL "To: $email_receipt_to\n";
print MAIL "\n";
select(MAIL);
#set your format header, etc.
write;
....
close(MAIL);
This is better as you dont have to deal with the pain of temp files.
hope this helps.
-sanjay malunjkar
------------------------------
Date: Tue, 03 Feb 1998 21:31:33 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: Re: I am female, blonde and stupid!
Message-Id: <6b82f2$s2u$1@cyprus.atlantic.net>
That's the weirdest subject line on a serious article I can remember.
According to Kati Gaebler <dont@mailmehere.com>:
>I copied a pretty nifty address
>book from a very good CUT-N-PASTE
>Javascript Site www.infohiway.com.
>
>Could someone help me improve this
>script adding some Perl functions.
JavaScript and Perl don't mix. (Thank goodness.)
--
Chip Salzenberg - a.k.a. - <chip@pobox.com>
"Boy, is it ever dark." "I hope they don't get a moonburn." // MST3K
-> Ask me about Perl training and consulting <-
Like Perl? Want to help out? The Perl Institute: www.perl.org
------------------------------
Date: 03 Feb 1998 20:22:56 +0100
From: Remove xx to reply <xxTony.Curtis@vcpc.univie.ac.at>
To: ldavis@iago.reston.ans.net
Subject: Re: Install ques: perl modules on RH Linux
Message-Id: <7xwwfcmr1r.fsf@beavis.vcpc.univie.ac.at>
Re: Install ques: perl modules on RH Linux, ldavis
<ldavis@iago.reston.ans.net> said:
ldavis> I was trying to install some modules last night, and
ldavis> I found that the Makefile.PL created a makefile with
ldavis> install dirs of /var/tmp/perl-root...
Do "perl -V". What does it say for @INC ?
I'd guess your perl was built to use the above directory.
If you want it elsewhere, perhaps you might consider
re-installing it from scratch (good experience too).
ldavis> where is Makefile.PL getting this information? I
perldoc h2xs
perldoc ExtUtils::MakeMaker
ldavis> really have my stuff installed in /usr/lib/perl5. I
ldavis> know I can edit my Makefile manually, but I want to
shudder :-)
Info about module setup is in
perldoc perlxs
perldoc perlxstut
perldoc perlmod
hth,
tony
------------------------------
Date: 3 Feb 1998 19:30:46 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Install ques: perl modules on RH Linux
Message-Id: <6b7r96$2bh$5@uranium.btinternet.com>
In article <ru4t2gfzvo.fsf@iago.reston.ans.net>, ldavis@iago.reston.ans.net
says...
>
>I was trying to install some modules last night, and
>I found that the Makefile.PL created a makefile with
>install dirs of /var/tmp/perl-root...
>
>where is Makefile.PL getting this information? I
>really have my stuff installed in /usr/lib/perl5. I know
>I can edit my Makefile manually, but I want to know the
>cause.
>
check Config.pm . It sounds like your installation is not quite right, for
myself I would reinstall perl from the beginning - you could be storing up a
lot of problems by editing Config.pm manually.
Jonathan
------------------------------
Date: Tue, 03 Feb 1998 21:23:59 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: Re: keyboard INPUT
Message-Id: <6b820q$s1m$1@cyprus.atlantic.net>
Keywords: keyboard input
According to russo02@sunserv.eelab.newpaltz.edu (Michael Russo):
>Does anybody have any insight on how to process keyboard input without
>having to wait for the '\n' (carriage return, in the vernacular)? Getc and
>read STDIN aren't cutting it.
*whack* FAQ.
--
Chip Salzenberg - a.k.a. - <chip@pobox.com>
"Boy, is it ever dark." "I hope they don't get a moonburn." // MST3K
-> Ask me about Perl training and consulting <-
Like Perl? Want to help out? The Perl Institute: www.perl.org
------------------------------
Date: 3 Feb 1998 19:20:13 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: LOW LEVEL PERL HELP
Message-Id: <6b7qld$2bh$3@uranium.btinternet.com>
In article <34D7281C.741F7AB3@ist4.co.umist.ac.uk>,
mcai3ph2@ist4.co.umist.ac.uk says...
>
>Hi there,
>
>I have to write a simple Perl script to communicate
>with a Printed Circuit Board, through a simple serial
>link (RS232 link).
>
>I have been advised to use ioctls.
>Has anyone have a bit of info. about this ioctls stuff?
>
>
ioctl() is generally platform specific. It would behove you to look at the
manpage for ioctl. Questions about controlling stuff via rs232 or (as i see
it) *seriously* out of the scope of this NG however, I will be prepared to
take a bite of one of my girlfriends hats if you get much more than this :-}
Have fun.
Jonathan
------------------------------
Date: Tue, 3 Feb 1998 16:49:58 -0500
From: jdf@pobox.com (Jonathan Feinberg)
Subject: Re: LOW LEVEL PERL HELP
Message-Id: <MPG.f415b1511a47459896b3@news.concentric.net>
Gellyfish@btinternet.com said...
> I will be prepared to
> take a bite of one of my girlfriends hats if you get much more than this :-}
Do you mean "the hat belonging to one of my girlfriends," or "one of the hats
belonging to my girlfriend?" Will ioctl() help me? Is this a FAQ?
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
------------------------------
Date: 3 Feb 1998 13:51:22 -0500
From: Matthew Hunt <mph@pobox.com>
Subject: Re: m/pattern/o -- when to use?
Message-Id: <6b7ova$dse$1@mph124.rh.psu.edu>
In article <34d6ffab.48025366@news.io.com>,
Thomas L. Shinnick <tshinnic@io.com.mapSoN> wrote:
> Does this mean that /o is useful _only_ when the pattern contains
> interpolated variables? Thus m/RTFM/o is a waste of typing?
Yes, regexps that can't change do not benefit from /o. You may
want to use "study" in such cases.
> As is this posting? :<(}
Nah, the fact that you've read the manual puts you above at least
half the people posting here.
------------------------------
Date: 03 Feb 1998 14:31:55 -0500
From: Jay Rogers <jay@rgrs.com>
To: "Michael King" <mike808@mvp.net>
Subject: Re: Module design question (use Exporter vs require Exporter)
Message-Id: <82ra5klc2c.fsf@shell2.shore.net>
"Michael King" <NOSPAM_mike808@mvp.net> writes:
> I've seen various module authors use the following constructs (not
> simultaneously!):
>
> use Exporter;
>
> and also
>
> require Exporter;
>
> What is (if any) the difference (besides the documented compile-time vs.
> run-time semantic differences) between the two usages?
Well the "use" will additionally try to import names into your
package. If you don't want to import any names from a module named
"Module" then do this:
use Module ();
For more info, see the perlfunc man page for use().
> Why would I want to use one form instead of the other for a module I am
> authoring?
>From the user's perspective it probably doesn't matter since they'll
invoke your module via a use which means any "use" or "require" you
have in your module will happen at compile-time.
Stylistically, I think most choose "use" over "require".
--
Jay Rogers
jay@rgrs.com
------------------------------
Date: Tue, 03 Feb 1998 21:16:04 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: Re: New core dump on long-working troff2html
Message-Id: <6b81hv$rve$1@cyprus.atlantic.net>
Keywords: perl troff html
According to Jim Spath <jspath@mail.bcpl.lib.md.us>:
>A 400-line troff file core dumps under the current perl (5.004)
The current perl is 5.004_04, not 5.004. Maybe if you try that one it
will work. If not (and try that first!), you might mail the script
and the data to a person who can run a perl binary that's been treated
with Purify to detect memory bizarrities.
Or you may be overflowing your stack due to ill-behaved regexes.
>systems I've tried but doesn't under 5.003. Can someone give me some
>tips as to how to debug this other than simply "-w"?
That's a good first step.
--
Chip Salzenberg - a.k.a. - <chip@pobox.com>
"Boy, is it ever dark." "I hope they don't get a moonburn." // MST3K
-> Ask me about Perl training and consulting <-
Like Perl? Want to help out? The Perl Institute: www.perl.org
------------------------------
Date: 3 Feb 1998 21:20:16 GMT
From: "J. Shawn Pope" <jpope@harris.com>
Subject: Perl and Databases
Message-Id: <6b81mg$p09@su102w.ess.harris.com>
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?
------------------------------
Date: 03 Feb 1998 14:28:50 -0500
From: Jay Rogers <jay@rgrs.com>
To: Tan Tong Kiat <tantongk@iscs.nus.edu.sg>
Subject: Re: Perl Signals (Please Help)
Message-Id: <82u3aglc7h.fsf@shell2.shore.net>
Tan Tong Kiat <tantongk@iscs.nus.edu.sg> writes:
> I'm writing a client program to handle 2 signals -- SIGIO and
> SIGALRM. I'm using ualarm to raise a SIGALRM signal at a regular
> interval of 100ms. SIGIO will be raised when a server program sends
> the client a UDP message. The server will intermittently send the
> client messages.
Writing signal handlers that return is very tricky business and should
only be done if you know all the pitfalls. See Bernie Cosell's recent
article for some examples of pitfalls. Search www.dejanews.com for
(~a cosell) & (~g comp.lang.perl.modules)
> What could possibly go wrong? Are there any alternatives I can use?
I'd recommend using select(). For the 100ms timer you could fork a
process that writes to a pipe every 100ms.
--
Jay Rogers
jay@rgrs.com
------------------------------
Date: Tue, 3 Feb 1998 12:42:42 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: team lamer <spam@fritter.com>
Subject: Re: Perl upload function
Message-Id: <Pine.GSO.3.96.980203121030.464C-100000@user1.teleport.com>
On Fri, 30 Jan 1998, team lamer wrote:
> On Fri, 30 Jan 1998 09:18:36 -0800, Tom Phoenix
> <rootbeer@teleport.com> enlightened us with:
>
> >On Thu, 29 Jan 1998, Reimer AG wrote:
> >
> >> the server gives an error message (Server Error).
> >
> >When you're having trouble with a CGI program in Perl, you should first
> >look at the please-don't-be-offended-by-the-name Idiot's Guide to solving
> >such problems.
> >Hope this helps!
>
> It probably wouldn't. Pat was probably using Netscape browser on Unix,
> IE on windowz. The input type=file is broke on IE ( seems to be \n\r
> placement), I know some people did manage to fix thier cgi's but since
> nobody is every going to use IE now, I don't see the point ;)
Well, IMHO, a bug in a browser shouldn't have to crash a CGI script! But
if you believe that additional information such as this would help to make
the "Idiot's Guide" better, please send your suggestions to Tom
Christiansen <tchrist@mox.perl.com>. Thanks!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
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 1799
**************************************