[7887] in Perl-Users-Digest
Perl-Users Digest, Issue: 1512 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Dec 20 05:07:19 1997
Date: Sat, 20 Dec 97 02:00:35 -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, 20 Dec 1997 Volume: 8 Number: 1512
Today's topics:
Re: DEBUGGER: How see expr result ? (Ilya Zakharevich)
Re: does ne1 know... <#@qz.to>
Downloading ALL CPAN Modules? (Roy S. Rapoport)
embare-assed newbie Q ushere@ibm.net
Re: For the Perl programmer who has everything... <ebohlman@netcom.com>
getting directory size <signal@shreve.net>
Re: Happy birthday Perl! (Jonathan Stowe)
Help on accessing the cgi-bin directory <jds35239@pegasus.cc.ucf.edu>
Re: Help with calculating Gunning (reading level) index (Tad McClellan)
Re: Help with pattern matching please? (Andrew M. Langmead)
Re: Help with pattern matching please? <ebohlman@netcom.com>
Re: Help with pattern matching please? <#@qz.to>
Re: HELP! Bitwise XOR (^) doesn't work on strings? (Bart Lateur)
HHEELLPP! <sportspic@stlnet.com>
Re: HHEELLPP! (Tad McClellan)
History of regexp <xah@best.com>
Re: how to do this from STDIN (Tad McClellan)
Re: Iteration within a foreach loop <rootbeer@teleport.com>
Re: Module for Checksums? <rootbeer@teleport.com>
need simple mailer perl scipt <cseh@best.com>
Re: Number of items in an array (Andrew M. Langmead)
Re: Opening remote files <ebohlman@netcom.com>
Password file maintenece <signal@shreve.net>
Re: Perl 5 syntax (Andrew M. Langmead)
Re: Perl and Website ON W95 (PAS)
Re: rindex ? <dha@panix.com>
sending email (Net::SMTP).. problem (Chris Thornton)
Re: targeting a frame window with perl <info@chiefaircraft.com>
Re: targeting a frame window with perl ushere@ibm.net
Re: Teaching programing (Tad McClellan)
Re: Which language pays most 17457 -- C++ vs. Java? <Bill_Leary@msn.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 20 Dec 1997 04:18:38 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: DEBUGGER: How see expr result ?
Message-Id: <67fguu$414$1@agate.berkeley.edu>
In article <349A41B9.6E815F28@seaslug.org>,
Tim Maher <Tim.Maher@seaslug.org> wrote:
> Funny, there's no mention of the "r" command in the debugging chapter of
> the Camel
> book! And all I can find in "perldebug" is the following :
> PrintRet: affects printing of return value after r command
> If the documentation of the r command is in that man page, I can't find
> it! Can
> somebody give me an RE to help me search to the right spot?
Correct. Patches welcome. Meanwhile one can always do
h h
h
h r
as the debugger prompts for.
Ilya
------------------------------
Date: 20 Dec 1997 03:38:27 GMT
From: Eli the Bearded <#@qz.to>
Subject: Re: does ne1 know...
Message-Id: <eli$9712192223@qz.little-neck.ny.us>
Keywords: luser
In article <349AEBB6.AE9BFE00@redrose.net>, MrPc <tjbiuso@redrose.net> wrote:
Took me a long time to figure out just what that subject meant.
There is a FAQish-thing on that doing that (and should probably be
put in the meta-meta FAQ):
<URL:http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post>
> where can i get source code for a keyword search engine?
What does this have to do with perl? You know yahoo has a subject
area on search engines? Used to just be software to implement them,
that was years ago though, now there are software pacakges and
online engines intertwined. It would be a good place for you to
start searching however.
(If you don't know how to use a search engine, just what do you
think you are going to do with the source?)
Elijah
------
brian d foy's Meta Meta FAQ: <URL:http://computerdog.com/Meta_MetaFAQ.html>
------------------------------
Date: 19 Dec 1997 16:24:49 -0800
From: rsr@best.com (Roy S. Rapoport)
Subject: Downloading ALL CPAN Modules?
Message-Id: <67f38h$rpb$1@shell3.ba.best.com>
This whole thing started when I downloaded LWP, and it complained
about the absence of MIME::Base64, and then I downloaded Net::FTP and
it complained about the absence of DATA::Dump, etc etc.
So I figure: Hey, I've got a decent net connection and the diskspace
to afford it, why don't I just download ALL the modules?
It looks like all the modules are in the CPAN directory under
authors/id/<AuthorID>. This makes it somewhat hard to get all of them
(especially when I seem to be having a problem with a site that will
keep a connection open long enough for me to be able to do an mget -R
within ncftp)
So two questions:
A) Why _shouldn't_ I download+install all the modules?
B) Has anyone come up with an automated way to get all the modules? It
doesn't _look_ like the CPAN module deals with 'install *' ...
-roy
------------------------------
Date: Sat, 20 Dec 1997 01:38:45 -0500
From: ushere@ibm.net
Subject: embare-assed newbie Q
Message-Id: <349B67F4.6042@ibm.net>
I'm having trouble getting a file written with tab
field separators. All the saves use a single space
instead.
is/are there any obvious goofs in this?
--------------------------------------
$,="\t";
{snip}
sub holwrite
{
$,="\t";
$fid="hw";
unlink <hw>;
open PENCIL, "> $fid" || die "can't open $fid ... $! \n";
foreach $ix (keys %hash)
{
{
print PENCIL "@{$hash{$ix}}";
}
}
close (PENCIL);
}
-----------------------------------------------
thanks for any hints.
cheers, /e-mail appreciated/
-|- Who, has loved us more? -|-
------------------------------
Date: Sat, 20 Dec 1997 00:16:43 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: For the Perl programmer who has everything...
Message-Id: <ebohlmanELGorv.Lo7@netcom.com>
Eli the Bearded <#@qz.to> wrote:
: Eric Bohlman <ebohlman@netcom.com> wrote:
: > I stopped by the local F.A.O. Schwartz (upscale US toy retailer) and what
: Oo, so close, but no. Schwartz is the correct spelling for Randal,
: but not for the store. That's "Schwarz".
No, the store did *not* have any stuffed fish that I could see.
------------------------------
Date: Fri, 19 Dec 1997 19:02:31 -0600
From: Brian <signal@shreve.net>
Subject: getting directory size
Message-Id: <349B1927.75ED@shreve.net>
I recently wrote a perl program to tell me which users of ours have web
pages in there directories, and if so, how much space it was taking up.
Now I know my code is very sloppy, please forgive. What I am trying to
accomplish is to get it to go faster.......
I am looking for a native perl function or library that will have
something similar to the "du" command in it so I can get directory
sizes. Also feel free to critisize my code and tell me any other places
I am doing something wrong and could make it better/faster.
When you have to check several thousand users directories its nice to be
able to make something go faster:
#!/usr/bin/perl
$hasweb=0;
chdir "/home/cust";
while(<*>) {
$currentdir=$_;
chdir $currentdir;
while(<*>) {
tr/A-Z/a-z/;
if(/htm/ || /HTM/) {
$size=`du -bs`;
$size=~s/\.//;
chop($size);
$total=$total+$size;
$percent=(($size/6000000)*100);
printf "%s\t%s\t%d%%\n",$currentdir,$size,$percent;
last;
}
}
chdir "..";
}
closedir DIR;
print "Total space used: $total\n";
--
/------------------------signal@shreve.net----------------------------\
|Brian Feeny | USR TC Hubs |ShreveNet Inc. (318)222-2638 |
|Systems Administrator | Perl, Linux |Web hosting, online stores, |
|ShreveNet Inc. | USR Pilot |Dial-Up 14.4-56k, ISDN & LANs|
|89 CRX DX w/MPFI, lots of|-=*:Quake:*=-|http://www.shreve.net/ |
|mods/Homepage coming soon|LordSignal/SN|Quake server: 208.206.76.3 |
\------------------------318-222-2638 x109----------------------------/
------------------------------
Date: 19 Dec 1997 23:59:57 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Happy birthday Perl!
Message-Id: <67f1pt$ch8$1@uranium.btinternet.com>
Keywords: sponsored by the letters C, F, K, and U
>the count <eglamkowski@angelfire.com> wrote:
>> So, what's everybody's favorite feature of perl?
>
in several word... It was never written in COBOL and thus the majority of
my colleagues will never be able to use it (he said in a rather puerile
post pub manner) -
PS when is the ICL VME port coming out guys ;-} (UK Local government joke
that)
Jonathan
------------------------------
Date: Fri, 19 Dec 1997 23:22:45 -0500
From: Jason Schutz <jds35239@pegasus.cc.ucf.edu>
Subject: Help on accessing the cgi-bin directory
Message-Id: <349B4815.81E4BCA5@pegasus.cc.ucf.edu>
I don't know what the problem is, maybe just a lack of privlidges,
but I have the password for an account on an NT server and the cgi-bin I
need to access runs parallel to my directory and I can't access it. Is
there any way other than saying cd ../cgi-bin (which I tried) to access
this directory. Plus I've tried using put and get put that doesn't work
either. Please help.
------------------------------
Date: Fri, 19 Dec 1997 18:37:02 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Help with calculating Gunning (reading level) index for documents
Message-Id: <ev3f76.ke8.ln@localhost>
Bass Player (fenderbass@evang.com) wrote:
: I am trying to determine the reading grade level (Gunning FOG Index) of a text
: document. I do have the calculation, but I ran into a snag....
: $a=any 100 word block
: $b=number of sentences in $a
: $c=number of words in $a having over 3 syllables.
: $GFI = int(( (100/$b) + $c) *0.4 ))
: The biggest stumbling block is trying to determine the number of syllables in
: a particular word. Anyone got any help on this?
^^^^^^^^^^^^
Not much, I'm afraid.
The only thing I can think of is to do a dictionary lookup in a
... well, in a Dictionary ;-)
Which will leave you flat-footed if the word in question is not
in the dictionary.
Finding the data with syllables marked seems the hard part.
Can't help with the hard part, but after you find it, you could:
--------------------------
#!/usr/bin/perl -w
# construct a syllable lookup table
# key is the 'word' (sans markup), value is the number of syllables
while (<DATA>) {
chomp;
$cnt = tr/-//d;
$syllables{$_} = $cnt + 1;
print "$_: $syllables{$_}\n"; # debugging statement
}
__DATA__
I
am
try-ing
to
de-ter-mine
the
read-ing
grade
lev-el
--------------------------
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sat, 20 Dec 1997 00:08:07 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Help with pattern matching please?
Message-Id: <ELGoDJ.AMI@world.std.com>
Rosemary I H Powell <Rosie@dozyrosy.demon.co.uk> writes:
> %card_types = (
> ".Chr" => "Christmas",
> ".Eas" => "Easter",
> ".Gen" => "General Greetings",
> ".Get" => "Get Well",
> ".Mot" => "Mothers Day",
> ".Val" => "Valentine",
> );
>
> while (($key,$value) = each(%card_types)) {
># next line is the problem one:
> if ($form_data{'ticket'} =~ m/$key/i) {
The character "." is a regular expression metacharacter. When you
interpolate $key into your regular expression, it does not lose its
special meaning.
One way of solving it would be to use the \Q and maybe the \E escape
sequences to "quote" metacharacters. But since you want to match the
extension, maybe you want to include the metacharacter to match the
end of the string.
if ($form_data{ticket} =~ m/\Q$key$/i) {
Another would be to make the key a regular expression that matches.
'\.Chr$' => 'Christmas',
--
Andrew Langmead
------------------------------
Date: Sat, 20 Dec 1997 00:25:49 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Help with pattern matching please?
Message-Id: <ebohlmanELGp71.Mro@netcom.com>
Rosemary I H Powell <Rosie@dozyrosy.demon.co.uk> wrote:
: # next line is the problem one:
: if ($form_data{'ticket'} =~ m/$key/i) {
[snip]
: But I have just discovered that it will also match the card_type string
: earlier, excluding the initial "." e.g In the string:
: dvalenzu.27443.Chr
: it is matching the "val" not the ".Chr"
: I believe I ought to use:
: m/$key$/i
: to anchor the pattern match to the end of the the string? But why is it
: not including the "." part of the pattern? Am I wrong in assuming that
: Perl should not consider the "." to be a special character if it part of
: a variable? What am I doing wrong please?
Yes, you are indeed wrong about your assumption. Special characters
(metacharacters) in interpolated variables are no different from
metacharacters in literal text.
Fortunately, your problem is so common that Perl has a built-in way
around it. If you change your pattern to:
m/\Q$key\E$/i
Perl will scan $key for any metacharacters and stick backslashes in front
of them when it copies them into the pattern. This will cause, for
example, a period to match a literal period and not just any character.
You'll probably want to read perlre() a second time (you did read it the
first time, didn't you) and learn some new things.
------------------------------
Date: 20 Dec 1997 03:15:42 GMT
From: Eli the Bearded <#@qz.to>
Subject: Re: Help with pattern matching please?
Message-Id: <eli$9712192200@qz.little-neck.ny.us>
Andrew M. Langmead <aml@world.std.com> wrote:
> Rosemary I H Powell <Rosie@dozyrosy.demon.co.uk> writes:
> > %card_types = (
> > ".Chr" => "Christmas",
...
> ># next line is the problem one:
> > if ($form_data{'ticket'} =~ m/$key/i) {
> The character "." is a regular expression metacharacter. When you
> interpolate $key into your regular expression, it does not lose its
> special meaning.
She knew that but did not realize it happened for interpolated values.
> One way of solving it would be to use the \Q and maybe the \E escape
> sequences to "quote" metacharacters. But since you want to match the
> extension, maybe you want to include the metacharacter to match the
> end of the string.
>
> if ($form_data{ticket} =~ m/\Q$key$/i) {
Her original suggestion of using "m/$key$/i" would work. Your
example does not:
:r! perl -we '$_=".nypm";$m=$_;printf(((m/\Q$m$/i)?"Yes":"No")."\n")'
No
After interpolation, the \Q will quote the metacharacters, including
the $ you hoped to have match the end of the string. Put in the \E
you wrote about and all works well:
:r! perl -we '$_=".nypm";$m=$_;printf(((m/\Q$m\E$/i)?"Yes":"No")."\n")'
Yes
> Another would be to make the key a regular expression that matches.
> '\.Chr$' => 'Christmas',
You could do this, but it is a generally sucky idea. Now the key
prints differently without the benefit of being a regular expression
that matches itself.
Elijah
------
perl -e 's Y Yreverse q N ny pm srekcah lrep kroy wen emosNYex and s Pmp ynP
P and s MsMjust sMx and print and s NYPM MPYN Nis or reverse and print q qq'
------------------------------
Date: Sat, 20 Dec 1997 08:28:32 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: HELP! Bitwise XOR (^) doesn't work on strings?
Message-Id: <349b8118.179275@news.tornado.be>
Tom Phoenix <rootbeer@teleport.com> wrote:
>If you are intending to manipulate bitstrings, you should be certain that
>you're supplying bitstrings: If an operand is a number, that will imply
>a numeric bitwise operation. You may explicitly show which type of
>operation you intend by using "" or 0+, as in the examples below.
>
> $foo = 150 | 105 ; # yields 255 (0x96 | 0x69 is 0xFF)
> $foo = '150' | 105 ; # yields 255
> $foo = 150 | '105'; # yields 255
> $foo = '150' | '105'; # yields string '155' (under ASCII)
This doesn't make sense. We've always been told that "a scalar is a
scalar". From a programmer's viewpoint (as opposed an implementor's
viewpoint) we cannot distinguish between a string and a number. So any
operator should always behave the same.
Bart.
------------------------------
Date: Fri, 19 Dec 1997 19:34:08 -0600
From: sportspic <sportspic@stlnet.com>
Subject: HHEELLPP!
Message-Id: <349B2090.2C60@stlnet.com>
I am a newbie...I am trying and set up a guestbook script(The guestbook
at "Matt's Script Archive" to be exact) and I keep getting an "Internal
Server Error" when trying to add to the guestbook.Can somebody please
help me!
------------------------------
Date: Sat, 20 Dec 1997 00:04:34 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: HHEELLPP!
Message-Id: <i5nf76.8k9.ln@localhost>
sportspic (sportspic@stlnet.com) wrote:
: I am a newbie...
You don't have to say so. We can tell ;-)
[
You didn't put an actual subject in your Subject header.
You should, you know. Less people will skip over it if they
can tell what it is about from the Subject:
Some people have programs that automatically delete articles
that match this perl pattern match: m/h+e+l+p+[!?]*$/i
( variations of "help!")
]
: I am trying and set up a guestbook script(The guestbook
: at "Matt's Script Archive" to be exact) and I keep getting an "Internal
: Server Error" when trying to add to the guestbook.Can somebody please
^^^^^^^^^^^^
That error message gives you a clue (that's the purpose of an error
message ;-)
You have a server error of some kind.
But this is the Perl newsgroup, and Perl doesn't _have_ a server.
: help me!
Folks that know about servers and CGI scripts and such are found in
a different newsgroup.
You should try asking in a newsgroup related to your question,
such as:
comp.infosystems.www.authoring.cgi
comp.infosystems.www.servers.mac
comp.infosystems.www.servers.misc
comp.infosystems.www.servers.ms-windows
comp.infosystems.www.servers.unix
And see the answer to the following Perl Frequently Asked Question:
"My CGI script runs from the command line but not the browser.
Can you help me fix it?"
which points out several other sources of helpful information.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 19 Dec 1997 23:40:35 -0800
From: "Xah" <xah@best.com>
Subject: History of regexp
Message-Id: <67fsh5$9ft$1@nntp1.ba.best.com>
Is there anywhere on the web that discuss the history of regular expression?
The idea, research, implementation, theory etc.?
I know that the O'Reilly's _Regular Expressions_ (owl book) covers it a bit.
I'm looking for texts that I can read free on-line.
Xah, xah@best.com
http://www.best.com/~xah/MathGraphicsGallery_dir/Tiling_dir/tiling.html
Mountain View, CA, USA
------------------------------
Date: Sat, 20 Dec 1997 00:56:25 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: how to do this from STDIN
Message-Id: <p6qf76.9o9.ln@localhost>
WOLtetch (woltetch@aol.com) wrote:
: Ironically, I do know how to do it with files as arguments.
That's OK, neither do I.
I know how to do it with filenames as arguments though ;-)
: All I want is to be able to type in the program name at the command line, then
: enter some items to sort and have the script sort them. So it's STDIN I'm using
: here (badly it seems).
^^^^^^^^^^^^^^
Looks OK to me.
I tried your script.
Works fine for me (now that I know that you want to enter them on STDIN).
You are, of course, using the appropriate end-of-file for your
operating system when you are done entering the list of things
that you want to sort, aren't you? ( control-D on Unix )
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 19 Dec 1997 16:28:16 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Terry Michael Fletcher - PCD ~ <tfletche@pcocd2.intel.com>
Subject: Re: Iteration within a foreach loop
Message-Id: <Pine.GSO.3.96.971219162550.23972L-100000@user2.teleport.com>
On 19 Dec 1997, Terry Michael Fletcher - PCD ~ wrote:
> > @buf = split /\n/, `whois $domname`;
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> nice. i wish this came up more often in user's code than seeing backticks
> and chops everywhere.
I'm not sure what you're saying is nice. It would be nicer to do this,
wouldn't it?
chomp(@buf = `whois $domname`);
...not that there's a big difference in execution speed in this case,
since the whois is going to take so long. Cheers!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Fri, 19 Dec 1997 16:31:37 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Jeremy Brinkley <jeremy@wishbone.stanford.edu>
Subject: Re: Module for Checksums?
Message-Id: <Pine.GSO.3.96.971219162913.23972M-100000@user2.teleport.com>
On 19 Dec 1997, Jeremy Brinkley wrote:
> What I'd like is a module to implement various checksum schemes on
> arbitrary data--you'd use it like this:
>
> use CheckSum;
>
> $mysum = bsd_sum($data);
> $mysum = md5_sum($data);
How many checksums do you need? :-) But doesn't the existing MD5 module
do enough for you, seriously?
If you need others, maybe you should make them as individual modules,
since that's more, well, modular.
use Checksum::BSD;
Cheers!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Fri, 19 Dec 1997 22:40:43 -0800
From: Frank Cseh <cseh@best.com>
Subject: need simple mailer perl scipt
Message-Id: <349B686B.103C@best.com>
Hi
I need a simple perl script, that mails to me a URL
the visitor entered on my web page in an InputBox -form.
The SendTo address in my email address, the URL should be put in the
Body field.
TIA
please respond also via mail also:
cseh@best.com
http://www.best.com/~cseh/
--
------------------------------
Date: Sat, 20 Dec 1997 00:25:00 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Number of items in an array
Message-Id: <ELGp5p.HEp@world.std.com>
tfletche@pcocd2.intel.com (Terry Michael Fletcher - PCD ~) writes:
>i see both sides here, but i would have to say that it can be just as
>misleading to use scalar() to get a scalar context, when it would have
>been scalar context anyways. this can lead 'lass' experienced coders in
>the wrong direction, too, thinking that it would have returned some sort
>of list.
>From my opinion, it depends on the context. In the statement:
push @random, splice @orig, scalar @orig, 1 while @orig.
The scalar can be useful because the chances that someone remembers
the exact syntax to splice (and whether the second argument is an
array or a scalar)
But the "while @orig" is an obvious succinct expression that describes
whether the array @orig contains any elements.
--
Andrew Langmead
------------------------------
Date: Sat, 20 Dec 1997 00:29:16 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Opening remote files
Message-Id: <ebohlmanELGpCs.AM@netcom.com>
Daniel Perez <danielperez@dragonet.es> wrote:
: I want to open files in other servers (not in mine) with a Perl CGI
: program from my server, and I don't know how to do it.
: Can anybody help me?
Yes, the kindly folks who wrote the LWP module can. If you don't already
have it, go over to your nearest CPAN site and grab it. The
documentation is quite comprehensive.
------------------------------
Date: Fri, 19 Dec 1997 19:13:31 -0600
From: Brian <signal@shreve.net>
Subject: Password file maintenece
Message-Id: <349B1BBB.3198@shreve.net>
Do any perl functions/librarys exist for maintaining the password files
on unix systems? Something like:
changing a users password information
I know about getpwnam()setpwnam() etc, but I want to change something.
Right now I open up 2 filehandles, one reads the password file in, and
writes it out to filehandle #2. When the user you want to "modify" is
read, it doesnt read from filehandle #1, it writes its own info, then
continues to get info from filehandle 1 and write to 2 until the
password file is complete, then moves the filehandle 2 to /etc/passwd:
Something like this, but is this the only way?
###############################
#### Change users password ####
###############################
sub change_user_pass {
&get_username;
open(PASSWD,$passwd_file) || die "Cannot open $passwd_file: $!";
open(NPASSWD,">$new_passwd_file") || die "Cannot create
temporary passwd file: $!";
while(<PASSWD>) {
($tlogin,$tpasswd,$tuid,$tgid,$tgecos,$thome,$tshell)
=split(/:/);
if($tlogin ne $username) {
print NPASSWD $_;
}
}
close(NPASSWD);
close(PASSWD);
}
--
/------------------------signal@shreve.net----------------------------\
|Brian Feeny | USR TC Hubs |ShreveNet Inc. (318)222-2638 |
|Systems Administrator | Perl, Linux |Web hosting, online stores, |
|ShreveNet Inc. | USR Pilot |Dial-Up 14.4-56k, ISDN & LANs|
|89 CRX DX w/MPFI, lots of|-=*:Quake:*=-|http://www.shreve.net/ |
|mods/Homepage coming soon|LordSignal/SN|Quake server: 208.206.76.3 |
\------------------------318-222-2638 x109----------------------------/
------------------------------
Date: Sat, 20 Dec 1997 00:13:10 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Perl 5 syntax
Message-Id: <ELGoLy.Cr4@world.std.com>
kchadha@hotmail.com writes:
>(Assume A, B and C each have a function PRINT which
>takes a parameter x).
>(Also, assume I get read a variable $function which
>can either contain the value A, B or C). I want
>to do the following:
>$function::PRINT($x)
>I get a syntax error with the above. If I were
>to do A::PRINT($x) or B::PRINT($x), I get no error.
You seem to be mixing up a perl module, and a perl module that
implements objects.
If you use the bless() operator on a reference, it "rememebers" which
package it is attached to. This blessed reference is what the
programmer cna use as an object. And then if you call a "method" with
that object, you will get the method that it either defined or
inherited.
See the perltoot man page for details.
--
Andrew Langmead
------------------------------
Date: Sat, 20 Dec 1997 00:27:58 GMT
From: temp@mailcheck.com (PAS)
Subject: Re: Perl and Website ON W95
Message-Id: <349b103b.60975927@news.erols.com>
Gilles,
I don't know if you got this problem resolved or not. If not, you
might want to check this to see if this is what is causing your
problem.
I am running perl/WebSite/Win95 also. It sounds to me like what you
are seeing is the cgi logging function. Check your properties sheets
in the WebSite administrator under logging and make sure that API/CGI
Execution is UNchecked. If it is checked, the dos box will open up
everytime someone accesses the perl script.
Hope this helps.
Regards,
Paul Sinclair
On Wed, 17 Dec 1997 00:57:10 GMT, Gilles.Maire@ungi.com (Gilles Maire)
wrote in comp.lang.perl.misc:
>Hi,
>
>I have reinstalled my perl 5004 on my window 95 and when I execute a
>CGI I have a dos window and my script is excuted inside.
>Any idea please ?
>
>Regards
>
>GM
>
>Amicalement
>
> Gilles.Maire@ungi.com
>|||||||||||||||||||||||||||||| - UNGI - ||||||||||||||||||||||||||||||
> http://www.ungi.com
------------------------------
Date: 20 Dec 1997 01:02:55 -0500
From: David Adler <dha@panix.com>
Subject: Re: rindex ?
Message-Id: <vx93ejod01e.fsf@panix.com>
mike@stok.co.uk (Mike Stok) writes:
>
> In article <67650t$f05$1@paris.magic.fr>, LE CORRE <lecorre@magic.fr> wrote:
> >Do you know what rindex mean ?? Thanks
> >lecorre@magic.fr
You know, all these technical answers are all well and good but...
>From the Llama...
"Astro pronouncing 'windex'".
best,
--
David H. Adler - <dha@panix.com>
"The perversity of the Universe tends towards a maximum."
------------------------------
Date: Sat, 20 Dec 1997 06:27:11 GMT
From: avies@penny-empire.com (Chris Thornton)
Subject: sending email (Net::SMTP).. problem
Message-Id: <349d6523.376893198@news.execulink.com>
Hi all.. I've got a problem.. I use Net::SMTP to send some mail out in
a perl prog... my problem is this... several times, i've seen that the
mail server I had in there wasn't up, or had a problem for whatever
reason, and none of the mail was sent.... I send similar to this:
$mailhost = 'my.mail.server';
$smtp = Net::SMTP->new($mailhost);
$smtp->mail('me@myaddress.com');
$smtp->to($emailer);
$smtp->data();
$smtp->datasend("$senders","From: $from (ME)\n","Reply-To: $from\n
$smtp->dataend();
$smtp->quit;
and it all works fine if the mail server is up... the problem is, I
need this to send mail out ALL THE TIME it's very important that it
doesn't skip an Email... does anyone know a way how I can either send
to a different mail server if it cannot connect to the first one, or
even record the error, and variables (IE which Email wasn't sent) to a
file so the mail can be sent later. I'd rather be able to have it go
to another mail server if it can't connect to the primary one (I've
got access to several) anyways... any help would be appreciated.
Please If you can, please email reply to avies@penny-empire.com as
well as to the group.. thanks
Chris
------------------------------
Date: 20 Dec 1997 00:19:37 GMT
From: "Sean Smithers" <info@chiefaircraft.com>
Subject: Re: targeting a frame window with perl
Message-Id: <01bd0cdc$c20fdd80$50841ad0@seans>
Is there a way to an html frame without using html? After all, the browser
is the one doing the parsing to display your page.
Shawn Tolivar <shawn@wwgv.com> wrote in article
<34981E8B.83BA10E6@wwgv.com>...
> is there a way to use perl to target an html frame without using the <a
> href> tag?
>
>
------------------------------
Date: Fri, 19 Dec 1997 23:51:21 -0500
From: ushere@ibm.net
To: Sean Smithers <info@chiefaircraft.com>
Subject: Re: targeting a frame window with perl
Message-Id: <349B4EC9.4F8D@ibm.net>
[post and mail]
Sean Smithers wrote:
>
> Shawn Tolivar <shawn@wwgv.com> wrote in article
> <34981E8B.83BA10E6@wwgv.com>...
> > is there a way to use perl to target an html frame without using the <a
> > href> tag?
> >
this might work IF you can direct a script into the URL {haven't tried
it yet},
<META HTTP-EQUIV="REFRESH" CONTENT="13; URL=0gear34.htm">
or,
print<<xhtm
<html><head><title>sometitle</title></head>
<body background="bak.gif" text="#000000" link="#0000ff"
vlink="#ff0000">
<form action="/cgi-bin/nextscript.pl" TARGET=\"frm1\" method="POST">
<input type="submit" name="goforbutton" value=" GoFer ">
</form>
xhtm
;
or, in a frameset;
<frame name="framename" etc..... src="therescript.pl">
I'm so newbie it's embare-assing so I don't even dream of being able
to explain these; could be just roundabout versions of <a href>.
While I'm here, ' I ' need a way to reverse this
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
and print the 'CONTENT_LENGTH' into memory from another array IF
there is any easy way of doing it... other than filling a form with
preset
values which sounds very unperlish, as in 'work' |:-( ???
cheers, /e-mail appreciated/
-|- Who, has loved us more? -|-
> >
------------------------------
Date: Sat, 20 Dec 1997 00:25:04 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Teaching programing
Message-Id: <0cof76.kl9.ln@localhost>
Chris Winters (cwinters@clark.net) wrote:
: Jacqui Caren <Jacqui.Caren@ig.co.uk> wrote:
: >I would (depending upon skills etc) start with Pascal. It provides
: >a better programming model for teaching than BASIC.
: >
: >There should be some very good Pascal primers designed for teaching
: >purposes.
: I remember with fondness the text *Oh, Pascal!* from my high
^^^^^^^^^^
: school days.
I learned to program from that text also.
Seemed to work fine for me, though I can't say that I remember
much about the book itself...
80% of my college textbooks are in boxes in the garage, but
"Oh, Pascal" is right here on my bookshelf.
Haven't looked at it for several years though.
: I saw recently that it had been updated since then
: (which wasn't that long ago).
Let's see. Mine was copyrighted... scuffle, scuffle,
.. in 1982
Could it have been that long ago?
Sigh...
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 19 Dec 1997 21:51:39 -0500
From: "William J. Leary Jr." <Bill_Leary@msn.com>
Subject: Re: Which language pays most 17457 -- C++ vs. Java?
Message-Id: <uEkDKIPD9GA.302@upnetnews04>
Quowong P Liu wrote in message <67evu7$9db$1@geraldo.cc.utexas.edu>...
>Bill Gates is rich. What language does Bill Gates like?
>From what he said in the interview I saw (which had to have been a bit
dated, they were talking about Win 3.1 as "current.") the answer is: Basic.
- Bill
------------------------------
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 1512
**************************************