[17449] in Perl-Users-Digest
Perl-Users Digest, Issue: 4869 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Nov 11 14:05:27 2000
Date: Sat, 11 Nov 2000 11:05:08 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <973969508-v9-i4869@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sat, 11 Nov 2000 Volume: 9 Number: 4869
Today's topics:
Ä, Ö and Å Characters in Perl Programs john_s_brown@my-deja.com
Re: Ä, Ö and Å Characters in Perl Programs <james@NOSPAM.demon.co.uk>
Checking Links (Jimtaylor5)
Re: Command-line arguments (Martien Verbruggen)
HELP!--International characters in Perl/Windows <paul@nowhere.com>
How to connect a Perl script with VNC viewer/system cal monkfunk@my-deja.com
Re: missing lines parsing an accesslog (Garry Williams)
Re: missing lines parsing an accesslog (Tad McClellan)
Re: Pattern matching question (Martien Verbruggen)
Re: Pattern matching question (Tad McClellan)
perl question under pc? guojx@my-deja.com
Re: perl question under pc? <jeff@vpservices.com>
Re: Pushing a hash on to a stack... (Anno Siegel)
Re: Pushing a hash on to a stack... <ren.maddox@tivoli.com>
Re: Random Array with Sort? <james@NOSPAM.demon.co.uk>
Re: returning a true value is FUN! (was Re: Log.pm did (Logan Shaw)
Re: Searching for many words in large string (Logan Shaw)
simple floating point question <nospam@mistnet.com>
Re: simple floating point question (Martien Verbruggen)
Re: switching the user in perl (Tad McClellan)
Re: switching the user in perl (Ameen Dausha)
Re: use-ing .pm file from different dir (Garry Williams)
Re: Using POST and POST/ACTION on the same page - I fig <admin@salvador.venice.ca.us>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 11 Nov 2000 17:39:32 GMT
From: john_s_brown@my-deja.com
Subject: Ä, Ö and Å Characters in Perl Programs
Message-Id: <8uk08k$964$1@nnrp1.deja.com>
How can I use Scandinavian characters like ä, ö, å and Ä, Ö, Å in my
perl programs?
Everytime I try to print those characters (e.g. print "äöä";), they
appear on my screen as different characters. For example, "Ä" turns
into "-" and "ä" turns into a strange symbol that looks like "E".
I am using Windows and Active State's Active Perl interpreter.
Thanks in advance!
-John S. Brown.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Sat, 11 Nov 2000 18:28:17 +0000
From: James Taylor <james@NOSPAM.demon.co.uk>
Subject: Re: Ä, Ö and Å Characters in Perl Programs
Message-Id: <ant111817313fNdQ@oakseed.demon.co.uk>
In article <8uk08k$964$1@nnrp1.deja.com>,
<URL:mailto:john_s_brown@my-deja.com> wrote:
>
> Everytime I try to print those characters (e.g. print "äöä";), they
> appear on my screen as different characters. For example, "Ä" turns
> into "-" and "ä" turns into a strange symbol that looks like "E".
>
> I am using Windows...
Surely that's your problem. I bet it has to do with the differing
character sets used by Windows and DOS. Can you reconfigure them
both to use the same character set (preferably a widely supported
one such as ISO-8859-1)?
--
James Taylor <james (at) oakseed demon co uk>
PGP key available ID: 3FBE1BF9
Fingerprint: F19D803624ED6FE8 370045159F66FD02
------------------------------
Date: 11 Nov 2000 16:28:00 GMT
From: jimtaylor5@aol.com (Jimtaylor5)
Subject: Checking Links
Message-Id: <20001111112800.08882.00000807@ng-mh1.aol.com>
I have the following simple perl program to check if links really exist. The
code is below. 95 percent of the time it works fine, but there is those times
when it says a link is not OK, when in fact it is. My question is twofold. Why
is that, and what for example can I do to this program to to recognize the
other 5 percent of links which are valid but for some reason don't show valid.
Thank you very much for any help you can give me in correcting this.
use LWP::Simple;
$URL = $FORM{'siteurl'};
$success = head($URL);
if ($success) {
&link_ok;
}
else {
push(@ERROR5, "This URL could not be retrieved!");
&link_not_ok;
}
H E L P !
------------------------------
Date: Sun, 12 Nov 2000 00:59:31 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Command-line arguments
Message-Id: <slrn90qk63.gs3.mgjv@martien.heliotrope.home>
On Sat, 11 Nov 2000 15:09:34 +0200,
Denys Kotseba <kdl@softhome.net> wrote:
> Hello,
>
> I have just upgraded to ActivePerl 618 and found out that I can't pass
> command line arguments any more. The simple one-liner shown below produces
> no output. Am I missing something? Please help.
>
> Code sample:
>
> print shift(@ARGV);
Try running this by passing your script explicitly to the perl
interpreter. If that works, then the 'file association' or whatever it's
called again in Windows, is broken. I seem to recall that there were
some murmurings about that a while ago.
# perl -wle "print @ARGV" foo bar baz
Should print 'foobarbaz'. If it doesn't Perl is broken, and you should
complain to ActiveState. If it does, but it doesn't work without
explicit invocation of perl, your association doohicky is broken, and
you may need to fix it. You can still compain to ActiveState. Maybe you
should check that they haven't got a note on the site somewhere about
this.
Martien
--
Martien Verbruggen |
Interactive Media Division | I took an IQ test and the results
Commercial Dynamics Pty. Ltd. | were negative.
NSW, Australia |
------------------------------
Date: Sat, 11 Nov 2000 18:43:16 GMT
From: "Paul D." <paul@nowhere.com>
Subject: HELP!--International characters in Perl/Windows
Message-Id: <8rgP5.2087$M51.764099@typhoon.ne.mediaone.net>
I can't get Perl (v620) to handle international characters correctly in
Windows. I have a simple program, foo.pl, that merely echoes its
arguments:
print @ARGV;
exit;
If I type
foo "¿ Some file name ?.doc"
Where ¿ is an international character such as Spanish upside-down
question mark, then my Perl program echoes something different
for ¿, one of the DOS line-drawing characters. When I examine the
input and output in hex, I see that Perl has actually converted
¿(0xA8) to something else, 0xBF.
Why does Perl do this, and how can I fix it?
I have messed with setlocale, codepages in DOS, use utf8, etc
and I can't seem to make it work. Has anyone made this work???
--
Paul DiLascia
dilascia@poREMOVETHISbox.com
------------------------------
Date: Sat, 11 Nov 2000 15:29:16 GMT
From: monkfunk@my-deja.com
Subject: How to connect a Perl script with VNC viewer/system call
Message-Id: <8ujok7$3js$1@nnrp1.deja.com>
I'm writing a VNC frontend to resolve machine names to IP address with
'nmblookup' so we can VNC to a machine name.
I need a one-liner system call to give the IP address & the password
system('echo password|vncviewer 172.168.0.1')
just won't cut it. I don't even know what it's called when you create a
process that you can send information to. Is this forking?
I could even leave out the IP address so that vncviewer pops up a GUI
box if I knew how to send information to a specific window.
Signed,
Drowning
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Sat, 11 Nov 2000 14:33:48 GMT
From: garry@zweb.zvolve.net (Garry Williams)
Subject: Re: missing lines parsing an accesslog
Message-Id: <gNcP5.121$xb1.7314@eagle.america.net>
[fixed broken line wrapping]
On Sat, 11 Nov 2000 10:44:54 -0000, Ebenezer Bodvarsson
<ebenezer@mosi.is> wrote:
>Hi I'm parsing an acces log file and somehow it does not parse all
>the lines and I cannot see any pattern of which lines it skips.
You didn't include any sample data that illustrates the problem.
#!/usr/local/bin/perl -w
use strict;
my %Visit;
>open(LOGFILE,"foo");
You should *always* check the result of open():
open(LOGFILE,"foo") || die "can't open foo: $!";
>while (<LOGFILE>){
>my ($ip, $id, $auth, $day, $tzone, $meth, $url, $protoc, $status, $bytes,
>$refer)= split(/\s+/,<VISITS>, 11);
^^^^^^^^
What is that? The split() operator takes a string for its second
argument. Your second argument is presumably a line from some *other*
file. What happened to the line from "foo" that you just read? Did
you copy/paste actual code here? You probably meant
my ($ip, $id, $auth, $day, $tzone, $meth, $url, $protoc,
$status, $bytes, $refer) = split(/\s+/, $_, 11);
> #visited pages
> if ($Visit{$url})
> {
> $Visit{$url}++;
> }else{
> $Visit{$url}=1;
> }
>}
This can be simplified to just
$Visit{$url}++;
That's because perl will automatically create the appropriate hash
entry and convert its undefined value to a zero and increment it.
This is also a special case in Perl that does not generate a warning.
This is the idiom you want here.
>close (LOGFILE);
>Does anyone know what may cause this script to skip some lines in the
>acces log? It does not matter if I have only 10 lines in the file,
>only appr 6 get parsed. Perhaps the answer is staring me in the face
>but I just don't get it this time. thank's in advance
That's impossible without seeing sample input (and probably actual
code).
--
Garry Williams
Zvolve Systems, Inc.
+1 770 551-4504
------------------------------
Date: Sat, 11 Nov 2000 09:10:20 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: missing lines parsing an accesslog
Message-Id: <slrn90qkqc.hb6.tadmc@magna.metronet.com>
On Sat, 11 Nov 2000 10:44:54 -0000, Ebenezer Bodvarsson
<ebenezer@mosi.is> wrote:
>open(LOGFILE,"foo");
You should always, yes *always*, check the return value from open():
open(LOGFILE, 'foo') || die "could not open 'foo' $!";
>while (<LOGFILE>){
Here you read a line from file 'foo' into the $_ variable, but
the rest of your code never accesses that variable!
You are ignoring lines from the logfile.
>my ($ip, $id, $auth, $day, $tzone, $meth, $url, $protoc, $status, $bytes,
>$refer)= split(/\s+/,<VISITS>, 11);
^^^^^^
Where do you establish that filehandle?
You should have warnings enabled.
> #visited pages
> if ($Visit{$url})
> {
> $Visit{$url}++;
> }else{
> $Visit{$url}=1;
> }
You don't need that (horridly indented) if/else. Just this will do:
$Visit{$url}++;
>Does anyone know what may cause this script to skip some lines in the acces
>log?
I expect you have not shown us your real code, so you
cannot expect real help.
--
Tad McClellan SGML consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 12 Nov 2000 01:28:20 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Pattern matching question
Message-Id: <slrn90qls4.gs3.mgjv@martien.heliotrope.home>
On Sat, 11 Nov 2000 13:51:38 GMT,
Andy Smith <asmith@hsonline.net> wrote:
> Hi,
> If I have an array filled with strings and run through a foreach :
>
> foreach (@array) {
> if($_ =~ /^{S+HOWTO}\.html/) {
> print "$_\n";
> }
> }
>
> Well, that is a piece of my code. What I really wanted to know is if
> the pattern above should print the string "Foo-HOWTO.html" and not
> print the string "Foo-HOWTO-1.html" providing they are both present in
> the array. Just a curious question.
The pattern won't match either. Watch:
# cat foo.pl
#!/usr/local/bin/perl -wl
use strict;
my @array = qw( Foo-HOWTO.html Foo-HOWTO-1.html );
for (@array) { print if /^{S+HOWTO}\.html/ }
# ./foo.pl
#
Let's have a look at that regex. It requires the string to start with a
literal {, followed by 1 or more uppercased S, followed by the string
HOWTO}.html. The only thing special in the whole regex is the +.
If you do want it to match anything _ending_ in HOWTO.html:
/HOWTO\.html$/;
If you want it to match anything ending in HOWTO-#.html, where # is a
digit (or more):
/HOWTO-\d+\.html$/
If you want it to match both:
/HOWTO(-\d+)?\.html$/
The perlre documentation talks about this quite extensively, and the
perl FAQ, part 6, has some handy stuff as well.
If none of the above are what you need, please feel free to describe
what you do need, and we'll try to help.
Martien
--
Martien Verbruggen |
Interactive Media Division | In the fight between you and the
Commercial Dynamics Pty. Ltd. | world, back the world - Franz Kafka
NSW, Australia |
------------------------------
Date: Sat, 11 Nov 2000 08:28:42 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Pattern matching question
Message-Id: <slrn90qica.h2r.tadmc@magna.metronet.com>
On Sat, 11 Nov 2000 13:51:38 GMT, Andy Smith <asmith@hsonline.net> wrote:
>If I have an array filled with strings and run through a foreach :
[ snip code, repeated below ]
>What I really wanted to know is if
>the pattern above should print the string "Foo-HOWTO.html" and not
>print the string "Foo-HOWTO-1.html" providing they are both present in
>the array.
Write a Perl program that provides both in the array and see.
What are you doing here with this? Can't you write Perl?
-----------------------
#!/usr/bin/perl -w
use strict;
my @array = qw/Foo-HOWTO.html Foo-HOWTO-1.html/;
foreach (@array) {
print " looking for '$_'...\n"; # try each one
if($_ =~ /^{S+HOWTO}\.html/) {
print "$_\n";
}
}
-----------------------
Looks like it will print neither string.
You tried to type in code instead of copy/paste, didn't you?
Don't do that.
Looks like you made some typos in your pattern.
--
Tad McClellan SGML consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sat, 11 Nov 2000 18:01:31 GMT
From: guojx@my-deja.com
Subject: perl question under pc?
Message-Id: <8uk1hp$a4h$1@nnrp1.deja.com>
hello,
I am a beginner in perl. could anyone tell me how to "cat" files into
one file in PC?
For example, I have 100 files (*.cdw), I want cat them into one file
(output.out) when name and content for each file in. How to do it in PC
by perl?
Thanks,
Jianxin
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Sat, 11 Nov 2000 10:46:22 -0800
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: perl question under pc?
Message-Id: <3A0D93FE.C2000FF9@vpservices.com>
guojx@my-deja.com wrote:
>
> I am a beginner in perl. could anyone tell me how to "cat" files into
> one file in PC?
I can think of at least three ways (in no particular order):
1. go to cygwin and get their free DOS/Win version of cat that works
fine from the
DOS console box or when called from a Perl system() call.
2. Go to http://language.perl.com/ppt/src/cat/ and get the Perl Power
Tools Perl implementation of cat.
3. Write your own in Perl using open() and print(). This shouldn't be
too hard if all you want to do is the file concatenation thing and not a
full implementation of "cat", any good book or tutorial on Perl will
show how to open and print text files. If you try this and have
difficulties, show us what you've tried and I'm sure someone will help.
--
Jeff
------------------------------
Date: 11 Nov 2000 15:38:05 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Pushing a hash on to a stack...
Message-Id: <8ujp4u$78g$1@lublin.zrz.tu-berlin.de>
Christopher Burke <craznar@hotmail.com> wrote in comp.lang.perl.misc:
>ren.maddox@tivoli.com (Ren Maddox) wrote in
><m366lvjwx8.fsf@dhcp11-177.support.tivoli.com>:
>
>>> > push @fulldata, \%hash; # but do not reuse the same %hash
>>>
>>> That one doesn't work ... because, even with creating new %hash each
>>> loop.
>>
>>Looks like you might not have finished this thought. It seems that
>>you started to say why this wouldn't work, but didn't actually say it.
>>
>
>No - I don't know why it doesn't work. When I tried it - it just didn't
>work.
You have shown some mastery of sulky evasiveness in this thread,
but this tops it off.
Look, Christopher was asking you why *you think* the code doesn't
work, not for your explanation why it doesn't. In other words:
Show what you tried. Explain what you expected it to do. Show
how the result doesn't meet your expectation. Then we can start
talking about what's going wrong.
Anno
------------------------------
Date: 11 Nov 2000 10:05:40 -0600
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: Pushing a hash on to a stack...
Message-Id: <m3ofzmjxyj.fsf@dhcp11-177.support.tivoli.com>
anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) writes:
> Christopher Burke <craznar@hotmail.com> wrote in comp.lang.perl.misc:
> >ren.maddox@tivoli.com (Ren Maddox) wrote in
> ><m366lvjwx8.fsf@dhcp11-177.support.tivoli.com>:
[A couple of attributions got lost here a couple of posts back, I wrote
the push line and Christopher wrote the "That one doesn't work" part.]
> >>> > push @fulldata, \%hash; # but do not reuse the same %hash
> >>>
> >>> That one doesn't work ... because, even with creating new %hash each
> >>> loop.
> >>
> >>Looks like you might not have finished this thought. It seems that
> >>you started to say why this wouldn't work, but didn't actually say it.
> >>
> >
> >No - I don't know why it doesn't work. When I tried it - it just didn't
> >work.
>
> You have shown some mastery of sulky evasiveness in this thread,
> but this tops it off.
>
> Look, Christopher was asking you why *you think* the code doesn't
> work, not for your explanation why it doesn't. In other words:
Just to clarify... Christopher is the OP. I (Ren) was asking
Christopher the question. As for what the question was, yes, it
basically comes down to, "Christopher, in what way did that not work
for you?"
> Show what you tried. Explain what you expected it to do. Show
> how the result doesn't meet your expectation. Then we can start
> talking about what's going wrong.
Yes, exactly.
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: Sat, 11 Nov 2000 14:57:00 +0000
From: James Taylor <james@NOSPAM.demon.co.uk>
Subject: Re: Random Array with Sort?
Message-Id: <ant111400d07fNdQ@oakseed.demon.co.uk>
In article <973937192.3210@itz.pp.sci.fi>, Ilmari Karonen
<URL:mailto:iltzu@sci.invalid> wrote:
>
> Fisher-Yates is O(n). You can't improve on that if you want to
> shuffle the whole array.
This is an interesting discussion and Fisher-Yates sounds like an
algorithm I ought to be aware of. I've checked the books I've got:
"Mastering Algorithms with Perl", Knuth vols.1-3, Sedgewick, and
others, but can't find any reference to it. Please could someone
explain Fisher-Yates or point me to a suitable URL. Thanks.
--
James Taylor <james (at) oakseed demon co uk>
PGP key available ID: 3FBE1BF9
Fingerprint: F19D803624ED6FE8 370045159F66FD02
------------------------------
Date: 11 Nov 2000 12:32:44 -0600
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: returning a true value is FUN! (was Re: Log.pm did not return a true value)
Message-Id: <8uk3cc$3sa$1@boomer.cs.utexas.edu>
In article <Pine.GSO.4.21.0011071220120.25313-100000@crusoe.crusoe.net>,
Jeff Pinyan <japhy@pobox.com> wrote:
>On Nov 7, Logan Shaw said:
>
>>> ()=0;
>>
>>Other things that work:
>>
>> !();
>> [];
>> $];
>> $$;
>
>Ah, but those are somewhat more intuitive. Why would assigning 0 to an
>empty list return a true value?
Hmm... I thought ()=0; was fairly intuitive, given what I know about
lists.
How intuitive is it that a reference is true when Perl thinks of it as
a boolean?
- Logan
------------------------------
Date: 11 Nov 2000 12:43:03 -0600
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: Searching for many words in large string
Message-Id: <8uk3vn$3tb$1@boomer.cs.utexas.edu>
In article <slrn90ivsa.dkr.rgarciasuarez@rafael.kazibao.net>,
Rafael Garcia-Suarez <rgarciasuarez@free.fr> wrote:
>Tony Mountifield wrote in comp.lang.perl.misc:
>>Hi, I wonder if anyone can improve on this.
>>
>>I have a potentially long list of words, and need to know which, if any,
>>appear in a large string. Assume the string and the list of words are
>>already folded to lower case.
>>
>>My idea:
>>
>>study $string;
>>@found = grep {$string =~ /\b$_\b/} @wordlist;
>>
>>Can this be improved upon, for speed?
>
>Your method performs one search per word in @wordlist.
>This one may be more efficient (but, of course, this depends on the
>data) :
>
>my $rx = join '|', map "\\b$_\\b", @wordlist; # Construct a big regexp
I was going to suggest that some sort of Boyer-Moore searching or some
similar algorithm would probably be the best, so I went searching the
web for "boyer moore perl", and I found this post:
Article 3772 of comp.lang.perl:
Xref: feenix.metronet.com comp.lang.perl:3772
Newsgroups: comp.lang.perl
Path: feenix.metronet.com!news.utdallas.edu!wupost!darwin.sura
.net!howland.reston.ans.net!usc!elroy.jpl.nasa.gov!swr
inde!network.ucsd.edu!news.cerf.net!netlabs!lwall
From: lwall@netlabs.com (Larry Wall)
Subject: Re: Why are pattern alternatives slower than logical
alternatives?
Message-ID: <1993Jun28.161328.2514@netlabs.com>
Sender: news@netlabs.com
Nntp-Posting-Host: scalpel.netlabs.com
Organization: NetLabs, Inc.
References: <1993Jun28.104548.5922@news.unige.ch>
Date: Mon, 28 Jun 1993 16:13:28 GMT
Lines: 15
In article <1993Jun28.104548.5922@news.unige.ch>
oscar@cui.unige.ch writes:
: It seems that logical alternatives in perl are much more efficient
: than pattern alternatives. Does anyone know why?
: The following example shows up the difference if address-file is big:
:
: time perl -n -e '(/Oscar/||/Xavier/||/Simon/) && print ;' address-file
: time perl -n -e '/Oscar|Xavier|Simon/ && print ;' address-file
:
: Does this mean that pattern alternatives should be avoided in general?
With this particular implementation of regular expressions, yes. The
first example takes advantage of Boyer-Moore searching, while the
second doesn't.
Larry
So, is this still true, or has the implementation changed enough since
1993 that fixed strings are handled differently?
- Logan
------------------------------
Date: Sun, 12 Nov 2000 00:49:00 +1030
From: "nospam" <nospam@mistnet.com>
Subject: simple floating point question
Message-Id: <3a0d52c7@news.iprimus.com.au>
I need some help.
If you can filter a string with something like $scalar=~ /\D/ ( where /d
is for ensures an integer)
So what if you want either an integer 1, 2, 3 etc or a floating point
number 1.00 etc
Can anyone tell me what to place between the // in that case?
TIA
------------------------------
Date: Sun, 12 Nov 2000 01:34:01 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: simple floating point question
Message-Id: <slrn90qm6p.gs3.mgjv@martien.heliotrope.home>
On Sun, 12 Nov 2000 00:49:00 +1030,
nospam <nospam@mistnet.com> wrote:
> I need some help.
>
> If you can filter a string with something like $scalar=~ /\D/ ( where /d
> is for ensures an integer)
It actually doesn't. An integer is allowed to start with a -, and
sometimes, it could even start with a +. All you are testing for is that
the string contains any non-digits.
> So what if you want either an integer 1, 2, 3 etc or a floating point
> number 1.00 etc
>
> Can anyone tell me what to place between the // in that case?
Perl FAQ part 4
=head2 How do I determine whether a scalar is a number/whole/integer/float?
Martien
--
Martien Verbruggen |
Interactive Media Division | Can't say that it is, 'cause it
Commercial Dynamics Pty. Ltd. | ain't.
NSW, Australia |
------------------------------
Date: Sat, 11 Nov 2000 08:37:06 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: switching the user in perl
Message-Id: <slrn90qis2.h2r.tadmc@magna.metronet.com>
On Thu, 9 Nov 2000 13:52:29 -0000 , Dresdner Kleinwort Benson
<patiln@dresdnerkb.com> wrote:
>I got your name from customer's comment for "perl for system admins".
I doubt that you got my name.
Is this a machine-generated posting?
Don't do that.
>We have web server login
>name as 'nescape'. But netscape user is having limited rights, hence we
>decided to change the user as root.
Yikes!
You just announced to the entire World that your system is
open to attack.
Why would you do such a thing?
Do not make your web server run as root.
Change your root password immediately.
Do this quickly! You have done a profoundly silly thing, like walking
down a dark alley at 2am with $50 bills hanging out of your pockets.
Hire a system administrator pronto. Ask _her_ questions about security.
Or at least be circumspect in what you reveal to a world full
of strangers.
--
Tad McClellan SGML consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sat, 11 Nov 2000 17:23:49 GMT
From: ameen @ dausha . net (Ameen Dausha)
Subject: Re: switching the user in perl
Message-Id: <3a0d8092.88541726@news>
I think he means the name of this newsgroup. . .
On Sat, 11 Nov 2000 08:37:06 -0500, tadmc@metronet.com (Tad McClellan)
spat:
>On Thu, 9 Nov 2000 13:52:29 -0000 , Dresdner Kleinwort Benson
> <patiln@dresdnerkb.com> wrote:
>
>>I got your name from customer's comment for "perl for system admins".
>
>
>I doubt that you got my name.
>
>Is this a machine-generated posting?
>
>Don't do that.
>
>
>>We have web server login
>>name as 'nescape'. But netscape user is having limited rights, hence we
>>decided to change the user as root.
>
>
>Yikes!
>
>You just announced to the entire World that your system is
>open to attack.
>
>Why would you do such a thing?
>
>Do not make your web server run as root.
>
>Change your root password immediately.
>
>Do this quickly! You have done a profoundly silly thing, like walking
>down a dark alley at 2am with $50 bills hanging out of your pockets.
>
>
>Hire a system administrator pronto. Ask _her_ questions about security.
>Or at least be circumspect in what you reveal to a world full
>of strangers.
>
>
>--
> Tad McClellan SGML consulting
> tadmc@metronet.com Perl programming
> Fort Worth, Texas
Ben Wilson (a.k.a. Ameen, Last of the Dausha)
____________________________
-"Ever heard of Aristotle . . . Plato . . . Socrates?!"
-"Yes."
-"Morons!"
------------------------------
Date: Sat, 11 Nov 2000 14:51:13 GMT
From: garry@zweb.zvolve.net (Garry Williams)
Subject: Re: use-ing .pm file from different dir
Message-Id: <B1dP5.122$xb1.7314@eagle.america.net>
On 11 Nov 2000 13:09:35 GMT, DoC <doc@CONSORTIUM.RedBrick.DCU.IE>
wrote:
>dVoon said this:
>>If I have a user-defined 'myfunc.pm' file in ~/cgi-bin/sharefunc/ , how
>>do I 'use' it from other different directories?
>>
>If it's just a bunch of useful methods in a file as opposed to an actual
>OO perl module, then you can just go
>
>require '/home/httpd/cgi-bin/sharefunc/myfunc.pm'
>
>If not, you could try invoking perl and telling it to look in this directory
>in your scripts. I.e. instead of the first line of scripts being
>
>#!/usr/bin/perl
>
>Change it to:
>
>#!/usr/bin/perl -I/home/httpd/cgi-bin/sharefunc
>
>Then you could just go
>
>use myfunc;
>
>in your perl script, and It'll look in that directory.
>
>Hope this helps.
Well it might, but why not use the method designed for this?
use lib '/home/httpd/cgi-bin/sharefunc';
use myfunc;
See perlfaq8, "How do I keep my own module/library directory?".
See perldoc for the "lib" module.
--
Garry Williams
Zvolve Systems, Inc.
+1 770 551-4504
------------------------------
Date: Sat, 11 Nov 2000 07:32:00 -0800
From: Salvador Peralta <admin@salvador.venice.ca.us>
Subject: Re: Using POST and POST/ACTION on the same page - I figured it out
Message-Id: <3A0D6670.4A1B431E@salvador.venice.ca.us>
Martien Verbruggen wrote:
>
> On Fri, 10 Nov 2000 23:55:38 -0800,
> Dragonia Radar Freedom, C.S. <radar@jetstream.net> wrote:
> > I figured out my problem 10 minutes after posting this...
> > a </form> is always a good thing :)
>
> it's wonderful that you found your problem. And fixed it.
>
> Now, please, for the next time, if you're still reading this, try to
> figure out before you post whether your problem could possibly be
> something else than a Perl problem. In this case, it was most definitely
> not a Perl problem, and you could have known that immediately. You were
> talking about forms, and what you wanted to display in browsers. Those
> things are _never_ a Perl problem. HTML or browser problems, yes. Not
> Perl.
Unless he had been having aproblem using the methods for building forms
defined in cgi.pm.
Never say "never". :)
--
admin@salvador.venice.ca.us
http://salvador.venice.ca.us
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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.
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 V9 Issue 4869
**************************************