[8160] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 1778 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jan 31 17:10:59 1998

Date: Sat, 31 Jan 98 14:00:25 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sat, 31 Jan 1998     Volume: 8 Number: 1778

Today's topics:
    Re: can variables be generated on the fly <tchrist@mox.perl.com>
    Re: Compiling regexs for efficency <tchrist@mox.perl.com>
    Re: Don't forget the Perl Journal (was Re: Good place t <joseph@5sigma.com>
    Re: Don't use signal handlers (was Re: Child processes) (Bernie Cosell)
    Re: Don't use signal handlers (was Re: Child processes) (Chip Salzenberg)
    Re: easy question about ARGV <rjk@coos.dartmouth.edu>
        fetching text not from STDOUT (pipe) <vegardha@ifi.uio.no>
    Re: Forcing 7-digit number? <rjk@coos.dartmouth.edu>
        Garbage collection + Stack corruption <marshall@pindar.com>
    Re: Help in finding Control Characters in a string. (milagro)
    Re: How do you make the something case-insensitive? <smiano@mindspring.com>
    Re: Locking files <tchrist@mox.perl.com>
    Re: Newbie question - UNIX to NT port <administrator@actioninternet.net>
    Re: Parsing Word Docs scott@softbase.com
        Perl and gcc (Dave Lilly)
        perl script displayed in browser sometimes... <lex@datadrivensolutions.com>
    Re: regex to extract text from string variable (Craig Berry)
    Re: regex to extract text from string variable <alecto@pe.Bogusstring.net>
    Re: removing a line from a file <rjk@coos.dartmouth.edu>
    Re: replacement for ls command? (robert doggett)
    Re: SelfLoader question (Randy J. Ray)
        send mail bug... ;(  <luckycom@ica.net>
    Re: send mail bug... ;( <corky@ultranet.com>
    Re: send mail bug... ;( (Chris Nandor)
    Re: Sending mail from NT4.0 <dave@turfpit.demon.co.uk>
    Re: Sending mail from NT4.0 <administrator@actioninternet.net>
    Re: Survival Of perl <lovegod@earthling.net>
    Re: Survival Of perl scott@softbase.com
    Re: Survival Of perl (I R A Aggie)
    Re: Where Is sub Autoloader? (Randy J. Ray)
    Re: Word -> HTML scott@softbase.com
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: 31 Jan 1998 14:59:21 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: can variables be generated on the fly
Message-Id: <6ave89$u2$2@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, puiu@kappa.ro writes:
:  Well, I use :
:${$var}{'key'}='what you want';
:and it works...

Only on global variables, and even then not when use strict refs is
in effect.

---tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com

"Make is like Pascal: everybody likes it, so they go in and change it. "
	    --Dennis Ritchie


------------------------------

Date: 31 Jan 1998 20:52:10 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Compiling regexs for efficency
Message-Id: <6b02tq$nqr$1@csnews.cs.colorado.edu>

In comp.lang.perl.misc, Eli the Bearded <fuckspam@qz.to> writes:
:It is only effective in loops *when the RE contains a variable*. Lots of
:otherwise pretty good perl programmers seem to overlook that.
:
:foreach (@useful_slash_o) {
:  if (/^$Some_Regexp/o) {
:     &do_stuff;
:  }
:}

Or worse,

    for $line (@lines) {
	for $pat (@pats) {
	    if ($line =~ /$pat/o) {  # WRONG WRONG WRONG
		....
	    } 
	} 
    } 

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com
    "...this does not mean that some of us should not want, in a rather
    dispassionate sort of way, to put a bullet through csh's head."
		Larry Wall in <1992Aug6.221512.5963@netlabs.com>


------------------------------

Date: Sat, 31 Jan 1998 12:21:43 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
To: Michael R Weholt <awnbreel@panix.com>
Subject: Re: Don't forget the Perl Journal (was Re: Good place to start in Perl 5)
Message-Id: <34D379BB.1CA74D3A@5sigma.com>

Even a Good Book's errata sheet for the first printing will be
long.  It just might not be public.

As I look at my current errata sheet, I see:

  5 wrong word / spelling (e.g. "build" instead of "built")
  6 erroneous comments (e.g. "Prints 4" should be "Prints 3")
  2 incorrect figures
  1 syntax error in code
  3 compilable errors in code
  1 text that needs clarification

To me the most disturbing kinds of errors are factual errors ("lies
about Perl") followed closely by code that won't compile.  I agree
that some of the Big Thick Perl Books have unacceptable densities
of this type of error.  Even worse, some books in that category
have had those errors not just through multiple printings, but from
one *edition* to the next.

	-joseph

Michael R Weholt wrote:
> 
> In article <34D27AC5.EA7205CE@5sigma.com>,
> joseph@5sigma.com wrote:
> 
> >I know how much
> >care and attention went into trying to keep errors out of my
> >book, and my conclusion is that a few in a first printing are not
> >a big deal and, so far as I can see, unavoidable.
> >
> >A book that has errors lasting into later printings -- now that's
> >a different animal.  Or a book that has *lots* of errors, or errors
> >that look like lapses in understanding rather than just writing
> >or editing goofs.
> 
> We all make mistakes and your comments about Trying Hard and so forth
> are apt.  Still, I spend a lot of time with books and tutorials,
> teaching myself this-n-that language, and the problem with a typo in
> these sorts of publications is that it can really cause the
> Self-Learner an enormous amount of grief, frustration, etc. when he
> tries to get a piece of source code to compile or whatever and it
> won't because there is, in fact, a typo in the book's code.[...]
-- 
Joseph N. Hall, prop., 5 Sigma Productions       mailto:joseph@5sigma.com
Author, Effective Perl Programming . . . . . http://www.effectiveperl.com
Perl Training  . . . . . . . . . . . . . . .  http://www.perltraining.com


------------------------------

Date: Sat, 31 Jan 1998 17:46:12 GMT
From: bernie@fantasyfarm.com (Bernie Cosell)
Subject: Re: Don't use signal handlers (was Re: Child processes)
Message-Id: <34d55c52.243585321@news.infoave.net>

Jacqui Caren <Jacqui.Caren@ig.co.uk> wrote:

} In article <6aq7jp$80d$1@cyprus.atlantic.net>,
} Chip Salzenberg <chip@pobox.com> wrote:
} >According to joseph@5sigma.com:
} >>I'm going to have to temper what I just said.  It's pretty likely
} >>that $SIG{CHLD} = sub { wait } is going to cause a problem if
} >>your program is spawning and reaping children at a good clip
} >>for a period of time.
} >
} >That's not strong enough.
} >
} >Any given signal resulting in a signal handler being executed can
}                                 ^
} is there a missing "perl" here? Or is perl in C broken as well?

