[9302] in Perl-Users-Digest
Perl-Users Digest, Issue: 2897 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jun 18 03:17:26 1998
Date: Thu, 18 Jun 98 00:00:38 -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 Thu, 18 Jun 1998 Volume: 8 Number: 2897
Today's topics:
Re: 2 questions about lists (Paul David Fardy)
Re: Cgi script to pass params to socket <rootbeer@teleport.com>
Re: Copying files in perl across NT servers <rglick@liii.com>
Duplicate emails with sendmail! ajm@antopia.com
Re: Duplicate emails with sendmail! <rootbeer@teleport.com>
Re: Excel - Perl conversion <psdspss@execpc.com>
Re: first language <rootbeer@teleport.com>
Re: formline and predefined formats <rootbeer@teleport.com>
How to open variable number of files for writeing ??? <johnvun@asiapac.net>
Re: How to open variable number of files for writeing ? <rootbeer@teleport.com>
Re: htpasswd in perl? <rootbeer@teleport.com>
Re: IPC Piping Error <rootbeer@teleport.com>
Re: Killing STDOUT within a CGI script? <rootbeer@teleport.com>
Re: kinda like tail -f...? <rootbeer@teleport.com>
Re: perl - win NT CGI followup <rootbeer@teleport.com>
Re: Perl CGI forms <rootbeer@teleport.com>
Re: perl command line options <rootbeer@teleport.com>
Perl with Javascript <peckss@cyberway.com.sg>
Re: Perl with Javascript <rootbeer@teleport.com>
Re: Referring to another computer <rootbeer@teleport.com>
Re: REVIEW: Perl CGI Programming - No Experience Requir (David Adler)
Re: REVIEW: Perl CGI Programming - No Experience Requir <uri@sysarch.com>
Re: Sending mail, can I set the $from ? <rootbeer@teleport.com>
Re: starting and killing pppd from a script <rootbeer@teleport.com>
Re: Symlink and Link <rootbeer@teleport.com>
Re: use strict; 755 permissions and file writing <rootbeer@teleport.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 17 Jun 1998 23:56:03 GMT
From: pdf@morgan.ucs.mun.ca (Paul David Fardy)
Subject: Re: 2 questions about lists
Message-Id: <6m9l2j$hdu$1@coranto.ucs.mun.ca>
"Alex Farber" <alex@kawo2.rwth-aachen.de> writes:
>2) what happens if i do a foreach()-loop on some @list
>and the push smth in that list IN THIS LOOP ? Like:
>foreach $elem (@list)
>{
> push @list, 'xxx' if ...
>}
Try it.
And compare it to:
foreach $elem (@array, ()) {
push @array, 'xxx' if ...
}
Why did I use @array instead of @list? Why does the perlfunc
show the usage for push as "push ARRAY, LIST"?
Paul Fardy
--
I don't like where I'm leading this thread. ;-)
------------------------------
Date: Thu, 18 Jun 1998 05:18:09 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Cgi script to pass params to socket
Message-Id: <Pine.GSO.3.96.980617221609.604P-100000@user2.teleport.com>
On Wed, 17 Jun 1998, Paraic O'Ceallaigh wrote:
> Subject: Cgi script to pass params to socket
> I want to write a script to pass parameters from a html form
> to a daemon listening on a port (which then executes those
> params).
You do this in the same way that you would if it weren't a CGI script. :-)
Check the perlipc manpage, and (if applicable) the docs for the module
which implements the protocol you need for talking to the daemon. Hope
this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 18 Jun 1998 05:33:34 GMT
From: "Ron Glick" <rglick@liii.com>
Subject: Re: Copying files in perl across NT servers
Message-Id: <01bd9a7b$1130aee0$da1d1dd0@asdfasdf>
nick_darby@my-dejanews.com wrote in article
<6m8iu6$bme$1@nnrp1.dejanews.com>...
> I've got a file on one NT server that I want to copy to another server.
>
> I tried directing the output to the destination ie the code on 'machine
1' to
> get the file to 'machine 2' used UNC, with suitable values for machine2
and
> share_dir
> $FILE_DEST="////machine2//share_dir";
> OPEN(DATA,">$FILE_DEST");
> ....
First, the forward slashes should be backslashes. Also, you've specified
the file that you're writing to as \\machine2\share_dir, which is the
directory that is the sharepoint on machine2. I think what you want is to
specify a filename as well.
Try
$FILE_DEST="\\\\machine2\\share_dir\\filename";
>
> When this didn't work, I tried to use the system command to copy the file
> from one server to another. I could COPY within the machine1, and I could
do
> a range of other os commands (such as 'net use' to set up a network drive
to
> machine2) but it would not copy a file from machine1 to machine2.
>
> Any suggestions gratefully received.
>
> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> http://www.dejanews.com/ Now offering spam-free web-based newsreading
>
HTH,
Ron Glick
------------------------------
Date: Thu, 18 Jun 1998 04:53:03 GMT
From: ajm@antopia.com
Subject: Duplicate emails with sendmail!
Message-Id: <6ma6ff$r8h$1@nnrp1.dejanews.com>
Help! I'm having a problem with sendmail. I have scripts which use it on my
server to take form input and create and send messages to people, and two
days ago for no apparent reason all calls to sendmail have started generating
and sending two identical duplicate emails! I'm only calling sendmail once.
Here's a sample script I wrote and it sends two emails!! What on earth....?
Good advice sought!
Anthony
#!/usr/local/bin/perl
require "ant-lib.cgi";
$mailprog = '/usr/sbin/sendmail';
&PrintHeader;
&ReadParse;
$EMAIL=$in{'EMAIL'};
$recipient = "$EMAIL";
open (MAIL, "|$mailprog $recipient");
print MAIL "From: bnet\@pobox.com\n";
print MAIL "Reply-To: bnet\@pobox.com\n";
print MAIL "\n";
print MAIL "This is the last of your signup emails.\n";
close (MAIL);
print "MAIL SENT TO $EMAIL<P>\n";
exit(0);
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Thu, 18 Jun 1998 06:12:49 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Duplicate emails with sendmail!
Message-Id: <Pine.GSO.3.96.980617231138.604d-100000@user2.teleport.com>
On Thu, 18 Jun 1998 ajm@antopia.com wrote:
> Help! I'm having a problem with sendmail.
Then perhaps this is a question for a newsgroup about sendmail? Or maybe
you're (accidentally) forking a copy of your program? Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Wed, 17 Jun 1998 22:22:51 -0500
From: Deva Seetharam <psdspss@execpc.com>
Subject: Re: Excel - Perl conversion
Message-Id: <6ma0mn$dj0@newsops.execpc.com>
Juli@my-dejanews.com wrote:
> I am looking for a script that will convert excel into perl.
> Any idea if a script like this exists? and where I could possibily obtain it?
>
> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> http://www.dejanews.com/ Now offering spam-free web-based newsreading
If u want to read a Excel file in perl, you can save the file in csv format.Fields
will be separated by commas; perl can read the file using
comma as FS and if the fields contain any commas, the field will be quoted.
If u want to do it programatically, I know of one tool called XESS,
it can read excel files and convert into unix text file format.
Have a look at http://www.ais.com, for further details.
Hope that helps.
Deva
------------------------------
Date: Thu, 18 Jun 1998 06:05:21 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: first language
Message-Id: <Pine.GSO.3.96.980617225309.604Y-100000@user2.teleport.com>
On Wed, 17 Jun 1998, Fred Kunkel wrote:
> Is perl a good language for the non-programer to attempt learning a cgi
> programing language? Is there a logical aproach to learning perl or
> should one start with some other language that might be easier to
> understand?
First and foremost, Perl is not "a CGI programming language". Sure, most
web-related things involve Perl in some way. But most of Perl has nothing
to do with the web. And yes, you can do CGI programming in Perl, but it's
hard to find a useful language in which you _wouldn't_ be able to write
CGI programs. Perl is often chosen for CGI programming because it's good
for many tasks, not just that relatively-small subset of tasks.
You may as well call a TV set "a device to keep sleeping cats warm". :-)
Having said that, Perl isn't generally a good choice for a first
programming language. A good introductory course on programming will teach
you important concepts which will make learning Perl easier and more
useful in the long run. For a first programming language, I usually
recommend Pascal - not because it's a great language that you'll want to
use for everything, but because it's generally taught at your local
community college by competent, patient instructors who will teach you how
good programming is done for a nominal fee.
Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 18 Jun 1998 05:39:45 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: formline and predefined formats
Message-Id: <Pine.GSO.3.96.980617223854.604U-100000@user2.teleport.com>
On Wed, 17 Jun 1998, Mark Evan Jones wrote:
> Is it possible to use formline and specify only a predefined format
> instead of duplicating the picture every time?
Just store your format into a variable which you can pass to formline. Is
that what you need? Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 18 Jun 1998 12:12:12 +0800
From: johnvun <johnvun@asiapac.net>
Subject: How to open variable number of files for writeing ???
Message-Id: <3588939B.AC4C07A7@asiapac.net>
Dear Expert,
I would like to open variable files for write, my perl program as bellow
:
for ($i = 1; $i < $j; $i++)
{
open (FILE$i, ">file$i.txt");
print FILE$i ("Perl 5.04\n);
}
$j is vaiable, it can be 2, 5 or 26 etc....
but open (FILE$i, ">file$i.txt"); give me problem, is there anyway i
can slove this problem ???
Thanks in advance !
John Vun
------------------------------
Date: Thu, 18 Jun 1998 06:11:26 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: How to open variable number of files for writeing ???
Message-Id: <Pine.GSO.3.96.980617231037.604c-100000@user2.teleport.com>
On Thu, 18 Jun 1998, johnvun wrote:
> I would like to open variable files for write,
Section five of the FAQ tells how to make arrays of filehandles; is that
what you need? Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 18 Jun 1998 04:53:39 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: htpasswd in perl?
Message-Id: <Pine.GSO.3.96.980617214047.604M-100000@user2.teleport.com>
On Wed, 17 Jun 1998, Joseph A. DiVerdi, Ph.D. wrote:
> In article <8clnqwgmx2.fsf@gadget.cscaper.com>, Randal Schwartz
> <merlyn@stonehenge.com> wrote:
>
> > Need help with a script I am working on that will create
> > passwords the same as htpasswd executable.
As others have pointed out, Randal wasn't the one needing that. :-)
> #!/usr/local/bin/perl
> srand(time ^ ($$ + ($$ <<15)));
That line isn't as good as omitting it would be. :-)
> my @chars = ('0'..'9','a'..'z','A'..'Z');
There are more characters in the salt set than that.
> print crypt($ARGV[0], $salt), "\n";
Of course, it's not good for any _real_ security needs to pass a password
on the command line, anyway.
And if you had read what Randal had written, you would have seen him
suggesting that anyone needing this should use a module rather than
reinventing this particular wheel.
> passme
Bless you, my son. :-)
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 18 Jun 1998 05:23:57 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: IPC Piping Error
Message-Id: <Pine.GSO.3.96.980617222236.604S-100000@user2.teleport.com>
On Wed, 17 Jun 1998, Corey Parsons wrote:
> A couple of people at work (including myself) have been getting the
> following error:
>
> [Wed Jun 17 09:14:37 1998] httpd: could not create IPC pipe
That's not a Perl error; it looks like a server error. If the docs for
your server don't tell you what to do, the docs, FAQs, and newsgroups
about servers may be able to help. Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 18 Jun 1998 05:52:30 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Killing STDOUT within a CGI script?
Message-Id: <Pine.GSO.3.96.980617225101.604X-100000@user2.teleport.com>
On Thu, 18 Jun 1998, Lon Boonen wrote:
> Is it possible to sort of 'kill' 'STDOUT' or whatever without killing
> the CGI-script and thereby telling the browser that it can start
> processing its input (and so starting the helper application since the
> input is some strange mime-type)?
I think you mean that you want to close STDOUT in order to send the eof
signal to the reading process. If that's not what you want, perhaps you
need to check the docs, FAQs, and newsgroups about browsers or servers.
Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 18 Jun 1998 05:22:18 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: kinda like tail -f...?
Message-Id: <Pine.GSO.3.96.980617222156.604R-100000@user2.teleport.com>
On 17 Jun 1998, John Chapin wrote:
> I suppose what I'm really asking for is how to get an open()
> to ignore the EOF -- so it behaves like a "tail -f",
See the FAQ, section five. Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 18 Jun 1998 05:20:52 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: perl - win NT CGI followup
Message-Id: <Pine.GSO.3.96.980617222003.604Q-100000@user2.teleport.com>
On Wed, 17 Jun 1998, Edgar wrote:
> When a form calls a perl script in a directory where the scripts reside,
> the script that gets executed is ALWAIS the first one on the directory.
If your server's docs don't tell you what to do, the docs, FAQs, and
newsgroups about your server may be helpful. Good luck!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 18 Jun 1998 06:10:14 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Perl CGI forms
Message-Id: <Pine.GSO.3.96.980617230554.604Z-100000@user2.teleport.com>
On Wed, 17 Jun 1998, Patrick Lanphier wrote:
> The below script I thought would load a predifined page if no parameters
> of the following categories (listed in the script) were passed by a form
> which it does but when the form is filled out and submitted to the
> script again none of the parameters seem to be being passed hence it
> displays the same form again instead of validating the data and
> displaying a success form or an error form were corrections need to be
> made. Thank you in advance for your help.
What help are you requesting? Do you need someone to debug your program
for you? Or are you saying that your _browser_ isn't passing the
parameters as you wish? If you're having troubles with your browser, it's
not really a Perl problem, of course.
When you're having trouble with a CGI program in Perl, you should first
look at the please-don't-be-offended-by-the-name Idiot's Guide to solving
such problems. It's available on CPAN.
http://www.perl.com/CPAN/
http://www.perl.org/CPAN/
http://www.perl.org/CPAN/doc/FAQs/cgi/idiots-guide.html
http://www.perl.org/CPAN/doc/manual/html/pod/
Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 18 Jun 1998 05:50:33 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: perl command line options
Message-Id: <Pine.GSO.3.96.980617224922.604W-100000@user2.teleport.com>
On Wed, 17 Jun 1998, Norman Bunn wrote:
> Is there anyway to tell perl from the command line not to look for input?
Check your shell's documentation about redirecting input to come from
/dev/null (or your system's equivalent).
> norman.bunn@nospam.mci.com
> remove "no spam" to reply.
Thanks for not requiring this of me by using the correct address in your
headers. :-)
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 18 Jun 1998 14:27:01 +0800
From: "soo" <peckss@cyberway.com.sg>
Subject: Perl with Javascript
Message-Id: <3588b2f0.0@news.cyberway.com.sg>
Hello there,
I just want to know is it possible to have Javascript written in a perl
script?
I need to have on-line calculation, where when I enter value a and value b,
value c will be calculated straight away on the front-end and reflect the
calculated value c on the screen. Is Perl capable of doing that??
thanks in advance,
Soo San
------------------------------
Date: Thu, 18 Jun 1998 06:48:00 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Perl with Javascript
Message-Id: <Pine.GSO.3.96.980617234653.604n-100000@user2.teleport.com>
On Thu, 18 Jun 1998, soo wrote:
> I just want to know is it possible to have Javascript written in a perl
> script?
You can write any text in a Perl script. If you're not sure what text to
write, though, the docs, FAQs, and newsgroups about Javascript may be able
to help you. Good luck!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 18 Jun 1998 04:23:00 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Referring to another computer
Message-Id: <Pine.GSO.3.96.980617212109.604K-100000@user2.teleport.com>
On 16 Jun 1998, Caleb Newville wrote:
> I am new to perl and found an auto-responder. I have the following line:
>
> $mailprog = '/usr/bin/sendmail';
>
> and I need it to go to 'yoda.fdt.net/usr/bin/sendmail' Anyone know how
> to do this?
It sounds as if you wish to run a program on another machine. You should
find a protocol supported by that machine which allows you to make that
request. Then you can implement that protocol in Perl (or in nearly any
programming language). Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 18 Jun 1998 04:43:28 GMT
From: dha@panix.com (David Adler)
Subject: Re: REVIEW: Perl CGI Programming - No Experience Required
Message-Id: <6ma5tg$d13@news1.panix.com>
On 18 Jun 1998 00:36:46 GMT, Rahul Dhesi <c.c.eiftj@54.usenet.us.com> wrote:
>In <pudge-1706980805290001@dynamic464.ply.adelphia.net> pudge@pobox.com
>(Chris Nandor) writes:
>
>>Here it is, your definition, which was
>>already 100 percent inferrable from the above information:
>
>> an array is a variable. a list is not.
>
>>That simple. Go home now.
>
>I will buy that, if everybody else will agree with you.
>
>My next question is: If the only difference between the two is that one
>is in a single variable, and the other is explicitly enumerated, why are
>we making such a a big deal of this difference? We don't make a big
>deal of the fact that the interger held in $i is differnt from the
>integer explicitly denoted by 15. If the ONLY difference between two
>things is that one is in a variable and the other is not, that's hardly
>a difference worth arguing about.
I think theres a shift in your argument, subtle though it may be, that
you're missing. That the integer held by $i is the same as the
integer 15 (assuming, of course, $i=15) is not, I think in dispute.
The problem comes when you say $i is the same as 15. The distinction
being that $i and the value *contained* in $i are not the same thing.
The contents of $i can change, the integer value itself cannot.
Hoping that's all clear now...
--
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
"Soup on all fours?"
"Of course. Whaddaya think, Soup is a biped?" - mst3k
------------------------------
Date: 18 Jun 1998 00:48:58 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: REVIEW: Perl CGI Programming - No Experience Required
Message-Id: <x7sol3e2md.fsf@sysarch.com>
>>>>> "RD" == Rahul Dhesi <c.c.eiftj@54.usenet.us.com> writes:
RD> In <pudge-1706980805290001@dynamic464.ply.adelphia.net>
RD> pudge@pobox.com (Chris Nandor) writes:
>> Here it is, your definition, which was already 100 percent
>> inferrable from the above information:
>> an array is a variable. a list is not.
RD> I will buy that, if everybody else will agree with you.
they do.
RD> My next question is: If the only difference between the two is
RD> that one is in a single variable, and the other is explicitly
RD> enumerated, why are we making such a a big deal of this
RD> difference? We don't make a big deal of the fact that the
RD> interger held in $i is differnt from the integer explicitly
RD> denoted by 15. If the ONLY difference between two things is that
RD> one is in a variable and the other is not, that's hardly a
RD> difference worth arguing about. -- Rahul Dhesi
RD> <dhesi@spams.r.us.com>
i have been following this thread and i am amazed that you aren't
grasping the fundamental difference between lists and arrays. there is a
MAJOR difference between an explicitly named variable and a list of
values. about the only thing they have in common is that an array in a
list context, gives its values as a list. that is why both can be
subscripted in similar ways. but lists can't be pushed onto, shifted,
unshifted, popped, spliced, passed by reference (i don't mean as an anon
list which is a copy), etc.
a variable is converted to a value when desired. it is not a value. a
list is a list of values without any associated container, so it will
disappear as soon as its expression is done. variables have a life
beyond the simple expression. hence the concept of assignment as a side
effect of an special expression since its value is the assigned value,
the assignment must do a copy of the assigned value to keep it around. a
list lives on the stack always while variables live on the stack, and in
allocated and static memory. you can't have a list in the last two types
of storage.
this is a fundamental computer science idea, a variable is NOT its
value, so an array is not its list and a list is not a variable.
list _context_ is a different animal as randal showed earlier in this
thread. there is no such thing as array context, as that phrase has no
meaning. context is about expressions and variables (e.g. arrays) are
not expressions. their values can be part of expressions. so a list or
scalar context controls the form of the values extracted from variables
and constants in expressions. this is done (as randal has shown) at
perl compile time as the rules are very well described but poorly
understood by the masses.
this (IMHO lucent) explanation of list vs. arrays vs. context may be
freely distributed to all who need help on this topic. this may mean
YOU! :-)
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
Perl Hacker for Hire ---- 8 Years of Perl Experience, Available Immediately
uri@sysarch.com --------- Resume and Perl Example at http://www.sysarch.com
Use the Best Search Engine on the Net -------- http://www.northernlight.com
------------------------------
Date: Thu, 18 Jun 1998 04:59:49 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Sending mail, can I set the $from ?
Message-Id: <Pine.GSO.3.96.980617215538.604N-100000@user2.teleport.com>
On Wed, 17 Jun 1998, Paul Rolfe wrote:
> You can reference sendmail directly:
>
> open (mail,"|/usr/sbin/sendmail -f$from $to");
>
> Which will allow you to set the from address. It will place a warning
> in the "hidden" headers about this being a possible fake message,
> however. I use it here for our Web based mail client at the moment.
You should be aware that it's generally a Bad Thing to include a
user-specified email address on the command line to sendmail, since an
email address may contain shell metacharacters and yet still be valid.
Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 18 Jun 1998 04:18:43 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: starting and killing pppd from a script
Message-Id: <Pine.GSO.3.96.980617211401.604J-100000@user2.teleport.com>
On Tue, 16 Jun 1998, Philip Antoniades wrote:
> the first is starting pppd, and getting it's pid so that i can kill it
> later. system will launch it without returning the pid, fork will not
> launch it at all.
When you say "fork will not launch it at all", what do you mean? fork (by
itself) won't launch anything. Were you using fork with exec? If you do
that and check each system call for error returns, what diagnostic message
do you get?
> the second is that, even if i use system (and thus successfully start
> it), this command will not be executed when crond runs the script. the
> line
> system( "/usr/sbin/pppd" ) or die "could not execute pppd: $!";
> is glossed over, no error printed, no ppp connection initiated. yet
> this works from the command line.
When you're running a program from cron, there will typically be different
environment variables than you find from the shell, a different working
directory, and possibly other differences.
Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 18 Jun 1998 05:38:14 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Symlink and Link
Message-Id: <Pine.GSO.3.96.980617222703.604T-100000@user2.teleport.com>
On Wed, 17 Jun 1998 oliverg@primesourcebp.com wrote:
> Problem: symlink command in perl works, but error on open after link is
> created.
Problem: Words individually make sense, but error on reading. :-)
> $config_file = "/home/greo98/qconfig";
> $original_config_file = "/home/greo98/qconfig.original.$todaydate";
> $created_config_file = "/home/greo98/qconfig.new.$todaydate";
> $config_file_test = "/home/greo98/qconfig.whatever";
Okay... What's in $todaydate? (Could it, perhaps, contain any control
character, such as a newline?)
> sub LinkQueueFile {
> symlink ($created_config_file, $config_file_test) or die "error";
> }
I'd include a little more information in the diagnostic, including $!,
but maybe that's just me. :-)
> Dir List: -rwxr-xr-x 1 greo98 staff 2316 Jun 17 12:21 qconfig -rw-r--r--
> 1 greo98 staff 2463 Jun 17 12:21 qconfig.new.06-17-98 -rw-r--r-- 1 greo98
> staff 2316 Jun 17 12:21 qconfig.original.06-17-98 lrwxrwxrwx 1 root system
> 34 Jun 17 12:21 qconfig.whatever -> /home/greo98/qconfig.new.06-17-98
Hmmm... Let's try that again!
> Dir List:
> -rwxr-xr-x 1 greo98 staff 2316 Jun 17 12:21 qconfig
> -rw-r--r-- 1 greo98 staff 2463 Jun 17 12:21 qconfig.new.06-17-98
> -rw-r--r-- 1 greo98 staff 2316 Jun 17 12:21 qconfig.original.06-17-98
> lrwxrwxrwx 1 root system 34 Jun 17 12:21 qconfig.whatever ->
/home/greo98/qconfig.new.06-17-98
There, that's easier to read. And it makes me ask, just to be sure, is
this listing of the /home/greo98 directory?
> Problem: When I try to open the file I get this:
>
> 356 root primeg30 /home/greo98 >cat qconfig.whatever
> cat: 0652-050 Cannot open qconfig.whatever.
>
> The link exists though.. Linking from the commandline works just fine
> though..
Well, if you're giving Perl's symlink function the exact same parameters
as you give to 'ln -s', then it should work in exactly the same way.
If you can't get this to work, try to make a short (say, five or six
lines) standalone script which shows what you mean, possibly by calling
system('ln','-s',$foo,$bar) and showing that you're getting a different
result than you do from symlink(). If you can do that, you may have found
a bug in Perl. Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 18 Jun 1998 04:34:17 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: use strict; 755 permissions and file writing
Message-Id: <Pine.GSO.3.96.980617212408.604L-100000@user2.teleport.com>
On Tue, 16 Jun 1998, Rick Parks wrote:
> In my first writing, I could create a file in a directory with 755
> permissions, but after implementing "-Tw" and "use strict;", I cannot.
> Can anyone tell me why?
Because you're doing something wrong. :-) I can't be much more specific
without seeing your code, but there's nothing about what you're saying
that should have any special difficulty. (But you do know about umask,
right?) (Also, you mean that the file, not the directory, has 755
permissions, right?)
> But, in my only perl book, Teach Yourself Perl by David Till(please
> don't laugh at me),
You know not what you ask. :-)
> it says that (stat($file))[2] is the permissions for $file. My
> directory is 755 as I said, but this returns 16877. Is there a way to
> confidently extract 755 from this number?
See your system's manpages for stat(2) the system call. That number is a
bit vector, so you'll probably want bitwise operations to work with it.
perl -we 'printf "%04o\n", (16877 & 0777)'
> I wanted to be able to create the counter files on the fly instead of
> making the user create one for each page that they wish to use this
> with, but it looks like it might be too much trouble.
I don't see why it should be difficult to create them, except in dealing
with file permissions and ownership. Of course, these issues are the same
no matter what language you're writing in; there's nothing Perl-specific
about that.
Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 2897
**************************************