[8018] in Perl-Users-Digest
Perl-Users Digest, Issue: 1643 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jan 15 00:05:40 1998
Date: Wed, 14 Jan 98 21:00:22 -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 Wed, 14 Jan 1998 Volume: 8 Number: 1643
Today's topics:
Re: Approximate (Clay Irving)
Re: basename with NT (Clay Irving)
Re: Can I create a Linked List in Perl <rjk@coos.dartmouth.edu>
Re: CGI.pm checkboxes: how to create labels for redunda (Randy J. Ray)
Creating a FoxPro database using Perl Scripts (Gary Masson)
Re: deleting old files (Tad McClellan)
Re: deleting old files (Martien Verbruggen)
Encrypting files with Perl. (Gary Masson)
Re: Encrypting files with Perl. (brian d foy)
How come this works <Webmaster@builders-connection.com>
Re: Interactive Processes (Tad McClellan)
Re: Interactive Processes (Martien Verbruggen)
Re: Interactive Processes <joseph@5sigma.com>
Limiting simultaneous users <webmaster@worldgraphix.com>
Re: Looking for HTML template script (Clay Irving)
Re: Multi-line input: fastest way? (Terry Michael Fletcher - PCD ~)
Re: opening text file <ebohlman@netcom.com>
perl -- a language for LEARNING programming? notsew@wwa.com
Re: Perl running under Linus - #!/bin/usr <ipetts@no-spam.ozemail.com.au>
Re: Perl running under Linus - #!/bin/usr <dformosa@st.nepean.uws.edu.au>
Re: Perl Script Not Receiving Parameters <rootbeer@teleport.com>
Re: Printing in NT 4 (Martien Verbruggen)
responding to prompting programs <jp@dkstat.com>
Re: sending emails with perl ? <perry@iway.fr>
Re: simple perl script to add directory to PATH if not <doug@tc.net>
Re: source into binary code <dformosa@st.nepean.uws.edu.au>
Re: Speaking of Looping through hashes... <rjk@coos.dartmouth.edu>
Re: Writing to a file in Win32 and Unix (Dave Wedwick)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 14 Jan 1998 22:01:07 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: Approximate
Message-Id: <69ju5j$ib@panix.com>
In <69jhi0$qhu@news1.mclink.it> "Aldo Armiento" <***armiento@mclink.it***> writes:
>If in a $var I have the value 1.74234234 there are a command that assign to
>$var2 the truncate value 1 or approximate value 2 ?
Perl FAQ, Section 4: Does perl have a round function?
For rounding to a certain number of digits, sprintf or printf is
usually the easiest route.
[...]
Perl FAQ: http://language.perl.com/CPAN/doc/manual/html/pod/perlfaq.html
--
Clay Irving <clay@panix.com> I think, therefore I am. I think?
http://www.panix.com/~clay/
------------------------------
Date: 14 Jan 1998 21:44:14 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: basename with NT
Message-Id: <69jt5u$scl@panix.com>
In <01bd20d9$d3243740$0c07000a@dns1.filnet.fr> "Olivier" <PAYS@FILNET.fr> writes:
>I would like to use the same command as basename (UNIX)
>to obtain with a path like
>c:\folderA\folderB\file.txt -->file.txt
>This expression is not good why ???
>$base=($File=~m|.*/([^/]+)$|)
How about:
#!/usr/local/bin/perl5.00403 -w
my $path = q|c:\folderA\folderB\file.txt|;
my @temp = split /\\/, $path;
print "$temp[$#temp]\n";
It prints:
file.txt
>P.S:I dont want to use cgi.pm
You are confused -- What does a files basename have to do with CGI.pm?
--
Clay Irving <clay@panix.com> I think, therefore I am. I think?
http://www.panix.com/~clay/
------------------------------
Date: Wed, 14 Jan 1998 23:50:21 -0500
From: Chipmunk <rjk@coos.dartmouth.edu>
Subject: Re: Can I create a Linked List in Perl
Message-Id: <34BD958C.F9799BA5@coos.dartmouth.edu>
John Porter wrote:
>
> Seems to me that Perl lists are already much more like Lisp lists
> than a typical linked list in C.
> With linked lists, you have the ability to traverse from any node
> to its previous or next (in the case of a doubly-linked list),
> without having to have knowledge of the root/head/tail/etc.
> Perl arrays do not intrinsically support this feature.
> Besides, the linked list question could be considered just a simple
> case of the more general question of directed graphs. Even if you
> find Perl arrays to be suitable for those situations where you thought
> you wanted a linked list, they do not (intrinsically) fit the bill
> when you need multiple edges to/from a node.
Whether it's a C-style linked list or a Perl array, you need to have
some reference to the current node. With a linked list, it's a
pointer. With a Perl array, it's an index.
So, if $i is the index, and you want the next element, $i++.
If you want the previous element, $i--.
I don't know what you mean by not having to have knowledge of the
root/head/tail/etc. You'd better keep the ends of the list in mind,
or you'll start dereferencing null pointers. Similarly, you need
to watch the index with a Perl array, so you don't go past the end
of the array or start counting from the end with a negative number.
I do agree with you point about situations where you need multiple
edges to/from a node. You might do that with lists of lists, but
a simple array would not work.
Chipmunk
------------------------------
Date: 14 Jan 1998 18:28:52 -0800
From: randyr@i2496147.nafohq.hp.com (Randy J. Ray)
Subject: Re: CGI.pm checkboxes: how to create labels for redundant values?
Message-Id: <v95yb0iv5az.fsf@i2496147.nafohq.hp.com>
>>>>> "William" == William R Ward <hermit@cats.ucsc.edu>
>>>>> wrote the following on 09 Jan 1998 18:58:15 -0800
William> Chris Schoenfeld <chris@ixlabs.com> writes:
>> In the -values field of FORM elements - checkboxes, for example,
>> the values are the keys and the labels are the values of the
>> hashref.
>>
>> Therefore values must be unique in order to have labels.
>>
>> But I'd like the possibility of values to be redundant for quiz
>> scoring where answers are not boolean but weighted. (for
>> instance, two answers to the same question have the same value).
I'm not sure how much this will aid the original poster, but I never use
labels in the creation of either checkboxes or radiobuttons. I generate the
list of boxes and save the return, then display with my own labels. If you
pass the labels to the CGI.pm methods, then the result is a checkbox with no
whitespace between it and the label. I prefer more control over the formatting
(in fact, I generally use borderless tables to force-align the boxes and text
in case the reader has a weird font selection in their browser).
Randy
--
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Randy J. Ray 408-343-7578
randyr@nafohq.hp.com
"Reach up your hand, if your cup be empty/If your cup is full, may it be again"
--Grateful Dead, "Ripple"
------------------------------
Date: Wed, 14 Jan 1998 23:52:38 GMT
From: massong@nbnet.nb.ca (Gary Masson)
Subject: Creating a FoxPro database using Perl Scripts
Message-Id: <69jj59$ng9$1@garnet.nbnet.nb.ca>
I haven't programmed to much with Perl, but I have a requirement to
take a flat file and create a FoxPro database (for x86 based
machines). Is there a module to add onto perl5 which will make this
relatively possible, if not easy ?
Thanks,
Gary Masson
PS: Please reply via email: massong@nbnet.nb.ca
------------------------------
Date: Wed, 14 Jan 1998 19:49:25 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: deleting old files
Message-Id: <5vpj96.af8.ln@localhost>
James Amihara (amihara@Hawaii.Edu) wrote:
: thanks for the responses... but i wanted to write a
: perl program to do delete files that are older
: than 7 days old from a particular directory. those
: commands below are not perl commands are they?
'perldoc' is a program that ships with the perl distribution.
It looks up stuff in the documentation that is also shipped
with the distribution.
So, let me rephrase it in laymen's terms:
Look up these things in the Perl documentation. They will all
help (ie. you will likely want to use them) you when you write
your script:
opendir()
readdir()
unlink()
stat()
-X (file tests in the 'perlfunc' man page)
( all of *those* are perl functions )
: i wanted to know how to write a perl program, not
: to do it from the unix prompt... thanks
That is just looking up stuff at the prompt, not "doing it".
Use a different way of looking up stuff if you don't like that way.
: Tad McClellan (tadmc@flash.net) wrote:
: : James Amihara (amihara@Hawaii.Edu) wrote:
: : : i want to write perl code to read a directory, and
: : ^^^^^^^^^^^^^^^^
: : perldoc -f opendir
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 15 Jan 1998 01:50:54 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: deleting old files
Message-Id: <69jq1u$79d$1@comdyn.comdyn.com.au>
In article <69jlc7$ilb@news.hawaii.edu>,
amihara@Hawaii.Edu (James Amihara) writes:
> thanks for the responses... but i wanted to write a
> perl program to do delete files that are older
> than 7 days old from a particular directory. those
> commands below are not perl commands are they?
> i wanted to know how to write a perl program, not
> to do it from the unix prompt... thanks
This lines were references to the documenation that comes with perl,
suggesting that you go and read it. perldoc is a tool to do that.
While you're at it, also have a look at the File::Find module.
perldoc File::Find
And, no, that is NOT a perl command. It's something you type at your
shell prompt, and then you get a bunch of documentation to read, after
which you, hopefully, can go off and write a perl script.
BTW. next time you post, spend some time reading through some other
messages as well. Questions like this come up all the time. References
to perldoc come up all the time. You SHOULD have known.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | Inside every anarchy lurks an old boy
Commercial Dynamics Pty. Ltd. | network - Mitchell Kapor
NSW, Australia |
------------------------------
Date: Wed, 14 Jan 1998 23:56:16 GMT
From: massong@nbnet.nb.ca (Gary Masson)
Subject: Encrypting files with Perl.
Message-Id: <69jjc3$ng9$2@garnet.nbnet.nb.ca>
On the same project I mentioned in my previous post (w/Foxpro
databases) I would like to be able to encrypt (and decrypt) large
binary files (they are self-extracting zips actually). Is their an
encryption module available for perl?
Gary
reply via email: massong@nbnet.nb.ca
------------------------------
Date: Wed, 14 Jan 1998 22:24:02 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Encrypting files with Perl.
Message-Id: <comdog-ya02408000R1401982224020001@news.panix.com>
Keywords: from just another new york perl hacker
In article <69jjc3$ng9$2@garnet.nbnet.nb.ca>, massong@nbnet.nb.ca (Gary Masson) posted:
>On the same project I mentioned in my previous post (w/Foxpro
>databases) I would like to be able to encrypt (and decrypt) large
>binary files (they are self-extracting zips actually). Is their an
>encryption module available for perl?
CPAN [1] is your friend.
[1]
Comprehensive Perl Archive Network
find one near you at <URL:http://www.perl.com>
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: Wed, 14 Jan 1998 18:54:08 -0700
From: Builders Connection <Webmaster@builders-connection.com>
Subject: How come this works
Message-Id: <34BD6C40.5892@builders-connection.com>
If someone could please tell me how this piece of code works take out
all commas and new lines but the second dos'nt work
$test="\nJim,\n and, Patty,\n";
$test=~ s/\n|,//g; # this takes out all , and new lines
print "$test";
--
$test="\nJim,\n and, Patty,\n";
$test=~ s/,|\n//g; # this takes out all , and new lines
print "$test";
=================================================
Hope you like your e-mail!
This is from Jim's wonderful box of replies!
Remember to write back: <Jim39@interworldnet.net>
=================================================
Or visit my site at:
<http://www.builders-connection.com>
------------------------------
Date: Wed, 14 Jan 1998 19:56:15 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Interactive Processes
Message-Id: <vbqj96.af8.ln@localhost>
Glenn Williamson (gdwillia@socs.uts.EDU.AU) wrote:
: In my little Perl manual, it says that I can't open a Unix process for
: both input and output.
: open(PROGRAM, "| blah"); or open(PROG, "blah |");
: Is there any way around this? Or any reason why it's impossible? ;)
: Eventually, I would like to run a telnet session thru a perl script,
: this is just the first wall I have come to ;)
Do you have a little Perl FAQ?
You've done your part to ensure that the 'F' part remains accurate.
from part 8:
"How can I open a pipe both to and from a command?"
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 15 Jan 1998 01:53:47 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Interactive Processes
Message-Id: <69jq7b$79d$2@comdyn.comdyn.com.au>
In article <Pine.SOL.3.95.980115105529.29756A-100000@peppermint-patty>,
Glenn Williamson <gdwillia@socs.uts.EDU.AU> writes:
> In my little Perl manual, it says that I can't open a Unix process for
> both input and output.
Chuck the little perl manual. It's wrong, or old. Rely on the
documentation that comes with perl for more definite answers.
perldoc perlfaq8
/How can I open a pipe both to and from a command
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | Little girls, like butterflies, need no
Commercial Dynamics Pty. Ltd. | excuse - Lazarus Long
NSW, Australia |
------------------------------
Date: Wed, 14 Jan 1998 21:03:26 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: Interactive Processes
Message-Id: <34BD8A71.D191158@5sigma.com>
If you want to run a telnet session through Perl, well,
sockets are bidirectional. If you want to send data to a program
and wait for a response, that's the way to go. Just be sure
that you understand the buffering involved and how the program
responds to the data you send it. Also see the Open2 and Open3
modules.
However, before you reinvent the wheel you should check the
CPAN to see that someone hasn't already written your Telnet/Mail/
NNTP/SMTP/SNMP/HTTP/POP/MMAP/LDAP etc. client for you.
-joseph
http://www.effectiveperl.com
Glenn Williamson wrote:
>
> Mornin' All,
>
> In my little Perl manual, it says that I can't open a Unix process for
> both input and output.
>
> open(PROGRAM, "| blah"); or open(PROG, "blah |");
>
> Is there any way around this? Or any reason why it's impossible? ;)
> Eventually, I would like to run a telnet session thru a perl script,
> this is just the first wall I have come to ;)
------------------------------
Date: Wed, 14 Jan 1998 18:02:32 -0800
From: Rick Johnson <webmaster@worldgraphix.com>
Subject: Limiting simultaneous users
Message-Id: <34BD6E37.1453B319@worldgraphix.com>
I am looking for a starting point to help me add a feature which will
limit the number of users who can access a script at one time.
I have a script which is basically a "classified ads script" but the
number of users who are trying to access the script at the same time is
so substantail that it seems to crash the script. Is there anyway to
limit how many people can be in an area at the same time and return a
message indicating the ads are unavailable at this moment, please try
again later.
Thanks!
Rick
webmaster@worldgraphix.com
------------------------------
Date: 14 Jan 1998 22:07:48 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: Looking for HTML template script
Message-Id: <69jui4$1bk@panix.com>
In <69jmo2$ih9$1@ns3.umkc.edu> "Bob" <bob@unews.com> writes:
>Help! My ISP is running Apache but has made it so that you can't include
>files that are not in the same directory as the .shtml file calling them.
>I'm looking for a script (I'm just getting started writing Perl scripts so I
>can't write it mysef) that will allow me to do the following:
>**insert header text from template file1**
Could it be as simple as:
# The header file
my header = "the/path/to/my/header/file.html";
# Open the header file
open HEADER, $header or die "Can't open $header: $!\n";
# For each line in the file
while (<HEADER>) {
print; # print the line
}
# Close the file
close HEADER;
>**insert "story" text from simple HTML file**
Same thing:
open STORY, $story, or die "Can't open $story: $!\n";
while (<STORY>) {
print;
}
close STORY;
>**insert footer text from template file2**
ditto.
--
Clay Irving <clay@panix.com> I think, therefore I am. I think?
http://www.panix.com/~clay/
------------------------------
Date: 15 Jan 1998 03:41:36 GMT
From: tfletche@pcocd2.intel.com (Terry Michael Fletcher - PCD ~)
Subject: Re: Multi-line input: fastest way?
Message-Id: <69k0hg$2ui$1@news.fm.intel.com>
Kevin Reid (kpreid@ibm.net) so eloquently and verbosely pontificated:
> Terry Michael Fletcher - PCD ~ <tfletche@pcocd2.intel.com> wrote:
>
> > $U_input = "input";
> >
> > for (print "$U_input> "; <>; print "$U_input> ") {
> > $_ .= <> while s/\\\s*$// and print " "x length($U_input) ."> ";
> >
> > # your statement is now ready here.... you may need to chomp.
> >
> > }
> >
> > hope that helps.
>
> That's certainly shorter, but I wanted something that is easier to
> understand, not harder.
sorry. :( at the time i posted, yours was the only article in the thread, so
i didnt know what you wanted. i also didnt realize that it was harder. i
was taking advantage of the fact that:
SOMETHING;
while (<FILE>) {
# stuff
} continue {
SOMETHING;
}
is easier written as:
for (SOMETHING; <FILE>; SOMETHING) {
# stuff
}
the <FILE> magic of a while loop also applies to a for() loop, in that if its
defined, it gets placed in $_.
oh well.
--
#!/usr/local/bin/perl -- tfletche@pcocd2.intel.com
map{$;.=chr$_}(112,114,105,110,116,32,117,110,112,97,99,107,32,34,117,
34);$_=$;.=q>,':2G5S="!A;F]T:&5R(%!E<FP@:&%C:V5R+`H`'>;y[\034]{}d;eval
------------------------------
Date: Thu, 15 Jan 1998 04:21:27 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: opening text file
Message-Id: <ebohlmanEMt5Fr.Bw9@netcom.com>
Builders Connection <Webmaster@builders-connection.com> wrote:
: How can I have perl open a text file that is a comma delimited database
: file and then check to see if the name is there and if so not add the
: entree? I already have a form and a database scripted put together but
: I can't figure out how to do this checking. If I can just be pointed
: the right I'm sure I can figure it out I hope.
You might want to look at sprite.pm, available on CPAN. It might save
you from re-inventing the wheel.
------------------------------
Date: Thu, 15 Jan 1998 04:21:28 GMT
From: notsew@wwa.com
Subject: perl -- a language for LEARNING programming?
Message-Id: <34bd8ad2.1055207@news.wwa.com>
so i've learned a bit of perl, as i figured it'd be helpful on the job
and it has been. got the camel book, read some articles, etc. i love
it.
i've no formal training in programming, but i'm thinking now i'd like
to take some classes or at least do some reading (classes seem
generally too slow) in general programming theory -- topics like data
structures, algorithms, etc. the problem is that most of these
classes/books seem to presuppose a working knowledge of c and/or c++,
in neither of which i have any experience. i'm seeking advice on
this: would it be worth it to back up and get these languages down,
despite (a) the suspicion that i'll probably not use them on the job
-- at least not on my current job (b) having a decent grasp of most
fundamental programming concepts and (c) having practical experience
in c/c++ derivatives (perl, java)? again, primarily for purposes of
further development...
------------------------------
Date: Thu, 15 Jan 1998 13:53:04 +1100
From: "Ian Petts" <ipetts@no-spam.ozemail.com.au>
Subject: Re: Perl running under Linus - #!/bin/usr
Message-Id: <69jtr8$3be$1@reader1.reader.news.ozemail.net>
>As I understand things, the first line in a perl program
>in Linux should be #!/bin/usr/perl so that when the perl
>script is called, Linux knows it has to direct the lines
>following to the perl program at /bin/usr
Make sure you include the full path including the perl executable. Yours
sounds like it's #!/bin/usr/perl/perl
You also need to set the file as executable:
$ chmod u+x filename
Do a "man chmod" if you're not sure what I'm doing here.
Hope this helps!
------------------------------
Date: 15 Jan 1998 02:24:46 GMT
From: ? the platypus {aka David Formosa} <dformosa@st.nepean.uws.edu.au>
Subject: Re: Perl running under Linus - #!/bin/usr
Message-Id: <884831064.37323@cabal>
In <34bd2de5.0@lightning.ica.net> grsshpper@feedME writes:
[...]
>As I understand things, the first line in a perl program
>in Linux should be #!/bin/usr/perl so that when the perl
>script is called, Linux knows it has to direct the lines
>following to the perl program at /bin/usr
That is correct, however it should also be set to be executable.
--
Please excuse my spelling as I suffer from agraphia see the url in my header.
Never trust a country with more peaple then sheep.
Support NoCeM http://www.cm.org/
I'm sorry but I just don't consider 'because its yucky' a convincing argument
------------------------------
Date: Wed, 14 Jan 1998 18:16:48 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Shane Hill <shill@ipa.net>
Subject: Re: Perl Script Not Receiving Parameters
Message-Id: <Pine.GSO.3.96.980114181258.2093a-100000@user2.teleport.com>
On Wed, 14 Jan 1998, Shane Hill wrote:
> Somehow my HTML form is not passing my PERL script values.
Sounds like a problem with your browser, rather than with Perl. If you
want to see what your browser is sending, point the form to submit to this
URL and it will tell you.
http://www.teleport.com/cgi-bin/custom/rootbeer/form-vars
If you have further problems with browsers or servers which aren't
answered in the docs, the people in the appropriate newsgroups may be able
to help. Good luck!
--
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: 15 Jan 1998 01:58:03 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Printing in NT 4
Message-Id: <69jqfb$79d$3@comdyn.comdyn.com.au>
[Content-Type: multipart/alternative; boundary="------------C85ADC5BF561187504FC8750"]
Please don't do this. Just post in plain text.
In article <34BD49BE.676AE125@hermes.atscanada.com>,
Clair Roberts <croberts@hermes.atscanada.com> writes:
> What I am wondering is if Perl for NT can print a PDF file directly?
Are you asking if perl has drivers for your printer which can
interpret PDF? I doubt it very much. If it's a PostScript printer, you
might be able to get tools that convert PDF to PostScript, but you'd
have to look for it at Adobe's site.
Maybe you can use Acrobat, or the Acrobat viewer with some command
line options, or something like that. But that is outside of the scope
of perl.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | I think I think, therefore I think I
Commercial Dynamics Pty. Ltd. | am.
NSW, Australia |
------------------------------
Date: Wed, 14 Jan 1998 20:30:16 -0800
From: Jean-Paul Cozzatti <jp@dkstat.com>
Subject: responding to prompting programs
Message-Id: <34BD90D8.64E3C48@dkstat.com>
hello there:
how does one write a script that responds to prompts, say
login:
passoword:
presuming I have $login="jp" and $password="dummy"
and would like to use my scalars to log in.
I would actually like to use such methods to make a cgi that makes
additions to an .htaccess password file.
Is this possible?
Thank You,
Jean-Paul Cozzatti
SysAdmin/StatsCrusher
Drogin, Kakigi & Associates
------------------------------
Date: Mon, 12 Jan 1998 11:27:19 +0100
From: Pascal PERRY <perry@iway.fr>
Subject: Re: sending emails with perl ?
Message-Id: <34B9F007.1473@iway.fr>
memeier@bene.baynet.de wrote:
>
> Hi !
> Can anybody tell me how send emails with perl-scripts ?
>
> Mike
1) Create a socket localy with socket()
2) Connect to a remote SMTP server with connect()
(for instance, STMP mail server of your ISP)
3) Send through this socket your SMTP-formated message
print SOCK "MAIL FROM: <from@domain.dm>\r\n";
print SOCK "RCPT TO: <rcpt@domain.dm>\r\n";
print SOCK "DATA\r\n";
print SOCK "From: <from@domain.dm>\r\n";
print SOCK "To: <email@domain.dm>\r\n";
print SOCK "Subject: ...\r\n";
print SOCK "\r\n\r\n";
print SOCK "Hi Guys,\r\n";
print SOCK "\r\n.\r\n";
4) You must verify for each server response that server
return (in)correct identifier 2xx, 3xx, 4xx or 5xx
specified in RFC#821 (SMTP standard specifications)
and use RFC#822 (Internet Message Format Specifications)
to know how to compose correct mail header and body.
--
Pascal PERRY
------------------------------
Date: 14 Jan 1998 22:07:52 -0500
From: Douglas McNaught <doug@tc.net>
Subject: Re: simple perl script to add directory to PATH if not there already
Message-Id: <m24t36wi2f.fsf@ono.tc.net>
mgjv@comdyn.com.au (Martien Verbruggen) writes:
> In article <34ba510a.327224093@relay>,
> randolph.a.bey@norwest.com (Randy Bey) writes:
>
> [SNIP]
> > And now, for some tasty spammer bait:
> > root@127.0.0.1
> > postmaster@127.0.0.1
> > webmaster@127.0.0.1
> [SNIP big list of addresses]
>
> Please don't do that. This stuff has to go all over the world,
> clogging up disk space and bandwidth everywhere. If you feel you have
> to do put those addresses in, try to keep it minimal.
Not to mention they're not RFC-compliant (missing square brackets)...
-Doug
--
sub g{my$i=index$t,$_[0];($i%5,int$i/5)}sub h{substr$t,5*$_[1]+$_[0],1}sub n{(
$_[0]+4)%5}$t='encryptabdfghjklmoqsuvwxz';$c='fxmdwbcmagnyubnyquohyhny';while(
$c=~s/(.)(.)//){($w,$x)=g$1;($y,$z)=g$2;$w==$y&&($p.=h($w,n$x).h($y,n$z))or$x==
$z&&($p.=h(n$w,$x).h(n$y,$z))or($p.=h($y,$x).h($w,$z))}$p=~y/x/ /;print$p,"\n";
------------------------------
Date: 15 Jan 1998 02:37:58 GMT
From: ? the platypus {aka David Formosa} <dformosa@st.nepean.uws.edu.au>
Subject: Re: source into binary code
Message-Id: <884831856.332075@cabal>
In <34BCD4B1.833924F3@ixl.com> Dan Boorstein <dboorstein@ixl.com> writes:
>Tom Christiansen wrote:
[...]
>> Compiling produces no security. Read the FAQ.
>i have to disagree with this statement. i can't read compiled
>code just by opening a file. in order to understand just
>what's going on internally i would have to disassemble the code.
This is securaty by obsuraty. Its not real securaty, somewhere out there
there is someone who will disassemble your code.
--
Please excuse my spelling as I suffer from agraphia see the url in my header.
Never trust a country with more peaple then sheep.
Support NoCeM http://www.cm.org/
I'm sorry but I just don't consider 'because its yucky' a convincing argument
------------------------------
Date: Wed, 14 Jan 1998 23:44:15 -0500
From: Chipmunk <rjk@coos.dartmouth.edu>
To: Kenneth Herron <kherron@campus.mci.net>
Subject: Re: Speaking of Looping through hashes...
Message-Id: <34BD941F.6B62AEE3@coos.dartmouth.edu>
Kenneth Herron wrote:
>
> It'd be nice to have a way to iterate over the keys without reading
> values as well. I'm talking about something like:
>
> while ($key = eachkey %hash) {
> ...
> }
Try reading the documentation.
>From the perlfunc manpage:
When called in a scalar context, returns the key for only the next element
in the hash. (Note: Keys may be ``0'' or ``'', which are logically false;
you may wish to avoid constructs like while {} for this reason.)
Programming Perl book puts it another way:
In a scalar context, each returns just the key, but watch out for false keys.
while (defined($key = each %hash)) {
...
}
Chipmunk
------------------------------
Date: Thu, 15 Jan 98 02:14:12 GMT
From: dave@wedwick.com (Dave Wedwick)
Subject: Re: Writing to a file in Win32 and Unix
Message-Id: <69jrjb$lif$1@usenet88.supernews.com>
In article <Pine.GSO.3.96.980114162200.2093R-100000@user2.teleport.com>, Tom Phoenix <rootbeer@teleport.com> wrote:
>Even when your script is "just an example" (and perhaps especially in that
>case!) you should _always_ check the return value after opening a file.
Yea, OK!
>Ah, another unreformed C programmer. :-) The more Perlian way looks more
>like this.
>
> for $counter (1..10) { ... }
>
>....or even this
>
> for (1..10) { ... }
Isn't there only one way to do things in Perl????
>Maybe you should check the return value from seek() as well.
>
> seek( ... ) or die "Can't seek: $!";
>
>On the other hand, the seek seems to be working on my machine. Hope this
>helps!
Yes, except, what is your machine? In another response, the test program ran
OK on an Unix box.
I guess the question: what would stop my ISP's system from seek()ing
correctly??? Permissions? On the file/directory/both???
Thanks for the response!
------------------------------
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 1643
**************************************