[10529] in Perl-Users-Digest
Perl-Users Digest, Issue: 4121 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Oct 31 20:07:24 1998
Date: Sat, 31 Oct 98 17:00:18 -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 Sat, 31 Oct 1998 Volume: 8 Number: 4121
Today's topics:
Re: [HELP] Newbie question. (Craig Berry)
File altering in-place w/ file locking hippie@net-alert.com
Function Parameters? <trikiw@hotmail.com>
Re: Function Parameters? <r28629@email.sps.mot.com>
Re: Function Parameters? (Michael Rubenstein)
Re: Not to start a language war but.. <piglet@richard.lse.ac.uk>
Re: Perl vs ASP in MS IIS 4.0 <Paul.Coleman@CoSeCo.com>
Question about mailing list script Rafely@xxiname.com
Re: Question about mailing list script (Ronald J Kimball)
Searching with perl <hicks@lineone.net>
Re: Size of JPEG and GIF <piglet@richard.lse.ac.uk>
Re: test <webmaster@ouweb.com>
Re: Testing Perlscript at home <jason.holland@dial.pipex.com>
text files versus dB <webmaster@eswap.co.uk>
Re: vec() <tchrist@mox.perl.com>
Re: vec() (Matt Knecht)
What is the "correct" location of perl under Solaris? vertreko@my-dejanews.com
Re: What is the "correct" location of perl under Solari <jason.holland@dial.pipex.com>
Re: What is the "correct" location of perl under Solari <aperrin@mcmahon.qal.berkeley.edu>
Re: What is the "correct" location of perl under Solari (Thomas Andrews)
Re: What is the "correct" location of perl under Solari (Michael Fuhr)
Re: What is the "correct" location of perl under Solari (Ronald J Kimball)
Re: What's with these Curly brackets??? <jason.holland@dial.pipex.com>
Re: What's with these Curly brackets??? (Matt Knecht)
Re: What's with these Curly brackets??? (John Hardy)
Why are you posting the same question over and over? (w <erikd@zip.com.au>
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 31 Oct 1998 20:29:00 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: [HELP] Newbie question.
Message-Id: <71fruc$p0j$2@marina.cinenet.net>
Kevin Lo (klo@mail2.intellect.com.tw) wrote:
: I'm a new to Perl. I don't know the following codes what it means,
: hope anyone can explain to me, thanks.
:
: open(CFG, 'config');
This means open the file named 'config' for reading, on a file handle
named 'CFG'. Note that the author failed to check the success of open,
which is a Bad Thing.
: while (<CFG>) {
This sets up a loop which will read lines from 'config' one at a time,
placing them in the $_ variable, and exiting the loop at end-of-file.
: ($var, $val) = split;
This makes use of all the default arguments to split. It takes the line
in $_, breaks it into pieces wherever whitespace occurs, then assigns the
first two pieces to $var and $val respectively.
: $$var = $val;
This uses a symbolic reference; the effect is "set the value of the
variable named by $var to $val. So if $var were 'foo', and $val were
'bar', after this line there would be a new variable $foo with the value
'bar'. By the way, it's generally considered better form to do this sort
of thing with hashes instead.
: }
:
: P.S. What's 'CFG'?
A file handle name. Now, go get and read the Llama!
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| "Ripple in still water, when there is no pebble tossed,
nor wind to blow..."
------------------------------
Date: Sat, 31 Oct 1998 22:46:47 GMT
From: hippie@net-alert.com
Subject: File altering in-place w/ file locking
Message-Id: <71g40o$8v9$1@nnrp1.dejanews.com>
(Constantly reading FAQs, DejaNews, man pages, ORA books, etc, but not certain
any of the knowledge is sinking in.)
I'm working on a vaguely BBS-like website, and am developing a module to
handle all the user-related calls. I just finished the system for allowing
users to change their password in the .htpasswd file, and was wondering if
some of the gooey-rus on here could perhaps look it over and give me an
opinion. I'm afraid I've missed something potentially fatal. It seems to
work, though, and I'm using "-w" and "use strict" in the module. Also using
FileHandle, CGI, and CGI::Carp.
(BEGIN SNIPPET)
my($datadir) = '/bbs/';
my($passfile) = "$datadir/.htpasswd";
my($passbackup) = "$datadir/old_passwd";
##
## chpasswd($user, $newpass);
##
sub chpasswd {
my ($chpu) = $_[0]; # passed-in username
my ($chpp) = $_[1]; # passed-in new password
my ($chpuo); # old username
my ($chppo); # old password (not really needed--replace with undef?)
my ($PFH); # password file handle
my ($chtime) = time; # Temporarily store time.
local($_); # Is this necessary? I was bitten once by something
# similar...
$chpp = crypt($chpp, '00');
$PFH = new FileHandle;
system('/bin/cp', $passfile, "$passbackup/$chtime"); # I'm paranoid.
open($PFH, "+<$passfile") || die "Can't open passfile: $!";
lockpass($PFH, 0);
while (<$PFH>) {
($chpuo, $chppo) = split(/:/);
if ($chpuo eq $chpu) {
seek($PFH, -(length($chppo)), 1);
print $PFH $chpp;
last;
}
}
seek($PFH, 0, 2);
unlockpass($PFH);
close($PFH);
}
##
## lockpass($FH, $rw); and unlockpass($FH);
## $rw = 0 for reading, 2 for writing
##
sub lockpass {
my($lp_counter);
my($LPFH) = $_[0];
for ($lp_counter = 0; $lp_counter < 5; $lp_counter++) {
if (flock($LPFH,LOCK_EX)) {
last;
}
sleep 1;
}
if ($lp_counter == 5) { die "FLOCK failed five times!"; }
seek($LPFH, 0, $_[1]);
}
sub unlockpass {
my($ULPFH) = $_[0];
flock($ULPFH,LOCK_UN);
}
(END SNIPPET)
An email CC is appreciated, but not required.
(Just learned how to pass hashes back and forth... and am still scared I don't
fully understand my() and local() as much as I should.)
--
Jim Davis
http://www.net-alert.com/hippie/
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Sat, 31 Oct 1998 22:21:23 GMT
From: Ricardo Dague <trikiw@hotmail.com>
Subject: Function Parameters?
Message-Id: <363B8E86.DC71B6E5@hotmail.com>
I've been learning perl for only a few days, and reading the
threads on c.l.p.m has been very helpful. What's the best
way to make function parameters? Like this?
sub Something
{
my($n,$i,$j) = @_;
. . .
}
Something(12);
Where $n is the "real" parameter and $i and $j are local
vars. This doesn't seem very clear to me and I think putting
the parameters on the same line as the function name (like
every other language does) is better.
-- Ricardo
------------------------------
Date: Sat, 31 Oct 1998 17:09:12 -0600
From: Tk Soh <r28629@email.sps.mot.com>
Subject: Re: Function Parameters?
Message-Id: <363B9898.681E62A7@email.sps.mot.com>
Ricardo Dague wrote:
>
> I've been learning perl for only a few days, and reading the
> threads on c.l.p.m has been very helpful. What's the best
> way to make function parameters? Like this?
>
> sub Something
> {
> my($n,$i,$j) = @_;
> . . .
> }
> Something(12);
>
> Where $n is the "real" parameter and $i and $j are local
> vars. This doesn't seem very clear to me and I think putting
> the parameters on the same line as the function name (like
> every other language does) is better.
while there are a bunch of helpful folks out there, who would definately
explain this topic in detail, I still believe everyone need to first do
her home work, and obviously 'a few days' isn't enough. Unless you have
good reasons not to, go get a copy of Learning Perl and spend a few
_more_ days (weeks?) with it.
Welcome to the world of Perl. Have fun.
-tk
------------------------------
Date: Sat, 31 Oct 1998 23:21:58 GMT
From: miker3@ix.netcom.com (Michael Rubenstein)
Subject: Re: Function Parameters?
Message-Id: <363b939a.248904525@nntp.ix.netcom.com>
On Sat, 31 Oct 1998 22:21:23 GMT, Ricardo Dague <trikiw@hotmail.com>
wrote:
>I've been learning perl for only a few days, and reading the
>threads on c.l.p.m has been very helpful. What's the best
>way to make function parameters? Like this?
>
> sub Something
> {
> my($n,$i,$j) = @_;
> . . .
> }
> Something(12);
>
>Where $n is the "real" parameter and $i and $j are local
>vars. This doesn't seem very clear to me and I think putting
>the parameters on the same line as the function name (like
>every other language does) is better.
You seem a little confused about the various elements of the language.
You are mixing several concepts.
The function parameters are the elements of the array @_. You may
assign them to variables with
my ($a, $b, $c) = @_;
Note that the my simply says that the variables are lexically in the
current scope (this is commonly called local in other languages but
since that has a different meaning in perl I'm going call such
variables lexical). You could also say
($a, $b, $c) = @_;
which would assign the paramters to global variables (assuming $a, $b,
and $c aren't made lexical earlier). You shouldn't normally do this,
but the language permits it.
You may also make the variables lexical and then later assign the
parameters:
my ($a, $b, $c);
($a, $b, $c) = @_;
Note that there's nothing special about @_ here except that it
contains the parameters. You can do this with any array:
my @arr = (1, 2, 3);
my ($a, $b, $c) = @arr;
You shouldn't use this construction with @_ when you don't intend the
variables to be assigned parameters. Don't use something like
my ($a, $i, $j) = @_;
to make $i and $j lexical. There's nothing wrong with this as far as
the language definition goes and the compiler/interpretter will be
happy, but the next person to look at your code probably won't be.
Instead use two (or more) statements:
my ($a) = @_;
my ($i, $j);
Remember @_ is an array. You may manipulate it like any other. In
particular, parameters may be accessed using subscripts (e.g., $_[0])
or may be removed from the array with shift or pop. I usually prefer
to assign them to lexical variables as I think it's clearer, but
that's for those reading the program not the language processor.
--
Michael M Rubenstein
------------------------------
Date: Sat, 31 Oct 1998 20:57:04 +0000
From: Tim Haynes <piglet@richard.lse.ac.uk>
Subject: Re: Not to start a language war but..
Message-Id: <Pine.LNX.4.02.9810312053550.1293-100000@spodzone.demon.co.uk>
On Thu, 29 Oct 1998, Larry Rosler wrote:
> > And where does the "max 80 column text" idea come from?
> In addition to the history that Uri Guttman expounded on, it happens
> also to be the Usenet standard, for similar good reasons. We are
> encouraged to set our line wraps at 72 columns in order that multiple
> quoting indents not push the lines over 80 columns.
<semi-serious not-completely-troll> <rant>
What I don't understand is why, in the days of vim and emacs where we have
paragraph auto-formatting, we should go out of our way to accommodate the
next W**d*ze (l)user coming along with an editor that cannot wrap quoted text
properly.
IMO it looks daft to see ng posts only using about half the screen "for other
people's benefit".
</rant> </s-s n-c-t>
~Tim
________________________________________ piglet@richard.lse.ac.uk __________
| Geek Code: GCS dpu s-:+ a-- C++++ UBLUAVHSC++++ P+++ L++ E--- W+++(--) N++ |
| w--- O- M-- V-- PS PGP++ t--- X+(-) b D+ G e++(*) h++(*) r--- y- |
| piglet@richard.lse.ac.uk http://www.glutinous.custard.org/ |
`----------------------------------------------------------------------------'
Version: PGPfreeware 5.0i for non-commercial use
Charset: noconv
iQEVAwUBNjt5ohHizYRYZ3MpAQE/GggArc+QEmtUAvGIpZX/x4GYdRwaNoDYp2H5
21tHCwWpbsmQGBz+Osfe9c0X513aCwLQ5zMBEoDVz+QkOe84eC6tQs38qJ/AVr21
+niD/W2Tf0rZhE7YmkvoOcQ2zuoqrxIFMicMIW6kB08FOVR3hoJ1RvP6nzd6nnxW
fmQeTJ9P3UA0Gkowtv5JsIgTiXZ1QuHjggpMboXDrqOJRH4snd+f4IwebAFxdCo7
Uc1vj9hk2nBPO3b2HrfCyVzu7vGz6TCFEUFW0MNKAcegkYYRsUSOxYjC2nD1EdVf
sGXpdxUkaBR45i2JjU+HLRsEhS4RY2I7IzhhYSldJ4APguu5Cg5w0A==
=KOx8
-----END PGP SIGNATURE-----
------------------------------
Date: Sat, 31 Oct 1998 17:45:55 -0500
From: "_Paul Coleman" <Paul.Coleman@CoSeCo.com>
Subject: Re: Perl vs ASP in MS IIS 4.0
Message-Id: <363b966f.0@news3.paonline.com>
Hi,
Check out http://www.CoSeCo.com/Serendipity as explained in the opening
page, this is a demo with dummy data. The Catalog was done with ASP and the
search option was done with perl (Perl.exe) using Win32::OLE. Both use the
Access OLEDB ODBC interface. Check it out and compare for your self.
Paul Coleman
IamInNet wrote in message <718u1a$boj@chronicle.concentric.net>...
>Can anybody give me any comparisons between Perl vs ASP in MS IIS 4.0?
>(Speed, scalability, stability, etc)
>Thanks in advance.
>
>
>
------------------------------
Date: Sat, 31 Oct 1998 21:48:26 GMT
From: Rafely@xxiname.com
Subject: Question about mailing list script
Message-Id: <363b84ac.3742050@news.iaehv.nl>
Hello,
I'm making my own script for a mailing list. When someone wants to
unsubscribe their e-mail address, I follow these steps:
1. open file containing e-mail addresses (to be read "<")
2. lock the file
3. read the file in the variable @database
4. close the file
5. check and see if the e-mail address appears in @database
if "no" then finish; else goto 6;
6. open file containing e-mail addresses (to be overwritten ">")
7. lock the file
8. write the e-mail addresses in @database to the file leaving out the
e-mail address to unsubscribe
9. close the file
But lets say someone decides to subscribe their e-mail address after I
lock the file in step 2. Then the script waits until the file gets
unlocked (step 4) and then writes the new e-mail address to the file.
But this new e-mail does not appear in @database so when I rewrite the
database (step 6-9), the new e-mail address will get lost. My question
is, is there a way to keep the file locked during step 1 to 9, so that
any new e-mail address will be added after I've rewritten the
database?? I've looked in many mailing list scripts but they don't put
much attention to this issue. I want to make a very professional
script!! Please let me know.
Best Regards,
Rafely@xxiname.com
------------------------------
Date: Sat, 31 Oct 1998 18:03:17 -0500
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: Question about mailing list script
Message-Id: <1dhryjf.oc694l17rjv36N@bos-ip-1-56.ziplink.net>
[posted and mailed]
<Rafely@xxiname.com> wrote:
> My question
> is, is there a way to keep the file locked during step 1 to 9, so that
> any new e-mail address will be added after I've rewritten the
> database??
Open the file for reading and writing at the same time:
1. open file containing e-mail addresses (read/write "+<")
2. lock the file
3. read the file in the variable @database
4. # don't close the file
5. check and see if the e-mail address appears in @database
if "no" then finish; else goto 6;
6. seek to the beginning of the file (seek FH, 0, 0)
7. # the file is still locked
8. write the e-mail addresses in @database to the file leaving out the
e-mail address to unsubscribe
9. close the file
--
_ / ' _ / - aka - rjk@coos.dartmouth.edu
( /)//)//)(//)/( Ronald J Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Sat, 31 Oct 1998 22:06:34 -0000
From: "Allan Hicks" <hicks@lineone.net>
Subject: Searching with perl
Message-Id: <lSL_1.5199$X41.185@news-reader.bt.net>
I hope you guys (and girls?) can help me...
I am reading 'Learning Perl' as I am a total beginner to programming in
general, and have got to chapter 6 or 7 (can't really remember). What I
want to do is create some sort of basic search engine for a web site, that I
can improve as I get better at programming. I'm not asking for people to
write me a load of code, just point me in the right direction or politely
tell me that I should go back and read a lot more of the book before
venturing in this direction again.
My ideal finished article would be able to search a database (in ANY format
as I don't have it yet) and that is easily customised so that I could apply
it to different sites. I would like to be able to search for 'X and Y' and
return multiple responses.
Any ideas?
Cheers
Tim
------------------------------
Date: Sat, 31 Oct 1998 22:01:09 +0000
From: Tim Haynes <piglet@richard.lse.ac.uk>
Subject: Re: Size of JPEG and GIF
Message-Id: <Pine.LNX.4.02.9810312159380.1293-100000@spodzone.demon.co.uk>
On 30 Oct 1998, John Beppu wrote:
> >I'm writing a small HTML generator in PERL, and wants to find out the size of
> >GIF and JPEG images. So that I can write the HEIGHT= and WIDTH= options in
> I wrote a script to do exactly this task last week. I called
> the external command indentify(1) that comes with ImageMagick
> to find the width and height of images.
IIRC there are some versions of 'file' out there that do the same thing...
~Tim
________________________________________ piglet@richard.lse.ac.uk __________
| Geek Code: GCS dpu s-:+ a-- C++++ UBLUAVHSC++++ P+++ L++ E--- W+++(--) N++ |
| w--- O- M-- V-- PS PGP++ t--- X+(-) b D+ G e++(*) h++(*) r--- y- |
| piglet@richard.lse.ac.uk http://www.glutinous.custard.org/ |
`----------------------------------------------------------------------------'
Version: PGPfreeware 5.0i for non-commercial use
Charset: noconv
iQEVAwUBNjuIqhHizYRYZ3MpAQHzZQf7BgmSiGs/2TDi29MLGsCWX6C1tIqo2j/j
Lx4ojfXEtfy3wN9YbHWIW1KQEckd9iMrHvwvQn3kiM/k2j5yTrEQIG82MgQvWlFf
2rnh2VWcL2y50A+CyrveK0SZsLTDHAcXXp4IwYyY80s4c2SNyRcchI3OP9Ax9V+F
8yi6Df6UMj/widq7mFQ802QLK19qnv0rrz77BpvwFKPbrI27y24LJcQHdsOUdSep
coBdqbbxaDgoyj4cfi51Y7N9JO2xCOfZ317/3GOcp345cnr8ZRExiKdxl8jbrjNv
BvOiA1L+srZQKK1D0UFvpllNFYW0YgafeeUgqbWh5lN/PfAZRbBuug==
=Oq0q
-----END PGP SIGNATURE-----
------------------------------
Date: 31 Oct 1998 15:38:23 PST
From: "Simon B." <webmaster@ouweb.com>
Subject: Re: test
Message-Id: <71g71f$b45@journal.concentric.net>
test
Simon B. wrote in message <71g6t9$b19@journal.concentric.net>...
>test
>
>
------------------------------
Date: Sat, 31 Oct 1998 20:48:08 +0000
From: Jason Holland <jason.holland@dial.pipex.com>
To: Hakan Kilic <a9609339@unet.univie.ac.at>
Subject: Re: Testing Perlscript at home
Message-Id: <363B7788.782C79BE@dial.pipex.com>
Hakan Kilic wrote:
>
> Sorry, I think I'm wrong here.
>
> I wrote a CGI, which I want to test out at home. This CGI gets some Input
> from a form.
>
> All I wanted is:
>
> Is there a programm to test CGI at home, without putting it on the web?
Hello,
This is easy!
1. Buy a Linux compatible computer
2. Buy a CD distribution of Linux
3. Set it all up
4. Mirror the relevent parts of your web server on the Linux box
5. Develop your stuff
This is what I do.
Bye!
--
sub jasonHolland {
my %hash = ( website =>
'http://dspace.dial.pipex.com/jason.holland/',
email => 'jason.holland@dial.pipex.com' );
}
------------------------------
Date: Sat, 31 Oct 1998 14:09:24 -0800
From: "E-swap" <webmaster@eswap.co.uk>
Subject: text files versus dB
Message-Id: <71g2d3$19e$1@nnrp3.snfc21.pbi.net>
Hi
i am currently running an auction site which is using flat text files for
each item and user who registers.
how does this affect the performance of the site versus using something like
MySQL, or any other database?
Is MySql easy to administer or is there an even better solution.
All help appreciated,
Darren
------------------------------
Date: 31 Oct 1998 21:42:51 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: vec()
Message-Id: <71g08r$e5r$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, hex@voicenet.com (Matt Knecht) writes:
:I'm having problems trying to figure out how vec() works. I've tried
:many variations on the following code.
:
:my $bv = 0;
Actually, one sets bitvectors to '', not to 0. They are strings,
not numbers.
:vec($bv, 0, 32) = 0;
or
vec($bv, 31, 1) = 0;
on a clear vector.
:# This gives me the expected 32 zeroes
:print unpack("b32", $bv), "\n";
That's you haven't done anything numeric on it yet.
:# Set low order bit
:$bv |= (1 << 0);
Oh no! You broke it. You just did a numeric
thing on it. You have to either use only vec,
or make sure both your operands are stringy.
:# This gives me '10001100'
:print unpack("b32", $bv), "\n";
That's because that's the bitpattern of the string "1".
Check this out:
2468 | 1357 3565
"2468" | "1357" "377?"
2468 & 1357 260
"2468" & "1357" "0040"
2468 ^ 1357 3305
"2468" ^ "1357" "\003\007\003\017"
~1357 4294965938
~"1357" "\316\314\312\310"
Does that help clarify things?
--tom
--
"A foolish consistency is the hobgoblin of little minds, adored by
little statesmen and philosophers and divines. With consistency a
great soul has simply nothing to do." --Ralph Waldo Emerson
------------------------------
Date: Sat, 31 Oct 1998 23:03:00 GMT
From: hex@voicenet.com (Matt Knecht)
Subject: Re: vec()
Message-Id: <EGM_1.47185$ZF.6951466@news3.voicenet.com>
Tom Christiansen <tchrist@mox.perl.com> wrote:
>:$bv |= (1 << 0);
>
>Oh no! You broke it. You just did a numeric
>thing on it. You have to either use only vec,
>or make sure both your operands are stringy.
For some reason "bit vector operation is desired when both operands are
strings" from perldoc -f vec didn't stick with me. Thanks for the
reminder.
But I still can't seem to get:
$bv |= '3'
or
$bv |= '1 << 0'; $bv |= '1 << 1';
On a clear bitvector to give me '0011' and not the representation of the
string 3. What's the syntax for that?
Similarly:
$one = $bv | 1;
or
$one = $bv | '1'; # Both operands are strings!
or
$one = $bv | '00000000000000000000000000000001';
or
$one = $bv | pack("b32", 1); # Sets the MSB on a Sparc
This can't be hard. What am I missing?
>:vec($bv, 0, 32) = 0;
>
>or
>
> vec($bv, 31, 1) = 0;
> ...
> Does that help clarify things?
Sort of. The way I would read what I wrote would be: "Take an empty
bitvector. Go to the first offset. Use all 32 bits. Set those bits
to zero".
I read what you wrote as: "Take an empty bitvector. Go to the 32nd
offset. Use one bit. Set that bit to zero".
So, vec($bv, 31, 1) = 1 give me the expected LSB set on, and all the
other bits off. I can set, or unset all bits in the vector by changing
the offest, and leaving BITS set to 1. This is good.
What isn't good is when I tried (Again, many variants of) something
like:
vec($bv, 27, 4) = 3;
I read that as: "Take an empty bitvector. Go to the 28 bit. set the
next four bits to the bit pattern of 3 (0011)".
I can't get anything other than turning a single bit on or off at a time
to work (Which, is exactly what I needed. But now I'm just curious as
to how everything else works).
--
Matt Knecht - <hex@voicenet.com>
------------------------------
Date: Sat, 31 Oct 1998 19:59:54 GMT
From: vertreko@my-dejanews.com
Subject: What is the "correct" location of perl under Solaris?
Message-Id: <71fq7q$t3b$1@nnrp1.dejanews.com>
Hi All. I've got a pseudo-philosophical question for you. My company was
recently acquired by a bigger company. Before the acquisition, we had the
location of our 'perl' as /usr/local/bin/perl, and all our scripts started
with:
#!/usr/local/bin/perl
The company that bought us has their Solaris perl located at:
#!/opt/local/bin/perl
One of us is going to have to change, and either way, it will be a major pain
in the a@#. I think the version that is least prevalent in common practice
should be the one to change. So, I'm asking, "Which version is more common?"
Please reply to my email address as well as the group.
Thanks in advance,
Keith
vertreko@my-dejanews.com
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Sat, 31 Oct 1998 20:26:40 +0000
From: Jason Holland <jason.holland@dial.pipex.com>
To: vertreko@my-dejanews.com
Subject: Re: What is the "correct" location of perl under Solaris?
Message-Id: <363B7280.5EF2C351@dial.pipex.com>
vertreko@my-dejanews.com wrote:
>
> Hi All. I've got a pseudo-philosophical question for you. My company was
> recently acquired by a bigger company. Before the acquisition, we had the
> location of our 'perl' as /usr/local/bin/perl, and all our scripts started
> with:
>
> #!/usr/local/bin/perl
>
> The company that bought us has their Solaris perl located at:
>
> #!/opt/local/bin/perl
>
Hello,
Personally I prefer the /usr/local/bin directory. This seems to be
fairly common in various sources of documentation.
So far, the omly time I've seen the /opt directory being used is when I
recently installed Netscape on a Linux system.
Make the new guys conform to YOUR world view!
Bye!
--
sub jasonHolland {
my %hash = ( website =>
'http://dspace.dial.pipex.com/jason.holland/',
email => 'jason.holland@dial.pipex.com' );
}
------------------------------
Date: Sat, 31 Oct 1998 13:00:08 -0800
From: Andrew Perrin <aperrin@mcmahon.qal.berkeley.edu>
To: vertreko@my-dejanews.com
Subject: Re: What is the "correct" location of perl under Solaris?
Message-Id: <363B7A58.A396C016@mcmahon.qal.berkeley.edu>
We use /usr/local/bin/perl. Suggestion: whichever you stick it in, put a link in
the other directory so your scripts don't break.
ap
vertreko@my-dejanews.com wrote:
> Hi All. I've got a pseudo-philosophical question for you. My company was
> recently acquired by a bigger company. Before the acquisition, we had the
> location of our 'perl' as /usr/local/bin/perl, and all our scripts started
> with:
>
> #!/usr/local/bin/perl
>
> The company that bought us has their Solaris perl located at:
>
> #!/opt/local/bin/perl
>
> One of us is going to have to change, and either way, it will be a major pain
> in the a@#. I think the version that is least prevalent in common practice
> should be the one to change. So, I'm asking, "Which version is more common?"
>
> Please reply to my email address as well as the group.
>
> Thanks in advance,
> Keith
> vertreko@my-dejanews.com
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
--
-------------------------------------------------------------
Andrew J. Perrin - NT/Unix/Access Consulting - (650)938-4740
aperrin@mcmahon.qal.berkeley.edu (Remove the Junk Mail King)
http://www.geocities.com/SiliconValley/Grid/7544/
-------------------------------------------------------------
------------------------------
Date: 31 Oct 1998 13:08:01 -0800
From: thomaso@best.com (Thomas Andrews)
Subject: Re: What is the "correct" location of perl under Solaris?
Message-Id: <71fu7h$8qk$1@shell3.ba.best.com>
I know there is at least one problem with using /usr/local/bin -
FreeBSD installs perl 4 in /usr/local/bin, and it can't (or couldn't
about a year ago) be replaced with perl 5.
=thomas
In article <363B7280.5EF2C351@dial.pipex.com>,
Jason Holland <jason.holland@dial.pipex.com> wrote:
>vertreko@my-dejanews.com wrote:
>>
>> Hi All. I've got a pseudo-philosophical question for you. My company was
>> recently acquired by a bigger company. Before the acquisition, we had the
>> location of our 'perl' as /usr/local/bin/perl, and all our scripts started
>> with:
>>
>> #!/usr/local/bin/perl
>>
>> The company that bought us has their Solaris perl located at:
>>
>> #!/opt/local/bin/perl
>>
>
>
>Hello,
>
>Personally I prefer the /usr/local/bin directory. This seems to be
>fairly common in various sources of documentation.
>
>So far, the omly time I've seen the /opt directory being used is when I
>recently installed Netscape on a Linux system.
>
>Make the new guys conform to YOUR world view!
>
>Bye!
>
>
>--
>sub jasonHolland {
> my %hash = ( website =>
>'http://dspace.dial.pipex.com/jason.holland/',
> email => 'jason.holland@dial.pipex.com' );
>}
--
Thomas Andrews thomasoa@yahoo.com http://www.best.com/~thomaso/
"Show me somebody who is always smiling, always cheerful, always
optimistic, and I will show you somebody who hasn't the faintest
idea what the heck is really going on." - Mike Royko
------------------------------
Date: 31 Oct 1998 14:50:52 -0700
From: mfuhr@dimensional.com (Michael Fuhr)
Subject: Re: What is the "correct" location of perl under Solaris?
Message-Id: <71g0ns$ph3@flatland.dimensional.com>
thomaso@best.com (Thomas Andrews) writes:
> I know there is at least one problem with using /usr/local/bin -
> FreeBSD installs perl 4 in /usr/local/bin, and it can't (or couldn't
> about a year ago) be replaced with perl 5.
FreeBSD 2.x (don't know about 3.x) installs Perl 4 as /usr/bin/perl.
I've been putting Perl 5 in /usr/local for about two years without
any problems, as long as my scripts know to use /usr/local/bin/perl
instead of /usr/bin/perl.
If you install the port found under /usr/ports/lang/perl5, everything
will be under /usr/local.
--
Michael Fuhr
http://www.fuhr.net/~mfuhr/
------------------------------
Date: Sat, 31 Oct 1998 18:03:18 -0500
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: What is the "correct" location of perl under Solaris?
Message-Id: <1dhrz3w.1wgnxem1np3hgpN@bos-ip-1-56.ziplink.net>
[posted and mailed]
<vertreko@my-dejanews.com> wrote:
> Hi All. I've got a pseudo-philosophical question for you. My company was
> recently acquired by a bigger company. Before the acquisition, we had the
> location of our 'perl' as /usr/local/bin/perl, and all our scripts started
> with:
>
> #!/usr/local/bin/perl
That's the one I prefer. Probably only because that's the one I'm used
to.
> The company that bought us has their Solaris perl located at:
>
> #!/opt/local/bin/perl
>
> One of us is going to have to change, and either way, it will be a major pain
> in the a@#.
Why will it be a major pain in the ass? Make one a link to the other
(`ln -s /usr/local/bin/perl /opt/local/bin` or vice versa).
> I think the version that is least prevalent in common practice
> should be the one to change. So, I'm asking, "Which version is more common?"
I believe that /usr/local/bin/perl is more common. But I don't know for
sure. Nonetheless, your company got bought out. The acquiring company
will probably get to decide which one will change. :-)
--
_ / ' _ / - aka - rjk@coos.dartmouth.edu
( /)//)//)(//)/( Ronald J Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Sat, 31 Oct 1998 20:39:50 +0000
From: Jason Holland <jason.holland@dial.pipex.com>
To: jhardy3747@my-dejanews.com
Subject: Re: What's with these Curly brackets???
Message-Id: <363B7596.48552885@dial.pipex.com>
jhardy3747@my-dejanews.com wrote:
>
> Whats the rules with the curly brackets. If I leave the sub below as is it
> complains of syntax error at the last bracket. If I take it out it complains
> that it is missing??
>
> sub SQL_ProcedureINS
> {
>
> use OLE;
>
> $Conn = CreateObject OLE "ADODB.Connection";
> $Conn->Open("DSN=iHRS;UID=sa;PWD=");
> $RS = $Conn->Execute ("dbo.CandidateINS \@RCODE='HeyGood', \@RNAME='Smarty'");
> if(!$RS) {
> $Errors = $Conn->Errors();
> print "Errors:\n";
> }
> foreach $error (keys %$Errors) {
> print $error->{Description},"\n";
> }
> die;
>
> $RS->Close;
> $Conn->Close;
> }
Hello,
Just a suggestion, does this code come right at the very end of your
file? One WEIRD thing I saw once, was that if you miss of the very last
newline (so that the brace is on the end of the file without a newline)
then the compiler balks on it.
I only saw this once when supervising a beginner, doesn't seem to happen
in Perl5.005 under Linux anymore though?
Bye!
--
sub jasonHolland {
my %hash = ( website =>
'http://dspace.dial.pipex.com/jason.holland/',
email => 'jason.holland@dial.pipex.com' );
}
------------------------------
Date: Sat, 31 Oct 1998 21:07:06 GMT
From: hex@voicenet.com (Matt Knecht)
Subject: Re: What's with these Curly brackets???
Message-Id: <_ZK_1.47182$ZF.6906685@news3.voicenet.com>
jhardy3747@my-dejanews.com <jhardy3747@my-dejanews.com> wrote:
>Whats the rules with the curly brackets. If I leave the sub below as is it
>complains of syntax error at the last bracket. If I take it out it complains
>that it is missing??
The rule is that all { must have a matching }.
What exact complaint are you getting? If you're getting something like
"Unmatched right bracket at FOO line X, at end of line", it's because
you're missing a right bracket somewhere else, not in this sub (All your
brackets here have partners in the sub you posted). Without a good
editor, finding this sort of typo can be a nightmare.
>sub SQL_ProcedureINS
>{
>
>use OLE;
>
>$Conn = CreateObject OLE "ADODB.Connection";
>$Conn->Open("DSN=iHRS;UID=sa;PWD=");
>$RS = $Conn->Execute ("dbo.CandidateINS \@RCODE='HeyGood', \@RNAME='Smarty'");
>if(!$RS) {
> $Errors = $Conn->Errors();
> print "Errors:\n";
>}
> foreach $error (keys %$Errors) {
> print $error->{Description},"\n";
> }
> die;
This sub *always* calls die. It will never return. Ever. This is why
keeping your indentation levels consistent is such a benefit. Errors
like this jump right out at you, and it's much easier to find missing
right brackets.
--
Matt Knecht - <hex@voicenet.com>
------------------------------
Date: Sat, 31 Oct 1998 21:04:40 GMT
From: jhardy@cins.com (John Hardy)
Subject: Re: What's with these Curly brackets???
Message-Id: <IXK_1.472$_t.352479@198.235.216.4>
In article <363B7596.48552885@dial.pipex.com>, jason.holland@dial.pipex.com
says...
>
>jhardy3747@my-dejanews.com wrote:
>>
>> Whats the rules with the curly brackets. If I leave the sub below as is it
>> complains of syntax error at the last bracket. If I take it out it complains
>> that it is missing??
>>
>> sub SQL_ProcedureINS
>> {
>>
>> use OLE;
>>
>> $Conn = CreateObject OLE "ADODB.Connection";
>> $Conn->Open("DSN=iHRS;UID=sa;PWD=");
>> $RS = $Conn->Execute ("dbo.CandidateINS \@RCODE='HeyGood',
\@RNAME='Smarty'");
>> if(!$RS) {
>> $Errors = $Conn->Errors();
>> print "Errors:\n";
>> }
>> foreach $error (keys %$Errors) {
>> print $error->{Description},"\n";
>> }
>> die;
>>
>> $RS->Close;
>> $Conn->Close;
>> }
>
>
>Hello,
>
>Just a suggestion, does this code come right at the very end of your
>file? One WEIRD thing I saw once, was that if you miss of the very last
>newline (so that the brace is on the end of the file without a newline)
>then the compiler balks on it.
>
>I only saw this once when supervising a beginner, doesn't seem to happen
>in Perl5.005 under Linux anymore though?
>
>
>Bye!
>
>--
>sub jasonHolland {
> my %hash = ( website =>
>'http://dspace.dial.pipex.com/jason.holland/',
> email => 'jason.holland@dial.pipex.com' );
>}
Doesn't seem to make a difference. I tried changing and still complained that
either it was there or missing when I took it away??
------------------------------
Date: Sun, 01 Nov 1998 07:56:57 +1100
From: Erik de Castro Lopo <erikd@zip.com.au>
Subject: Why are you posting the same question over and over? (was Re: Why is junk being appended to my saved data file?)
Message-Id: <363B7999.381A0FDC@zip.com.au>
IFN wrote:
>
> Hi all,
> Whenever I write a data file back, it appends a bunch of junk to the end of
> the file. Below I've listed the small amount of code it takes to duplicate
> the problem along with it's input file and output file.
PLEASE, get a clue.
Erik
--
+-------------------------------------------------+
Erik de Castro Lopo erikd@zip.com.au
+-------------------------------------------------+
Seen on usenet (possibly a quote from an IBM exec):
Each large company needs its Vietnam, and Microsoft will
experience it with NT...
------------------------------
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 4121
**************************************