[10410] in Perl-Users-Digest
Perl-Users Digest, Issue: 4003 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Oct 18 15:02:21 1998
Date: Sun, 18 Oct 98 12:00:22 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sun, 18 Oct 1998 Volume: 8 Number: 4003
Today's topics:
Re: Are there any "perl.newbie" group or forum? <eashton@bbnplanet.com>
Re: Are there any "perl.newbie" group or forum? (Joergen W. Lang)
Re: Comparing dates in Perl (Steffen Beyer)
Re: I have a few elementary Perl problems (Ilya)
Re: I have a few elementary Perl problems <eashton@bbnplanet.com>
interogate values from a select multiple? <solomonf@sd.znet.com>
Re: interogate values from a select multiple? (Garth Sainio)
Re: Passing Filehandle as parameters to function <strougatski@clara.net>
Re: Perl as a first language... I vote yes! <eashton@bbnplanet.com>
PERLBOOK-5.005_02 - Complete PDF documentation for Perl (Bill Middleton)
Re: Raleigh.pm (Raleigh, NC, USA perl mongers) has regi (Craig Berry)
Re: Raleigh.pm (Raleigh, NC, USA perl mongers) has regi <eashton@bbnplanet.com>
Re: Raleigh.pm (Raleigh, NC, USA perl mongers) has regi <dgris@perrin.dimensional.com>
replacing <imchat@imchat.com>
Re: replacing (Garth Sainio)
Re: replacing <imchat@imchat.com>
Re: replacing <dgris@perrin.dimensional.com>
Re: replacing <imchat@imchat.com>
Re: rsh perl problem <eashton@bbnplanet.com>
Shell commands <biela@netdienste.de>
Re: Shell commands <jason.holland@dial.pipex.com>
Re: Shell commands <eashton@bbnplanet.com>
Re: Shell commands (Nathan V. Patwardhan)
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 18 Oct 1998 17:10:45 GMT
From: Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com>
Subject: Re: Are there any "perl.newbie" group or forum?
Message-Id: <362A1E90.4B05E73@bbnplanet.com>
Joergen W. Lang wrote:
> Something along the line of
> use FOOD::DINNER qw(candle_light);
> would be very nice. ;-)
Candle light? Sounds a bit too romantic for me
use DINNER::SESAMEBEEF qw(at_desk);
is more like it :) The light from the monitor I guess could be sorta
like candle light.
e.
After all, the cultivated person's first duty is to
always be prepared to rewrite the encyclopedia. - U. Eco -
------------------------------
Date: Sun, 18 Oct 1998 19:18:56 +0100
From: jwl@_munged_worldmusic.de (Joergen W. Lang)
Subject: Re: Are there any "perl.newbie" group or forum?
Message-Id: <1dh3zc6.ort8i6fvr6v4N@host061-210.seicom.net>
Andrew Johnson <ajohnson@gatewest.net> wrote:
> Joergen W. Lang wrote:
> >
> > Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com> wrote:
> >
> > > > Perl is _not_ just for breakfast anymore!
> > >
> > > Yes, and the day it makes dinner for me my life will be complete. :)
> > >
> > > e.
> >
> > Something along the line of
> > use FOOD::DINNER qw(candle_light);
> > would be very nice. ;-)
>
> heck, I'd be happy if
>
> make Kraft::Dinner
>
> worked out of the box.
> :-)
>
> andrew
# Can't locate object method "make" via package "Kraft::Dinner".
^^^^^^^
(F) You called a method correctly, and it correctly indicated a
package functioning as a class, but that package doesn't define that
particular method, nor does any of its base classes. See perlobj.
hth, ;-)
Joergen
--
To reply by email please remove _munged_ from address Thanks !
-------------------------------------------------------------------
"Everything is possible - even sometimes the impossible"
HOELDERLIN EXPRESS - "Touch the void"
------------------------------
Date: 18 Oct 1998 16:27:37 GMT
From: sb@engelschall.com (Steffen Beyer)
Subject: Re: Comparing dates in Perl
Message-Id: <70d4tp$k3i$1@en1.engelschall.com>
Lawrence Frewin <Sales@the-net.co.uk> wrote:
> I want to add a subroutine to a Perl file that looks at the date a
> database entry was created, compares it with the current date, then if
> the entry is more than one month old it deletes the entry from the
> database.
> I have worked out how to add the date to each database entry I make, but
> relating that to the current date less thirty days isn't as easy as I
> though it would be.
> [...]
> Does anyone know the name and URL of any perl scripts that uses
> previously determined dates for comparison against the current date then
> performs an action based on the result?
Perl modules are your friend.
There is "Date::Manip" and "Date::Calc available on CPAN (the "Comprehensive
Perl Archive Network") under the URL
http://www.perl.com/CPAN/modules/by-module/Date/
With Date::Calc, you would go about your problem as follows:
use Date::Calc qw(:all);
$limit = Date_to_Days(Today()) - 30;
($year,$month,$day) = date_from_your_database(); # must be provided by you
if (Date_to_Date($year,$month,$day) <= $limit)
{
# delete it
}
Hope this helps.
Yours,
--
Steffen Beyer <sb@engelschall.com>
Free Perl and C Software for Download: www.engelschall.com/u/sb/download/
------------------------------
Date: 18 Oct 1998 16:32:09 GMT
From: ilya@ns1.foothill.net (Ilya)
Subject: Re: I have a few elementary Perl problems
Message-Id: <70d569$7t$1@ns2.foothill.net>
Ronald J Kimball (rjk@coos.dartmouth.edu) wrote:
: [posted and mailed]
: Ilya <ilya@ns1.foothill.net> wrote:
: > I have the following script. The purpose of the script is to process the
: > MASTER_LIST, which is a file that simply contains a number of fully
: > qualified host names. I want to perform several Unix commands on each host
: > via remsh, and then save the results in its corresponding directory, i.e.,
: > I want to save the ouput from machine1 to the directory
: > /home/ilya/web/sysinfo/machine1/command.out.
: >
: > #!/usr/contrib/bin/perl
: > # Open a file in the format:
: > # fully_qualified_name1
: > # fully_qualified_name2
: > # fully_qualified_name3
: >
: > open (MASTER_LIST, "<master_list"); #open master_list for reading
: open (MASTER_LIST, "<master_list")
: or die "Unable to open master_list: $!\n";
: > while (<MASTER_LIST>) # read until EOF
: > {
: >
: > chop;
: use chomp() instead.
: > system ("remsh $_ command > /home/ilya/web/sysinfo/$_/command");
: >
: > }
: > close (MASTER_LIST);
: >
: >
: > However, the problem is that in the example above,
: > /home/ilya/web/sysinfo/$_/command apparently does not expand to
: > /home/ilya/web/sysinfo/machineXX/command file as it should and I am
: > getting an error message:
: If the string were not being interpolated properly, you would not be
: getting the following errors.
:
: > $ ./build_page.pl
: > sh: /home/ilya/web/sysinfo/machine1: Cannot create the specified file.
: > sh: /home/ilya/web/sysinfo/machine2: Cannot create the specified file.
: > sh: /home/ilya/web/sysinfo/machine3: Cannot create the specified file.
: >
: > Now why would this be? Of course it cannot create
: > /home/ilya/web/sysinfo/machine3 file, because it is a directory. I am
: > trying to create /home/ilya/web/sysinfo/machineXX/command_name, in each
: > directory.
: Do the directories already exist? If not, perhaps the error message
: means that the shell cannot even create the directory in which you have
: asked it to create the file.
Yes, the directories already exist.
All of the following create files the way I want to:
system ("remsh $_ command > /tmp/test.$_"
system ("remsh $_ command > /home/test.$_"
system ("remsh $_ command > /home/ilya/test.$_"
system ("remsh $_ command > /home/ilya/web/test.$_"
system ("remsh $_ command > /home/ilya/web/sysinfo/test.$_"
But
system ("remsh $_ command > /home/ilya/web/sysinfo/$_/test.$_"
Gives me the erorr. What's up with that?
: Perhaps the shell does not have the proper permissions to create the
: directory.
The directories have already been created.
: >
: > chop;
: > system ("remsh $input command > /home/ilya/web/sysinfo/$uptime/command");
: > print "Processing $input \n";
: > }
: >
: > That does not give me an error. Instead, it logs me in to each machine
: > want to run the command on!!! I do NOT want to log on each machine. I
: > want to remsh a few command for a few dozen machines and record the
: > output.
: That's because you forgot to update the chop; line. You're still
: chopping $_, instead of $input, so your argument to system now looks
: like:
: remsh machineXX
You are right about that. I will fix it, hopefully it will work. Thank you
for your very clear explanation.
: command > /home/ilya/web/sysinfo/$uptime/command
: The shell executes `remsh machine`, logging you into machineXX.
: Everything following the newline is most likely ignored.
: By the way, that's really not Perl's fault.
You are right about that as well.
: I am sorry to hear that you are disappointed. Stick with it, and I
: think you will be able to figure it out.
I will try!
Ilya
------------------------------
Date: Sun, 18 Oct 1998 17:38:54 GMT
From: Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com>
Subject: Re: I have a few elementary Perl problems
Message-Id: <362A2529.57682B40@bbnplanet.com>
Ronald J Kimball wrote:
> Perhaps the shell does not have the proper permissions to create the
> directory.
One would think he could write files to a directory seemingly in his
home directory.
Has the poster considered using something like trace/truss/par to catch
what the system is doing with the script?
> > That does not give me an error. Instead, it logs me in to each machine
> > want to run the command on!!! I do NOT want to log on each machine. I
> > want to remsh a few command for a few dozen machines and record the
> > output.
Well, you could do that with ssh and RSA auth and it would be much more
secure. The 'r' commands make me cringe.
> I am sorry to hear that you are disappointed. Stick with it, and I
> think you will be able to figure it out.
>
> I would like to point out that if this is the first Perl script you have
> written, then you are not familiar enough with Perl to compare it
> meaningfully to ksh.
Indeed. I remember my first Perl script. It was hilarious...of course in
retrospect...at the time I think I had to go get a beer to temper my
frustration.
Patience is never easy, but it will help you see the problems with your
approach.
/me sends poster a big mug of Newcastle.
e.
After all, the cultivated person's first duty is to
always be prepared to rewrite the encyclopedia. - U. Eco -
------------------------------
Date: Sun, 18 Oct 1998 10:27:54 -0700
From: solomon <solomonf@sd.znet.com>
Subject: interogate values from a select multiple?
Message-Id: <362A251A.A996B487@sd.znet.com>
When I interrogate the values from a select multiple I only get the
last one selected.
In the form shown I selected Golf and Soccer. But I was only successful
with Soccer even though I selected both by holding down control. How do
I inquiry the values selected from a select multiple?
------------------------------------------------------------
below is my form
<form method="POST" action="select.cgi">
<h3 align="center">Customer Form</h3>
<center>
<table>
<tr>
<td>Sports of interest(hold control to select more than one)
<select name="Sports" size="3" multiple>
<option value="Swimming">Swimming</option>
<option value="Tennis">Tennis</option>
<option value="Golf">Golf</option>
<option value="Table Tennis">Table Tennis</option>
<option value="Sky Diving">Sky Diving</option>
<option value="Baseball">Baseball</option>
<option value="Football">Football</option>
<option value="Soccer">Soccer</option>
</select>
</td>
</tr>
</table>
<input type="submit" value="Transmit Form">
<input type="reset" NAME="Clear" value="Clear Form">
----------------------------------------------------------------------------
below is select.cgi:
#!/usr/local/bin/perl
require "cartsubs.pl";
$tit="select";
&getnvps;
&splitnvps;
&pagehead;
if($e{Sports} eq "Golf"){
print "<p>Sports:Golf</p>\n"
}
if($e{Sports} eq "Soccer") {
print "<p>Sports:Soccer</p>\n"
}
print"</body></html>\n";
Your help is appreciated.......!!!
Fred
------------------------------
Date: Sun, 18 Oct 1998 13:55:49 -0500
From: modred@shore.net (Garth Sainio)
Subject: Re: interogate values from a select multiple?
Message-Id: <modred-1810981355500001@mrlbma-01-250.port.shore.net>
In article <362A251A.A996B487@sd.znet.com>, solomon <solomonf@sd.znet.com>
wrote:
> When I interrogate the values from a select multiple I only get the
> last one selected.
> In the form shown I selected Golf and Soccer. But I was only successful
> with Soccer even though I selected both by holding down control. How do
> I inquiry the values selected from a select multiple?
The easiest solution is to 'use CGI'. The CGI module takes care of all of
these types of things and you do not have to reinvent the wheel.
Garth
--
Garth Sainio "Finishing second just means you were the
modred@shore.net first to lose" - anonymous
------------------------------
Date: Sun, 18 Oct 1998 19:44:31 +0100
From: Ivan Strougatski <strougatski@clara.net>
Subject: Re: Passing Filehandle as parameters to function
Message-Id: <362A370F.E43A8381@clara.net>
Sorry, what language are you using?
C, C++, Objective C, Java or something diffferent
Jules wrote:
>
> Dear all, newbie question: how do I pass a filehandle as a parameter to a
> function which can then make use of them? An example use:
>
> OpenFile (FILEHANDLE, "filename.out");
> PrintLine (FILEHANDLE, "Hello World");
> CloseFile (FILEHANDLE);
>
> When PrintLine() would contain other operations, not just printing. So
> inside PrintLine() I would probably have for instance something like:
>
> PrintLine {
> print $_[0] $_[1];
> $line++;
> }
>
> I tried something similar but the filehandle $_[0] obviously was not
> FILEHANDLE. And $_[1] was not "Hello World" either I think. Apparently if I
> used $_[2] instead of $_[1], it gave "Hello World" when I omitted the
> filehandle bit in the print operation. Is it that if I pass parameters to a
> function, the first argument would be $_[1] instead and there's no $_[0]???
> I'm gettng confused. And how do I pass the FILEHANDLE to PrintLine() and
> making which print the output to the same filehandle as OpenFile and
> CloseFile?
>
> Please help.
>
> Thanx,
> Jules
>
> ***There is not enough darkness in the whole world to extinguish the light
> of a small candle***
------------------------------
Date: Sun, 18 Oct 1998 17:18:34 GMT
From: Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com>
Subject: Re: Perl as a first language... I vote yes!
Message-Id: <362A2065.6E419A5@bbnplanet.com>
mterich wrote:
> 4. I do not have time (or money) to take programming courses (trying to be
> a SysAsmin and a rock star simultaneously, also trying to prevent myself
> from destroying my social life by spending all my time learning to
> program.)
This is funny as we saw a resume' not to long ago where the person
listed 'wearing leather pants' in one of his positions as a drummer for
some band. The guys couldn't understand why I wanted to interview the
guy with a request that he wear the leather pants :).
> 5. After fighting with books on C, C++, java... perl "made sense." And now
> I'm able to write some perl after only a month.
Everyone learns differently and there isn't 'one true way' to learn
anything. Enjoy.
> Oh! I'm newbie-wannabe-loser, am I ?!?!!
> Well... my hardcore band is better than your hardcore band.
Hmmm, well I am getting a Jazz quartet together, so probably ;).
e.
After all, the cultivated person's first duty is to
always be prepared to rewrite the encyclopedia. - U. Eco -
------------------------------
Date: 18 Oct 1998 16:08:47 GMT
From: wjm@metronet.com (Bill Middleton)
Subject: PERLBOOK-5.005_02 - Complete PDF documentation for Perl available
Message-Id: <70d3qf$jp0$1@news.neta.com>
Perlbook.pdf, the complete PDF documentation for Perl5.005_02 is
now (or soon) available at your nearest CPAN archive, as the file:
authors/id/BMIDD/perlbook-5.005_02-a.tar.gz
this PDF file contains the entire standard documentation suite for
Perl5. All of the standard perl modules which include embedded
Pod documentation, as well as the complete set of perl pods, along
with the various README files, INSTALL files, and documentation for
external programs which are part of the standard perl kit.
Most of the hyperlinks which are available in the perl html documentation
can be accessed via PDF bookmarks (and links) in this document.
It includes a standard Acrobat bookmark for each pod, which can be
expanded to multiple levels to view the headers and main topics for
each document within.
To view this document, you must have one of the Adobe Acrobat (tm)
tools, Acrobat Exchange, or Acrobat Reader. Acrobat Reader is available
for no charge from the Adobe Systems, Inc. web site:
http://www.adobe.com
In previous versions this document has included an Acrobat Catalog (tm)
index of the entire document. Unfortunately, I don't have the time to
continue to support that feature. If you want an index, you'll have
to generate it yourself using AcroCat.
This version also includes some additional documentation from various
modules which I use, and are quite popular, including libwww, DBD,
Sybperl, and the all-important Win32:: modules. Find these under the
Additional Modules bookmark.
If you have trouble extracting the PDF file from the TAR.GZ archive
file under Windows OS'en, you can grab a zipfile equivalent of the
archive at
http://www.metronet.com/~wjm
but please, only use this server as a last resort.
Enjoy!
Bill Middleton
wjm@metronet.com
--
Bill Middleton - wjm@metronet.com
------------------------------
Date: 18 Oct 1998 16:30:03 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Raleigh.pm (Raleigh, NC, USA perl mongers) has registered
Message-Id: <70d52b$9dq$1@marina.cinenet.net>
Uri Guttman (uri@sysarch.com) wrote:
: JWL> Which means you are expected to know how to use a fork().
: JWL> (RTFM = "read the forking manual" ?)
:
: else they can only order finger food (no forks)
But alas, many sysadmins disable finger.
---------------------------------------------------------------------
| 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: Sun, 18 Oct 1998 17:21:22 GMT
From: Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com>
Subject: Re: Raleigh.pm (Raleigh, NC, USA perl mongers) has registered
Message-Id: <362A210C.B920F014@bbnplanet.com>
Uri Guttman wrote:
> >> No, non-geeks are expected to RTFM if they are
> >> hungry :-).
>
> JWL> Which means you are expected to know how to use a fork().
> JWL> (RTFM = "read the forking manual" ?)
>
> else they can only order finger food (no forks)
Yes, I can see guys saying to their date 'sorry honey, rtfm!'. Somehow I
don't think that would go over very well. :)
e.
After all, the cultivated person's first duty is to
always be prepared to rewrite the encyclopedia. - U. Eco -
------------------------------
Date: Sun, 18 Oct 1998 18:04:49 GMT
From: Daniel Grisinger <dgris@perrin.dimensional.com>
Subject: Re: Raleigh.pm (Raleigh, NC, USA perl mongers) has registered
Message-Id: <m3ww5xu55f.fsf@perrin.dimensional.com>
cberry@cinenet.net (Craig Berry) writes:
> Uri Guttman (uri@sysarch.com) wrote:
> : JWL> Which means you are expected to know how to use a fork().
> : JWL> (RTFM = "read the forking manual" ?)
> :
> : else they can only order finger food (no forks)
>
> But alas, many sysadmins disable finger.
But they can always chomp() if desperate.
dgris
--
Daniel Grisinger dgris@perrin.dimensional.com
Support grumpiness where grumpiness is due on clpm.
perl -Mre=eval -e'$_=shift;;@[=split//;;$,=qq;\n;;;print m;(.{$-}(?{$-++}));,q;;while$-<=@[;;' 'Just Another Perl Hacker'
------------------------------
Date: Sun, 18 Oct 1998 12:44:13 -0500
From: "Mark P." <imchat@imchat.com>
Subject: replacing
Message-Id: <362A28EC.9AD413FE@imchat.com>
I need a little help replacing text in a file. First I need to get the
line that starts with null and replace it with form data. Here's what I
have so far, but its not working of course.
open (FAQ, ">>$datadir/faq.txt") || &CgiDie("Cannot open faq.txt");
while (<FAQ>)
{
print FAQ "$_";
print FAQ $_ =~ s/null/$form_data{'answer'}/g
}
close (FAQ);
Obviously not correct.
------------------------------
Date: Sun, 18 Oct 1998 14:02:01 -0500
From: modred@shore.net (Garth Sainio)
Subject: Re: replacing
Message-Id: <modred-1810981402010001@mrlbma-01-250.port.shore.net>
In article <362A28EC.9AD413FE@imchat.com>, imchat@imchat.com wrote:
> I need a little help replacing text in a file. First I need to get the
> line that starts with null and replace it with form data. Here's what I
> have so far, but its not working of course.
>
> open (FAQ, ">>$datadir/faq.txt") || &CgiDie("Cannot open faq.txt");
^^ This opens the file for appending, if you want to open it
for reading and writing you'll want to use "+>$datadir/faq.txt". You may
also want to look at the fifth section of the Perl FAQ "Files and
Formats", more specifically the item entitled "How do I change one line in
a file/delete a line in a file/insert a line in the middle of a
file/append to the beginning of a file?". There should be a copy in the
Perl documentation that you can get using perldoc FAQ or on the web at
http://www.perl.com/CPAN-local/doc/manual/html/pod/perlfaq5.html.
> while (<FAQ>)
> {
> print FAQ "$_";
> print FAQ $_ =~ s/null/$form_data{'answer'}/g
> }
> close (FAQ);
>
> Obviously not correct.
Garth
--
Garth Sainio "Finishing second just means you were the
modred@shore.net first to lose" - anonymous
------------------------------
Date: Sun, 18 Oct 1998 13:13:23 -0500
From: "Mark P." <imchat@imchat.com>
To: Garth Sainio <modred@shore.net>
Subject: Re: replacing
Message-Id: <362A2FC2.B9A38260@imchat.com>
Thanks for the tip, I'll check out the faqs and see if I can get it to
work. This is for a faq anyway. I guess it would help to check the established
faqs too. :-)
Garth Sainio wrote:
> In article <362A28EC.9AD413FE@imchat.com>, imchat@imchat.com wrote:
>
> > I need a little help replacing text in a file. First I need to get the
> > line that starts with null and replace it with form data. Here's what I
> > have so far, but its not working of course.
> >
> > open (FAQ, ">>$datadir/faq.txt") || &CgiDie("Cannot open faq.txt");
> ^^ This opens the file for appending, if you want to open it
> for reading and writing you'll want to use "+>$datadir/faq.txt". You may
> also want to look at the fifth section of the Perl FAQ "Files and
> Formats", more specifically the item entitled "How do I change one line in
> a file/delete a line in a file/insert a line in the middle of a
> file/append to the beginning of a file?". There should be a copy in the
> Perl documentation that you can get using perldoc FAQ or on the web at
> http://www.perl.com/CPAN-local/doc/manual/html/pod/perlfaq5.html.
>
> > while (<FAQ>)
> > {
> > print FAQ "$_";
> > print FAQ $_ =~ s/null/$form_data{'answer'}/g
> > }
> > close (FAQ);
> >
> > Obviously not correct.
>
> Garth
>
> --
> Garth Sainio "Finishing second just means you were the
> modred@shore.net first to lose" - anonymous
------------------------------
Date: Sun, 18 Oct 1998 18:19:07 GMT
From: Daniel Grisinger <dgris@perrin.dimensional.com>
Subject: Re: replacing
Message-Id: <m3soglu4hj.fsf@perrin.dimensional.com>
modred@shore.net (Garth Sainio) writes:
> In article <362A28EC.9AD413FE@imchat.com>, imchat@imchat.com wrote:
> > open (FAQ, ">>$datadir/faq.txt") || &CgiDie("Cannot open faq.txt");
> ^^ This opens the file for appending, if you want to open it
> for reading and writing you'll want to use "+>$datadir/faq.txt".
^^^^^^^^^^^^^^^^^^
This opens the file for reading and writing but truncates the file.
You'll want to use "+<$datadir/faq.txt" or, more likely, $^I.
dgris
--
Daniel Grisinger dgris@perrin.dimensional.com
Support grumpiness where grumpiness is due on clpm.
perl -Mre=eval -e'$_=shift;;@[=split//;;$,=qq;\n;;;print m;(.{$-}(?{$-++}));,q;;while$-<=@[;;' 'Just Another Perl Hacker'
------------------------------
Date: Sun, 18 Oct 1998 13:46:49 -0500
From: "Mark P." <imchat@imchat.com>
To: Garth Sainio <modred@shore.net>
Subject: Re: replacing
Message-Id: <362A3798.6401B90C@imchat.com>
Thanks so much! It only took me 15 minutes to get everything working correctly
using your advice and the faq.
I really appreciate it.
Garth Sainio wrote:
> In article <362A28EC.9AD413FE@imchat.com>, imchat@imchat.com wrote:
>
> > I need a little help replacing text in a file. First I need to get the
> > line that starts with null and replace it with form data. Here's what I
> > have so far, but its not working of course.
> >
> > open (FAQ, ">>$datadir/faq.txt") || &CgiDie("Cannot open faq.txt");
> ^^ This opens the file for appending, if you want to open it
> for reading and writing you'll want to use "+>$datadir/faq.txt". You may
> also want to look at the fifth section of the Perl FAQ "Files and
> Formats", more specifically the item entitled "How do I change one line in
> a file/delete a line in a file/insert a line in the middle of a
> file/append to the beginning of a file?". There should be a copy in the
> Perl documentation that you can get using perldoc FAQ or on the web at
> http://www.perl.com/CPAN-local/doc/manual/html/pod/perlfaq5.html.
>
> > while (<FAQ>)
> > {
> > print FAQ "$_";
> > print FAQ $_ =~ s/null/$form_data{'answer'}/g
> > }
> > close (FAQ);
> >
> > Obviously not correct.
>
> Garth
>
> --
> Garth Sainio "Finishing second just means you were the
> modred@shore.net first to lose" - anonymous
------------------------------
Date: Sun, 18 Oct 1998 17:42:44 GMT
From: Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com>
Subject: Re: rsh perl problem
Message-Id: <362A260F.E2B5D30E@bbnplanet.com>
Lars Kr. Lundin wrote:
> Can anybody help me to remotely run remotescript.pl in a
> more robust fashion?
Given all of the variables, you would need to post the code as well as
some more context as it really could be anything at this point.
e.
After all, the cultivated person's first duty is to
always be prepared to rewrite the encyclopedia. - U. Eco -
------------------------------
Date: Sun, 18 Oct 1998 18:16:51 +0100
From: Simon Biela <biela@netdienste.de>
Subject: Shell commands
Message-Id: <362A2283.C4C68C19@netdienste.de>
Hi,
I want to create an HTML Administration Form for my webspace customers,
so they can add FTP or POP Users themselves.
In order to do this I gonna need to execute UNIX Shell commands. i.e.
passwd if I want to change the password of a users user. Or I need to
calla programm called ncftpd_passwd with certain parameters.
How do I do this in Perl?
Thanks!
--
mit freundlichen Gr|_en
Simon Biela
________________________________________
netdienste - Ihr einfacher Weg ins Internet
Kirchenhof 4 - 50933 Kvln - Germany
Tel.: 0221 - 947 30 10 - Fax.: 0221 - 947 30 11
biela@netdienste.de - www.netdienste.de
------------------------------
Date: Sun, 18 Oct 1998 17:42:15 +0000
From: Jason Holland <jason.holland@dial.pipex.com>
To: Simon Biela <biela@netdienste.de>
Subject: Re: Shell commands
Message-Id: <362A2877.76ED6198@dial.pipex.com>
Simon Biela wrote:
>
> Hi,
>
> I want to create an HTML Administration Form for my webspace customers,
> so they can add FTP or POP Users themselves.
>
> In order to do this I gonna need to execute UNIX Shell commands. i.e.
> passwd if I want to change the password of a users user. Or I need to
> calla programm called ncftpd_passwd with certain parameters.
>
> How do I do this in Perl?
Check the system() command.
--
sub jasonHolland {
my %hash = ( website =>
'http://dspace.dial.pipex.com/jason.holland/',
email => 'jason.holland@dial.pipex.com' );
}
------------------------------
Date: Sun, 18 Oct 1998 17:25:07 GMT
From: Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com>
Subject: Re: Shell commands
Message-Id: <362A21ED.6816DA0B@bbnplanet.com>
Simon Biela wrote:
> I want to create an HTML Administration Form for my webspace customers,
> so they can add FTP or POP Users themselves.
>
> In order to do this I gonna need to execute UNIX Shell commands. i.e.
> passwd if I want to change the password of a users user. Or I need to
> calla programm called ncftpd_passwd with certain parameters.
In order to do this, your program will have to run as root unless you
use something other than the system password files. This is extremely
insecure and you may want to consider a different solution. Also, try
perldoc perlsec to read more about Perl security.
e.
After all, the cultivated person's first duty is to
always be prepared to rewrite the encyclopedia. - U. Eco -
------------------------------
Date: Sun, 18 Oct 1998 17:51:34 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Shell commands
Message-Id: <GUpW1.23$OZ4.14896@news.shore.net>
Jason Holland (jason.holland@dial.pipex.com) wrote:
: Check the system() command.
system() is not a command.
--
Nate Patwardhan|root@localhost
"Fortunately, I prefer to believe that we're all really just trapped in a
P.K. Dick book laced with Lovecraft, and this awful Terror Out of Cambridge
shall by the light of day evaporate, leaving nothing but good intentions in
its stead." Tom Christiansen in <6k02ha$hq6$3@csnews.cs.colorado.edu>
------------------------------
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 4003
**************************************