I don't know what you mean by "perl in C", but the fact is that on Unix
[and especially in the SysIII/SysV derived versions...] handling signals
correctly and fault-free is mindbogglingly difficult.  It is possible but
generally not using the straightforward [or if you will "naive"] approach
to signal handling [which is to do something in the handler].

The problem is that virtually -nothing- in a Unix process is reentrant and
so any signal that happens can run into a conflict in a myriad of places.
You want a signal handler to do "fprintf (stderr, "Ouch\n")"?  Almost
guaranteed process-death.  Doing any I/O with stdio in a signal handler can
mess up your process big time; doing anything that might require a call to
malloc can do you in. [I mention stuff like that because all those
"utility" routines in libc are used almost-invisibly just about
*everywhere*; the problems only get trickier when you get to the big
visible libraries [libdbm, libmath, etc] and try to call *them* in a signal
handler].

And none of this even scratches the surface of problems with a signal
handler in Perl [what if you have a signal handler that does an 'eval' or
dyna-loads something... virtually ALL of Perl would have to be reentrant to
use signals in the 'straightforward' way!].

Experienced Unix programmers [at least the good ones...:o) ...Hi
Chip...:o)] avoid doing *ANYTHING* unnecessary on a signal handler.  There
are programming techniques for getting around this, but it takes a fairly
careful programmer to make sure it is done correctly.  You'd be amazed at
how many programs you can blow out of the water just by hitting "control-C"
a lot at them quickly.

} >Don't use Perl signal handlers.  Ever.
} 
} This infers that perl is not a language fit for commercial use.  Given
} the significant effort made by many of us to try and convince various
} people that perl is reliable and stable this sort of statement puts 
} perl back as into the toy language category.

This is partly true, IMO.  The problem here is that whereas it is VERY hard
to handle signals correctly in the first place on Unix, at least at the
cc/as level, at least you have a -chance- of coding things up carefully
enough to get *your* program to work.  With Perl's signal-control machinery
being broken there's virtually -no- way to code-around the problem and have
a Perl program that handles things like SIGINTR and SIGCHLD and SIGPIPE
properly.

  /Bernie\
-- 
Bernie Cosell                     Fantasy Farm Fibers
bernie@fantasyfarm.com            Pearisburg, VA
    -->  Too many people, too few sheep  <--          


------------------------------

Date: Sat, 31 Jan 1998 21:46:20 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: Re: Don't use signal handlers (was Re: Child processes)
Message-Id: <6b065q$ejs$1@cyprus.atlantic.net>

According to ilya@math.ohio-state.edu (Ilya Zakharevich):
><chip@pobox.com> wrote:
>> There's no point in writing a SEGV handler in Perl.
>
>There is a lot of points in writing a SEGV handler in Perl, one is
>used in (say) Perl debugger.

