[7783] in Perl-Users-Digest
Perl-Users Digest, Issue: 1408 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Dec 4 18:16:22 1997
Date: Thu, 4 Dec 97 15: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 Thu, 4 Dec 1997 Volume: 8 Number: 1408
Today's topics:
Dynamic text-to-GIF utility <smanes@NOSPAM.EVERmagpie.com>
Re: each() does not work?! (Gurusamy Sarathy)
Re: eval (Abigail)
graphic file dimensions in PERL? , snailgem@aol.com
HELP ME!!! <dweller@traknet.com>
Re: How to directly call a POST method <hangtown@calweb.com>
methods for array del(), put() in DB_File not working nick@ideation.net
Re: open and whitespace (John Moreno)
Re: Opening files in a Perl/Win32 script (Martien Verbruggen)
Re: Pattern matching (or not....) (Martien Verbruggen)
Re: perl-cgi frames <hangtown@calweb.com>
Re: Perl4 is not Y2K (was Re: Forced to use brain-dead (Bart Lateur)
printing and screen output <blue145@u.washington.edu>
Re: printing and screen output <tycage@infi.net>
Re: printing and screen output (Mike Stok)
problem with Perl <froboz@cif.rochester.edu>
QUEER needs perl cgi freelance helper. <tomh@cyberzine.org>
Re: Recommended PERL-book? (Faust Gertz)
Re: Shell command in Perl (Amy Williams)
Re: simple perl problem (Martien Verbruggen)
Re: some good perl-sites (Martien Verbruggen)
Re: Using Pipe with Fork (Matthew Cravit)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 4 Dec 1997 20:01:26 GMT
From: Steve Manes <smanes@NOSPAM.EVERmagpie.com>
Subject: Dynamic text-to-GIF utility
Message-Id: <EKoKyE.1Gz@magpie.com>
I'm looking for a freeware tool which will generate an on-the-fly
GIF given some text, a font style from a local database and, ideally,
a background GIF. Oh yeah, and it has to run on Linux. This is
to generate a dynamic headline of a few words using a known font
face. I've used the gd 1.2 library and the latest one appears to
come with several public-domain fonts but the GD1.5 perl interface
limits font options to a single typeface of four different sizes.
Can anyone suggest any alternatives?
-----------------------[ http://www.magpie.com ]-----------=o&>o-----
Steve Manes | Int'l Bass Players | for info, email
smanes [at] magpie.com | NYC Motorcyclists | server@magpie.com with
94 Harley-Davidson FLHR | Triumph MC Owners | the message, "lists"
95 Triumph Super III | Motorcycle Safety |
97 Triumph T595 | | N'Yawk, N'Yawk
------------------------------
Date: 3 Dec 1997 02:49:09 GMT
From: gsar@engin.umich.edu (Gurusamy Sarathy)
Subject: Re: each() does not work?!
Message-Id: <662hb5$m1u@srvr1.engin.umich.edu>
[ mailed and posted ]
In article <661m7h$1o0$1@due.unit.no>,
Morten Simonsen <mortensi@idt.ntnu.no> wrote:
>Morten Simonsen <mortensi@stud.ntnu.no> wrote:
>: I got the latest distribution of Perl for Win95 (perl5.004_02), but that
>: seemed to make things even worse.:-( I tried the same program again
>: this morning on another UNIX-machine too, and it is absolutly clear that
>: the each() works fine on perl5.003 with EMBED (under Solaris). Anyhow, I
>: cannot think of anything I could have done to produce these errors, so
>: I hope somebody will take affair and find that bug.
>
>I have posted another mail too, under the subject "size of DB", where I complained
>about the size of the SBM_File databases. Then it turns out that SDBM_File
>is broken under win32 distribution for certain file systems. I didn't know
>that this was a well known fact, but so it is.
You may want to try the DB_File binary distribution for the standard port:
http://www.perl.com/CPAN/authors/id/GSAR/DB_File-1.54-bin-v2-x86-mswin32-bc.zip
- Sarathy.
gsar@umich.edu
------------------------------
Date: 3 Dec 1997 02:32:07 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: eval
Message-Id: <slrn689h8l.175.abigail@betelgeuse.wayne.fnx.com>
Christopher Lambrou (hold@cglis.com) wrote on 1555 September 1993 in
<URL: news:01bcff90$d77abd10$75712581@akis>:
++ Is it possible to use eval to catch a run time "Out of memory" error?
>From 'man perldiag'
Out of memory!
(X|F) The malloc() function returned 0, indicating there
was insufficient remaining memory (or virtual memory) to
satisfy the request.
The request was judged to be small, so the possibility
to trap it depends on the way perl was compiled. By
default it is not trappable. However, if compiled for
this, Perl may use the contents of $^M as an emergency
pool after die()ing with this message. In this case the
error is trappable once.
Abigail
--
perl -wle 'print "Prime" if (1 x shift) !~ /^1?$|^(11+?)\1+$/'
------------------------------
Date: Tue, 02 Dec 1997 22:43:14 -0500
From: , snailgem@aol.com
Subject: graphic file dimensions in PERL?
Message-Id: <3484D548.5081@aol.com>
Is there any way to determine the WIDTH and HEIGHT of a gif file using
PERL?
Thanks.
------------------------------
Date: Tue, 02 Dec 1997 22:31:40 -0500
From: James BeVard <dweller@traknet.com>
Subject: HELP ME!!!
Message-Id: <3484D29B.7FF4C5EA@traknet.com>
Is there a Freeware/Shareware version of perl? can someone tell me whare
to get it.
Thanks, Jim BeVard
------------------------------
Date: Tue, 02 Dec 1997 18:40:40 -0800
From: Scott Willsey <hangtown@calweb.com>
Subject: Re: How to directly call a POST method
Message-Id: <3484C6A8.123D8BDA@calweb.com>
SveN wrote:
>
> Help,
>
> I have a HTML Dokument that uses:
>
> <form method=POST action="http://www.domain.com/cgi-bin/test.pl">
> <input type=text name=var size=6><BR><BR>
> <input type=submit>
> </form>
>
> Now I want to call test.pl directly without any user action
> (no klicking on the submit button) with a specified value for
> var. How can I do this?
>
> Greeting from SveN, Germany
In addition to SSI and perl module solutions, javascript has a submit
function, so that if you have your form as above but add a name to it:
<form method=POST action="http://www.domain.com/cgi-bin/test.pl"
name="foobar">
then you can call a javascript submit function like this:
<script language="javascript">
document.foobar.submit();
</script>
You can have a perl script with a totally hidden form (using input
type=hidden and assuming you know the data values for each field) and
submit it with no interaction by using javascript this way.
Scott
--
~~~~~~~~~hangtown@calweb.com~~~~~~~~~
I am running linux not as a political
statement against any OS or company
but because I happen to like it.
ICQ UIN 555312
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
------------------------------
Date: Thu, 04 Dec 1997 14:23:42 -0600
From: nick@ideation.net
Subject: methods for array del(), put() in DB_File not working
Message-Id: <881265413.10889@dejanews.com>
In my code which uses a tied array in the DB_File modual, I have this
quoting:
<CODE>
$T = tie(@temp, "DB_File","$dirOpen/$file", O_RDRW, 644, $DB_RECNO)
or die "Cannot tie file: $!, $0\n";
</CODE>
as the declaration for my file that I wasnt to inplace edit.
This method of getting the length of the array works:
<CODE>
$lengthOfFile = $T->length;
</CODE>
but these don't:
<CODE>
$T->del($cut) or die "Could not cut: $!,$?\n";
....
$T->put($begin, "<NOFRAMES>\n @rightFrame \n </NOFRAMES>", R_IAFTER)
or die "Could not put: $!,$?\n";
</CODE>
Both yield the die statements. Am I to guess that these methods simply
aren't implemented? This is perl 5.004
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: Tue, 2 Dec 1997 22:16:41 -0500
From: phenix@interpath.com (John Moreno)
Subject: Re: open and whitespace
Message-Id: <1d0ncgy.oxmm971g6lhxbN@roxboro-166.interpath.net>
Niall O Broin <nobroin@esoc.esa.de> wrote:
> John Moreno wrote:
> >
> > Tom Phoenix <rootbeer@teleport.com> wrote:
>
> > It doesn't look to me like he was talking about files generated by or
> > processed by MacPerl - although it could be of course, but note that he
> > is posting using a unix version of Netscape and says he a UNIX Net/Adm
> > in his sig. It looks like the files are either being generated on a Mac
> > and transferred over to a unix
>
> Got it in one - Mac users are accessing files on a Linux box using
> netatalk.
I assume this means they are also creating files?
> > are including spaces in the name so that they sort first when viewed on
> > their machines - if it's the latter then they need to be told to stop.
>
> What kind of facism is this ?! A space is a perfectly legitimate
> character in a MacOS filename (and in most modern OSes BTW) and the Mac
> user using a GUI exclusively has no problems with that. The CLI bound are
> of course used to using whitespace as a word separator. Unix shells can
> handle these files too, but you must quote the names.
It violates the naming convention of the remote host - this is
considered rude at best.
> > A better solution would be to have some way of telling open that that
> > the file name isn't a expression and have it evaluated 'as is' (say if
> > the file name was quoted using 's).
>
> That would be my preference something like
>
> require a_version_of_open_which_doesn't_strip_spaces;
>
> or YASV (yet another special variable - $ would be ideal, that's "$ ",
> not "$" :-;)
I was thinking more along the lines of:
open (FOO, ' filename') or die;
This isn't going to be a one line fix because of things like file
permissions and names that start with '. Maybe it'd be better if it was
open (FOO, "> \ filename") or die;
> > But using a full pathname (as recommended in the faq) seems to work
>
> Yes, prepending a ./ and appending a \0 works just fine. However, it
> means checking filenames all the time.
>
> My solution is going to be to hack my copy of Perl to remove the
> whitespace stripping code.
I don't know if it would be different on a unix box or not - but I
didn't use ./ and \0 I did:
$filename="HD:MacPerl Folder: jack"; # why ' jack'? I don't know, jack.
open (FOO, "> $filename" or die;
--
John Moreno
------------------------------
Date: 3 Dec 1997 02:54:37 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Opening files in a Perl/Win32 script
Message-Id: <662hld$2iu$2@comdyn.comdyn.com.au>
In article <3483F0DA.D2C6AF1A@exacomm.nl>,
Leon Boot <l.boot@exacomm.nl> writes:
Content-Type: text/html; charset=us-ascii
Next time you post, do not post HTML. Usenet is supposed to be text
based. A lot, if not most, people will not be able to read your post,
or will not bother to.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au |
Commercial Dynamics Pty. Ltd. | What's another word for Thesaurus?
NSW, Australia |
------------------------------
Date: 3 Dec 1997 02:52:17 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Pattern matching (or not....)
Message-Id: <662hh1$2iu$1@comdyn.comdyn.com.au>
Please, next time you post, do it correctly. The following is not a
valid Newsgroups header:
Newsgroups: Falcon@darkwave.org.uk,comp.lang.perl.misc
In article <3483EF83.5775@darkwave.org.uk>,
-=Falcon=- <Falcon@darkwave.org.uk> writes:
> $word = "C++";
> $Description = "This is a test to find and match C++ in a large string";
>
> Why doesnt
>
> if ($Description =~ /$word/i) {
> print "Found it\n";
> } else {
> print "Nope!\n";
> }
>
> work?
Because the + is a special character in regexps.
Try
$word = 'C\+\+';
or
$word = "C\\+\\+";
or, much better:
$word = 'C++';
if ($Description =~ /\Q$word\E/i) {
(BTW, this will also match things like "C++-like languages", which
might not be what you want. Look for word boundary tokens in the
perlre documentation, which is also where you will find an explanation
of \Q..\E)
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | I'm just very selective about what I
Commercial Dynamics Pty. Ltd. | accept as reality - Calvin
NSW, Australia |
------------------------------
Date: Tue, 02 Dec 1997 18:51:12 -0800
From: Scott Willsey <hangtown@calweb.com>
Subject: Re: perl-cgi frames
Message-Id: <3484C920.CA38823A@calweb.com>
Andrew Williams wrote:
> Frames have exactly what to do with perl? Look at the TARGET=top
> option to links and form output. Or you could even try posting this
> to a relavent news group.
Not to nitpick on something that's not perl related, but I think you
mean target="_top" with an underscore... :)
Scott
--
~~~~~~~~~hangtown@calweb.com~~~~~~~~~
I am running linux not as a political
statement against any OS or company
but because I happen to like it.
ICQ UIN 555312
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
------------------------------
Date: Thu, 04 Dec 1997 21:14:06 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: Perl4 is not Y2K (was Re: Forced to use brain-dead perl 4 -- how do I accomplish task that is simple in perl 5 ?)
Message-Id: <34871c82.803003@news.tornado.be>
mjtg@cus.cam.ac.uk (M.J.T. Guy) wrote:
>I R A Aggie <fl_aggie@thepentagon.com> wrote:
>>
>>Well, its too late now. The rumor mill will run with it, and blow it
>>completely out of proportion. Eventually, perl 4 will be blamed for
>>violence, flood, famine, and El Nino.
>
>Not to mention the plague of Camel fleas.
>Mike Guy
Eventually, people will say: "Perl 4!?!?! Who the hell did design such
crap!?!"
Unfortunately it's the same people at the forefront of development of
Perl 5. Unfortunate for THEM, I mean. Can you imagine, having to live
with that reputation?
Bart.
------------------------------
Date: Thu, 4 Dec 1997 11:55:02 -0800
From: David Adams <blue145@u.washington.edu>
Subject: printing and screen output
Message-Id: <Pine.SUN.3.93.971204115050.4582A-100000@psts.mbt.washington.edu>
Hi,
I didn't find the answer to this question in the FAQ.
How do you force print output without a linefeed ("\n")? I would like to
have a program continue to print to the same line to indicate status, e.g.
<time1> thinking.
<time2> thinking..
<time3> thinking...
If I use
print "thinking.";
then
print ".";
then finally
print "\n";
Nothing shows up on my xterm until the \n line. Any suggestions?
please cc: to dradams@bigfoot.com
Thanks ahead of time!
-david adams
_______________________________________________________________________
Web Page: http://psts.mbt.washington.edu/davepage.html
Email: dradams@bigfoot.com <---best bet
Phone: (w) 616-6023 or 685-7901 or 685-7337
Finger Target: blue145@nootka.mbt.washington.edu
_______________________________________________________________________
------------------------------
Date: Thu, 04 Dec 1997 15:30:21 -0500
From: Ty Cage Warren <tycage@infi.net>
Subject: Re: printing and screen output
Message-Id: <348712DD.35A6C011@infi.net>
[E-mailed also, since I'm a nice guy]
David Adams wrote:
>
> Hi,
>
> I didn't find the answer to this question in the FAQ.
You should have found it in the documentation...
> How do you force print output without a linefeed ("\n")? I would like to
> have a program continue to print to the same line to indicate status, e.g.
>
Just set $|=1
man perlvar for more info.
Hope this helps,
Ty
--
+---+
Ty Cage Warren tycage@infi.net
Systems Engineer InfiNet
Homepage: http://tazer.engrs.infi.net/~tycage
PGP Public Key: http://tazer.engrs.infi.net/~tycage/pgpkey.html
PGP Fingerprint: FF C1 28 CA 80 B5 31 78 B1 24 2E 8C AB DA FB D2
------------->Never invoke anything bigger than your head.<-------------
------------------------------
Date: 4 Dec 1997 20:24:45 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: printing and screen output
Message-Id: <6673id$nd1@news-central.tiac.net>
In article <Pine.SUN.3.93.971204115050.4582A-100000@psts.mbt.washington.edu>,
David Adams <dradams@bigfoot.com> wrote:
>I didn't find the answer to this question in the FAQ.
>
>How do you force print output without a linefeed ("\n")? I would like to
>have a program continue to print to the same line to indicate status, e.g.
>
><time1> thinking.
><time2> thinking..
><time3> thinking...
Use $| for piping hot output e.g.
#!/usr/local/bin/perl -w
$| = 1;
print "Thinking";
for (1 .. 3) {
sleep 1;
print ".";
}
print "\n";
or using a recent perl you can use IO::Handle's methods to hot have to
worry about which handle is currently selected (see hte perlvar and
perlfunc sdocumentation for $| and select) e.g.
#!/usr/local/bin/perl -w
use IO::Handle;
STDOUT->autoflush;
print "Thinking";
for (1 .. 3) {
sleep 1;
print ".";
}
print "\n";
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@colltech.com | Collective Technologies (work)
------------------------------
Date: 4 Dec 1997 20:55:28 GMT
From: Joshua Pincus <froboz@cif.rochester.edu>
Subject: problem with Perl
Message-Id: <6675c0$n0d14@biko.cc.rochester.edu>
Hi,
I'm having some strange difficulties with Perl5 on a bunch of
SunOS 4.1.3_u1 machines. Both Perl5.001 and Perl5.004_04 exhibit the same
strange behavior. If I fork within a Perl script and close a Client socket in
the parent's thread, the socket becomes null and void in the child process
before it can be "dup'ed".
I am trying to write a simple client/server application, and I can't get the
copies of Perl on SunOS machines to fork off the child process and allow me to
the dup the Client socket after the parent process loops back to an accept
statement. Here is a sample of code:
sub REAPER {
$waitedpid = wait;
#$SIG{CHLD} = \&REAPER;
logmsg ("reaped $waitedpid" . ($? ? " with exit $?" : ""));
}
$SIG{CHLD} = \&REAPER;
for ($waitedpid = 0;
($paddr = accept (Client, Server)) || $waitedpid;
$waitedpid = 0, close (Client)) {
next if $waitedpid and not $paddr; # could check for $! == EINTR
my ($port, $iaddr) = sockaddr_in($paddr);
my $name = gethostbyaddr ($iaddr, AF_INET);
logmsg ("connection from $name [", inet_ntoa($iaddr), "] at port $port");
spawn sub {
print "Hello there, $name, it's now ", scalar (localtime),
"\n";
};
}
sub spawn {
my $coderef = shift;
unless (@_ == 0 && $coderef && ref($coderef) eq 'CODE') {
confess "usage: spawn CODEREF";
}
my $pid;
if (!defined($pid = fork)) {
logmsg "cannot fork: $!";
return;
} elsif ($pid) {
logmsg "begat $pid";
return; #I'm the parent
}
# else I'm the child -- go spawn
open (STDIN, "<&Client") || die "can't dup client to stdin";
open (STDOUT, ">&Client") || die "can't dup client to stdout";
## open (STDERR, ">&STDOUT") || die "can't dup stdout to stderr";
exit &$coderef();
}
This should allow me to dup the Client socket handle within the child thread
after the parent thread returns. It doesn't.
This code (stolen from the Perl 5 O'Reilly text) works
under FreeBSD and Solaris. Is there something magical about SunOS that I'm
missing? Is the signal handler being properly applied? Is there something
backwards and scary about the reaping of zombied child processes and the accept
statement???
Help would be VERY much appreciated.
JP
--
Joshua Pincus
UNIX Programmer
University of Rochester Computing Center
Rochester, New York 14627
------------------------------
Date: 3 Dec 1997 02:36:54 GMT
From: "Tom Hicks" <tomh@cyberzine.org>
Subject: QUEER needs perl cgi freelance helper.
Message-Id: <01bcff93$c96ef9e0$c746cfcf@sparky2>
The CyberQueer lounge
http://www.cyberzine.org
needs help with scripts once in awhile.
Have a CGI script for hell that runs a chat, personal bio search area that
needs damage control etc periodically.
***Have pipe dream projects that need work.***
Have scripts installed that won't run.
Want to provide a remote access counter service for other Queer sites.
Want to do a database/search engine for Queer sites.
Have lots of scripts pulled off the Internet. Some work some ...
Need someone with creative skills to tweak a few things to make 'em fly
right.
Need a freelancer that is good at communicating, answering E-mail,
following through.
If interested contact me at
tomh@cyberzine.org
------------------------------
Date: Thu, 04 Dec 1997 20:16:48 GMT
From: faust@wwa.com (Faust Gertz)
Subject: Re: Recommended PERL-book?
Message-Id: <34890eea.2981036@news.wwa.com>
On Thu, 04 Dec 1997 11:38:51 +0100, Christian Bjelle
<christian.bjelle@sesig.mail.abb.com> wrote:
>Hello.
> I want to find a book that describes the basics of PERL, that also
>doesn't get useless after a few days; i.e. it should be useful as a
>reference when the PERL-basics has stuck in my head :)
>I suppose there is some book out there that is to PERL what 'The C
>programming language' by K&R is to C.
>Many thanks in advance. (By the way, this question is most likely
>answered in an faq somewhere isn't it?)
Yes it is and here is the answer from the FAQ
(http://www.perl.com/CPAN-local/doc/FAQs/FAQ/PerlFAQ.html#Perl_Boks).
>Perl Books
>
>A number books on Perl and/or CGI programming are available. A few of these are good, some are ok, but many aren't worth
>your money. Tom Christiansen maintains a list of these books, some with extensive reviews, at
>http://language.perl.com/critiques/index.html.
>
>The incontestably definitive reference book on Perl, written by the creator of Perl and his apostles, is now in its second edition
>and fourth printing.
>
> Programming Perl (the "Camel Book"):
> Authors: Larry Wall, Tom Christiansen, and Randal Schwartz
> ISBN 1-56592-149-6 (English)
> ISBN 4-89052-384-7 (Japanese)
> (French and German translations in progress)
>
>Note that O'Reilly books are color-coded: turquoise (some would call it teal) covers indicate perl5 coverage, while magenta
>(some would call it pink) covers indicate perl4 only. Check the cover color before you buy!
>
>What follows is a list of the books that the FAQ authors found personally useful. Your mileage may (but, we hope, probably
>won't) vary.
>
>If you're already a hard-core systems programmer, then the Camel Book just might suffice for you to learn Perl from. But if
>you're not, check out the ``Llama Book''. It currently doesn't cover perl5, but the 2nd edition is nearly done and should be out
>by summer 97:
>
> Learning Perl (the Llama Book):
> Author: Randal Schwartz, with intro by Larry Wall
> ISBN 1-56592-042-2 (English)
> ISBN 4-89502-678-1 (Japanese)
> ISBN 2-84177-005-2 (French)
> ISBN 3-930673-08-8 (German)
>
>Another stand-out book in the turquoise O'Reilly Perl line is the ``Hip Owls'' book. It covers regular expressions inside and out,
>with quite a bit devoted exclusively to Perl:
>
> Mastering Regular Expressions (the Cute Owls Book):
> Author: Jeffrey Friedl
> ISBN 1-56592-257-3
>
>You can order any of these books from O'Reilly & Associates, 1-800-998-9938. Local/overseas is 1-707-829-0515. If you
>can locate an O'Reilly order form, you can also fax to 1-707-829-0104. See http://www.ora.com/ on the Web.
>
>Recommended Perl books that are not from O'Reilly are the following:
>
> Cross-Platform Perl, (for Unix and Windows NT)
> Author: Eric F. Johnson
> ISBN: 1-55851-483-X
>
> How to Set up and Maintain a World Wide Web Site, (2nd edition)
> Author: Lincoln Stein, M.D., Ph.D.
> ISBN: 0-201-63462-7
>
> CGI Programming in C & Perl,
> Author: Thomas Boutell
> ISBN: 0-201-42219-0
>
>Note that some of these address specific application areas (e.g. the Web) and are not general-purpose programming books.
>
>
>
>Perl in Magazines
>
>The Perl Journal is the first and only magazine dedicated to Perl. It is published (on paper, not online) quarterly by Jon Orwant
>(orwant@tpj.com), editor. Subscription information is at http://tpj.com or via email to subscriptions@tpj.com.
>
>Beyond this, two other magazines that frequently carry high-quality articles on Perl are Web Techniques (see
>http://www.webtechniques.com/) and Unix Review (http://www.unixreview.com/).
Streben nach Wahrheit
Faust Gertz
Philosopher at Large
------------------------------
Date: Wed, 03 Dec 1997 02:17:43 GMT
From: epic@aros.net (Amy Williams)
Subject: Re: Shell command in Perl
Message-Id: <3484c01e.881247@news.aros.net>
On 3 Dec 1997 02:02:54 GMT, "S. Lam"
<Slammy@postoffice.worldnet.att.net> wrote:
>I'm very unfamiliar with Perl and I am trying to make a shell command to
>invoke Sendmail. I've included the header:
>
>Use Shell qw(mail);
>
>what I'm stuck on is the exact syntax on how to invoke the mailer. I've
>trying to do the following:
>
>mail someone@foo.bar < message.file
>
>I know other shell commands require parenthesis and quotes, but l can't
>figure out the syntax for this one. None of the books that I have show
>anything on this.
I have a CGI script that starts sendmail like so:
$sendmail='/usr/sbin/sendmail';
open(MAIL, "|$sendmail someone@foo.bar") || die "Can't open
sendmail!\n";
print MAIL "From: me@foo.bar" (Myname)\n";
print MAIL "Subject: Blah\n";
print MAIL "Hi,\n";
print MAIL "I'm printing to the body of the message! :)\n";
Hopefully that gives you an idea of how to do it. If you're wondering
about the open statement you outa pick up a book (I recommend Learning
Perl) and research it. :)
--
Amy Williams
epic@aros.net
http://www.aros.net/~epic/
Finger for PGP public key.
------------------------------
Date: 3 Dec 1997 02:20:05 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: simple perl problem
Message-Id: <662fkl$2go$1@comdyn.comdyn.com.au>
In article <3483C41A.9680F18F@isu.edu>,
Ann <ngyat@isu.edu> writes:
> Hi,I am a beginner of perl. I tried to write a perl program to fix a
> text file (input file) with some broken paragraphs.
> In that execise, I was asked to input a file, like the following,
> with some "tab" and "blank line" between the paragraph. When I see
> either "tab" or a "blank line", I will take it as another paragraph.
I will take this to mean that a paragraph separator can mean any of
the following:
1) a blank line: This is a line which might contain whitespace?
( Also eat up any whitespace after the blank line)
/\n\s*\n\s*/
2) a line starting with a tab
( Also eat up any whitespace after the tab)
/\n\t\s*/
Of course you can change these regexps to eat up less or more
whitespace, or be more or less discriminate.
For the wrapping, I think you will find the Text::Wrap module helpful.
You can download it from CPAN (http://www.perl.com/CPAN/)
---- SNIP ----
#!/usr/local/bin/perl5 -w
# yes, I know this can be more concise. It's done this way so
# it's a bit more clear what happens
use strict;
use Text::Wrap;
# Set the wrap width
$Text::Wrap::columns = 40;
# The following would work if you always had one or more
# blank lines as paragraph separators
# $/ = "";
# my @pars = <DATA>;
# The following will work for one or more newlines, followed by a tab,
# or a 'blank' line
# Get the whole file in a single string
my $text = join("", <DATA>);
# Split the file up on the boundaries described above
my @pars = split( m/ \n\s*\n\s* | \n\t\s* /x, $text);
foreach my $par (@pars)
{
# Collapse whitespace
$par =~ s/\s+/ /g;
# Use Text::Wrap to format the paragraph
$par = wrap("\t", "", $par);
}
# Print out the new paragraphs, assuming that you want them to be
# separated by a blank line
print join("\n\n", @pars);
print "\n";
__DATA__
Some text that should form the first paragraph
split over
a few lines.
Some more text that should end up in this first paragraph.
The second paragraph starts here
and ends here.
This should be a new paragraph.
And another paragraph to conclude the show.
---- SNIP ----
HTH,
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | We are born naked, wet and hungry. Then
Commercial Dynamics Pty. Ltd. | things get worse.
NSW, Australia |
------------------------------
Date: 3 Dec 1997 02:23:09 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: some good perl-sites
Message-Id: <662fqd$2go$2@comdyn.comdyn.com.au>
In article <660mgh$l19@dos.canit.se>,
sap1d@canit.se (Johan Dalstrom) writes:
> Hey..
>
> I'm learning perl and I'd like to know if there are any good
> tutorials and FAQ's etc..
If you had read a few of the messages here, you probably would have
found some references to www.perl.com. Start there.
You would also have noticed numerous references to the documentation
that comes with perl, available through perldoc. Read that as well.
The FAQs also come with perl. Please read them.
> If you know any good sites.. Please mail me or post it in the
> group.
done.
> / sap1d
odd name.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | Advertising: The science of arresting
Commercial Dynamics Pty. Ltd. | the human intelligence long enough to
NSW, Australia | get money from it.
------------------------------
Date: 4 Dec 1997 12:05:18 -0800
From: mcravit@best.com (Matthew Cravit)
Subject: Re: Using Pipe with Fork
Message-Id: <6672du$33m$1@shell3.ba.best.com>
In article <3486FA0A.D5E@arl.mil>, Howell Caton (ISTD/TD) <caton> wrote:
> open(READHANDLE, "doit|");
> open(WRITEHANDLE, "|doit");
You want to look at the documentation for the IPC::Open2 module. Basically,
you do something like this:
use IPC::Open2;
use Symbol;
$readhandle = gensym;
$writehandle = gensym;
$pid = open2($readhandle, $writehandle, '/usr/local/bin/whatever');
$input = <$readhandle>;
print $writehandle "Blah\n";
close $writehandle;
close $readhandle;
Hope this helps.
/MC
--
Matthew Cravit, N9VWG | Experience is what allows you to
E-mail: mcravit@best.com (home) | recognize a mistake the second
mcravit@taos.com (work) | time you make it.
------------------------------
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 1408
**************************************