There is no use writing a SEGV handler in Perl because Perl is unable
to do anything significant without invoking internal routines that
perform all sorts of data structure manipulation and memory allocation;
and the only way a Perl program can generate a SEGV is by some bug
corrupting those data structures and memory arenas.  Furthermore, as
the Perl internals are not designed for interruption at arbitrary
points, even if by some miracle the SEGV isn't due to corruption, it
can in and of itself _cause_ such corruption.

Moral:  SEGV handler in Perl is useless except as a dancing bear.

>> What's missing isn't tuits, but approval.
>
>Without tuits to fix the broken semantics (say, I favor
>
>	$SIG{INT} = [ postponed => \&postponed_handler, 
>		      immediate => \&immediate_handler];
>

Immediate delivery in perl5 (without thread support) is a bug.
That's not a tuit issue, that's an issue of the pumpkin holders
having (or not having) the guts to refuse to rearrange the deck
chairs on the Titanic, no matter how much some person who isn't
paying attention to the ongoing disaster asks for help.
-- 
Chip Salzenberg               - a.k.a. -                <chip@pobox.com>
    Like Perl?  Want to help out?  The Perl Institute: www.perl.org
           ->  Ask me about Perl training and consulting  <-
             "It's the lemon zester of death!!"   // MST3K


------------------------------

Date: Sat, 31 Jan 1998 15:39:48 -0500
From: Chipmunk <rjk@coos.dartmouth.edu>
Subject: Re: easy question about ARGV
Message-Id: <34D38C15.36A81BBD@coos.dartmouth.edu>

Craig Berry wrote:
> 
> CS44 Personel (dwu@svcam.amd.com) wrote:
> : open (guesthandle2 , "/usr/printtwo.html"):
> : open (guesthandle2 , "/var/blah/printfrom.log");
> 
> Forgot to run with -w enabled (I'm nearly certain).  Forgot to check for
> success on open (e.g. open(FOO, '<bar') or die $!).  Did not follow
> recommended practice of naming filehandles in ALL CAPS.  Syntax error at
> end of first line (: rather than ;).  Both opens name the same filehandle
> (guesthandle2); I'm guessing the second one is supposed to end with 3.
> Both files are opened (implicitly) in read mode; presumably you meant the
> first(?) one to be in write mode.  Oh, and this is a nit, but there's no
> need for double-quoted (interpolating) strings in your filename arguments
> to open; single-quotes would probably be prefered here.
> 
> Wow, that's a lot of mistakes to pack into two lines! :)

One more:

'two' is a number.  'to' is a preposition.
The name of the file in line one should be "/usr/printto.html".

:-)

Chipmunk


------------------------------

Date: 31 Jan 1998 20:25:18 +0100
From: Vegard Hanssen <vegardha@ifi.uio.no>
Subject: fetching text not from STDOUT (pipe)
Message-Id: <y9xra5owin5.fsf@hindarfjell.ifi.uio.no>

open(PROG, "program |") || die;

while(<PROG>) {
	<do something with the text>
}
close PROG;

-------

I want to fetch the text from the program, but how do I do it when the
program not output the text to STDOUT?

Vegard


------------------------------

Date: Sat, 31 Jan 1998 15:59:32 -0500
From: Chipmunk <rjk@coos.dartmouth.edu>
Subject: Re: Forcing 7-digit number?
Message-Id: <34D390B4.4632A965@coos.dartmouth.edu>

Anthony Boyd wrote:
> 
> abigail@fnx.com wrote:
> > Anthony Boyd <anthony@outshine.com> wrote:
> >
> > ++ Clearly, the time is being used to seed the random number.  I cannot find
> > ++ an example of how to get a random number that will vary independent of the
> > ++ time, although the man pages and books all say it's possible.  Anyone have
> > ++ a pointer?
> >
> > Did you actually read the man page? What did the entry on srand say?
> 
> Yes, I actually read the man page.  The entry on srand says it can be fed
> a "seed" but provides no sample code, which is what I was asking for.

Oddly, the perlfunc manpage with perl5.003 does not include any examples of
calling srand, although the manpage with perl5.002 does.

However, the perl5.004 version of the docs, (also available from <http://www.perl.com/>),
includes this:

     srand EXPR
             Sets the random number seed for the rand operator. If EXPR is
             omitted, uses a semi-random value based on the current time and
             process ID, among other things. In versions of Perl prior to 5.004
             the default seed was just the current time. This isn't a particularly
             good seed, so many old programs supply their own seed value
             (often time ^ $$ or time ^ ($$ + )), but that isn't necessary any
more. 

[That second one is obviously a syntax error.  Oh well.  Probably just a problem
in the HTML version.]

             In fact, it's usually not necessary to call srand at all, because
if it
             is not called explicitly, it is called implicitly at the first
use of the
             rand operator. However, this was not the case in version of Perl before
             5.004, so if your script will run under older Perl versions, it should
             call srand. 

             Note that you need something much more random than the default
seed for
             cryptographic purposes. Checksumming the compressed output of one or
             more rapidly changing operating system status programs is the
usual method.
             For example: 

                  srand (time ^ $$ ^ unpack "%L*", `ps axww | gzip`);

             If you're particularly concerned with this, see the
Math::TrulyRandom module in CPAN. 


There you go, some nice examples of calling srand with a seed.  time ^ $$ is probably
sufficient for your needs.


Another reason to upgrade to the latest version: updated documentation.

Chipmunk


------------------------------

Date: Fri, 30 Jan 1998 15:25:33 -0000
From: "Roger Marshall" <marshall@pindar.com>
Subject: Garbage collection + Stack corruption
Message-Id: <6asrh1$r83@akira.pindar.com>

Hi,

My perl script runs on unix in the background and processes files that are
dropped in directories.

The perl script is around 2000 lines.

I'm hoping to let this perl script run indefinitely.

The main of my perl looks like this :

while ()
{
    check_folders($folder1);
    check_folders($folder2);
    ..

    sleep 5;
}

will I have any problems with corruption of the stack - or garbage
collection.

Anybody ever had any problems with leaving perl script running for long
times.

Thanks for your help.

Roger Marshall




------------------------------

Date: Sat, 31 Jan 1998 14:37:35 -0500
From: milagro@beanfield.com (milagro)
Subject: Re: Help in finding Control Characters in a string.
Message-Id: <milagro-ya02408000R3101981437350001@news.erols.com>


> 
> I think a simple 
> 
>     pos($rec) = 0;
>     while ($rec =~ /[\000-\011\013\014\020-\37]/g) {
>         warn "Bad char at position " . pos($rec) . " in record $count.\n";
>     }
> 
> will do.
> 
> Regards,
> Mike Heins    


Mike
 Thanks for the response. There is one thing I don't really understand what
you did. Hope you don't mind my asking but  the regex 
/[\000-\011\013\014\020-\37]/g   is confusing to me.  I don't understand
what the dashes "-" are doing on either side of  \011\013\014\020. At first
I thought it was like a range.. saying all the octal nums between 000 and
037. But then I don't understand what the numbers between the dashes are
doing. 
Could you tell me how this line would read in english? Thanks. 

Also you said there is no 8 in octal. Did  you mean that \008 was not an
octal number? 
Why do you have 37 instead of 037? Does it not need the leading 0 or are
\37 and \037 different numbers.

Thanks so much.. from a novice perl programmer

Mike Shavel
mshavel@erols.com


------------------------------

Date: Fri, 30 Jan 1998 08:35:12 -0500
From: Stephen Miano <smiano@mindspring.com>
Subject: Re: How do you make the something case-insensitive?
Message-Id: <34D1D710.2AA2254A@mindspring.com>

This is a multi-part message in MIME format.
--------------64A5D51CBB02D49E3A441258
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Chocolate wrote:

> I have this form and I want to be able to search but I want the case to be
> insensitive.  How do I do this?

  i        ( Do case-insensitive pattern matching)

while(<>) {
    if ( /pattern/i) {
           print "Line has word pattern in any case\n";
    }
}

--------------64A5D51CBB02D49E3A441258
Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Stephen Miano
Content-Disposition: attachment; filename="vcard.vcf"

begin:          vcard
fn:             Stephen Miano
n:              Miano;Stephen
org:            ESM Inc.
adr:            187 Colonial Pkwy North;;;Yonkers;New York;10710;USA
email;internet: smiano@mindspring.com
tel;work:       212-821-6028
tel;fax:        212-821-6634
tel;home:       914-337-0063
x-mozilla-cpt:  ;0
x-mozilla-html: TRUE
version:        2.1
end:            vcard


--------------64A5D51CBB02D49E3A441258--



------------------------------

Date: 31 Jan 1998 14:57:22 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Locking files
Message-Id: <6ave4i$u2$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, BENJAMIN BERUBE <berub00@DMI.USherb.CA> writes:
:My question is about locking file so that when I open a file, nobody
:else can open it.  

Apparently you misunderstand locking.  Locking a file blocks 
out other *lockers*, and no one else.  No one.

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com


150 years ago everybody was a Christian Scientist.   --dmr


------------------------------

Date: Sat, 31 Jan 1998 16:41:26 -0500
From: "Shane Newberg" <administrator@actioninternet.net>
Subject: Re: Newbie question - UNIX to NT port
Message-Id: <34d39ad6.0@209.4.95.130>


Richard Wilson wrote in message <01bd2c4b$0e33ff60$610d93c3@onyx>...
>
>Hello,
>
>An easy question here!  I've been asked if an application which uses ORACLE
>RDBMS and Perl can be ported from a HP-UX platform to NT.  I know the
>migration of ORACLE will be reasonably straight forward, but not being an
>NT person I'm unsure about Perl.  Reading some of the mail on this news
>site indicates Perl is available for NT.  Does anyone have any experience
>of porting from UNIX to NT, and where do I get Perl from (for NT)?
>
>Any advice will be gratefully received!
>
>Thanks


www.perl.com has excellent links to NT installation for Perl. Make sure you
are prepared to edit registry and make associations.
Good Luck !





------------------------------

Date: 31 Jan 1998 20:48:39 GMT
From: scott@softbase.com
Subject: Re: Parsing Word Docs
Message-Id: <6b02n7$11v$2@mainsrv.main.nc.us>

newsie (newsspam@weptop.com) wrote:
> This only works on word 6/95. Has anyone been able to parse a word 97
> doc?

Use Automation, and the SaveAs functionality to save the document
as text!

Scott
--
Look at Softbase Systems' client/server tools, www.softbase.com
Check out the Essential 97 package for Windows 95 www.skwc.com/essent
All my other cool web pages are available from that site too!
My demo tape, artwork, poetry, The Windows 95 Book FAQ, and more. 


------------------------------

Date: Sat, 31 Jan 1998 12:36:52 -0600
From: lilly@acm.org (Dave Lilly)
Subject: Perl and gcc
Message-Id: <lilly-3101981236520001@a161217.n1.vanderbilt.edu>

Hi there all-

I've been trying unsuccessfully to get Perl and gcc to work together (in a
CGI script).  I've tried all sorts of different things, including piping
the input directly to gcc and calling gcc through "system" but nothing
seems to work.  I was wondering if anyone had any experience trying to get
these two things to work together, and if so, had any advice...

Thanks...

Dave Lilly


------------------------------

Date: Sat, 31 Jan 1998 21:13:43 GMT
From: "Lex Sheehan" <lex@datadrivensolutions.com>
Subject: perl script displayed in browser sometimes...
Message-Id: <01bd2e8d$96473f40$f40898cd@emerald-city>

I am running IIS3.0, have configured .pl files in NT4.0 registry
and sometimes they run, and sometimes they are displayed
in the browser's window???

How can I ensure that the perl scripts are always executed,
not ever displayed?

Thanks


------------------------------

Date: 31 Jan 1998 18:57:10 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: regex to extract text from string variable
Message-Id: <6avs66$fv5$1@marina.cinenet.net>

Gerrard Family (family@gerrard.org) wrote:
: I am in need of a regex to extract some text from a string variable:
: 
: The variable $output holds the output of a external command, the output is a
: basic html formatted file, an example is shown below:
[Example snipped]
: I would like to use a regex to extract the text that is between the <PRE>
: and </PRE> tags and place it into a new variable, say $pretext.
: 
: Thanks in advance for a working example of this, if it can be done.  I can
: use Perl 4 or 5.

If you know for sure that there is only one <PRE>..</PRE> pair in $output
(or that you only want the first such pair), then this will do the trick: 

  my ($preText) = $output =~ m!<PRE>(.*?)</PRE>!s;

The 's' match modifier allows newlines to match ., which lets the regex 
cross line boundaries between <PRE> and </PRE>.  You may want/need to 
clean up (e.g.) initial newlines in $preText before using it.

HTH!

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


------------------------------

Date: 31 Jan 1998 20:50:38 GMT
From: alecto <alecto@pe.Bogusstring.net>
Subject: Re: regex to extract text from string variable
Message-Id: <6b02qu$ctq$1@nntp.pe.net>

Gerrard Family <family@gerrard.org> wrote:

>I am in need of a regex to extract some text from a string variable:
>The variable $output holds the output of a external command, the output is a
>basic html formatted file...
       [$output snipped]
>I would like to use a regex to extract the text that is between the <PRE>
>and </PRE> tags and place it into a new variable, say $pretext.

one way is:

#! /usr/bin/perl -w
# This is perl, version 5.003 with EMBED
$output ="
<html>
<body>
<center><PRE>
This is the text I want to extract
and it can be spread across
three or more lines
</PRE>
</body>
</html>
== EOF ==";

$output =~ /<PRE>.(.*)<\/PRE/s ;
$pretext = $1 ;

print "\$pretext contains:\n$pretext";



------------------------------

Date: Sat, 31 Jan 1998 15:21:14 -0500
From: Chipmunk <rjk@coos.dartmouth.edu>
Subject: Re: removing a line from a file
Message-Id: <34D387BA.EB564856@coos.dartmouth.edu>

Chad R Cordero wrote:
> 
> [...]

Ow!  Your code is so painful I can't even bear to quote it.

Try this instead:

perl -ni -e 'print if not /^username$/'

Chipmunk


------------------------------

Date: Thu, 29 Jan 1998 15:50:37 -0800
From: rdoggett@oz.net (robert doggett)
Subject: Re: replacement for ls command?
Message-Id: <rdoggett-2901981550380001@crystal.oz.net>

> > Is there an equivalent way of doing a Unix ls command?  For example,
> >         @found=`ls abc*/def*/some*.txt`;
> > 
> > Without resorting to ``, or system, of course.

Forget about the directory reading functions.  Use "glob" instead.

robert


------------------------------

Date: 31 Jan 1998 12:50:41 -0800
From: rjray@localhost.localdomain (Randy J. Ray)
Subject: Re: SelfLoader question
Message-Id: <m3oh0s9xlq.fsf@localhost.localdomain>

>>>>> "jeremy" == jeremy howard todd <jhtodd@students.uiuc.edu>
>>>>> wrote the following on 31 Jan 1998 08:25:09 GMT

  jeremy> 	Okay, so I have my required subroutines, etc. way up
  jeremy> at the top of my file, then the __DATA__ literal, and then
  jeremy> the rest of the optional subroutines.

Good start :-).

  jeremy> 	My question is, suppose a script references one of the
  jeremy> optional subroutines.  Does perl then parse and compile
  jeremy> -all- the code after the __DATA__ marker, or only until it
  jeremy> reaches the desired function?

Neither. Upon start-up, the SelfLoader reads everything past the __DATA__
token, storing it in a hash table indexed by subroutine name. The routines
are compiled via eval() on-demand.

  jeremy> 	In other words, is there any advantage to sorting the
  jeremy> subroutine definitions after __DATA__ in decreasing order of
  jeremy> likelihood of use, or will it have the same result to group
  jeremy> them together in, say, alphabetical order, or grouped by
  jeremy> function, etc.?

No benefit from the ordering of the functions, no. SelfLoader reads when
it is use'd, and compiles on demand.

Randy
-- 
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Randy J. Ray                                                    rjray@tsoft.com
Campbell, CA                                                      randy@byz.org
Web page coming soon


------------------------------

Date: Sat, 31 Jan 1998 13:19:22 -0800
From: Alexander Kovalenko <luckycom@ica.net>
Subject: send mail bug... ;( 
Message-Id: <34D39559.8B5E9EBC@ica.net>

hey for some reason when I am sending e-mail , it sends without any
SUBJECT !!! whatz wrong with the following script :

sub send_mail
{
  local($addressee, $subject, $message) = @_;
  local($sendmail) = "/usr/sbin/sendmail";

  open(SENDMAIL, "| $sendmail -t");

  print SENDMAIL "To: ", $addressee, "\n\n";
  print SENDMAIL "Subject: ", $subject, "\n\n",
  print SENDMAIL $message;

  close(SENDMAIL);
}

$to="luckycom\@ica.net";
$sub="Test of sending e-mail.. !";
$body="test";
&send_mail($to, $sub, $body);

so any ideaz wqhat did i do wrong?
--
With best wishes,
Alex.

------------------
To purchase your own www.yourcompany.com,
please, click here: http://www.philex.net
    The Best Prices on the Net!!!
    19.95$ for 250Mb per month
                  +
     many additional options.




------------------------------

Date: Sat, 31 Jan 1998 13:40:48 -0500
From: Bob Trieger <corky@ultranet.com>
To: Alexander Kovalenko <luckycom@ica.net>
Subject: Re: send mail bug... ;(
Message-Id: <34D37030.2747@ultranet.com>

Alexander Kovalenko wrote:
> 
> hey for some reason when I am sending e-mail , it sends without any
> SUBJECT !!! whatz wrong with the following script :
> 
> sub send_mail
> {
>   local($addressee, $subject, $message) = @_;
>   local($sendmail) = "/usr/sbin/sendmail";
> 
>   open(SENDMAIL, "| $sendmail -t");
> 
>   print SENDMAIL "To: ", $addressee, "\n\n";
>   print SENDMAIL "Subject: ", $subject, "\n\n",
>   print SENDMAIL $message;
> 
>   close(SENDMAIL);
> }
> 
> $to="luckycom\@ica.net";
> $sub="Test of sending e-mail.. !";
> $body="test";
> &send_mail($to, $sub, $body);
> 
> so any ideaz wqhat did i do wrong?


You should only have 1 carriage return after the "To" line. Anything
after a double carriage return is considered body.


HTH
Bob Trieger
corky@ma.ultranet.com


------------------------------

Date: Sat, 31 Jan 1998 13:50:16 -0500
From: pudge@pobox.com (Chris Nandor)
Subject: Re: send mail bug... ;(
Message-Id: <pudge-3101981350170001@ppp-17.ts-1.kin.idt.net>

In article <34D39559.8B5E9EBC@ica.net>, Alexander Kovalenko
<luckycom@ica.net> wrote:

#   print SENDMAIL "To: ", $addressee, "\n\n";
#   print SENDMAIL "Subject: ", $subject, "\n\n",

Sigh.  Learn sendmail, and do not spam clpm with this completely non-perl
question.

-- 
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey=('B76E72AD',[1024,'0824 090B CE73 CA10  1FF7 7F13 8180 B6B6'])
#==       New Book: MacPerl:  Programming for the Rest of Us       ==#
#==    Publishing Date: Early 1998. http://www.ptf.com/macperl/    ==#


------------------------------

Date: Sat, 31 Jan 1998 18:28:51 +0000
From: David Richards <dave@turfpit.demon.co.uk>
Subject: Re: Sending mail from NT4.0
Message-Id: <34D36D63.436D9199@turfpit.demon.co.uk>

Try BLAT - a command line mailer for NT.

Lars Lyshaug wrote:

> All,
>
> I've never done any programming in Perl, but a collegue made me believe
> that it would cover my needs anyway.
>
> I have a NT 4.0 domain controller. Here, I run misc. (CMD)scripts for
> logging disk use, etc, etc..
> I need to find a way to 'pipe' the content of my logfiles automatically
> to a pre-defined mail recipient.
> Perl5 is installed on the server. IIS is NOT installed on the server,
> nor is Microsoft Outlook. Office95 is, though.
>
> Maybe Perl isn't what I'm looking for, but it's worth a try. I would
> like to learn enough about it to make small scripts that the MS Command
> Shell isn't able to do for me. Thanks.
>
> Best regards, Lars.





------------------------------

Date: Sat, 31 Jan 1998 16:29:31 -0500
From: "Shane Newberg" <administrator@actioninternet.net>
Subject: Re: Sending mail from NT4.0
Message-Id: <34d3980a.0@209.4.95.130>


Lars Lyshaug wrote in message
<34D19C37.34D497ED@oslo.geco-prakla.slb.com>...
>All,
>
>I've never done any programming in Perl, but a collegue made me believe
>that it would cover my needs anyway.
>
>I have a NT 4.0 domain controller. Here, I run misc. (CMD)scripts for
>logging disk use, etc, etc..
>I need to find a way to 'pipe' the content of my logfiles automatically
>to a pre-defined mail recipient.
>Perl5 is installed on the server. IIS is NOT installed on the server,
>nor is Microsoft Outlook. Office95 is, though.
>
>Maybe Perl isn't what I'm looking for, but it's worth a try. I would
>like to learn enough about it to make small scripts that the MS Command
>Shell isn't able to do for me. Thanks.
>
>Best regards, Lars.
>



Well, I know that you need the smtp.pl script to send the mail on a NT
system. I found it in raw form on www.seattlelab.com and found it under
SLmail 2.6 options and Utilities.

Then we modified the script to send contents of a web form, you need to
modify the script to read and add the contents of your log files. You would
then have to set up a scheduler to run the script as often as you like.


Good luck .





------------------------------

Date: Sat, 31 Jan 1998 13:30:42 -0600
From: Rich Grise <lovegod@earthling.net>
Subject: Re: Survival Of perl
Message-Id: <34D37BE2.77B4@earthling.net>

Chris Nandor wrote:
> 
[snip]
> If someone is using perl only for the web, then he either has no use for
> programming in general or, again, he is not keen enough to do anything
> else.  In either case, I would hardly call this the cutting edge.
> 
[more snip]
Well, as a relative newcomer to the world of perl, I'm glad I have
enough
experience in other programming-related stuff to not take personal
offense
at this remark. Yes, I'm a little off-topic here, and I'm really holding
my desire to flame in restraints here, but I've never had the benefit of
working for an organization that presented me with a Unix system on
which
to learn programming. And as an "end-user", the only computer I could
find
with web (or "net") access for less than $20,000.00 came with w95. I
don't
like it; I cut my teeth on C in PCDos. (actually, my first language was
Intercom 500 on the Bendix G-15 that they had in my high school.) I have
use for programming, except the platform that's available to me is the
Cyrix 6x86 with w95, and VB. (I'm not a high-buck consultant who can
afford
to plunk down another $500.00 for VC++, which I'd have to plunk down
another
grand or two for school to learn how to use all that object crap.)
But I do have uses for programming. I write utilities for my own use and
development work primarily in VB, since, as I've said, that's the
platform
I have. To make my web page do interesting stuff, however, perl is the
tool
that's available, and I've discovered it's a great language! And I can't
very well expect my web page host to install VB runtime just for me, can
I?
I can run a DOS prompt as a task, and do stuff in perl if I need to, but
I also have close to 10 years' experience with DOS C for those kind of
command-line driven utilities, if I ever need them.

But "no use for programming"? Or, particularly egregious, "not keen
enough 
to do anything else?"

I don't think so, Chris.

Rich Grise
rmgrise@spacestar.net
http://thunder.prohosting.com/~rmgrise



------------------------------

Date: 31 Jan 1998 20:56:09 GMT
From: scott@softbase.com
Subject: Re: Survival Of perl
Message-Id: <6b0359$11v$3@mainsrv.main.nc.us>

Frank (FHeasley@chemistry.com) wrote:
> Perl's new users tend to be web oriented, and the web is huge. ...
> Depending on how you look at it, the web is either a problem, or an
> opportunity for perl.  I see it as an opportunity, for the time being.
> Later on, it could become a problem. 

I don't see how. As long as UNIX and NT exist, and system
administrators exist, there will be Perl. There is always going to be a
maintenance base of serious Perl users on both UNIX and Win32
platforms. The potential for Perl on Win32 is just barely beginning as
people realize what you can do with Automation. And I can't imagine
running a UNIX box without Perl scripts. Sure, there's a lot of web
programmers using Perl. But look at it this way: Perl adapted itself to
the Web, right? -- so how could you stop it from adapting to the *NEXT*
big splashy thing that comes along? Perl is already being adapted to
run on the Java virtual machine.

> Many here may find it surprising that most new internet users consider
> the web to be the WHOLE internet.  This belief is fostered by
> Microsoft, which calls its IE icon "The Internet".

Ironically, IE also supports FTP, gopher, etc. It is hardly limited to
"the Web", i.e. HTTP transactions. It also has optional IRC, e-mail, and
news support should you choose to install it. So they're right, it is
"the" Internet presented from one central control panel. I don't
understand how, from this, you draw the conclusion that this is
saying the Internet = the Web.

Scott
--
Look at Softbase Systems' client/server tools, www.softbase.com
Check out the Essential 97 package for Windows 95 www.skwc.com/essent
All my other cool web pages are available from that site too!
My demo tape, artwork, poetry, The Windows 95 Book FAQ, and more. 


------------------------------

Date: Sat, 31 Jan 1998 16:21:02 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Survival Of perl
Message-Id: <fl_aggie-3101981621030001@aggie.coaps.fsu.edu>

In article <34D37BE2.77B4@earthling.net>, lovegod@earthling.net wrote:

+ my desire to flame in restraints here, but I've never had the benefit of
+ working for an organization that presented me with a Unix system on
+ which
+ to learn programming. And as an "end-user", the only computer I could
+ find
+ with web (or "net") access for less than $20,000.00 came with w95.

Two things:

1. You can get a low-end SGI O2 for under $10k.
2. Ever hear of linux? No one is forcing you to run Win95...

Followups...

James

-- 
Consulting Minister for Consultants, DNRC
The Bill of Rights is paid in Responsibilities - Jean McGuire
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/perl/faq/idiots-guide.html>


------------------------------

Date: 31 Jan 1998 12:55:39 -0800
From: rjray@localhost.localdomain (Randy J. Ray)
Subject: Re: Where Is sub Autoloader?
Message-Id: <m3n2gc9xdg.fsf@localhost.localdomain>

>>>>> "Robert" == Robert Sample <robert_sampleNOSPAM@mediaone.net>
>>>>> wrote the following on Sat, 31 Jan 1998 10:10:49 -0500

  Robert> Hi Folks, I have written a script which uses Registry.pm.
  Robert> In the subroutine AUTOLOAD, there is a call to the
  Robert> subroutine Autoloader, goto &Autoloader::AUTOLOAD.  When I
  Robert> execute the script, I receive the following error: Goto
  Robert> undefined subroutine &AutoLoader::AUTOLOAD at
  Robert> D:\Perl5\Lib/Win32/Registry.pm line 84.

Registry.pm should have a line akin to "use AutoLoader;" somewhere towards
the top. The routine &AutoLoader::AUTOLOAD is just a direct call to the
AUTOLOAD defined in the AutoLoader package, to avoid being intercepted by
inheritance. If Registry.pm does not have the AutoLoader line, then it is
probably corrupted on your system, because I know a great number of people are
using Registry successfully.

Randy
-- 
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Randy J. Ray                                                    rjray@tsoft.com
Campbell, CA                                                      randy@byz.org
Web page coming soon


------------------------------

Date: 31 Jan 1998 20:57:47 GMT
From: scott@softbase.com
Subject: Re: Word -> HTML
Message-Id: <6b038b$11v$4@mainsrv.main.nc.us>

Patrick Husi (patrick@husi.ch) wrote:

> I'm looking for a converter from Word format (i.e. .doc files) to HTML,
> preferably for Perl or Java.  Anyone ??

I almost hate to say this, but ...

IT IS BUILT INTO WORD! All you do is File/Save As HTML!

(I guess it's so obvious he overlooked it.)

You can do this from a Perl program using Automation. Open the
file, and SaveAs it.

Scott
--
Look at Softbase Systems' client/server tools, www.softbase.com
Check out the Essential 97 package for Windows 95 www.skwc.com/essent
All my other cool web pages are available from that site too!
My demo tape, artwork, poetry, The Windows 95 Book FAQ, and more. 


------------------------------

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 1778
**************************************

home help back first fref pref prev next nref lref last post