[8621] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2238 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Apr 2 23:07:23 1998

Date: Thu, 2 Apr 98 20:00:29 -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, 2 Apr 1998     Volume: 8 Number: 2238

Today's topics:
    Re: (Off-topic) Furlongs, fortnights, acres, chains, et (Martin Vorlaender)
    Re: Clarification wanted on FileHandle syntax (Jason Gloudon)
    Re: Delete file on server! (Martien Verbruggen)
    Re: Diddling with search engines via CGI (Peter Caffin)
    Re: HELP !!! - Templates within Perl <rpsavage@ozemail.com.au>
    Re: How do I strip newlines from a var (Martien Verbruggen)
    Re: how to count a list of comma sep. items <merlyn@stonehenge.com>
    Re: integer or string ? <rjk@coos.dartmouth.edu>
    Re: Is there a "Newsgroup" for Newbies to Perl? (Jim Michael)
    Re: Is there a "Newsgroup" for Newbies to Perl? (Chris Russo)
    Re: Is there a "Newsgroup" for Newbies to Perl? <ljz@asfast.com>
    Re: Is there a "Newsgroup" for Newbies to Perl? (Jeffrey Drumm)
    Re: Looking for ANY Suggestions on parsing this line!! (Martien Verbruggen)
    Re: Multidimensional Arrays (Martien Verbruggen)
    Re: Multidimensional hashes (Martien Verbruggen)
    Re: Munging addresses (was: Re: Perl Cgi Questions) <rjk@coos.dartmouth.edu>
    Re: Munging addresses (was: Re: Perl Cgi Questions) (Peter Caffin)
        PID numbers with forground and background nums not matc (Michael Shavel)
    Re: printing in windows (Jeffrey Drumm)
    Re: problem calling programs with ` (Martien Verbruggen)
    Re: Problems trying to embed perl in a Win32 programme (Cory C. Albrecht)
    Re: processing big file (Martien Verbruggen)
        RMS should be invited to O'Reilly's "Free Software Summ <atai@tyrell.ucsd.edu>
    Re: RMS should be invited to O'Reilly's "Free Software  <bashford@gage.scripps.edu>
    Re: RMS should be invited to O'Reilly's "Free Software  <pinard@iro.umontreal.ca>
        Unitialized values (was Re: use strict and GD) <rjk@coos.dartmouth.edu>
    Re: unpack vs. substr (was Re: Data Structure for Input <rjk@coos.dartmouth.edu>
    Re: unpack vs. substr and SWIG/XS help (Jason Gloudon)
        using &say("something"); <mhanson@arrowweb.com>
    Re: using &say("something"); <sowmaster@juicepigs.com>
        Weird Effects w/ "require" <bradenb@ibm.net>
    Re: Why does $# cause loss of newline? (Jason Gloudon)
    Re: Why does $# cause loss of newline? (David A. Black)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Thu, 02 Apr 1998 18:52:56 +0200
From: martin@RADIOGAGA.HARZ.DE (Martin Vorlaender)
Subject: Re: (Off-topic) Furlongs, fortnights, acres, chains, etc.
Message-Id: <3523c268.524144494f47414741@radiogaga.harz.de>

>Daniel P. B. Smith wrote:
>> It was recently pointed out to me that "one furlong per fortnight"
>> is almost exactly 1 centimeter per minute.  How's that for useful?

In the depths of OpenVMS there is a system parameter whose unit is given
as "microfortnights" - about 1.2 seconds.

cu,
  Martin
--
                          | Martin Vorlaender | VMS & WNT programmer
 Ceterum censeo           | work: mv@pdv-systeme.de
 Redmondem delendam esse. |       http://www.pdv-systeme.de/users/martinv/
                          | home: martin@radiogaga.harz.de


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

Date: Fri, 03 Apr 1998 03:42:24 GMT
From: jgloudon@hyssop.bbn.com.bbn.com (Jason Gloudon)
Subject: Re: Clarification wanted on FileHandle syntax
Message-Id: <slrn6i8mmn.5t.jgloudon@hyssop.bbn.com>

Nevin Kapur <kapur@cbl.ncsu.edu> wrote:
 .
>aries[~]$ perl -we '
>>          use FileHandle;
>>  
>>          $fh = new FileHandle;
>>          if ($fh->open "< file") {
>>              print <$fh>;
>>              $fh->close;
>>          }
 .
 .
>Enclosing "< file" in parens gets rid of these errors. Am I missing
>something obvious?
>-Nevin

According to the docs with my 5.004_04 version of perl, if you make a 
method call that takes arguments you must include the arguments in parentheses.
The FileHandle example is not correct.

--
Jason Gloudon


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

Date: 3 Apr 1998 02:38:34 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Delete file on server!
Message-Id: <6g1i3a$7oe$2@comdyn.comdyn.com.au>

In article <35242fec.348008704@darius>,
	anthony@SPAMISBADpce.net (Anthony) writes:

> try system("rm filename");

Hmm.. What if the machine running this is not a machine that
understand the rm command? Say... some NT box?

Instead of using (shiver) system calls like that, have a look at the
perl builtin function with the name unlink.

perldoc -f unlink.

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | If it isn't broken, it doesn't have
Commercial Dynamics Pty. Ltd.       | enough features yet.
NSW, Australia                      | 


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

Date: Thu, 02 Apr 1998 01:29:39 GMT
From: UCE-trap_synic@omen.net.au (Peter Caffin)
Subject: Re: Diddling with search engines via CGI
Message-Id: <3523e926.5708581@news.omen.net.au>

klassa@aursgh.aur.alcatel.com (John Klassa) did cunningly address to
comp.lang.perl.misc..
:So Tom (Phoenix, in this case :-)) should spend extra time answering the
:same questions over and over again.  How many times does somebody have to
:say "go to comp.infosystems.www.authoring.*", for example?

If you can't answer a question properly, don't bloody do so.

Duh.

:To say that
:the question has nothing to do with perl is correct and to the point, and
:doesn't waste a lot of time.

It also doesn't inform much either. And it makes this newsgroup a much less
enjoyable place to hang out in, answering questions that I can answer.


--:     _         ___  _    _ _ 
 _oo__ |_|_ |__  _ |  |  _ |_|_' _   synic at omen dot net dot a u
//`'\_ | (/_|(/_| .|. |_(_|| | || |  http://www.omen.net.au/~synic
/              PO Box 869, Hillarys WA 6923, AUSTRALIA


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

Date: Fri, 03 Apr 1998 10:55:42 +1000
From: Ron Savage <rpsavage@ozemail.com.au>
Subject: Re: HELP !!! - Templates within Perl
Message-Id: <3524338E.7B86@ozemail.com.au>

[snip]
 
> Have a look at Text::MetaText.  This should do what you want.

[snip]

You really should try Text::MetaText.
See my web site below for a set of pages generated using this package.

-- 
Cheers,
Ron Savage
Office: savage.ron.rs@bhp.com.au
Home (preferred): rpsavage@ozemail.com.au
Web: http://www.ozemail.com.au/~rpsavage


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

Date: 3 Apr 1998 03:27:01 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: How do I strip newlines from a var
Message-Id: <6g1ku5$7u7$2@comdyn.comdyn.com.au>

In article <6g11rf$pmf$1@newsin-1.starnet.net>,
	bsapot@office1.gundaker.com (Bryan Sapot) writes:
> how can i strip new lines out at var.

"strip new lines out at var" meaning "remove all newlines from a variable's
content"?

$var =~ s/\n//g;

> SCO Openserver 5.0 (sorry)

What does that have to do with it?

> please email response to bsapot@gundaker.com

post here, read here. Better would have been to read the documentation.

-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | 
Commercial Dynamics Pty. Ltd.       | What's another word for Thesaurus?
NSW, Australia                      | 


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

Date: 02 Apr 1998 19:59:22 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: gbacon@cs.uah.edu
Subject: Re: how to count a list of comma sep. items
Message-Id: <8cg1jv7gqd.fsf@gadget.cscaper.com>

>>>>> "Greg" == Greg Bacon <gbacon@cs.uah.edu> writes:

Greg> An array in scalar context yields the number of elements
Greg> in the array.  A list in scalar context yields the number of elements
Greg> in the list, so....

No it doesn't.  There's no such things as a "list in a scalar context".

Greg>     $_ = 'item, item1, item2, item3, item4';
Greg>     my @item = split /\s*,\s*/;
Greg>     my $count = @item;

This is an arrayname in a scalar context.  So, we get the number of
elements in @item.

Greg> If you want to count the number of items in a hash, use one of

Greg>     $count = scalar keys %hash;
Greg>     $count = scalar values %hash;

Greg> since both keys and values return lists of a hash's keys and a hash's
Greg> values, respectively.

These two work only because the two operators are special-cased to
return number of items in a scalar context.  They could have instead
invoked nethack.  At *no time* is there a *list* of the keys or
values in memory.  They merely count.

There are *more* operators that do not return a count than do.  Please
stop saying that the count is the rule... it's more like the
exception.

print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 151 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: Thu, 02 Apr 1998 22:08:16 -0500
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
Subject: Re: integer or string ?
Message-Id: <352452A2.A87030FA@coos.dartmouth.edu>

Jason Gloudon wrote:
> 
> >$string =~ /(\d+)\s+(\d+)/;  works just fine
> >($a, $b) = (0 + $1, 0 + $2);
> 
> Why not recomend split :
> 
> ($a,$b) = split $string;

Woops.  That will split $_ using the value of $string as the regex.  I think
you meant

($a,$b) = split " ", $string;

(I've made that same mistake in actual code.  It just seems right that one
argument to split should be the target string rather than the regex.)

-- 
 _ / '  _      /         - aka -             rjk@coos.dartmouth.edu
( /)//)//)(//)/(    Ronald J. Kimball           chipmunk@m-net.arbornet.org
    /                                   http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Fri, 3 Apr 1998 02:48:53 GMT
From: genepool@netcom.com (Jim Michael)
Subject: Re: Is there a "Newsgroup" for Newbies to Perl?
Message-Id: <genepoolEqtH5H.150@netcom.com>

Chris Vogel (C.VOGEL@LINK-GOE.de) wrote:
:   genepool (Jim Michael) wrote in genepoolEqpsKs.H8D@netcom.com on
:   02.04.98 following lines, starting with '*'

: * virtual professors

: I do not think that a learn group needs a professor. A moderator from

Did you really miss the point? In a university setting you are expected 
to do your own research. If you come to your prof with a question it 
should be to clarify a point you don't understand, not to be spoonfed
answers. Your virtual professors are right here (those who are still 
around), do your research, ask poignant questions, but don't expect to be 
spoonfed answers. 

Cheers,

Jim
--
Where IS that 2nd RFD?


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

Date: Thu, 02 Apr 1998 19:11:42 -0800
From: news@russo.org (Chris Russo)
Subject: Re: Is there a "Newsgroup" for Newbies to Perl?
Message-Id: <news-0204981911430001@buzz.alink.net>

In article <6g0ivc$daq@co-op.newsguy.com>, smitty77@pacbell.net wrote:

>In article <news-0204980900530001@buzz.alink.net>, news@russo.org says...

>>You're a very small man, basking in the limelight of your attempt to "take
>>down" a celebrity.
>
>A celebrity?  You don't get out much, do you Chris.  In what way am I
>attempting to take down Randal Schwartz?  Is the guy perfect?  Have
>you ever met him?   If you have something interesting to say, then say
>it, Chris.  Don't be so closed minded that you can't in your wildest
>dreams fathom that your hero might not be perfect.  It's a brutal
>world out there, Chris.  Check it out sometime.

Haven't you done enough trolling for one week, sonny?

Keep trying, though.  It reveals loads about you.

Regards,

Chris Russo

-- 
Chris Russo                          A-Link Network Services, Inc.
news@russo.org                       Bolo me
http://www.alink.net/~crusso


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

Date: 02 Apr 1998 22:19:28 -0500
From: Lloyd Zusman <ljz@asfast.com>
Subject: Re: Is there a "Newsgroup" for Newbies to Perl?
Message-Id: <luyaxn383j.fsf@asfast.com>

genepool@netcom.com (Jim Michael) writes:

> Chris Vogel (C.VOGEL@LINK-GOE.de) wrote:
> :   genepool (Jim Michael) wrote in genepoolEqpsKs.H8D@netcom.com on
> :   02.04.98 following lines, starting with '*'
> 
> : * virtual professors
> 
> : I do not think that a learn group needs a professor. A moderator from
> 
> Did you really miss the point? In a university setting you are expected 
> to do your own research. If you come to your prof with a question it 
> should be to clarify a point you don't understand, not to be spoonfed
> answers. Your virtual professors are right here (those who are still 
> around), do your research, ask poignant questions, but don't expect to be 
> spoonfed answers. 

So perhaps we should rename comp.lang.perl.misc to something like
comp.lang.perl.we-are-pretending-to-be-a-university, and then create a
comp.lang.perl.novices newsgroup for those who prefer a different
approach.


-- 
 Lloyd Zusman
 ljz@asfast.com


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

Date: Fri, 03 Apr 1998 03:48:54 GMT
From: drummj@mail.mmc.org (Jeffrey Drumm)
Subject: Re: Is there a "Newsgroup" for Newbies to Perl?
Message-Id: <352426cb.77422537@news.mmc.org>

On 2 Apr 1998 08:37:16 -0800, smitty77@pacbell.net wrote:

(deletia)

>Believe it or not, James, there are some non-pompous people out there who are
>more than willing to help out novices and others who are just looking for a
>quick bit of help without having to pour through the immense FAQ which may or
>may not answer the question thoroughly. I know you wouldn't put yourself into
>that category, and believe me, the novices would welcome your absense from the
>group nearly as much as you would welcome their absense from this group.  People
>who are knowledgable in perl will go to this other newsgroup to both help and
>ask questions.  What are you afraid of?  That you'll get bored without all these
>people to pick on?

Sigh.

I'm one of those folks that falls somewhere in the middle (probably still
on the low side) of the 'Perl Perfection' scale. I've got a good handle on
the basics, can form  a regex that can do some decent damage, know a bit
about references, hashes, OOP, control structures, and contexts. I can get
pretty much everything I want done in both the Win32 and Unix world.

Sad to say, a lot of my Perl code still comes out looking like BASIC . . .

One thing I've learned in my journey towards Perl enlightenment is that I
DON'T get the quickest answer by posting to Usenet. Books have indexes,
FAQs are _searchable_, the on-line documentation _usually_ has an
understandable answer, and is often available in every document format
useful to me. This is true of Perl more than just about anything else you
get for free.

If I need to post a question to Usenet, it's because I spent the 15 minutes
or so it takes to grep the FAQs/search the HTML docs, check DejaNews,  and
look in my Camel/Hip Owls/Panther/EPP/Desktop Reference (not necessarily in
that order).

I take that 15 minutes, then spend another minute (or an hour, or a day!)
trying to figure out a solution for myself. Posting to Usenet is a LAST
RESORT. 

Why?

Partly because I prefer to solve my own problems and am more likely to
remember the solution for future efforts, but more importantly, because I
respect the knowledge base present in this group, and know that posting a
question that's been answered before will only serve to reduce the
information content here (not that this posting particularly helps :-)). 

To me, posting as a _first_ resort is asking for something without EARNING
it.

But enough about me . . . ;-)

To the point: I've been following this group daily for a bit over a year
now . . . and from what I've seen, I doubt your solution will make a
lasting impression on the problem.

The newbies may flock to the group, and some intermediate folks may hang
out there for a while. The newbies may get the answers they're too, um,
(unskilled? impatient? presumptive? Dare I say it: lazy?) to look up, and
the intermediate folks will get a little lift from helping their fellow
pilgrims . . . but they'll quickly get tired of answering the same
questions over and over and over again. They'll stop learning from their
experiences there. And finally, they'll get frustrated and start (rudely or
politely, it doesn't seem to matter since it pisses off the newbies either
way) referring those newbies to whatever serves for a FAQ for the
c.l.p.help group.  Or they'll leave.

And the newbies . . . well, with c.l.p.help becoming devoid of useful
content, I suspect they'll be back here.  But maybe 'here' will be a
different place by then, because all the gurus will have fled to the
moderated group currently under discussion. I'll follow them, because I
want to learn. The newbies won't, because moderation won't let them.

Being a newbie will REALLY suck then . . . since a terse referral to the
FAQs is better than a wrong answer, or no answer at all.

(more deletia)

>Wizards?  James, you are an arrogant little guy.  What could be the harm of
>having this other newsgroup?  You will be rid of us wizard-wannabes and we will
>be rid of you pompous asses.  It's a win-win.

I didn't see James refer to himself as a wizard.

Just curious, but how long have you been following this group? I'm
wondering how you developed such a low opinion of James. He's a profligate
poster of useful information, and hardly of the rude or pompous variety. 

>
>Dave
>
-- 
                           Jeffrey R. Drumm, Systems Integration Specialist
                                  Maine Medical Center Information Services
                                     420 Cumberland Ave, Portland, ME 04101
                                                        drummj@mail.mmc.org
"Broken? Hell no! Uniquely implemented." -me


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

Date: 3 Apr 1998 03:18:50 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Looking for ANY Suggestions on parsing this line!!
Message-Id: <6g1keq$7u7$1@comdyn.comdyn.com.au>

In article <6g0u85$jbe$1@nnrp1.dejanews.com>,
    randy.paries@avex.com writes:

> the problem is that the program that does the export(that I do not have
> control over) does not put quotes around word 2 and word 8. Even though it is
> suppose to be a csv, they put comma's in the values if over 1000. ARG!@!

That is a serious bug. Contact the author of that program and yell at
him/her.

> does anyone have any ideas of how to parse this line into words. The values of
> course will be of the same type but different values.
> 
> "MGORDON",$1,860.65,"STAR","$539.35","$1,139.35","$1,739.35",0,$1,860.65
> "LE GRAVES",$1,822.43,"STAR","$577.57","$1,177.57","$1,777.57",0,$822.43

Maybe a regex of the following form (adapt to your liking and/or
needs):

#!/usr/local/bin/perl5 -w
use strict;
while (<DATA>)
{
    my @ar = m{
        ^
        "(.+)",         # Assume some characters in quotes
        (\$[0-9,.]+),   # some dollar thingie
        "(.+)",         # Assume some characters in quotes
        "(\$[0-9,.]+)", # some quoted dollar thingie
        "(\$[0-9,.]+)", # some quoted dollar thingie
        "(\$[0-9,.]+)", # some quoted dollar thingie
        (\d),           # a digit (can this be anything more?)
        (\$[0-9,.]+)    # closing dollar thingie
        $
    }x;

    print join( ' - ', @ar ), "\n";

}

__DATA__
"MGORDON",$1,860.65,"STAR","$539.35","$1,139.35","$1,739.35",0,$1,860.65
"LE GRAVES",$1,822.43,"STAR","$577.57","$1,177.57","$1,777.57",0,$822.43


After this, write it out as a correct CSV, and proceed.

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | Very funny Scotty, now beam down my
Commercial Dynamics Pty. Ltd.       | clothes.
NSW, Australia                      | 


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

Date: 3 Apr 1998 01:47:53 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Multidimensional Arrays
Message-Id: <6g1f49$7e4$1@comdyn.comdyn.com.au>

In article <3523BE38.600B@cisco.com>,
	Konstantin Kalaitzidis <kkalaitz@cisco.com> writes:
> How can I create a multidimensional array?

perldoc perllol
perldoc perldsc
perldoc perlref

>      2  $multidim = [['1.1', '1.2', '1.3] , ['2.1', '2.2','2.3']];

You're missing a quote.

Martien


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

Date: 3 Apr 1998 02:04:06 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Multidimensional hashes
Message-Id: <6g1g2m$7e4$3@comdyn.comdyn.com.au>

In article <3523D4A8.1E2CAF7C@dataplusnet.com>,
	webmaster@dataplusnet.com writes:
> I'm using perl5.002 and need to know how to handle a multidimensional
> associative array.
> I'm using:
> $hash{$foo}{$bar} = $answer;

Nothing obviously wrong with this. What's in $foo? What's in $bar?
What is %hash before you use it this way?

> and the error occurs:
> syntax error in file ./stats.cgi at line 253, next 2 tokens "}{"
> Can anyone tell me what I'm doing wrong?

You're using perl 5.002 instead of the most recent version. You might
also want to read the documentation that comes with perl 5.004

perldoc perldsc
perldoc perllol

Martien


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

Date: Thu, 02 Apr 1998 21:58:11 -0500
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
Subject: Re: Munging addresses (was: Re: Perl Cgi Questions)
Message-Id: <35245044.E0B50F99@coos.dartmouth.edu>

Peter Caffin wrote:
> 
> [More pointless discussion about munging addresses]
> 
> This is a boring topic, IMHO.

And yet people keep bickering about it.  I think it's time a few people opened
their eyes and faced the facts:

1.  Some people think munging addresses is worthwhile and should be allowed.

2.  Some people think munging addresses is not worthwhile and should not be allowed.

3.  Both groups of people are stubborn as mules, and neither is going to
convince the other to change their minds.

4.  Even if someone is convinced to change their position, it's not going to
make a bit of difference.  1 and 2 will still be true.

5.  This topic always has been and always will be off-topic for
comp.lang.perl.misc.  The FAQs are irritating, but at least they're about
Perl; this ongoing debate is more obnoxious by far.  All you little children
who keep fighting over whether munging addresses is good or bad should grow up
and deal with the difference of opinion.

-- 
 _ / '  _      /         - aka -             rjk@coos.dartmouth.edu
( /)//)//)(//)/(    Ronald J. Kimball           chipmunk@m-net.arbornet.org
    /                                   http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Thu, 02 Apr 1998 01:21:45 GMT
From: UCE-trap_synic@omen.net.au (Peter Caffin)
Subject: Re: Munging addresses (was: Re: Perl Cgi Questions)
Message-Id: <3522e74c.5234393@news.omen.net.au>

gbacon@cs.uah.edu (Greg Bacon) did cunningly address to comp.lang.perl.misc..
[snippage of Greg Bacon's off-topic banter that's not even getting close to
the on-topic discussion of Perl NNTP spiders]

[re: email address munging]
:: This is a boring topic, IMHO.
:
:Well, everyone, let's make room for the weary sophisticate.

No, everyone make room for the topic of this newsgroup: Perl. I've wasted
enough offtopic space here discussing nospams. You have too. Take it elsewhere
now. You'll always have Dejanews to find my opinions on this topic.

--:     _         ___  _    _ _ 
 _oo__ |_|_ |__  _ |  |  _ |_|_' _   synic at omen dot net dot a u
//`'\_ | (/_|(/_| .|. |_(_|| | || |  http://www.omen.net.au/~synic
/              PO Box 869, Hillarys WA 6923, AUSTRALIA


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

Date: Thu, 02 Apr 1998 22:05:00 -0500
From: mshavel@erols.com (Michael Shavel)
Subject: PID numbers with forground and background nums not matching
Message-Id: <mshavel-0204982205000001@130.9.16.207>

Hi

 I am using perl to call some SQR statments  from within a perl/tk
interface. I want to call the statments in the background so the GUI will
not lock up while these reports are running. 

While making these sqr calls in the background I also need to retrieve the
PID number of that processes that is spawned from my call. 
The code I am using is as follows, and does what I want it to do. 

_________
#!/usr/bin/perl

$pid =0;


$c="sqr test.sqt report/report -RT /trsdmp.lis 03/03/1998";

#call in background
$pid =open RUN, "| $c . &" ;

#add one to pid because it is always one off when called in background
$pid = $pid + 1;

print "PID num id $pid \n";
close(RUN);

______

The question I have is related to the PID number of that process I am running. 
When I run the sql statment in the foreground, the PID number the perl
script is giving me is the same PID number I get from using ps -ef |grep
report

However, if I run the sqr statment in the background (as I do in the code
above) I get a PID number that is one (1) off. 
Example:  perl tells me the PID number is 27312 but ps -ef tells me the
pid number is 27313. 

Does this make sense. Does the background process "&" get its own PID
first and then a PID is assigned to the  sqr ?

Thanks

Mike Shavel
mshavel@erols.com


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

Date: Fri, 03 Apr 1998 03:48:56 GMT
From: drummj@mail.mmc.org (Jeffrey Drumm)
Subject: Re: printing in windows
Message-Id: <352544c6.85098855@news.mmc.org>

On Thu, 02 Apr 1998 18:42:09 +0100, Fergal Daly <fergal@clubi.ie> wrote:

>Is it possible to do proper printing in windows using perl? If not, is
>it possible to talk directly to the printer and send epson codes
>(assumig it understands them)? Thanks,
>
>Fergal
>
>P.S. I'd appreciate if you could cc answers to fergal@clubi.ie as I
>don't get a chance to read news that often.

I've done it in NT, but only by creating a share for the printer and
opening the share name for output. If there's a device you can print to
directly, I haven't found it yet (but since I spend most of my time in the
land of Unix I admit I haven't looked very hard). I do know that LPT1:
didn't work on my system.

open PRN,'>//computer/share_name';
print PRN $stuff_to_print;
 .
 .
 .
close PRN;

-- 
                           Jeffrey R. Drumm, Systems Integration Specialist
                                  Maine Medical Center Information Services
                                     420 Cumberland Ave, Portland, ME 04101
                                                        drummj@mail.mmc.org
"Broken? Hell no! Uniquely implemented." -me


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

Date: 3 Apr 1998 02:35:49 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: problem calling programs with `
Message-Id: <6g1hu5$7oe$1@comdyn.comdyn.com.au>

In article <6g1aum$9l5$1@prometheus.acsu.buffalo.edu>,
	kdr@cs.buffalo.edu (Kevin D Ruggiero) writes:

> This works fine, except for one problem.  When using ` to call programs,
> it waits for them to complete.  Is there any way to call a program and not
> wait for it to finish? 

perldoc -f fork
perldoc -f exec
perldoc perlipc

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | That's not a lie, it's a terminological
Commercial Dynamics Pty. Ltd.       | inexactitude.
NSW, Australia                      | 


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

Date: Fri, 03 Apr 1998 03:11:32 GMT
From: coryalbrecht@hotmail.com (Cory C. Albrecht)
Subject: Re: Problems trying to embed perl in a Win32 programme
Message-Id: <6g1k14$13o_002@news.sentex.ca>
Keywords: perl5 embed win32 windows95 perl5.004_2

In article <6fuhrr$3d0_002@news.sentex.ca>, coryalbrecht@hotmail.com (Cory =
C. Albrecht) wrote:
>My question is this - can I just comment out the appropriate #include for =
one
>of either direct.h or dirent.h, so that only one gets processed? Or is stu=
ff
>from both files necessary, such that I am going to have to muck about dire=
nt.h
>(and perhaps other *.h files in C:\Perl\lib\CORE) so that the conflict is =
not
>there? My guess right now is to look through all the *.h files and change =
any
>reference from DIR to struct _dir_struct. The lack of that typedef is not
>going to affect anything that I haven't thought of, eh?

Well, I guess I was able to answer my own question. I changed the DIR in al=
l=20
the C:\Perl\lib\CORE\*.h files to __DIR, and I was able to successfully emb=
ed=20
an interpreter. Everything seems to work fine, but again, I might be missin=
g=20
something that is dependent on that little "typedef struct _dir_struct {...=
}=20
DIR;" rather than a "typedef struct _dir_struct {...} __DIR;". Does any bod=
y=20
know if I am missing anything?

Thanks in advance.

--
Cory C. Albrecht
http://www.sentex.ca/~cory/
PGP Key Fingerprint: FA8C A548 5261 D415  C20C 424C 703F 32F2
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/CM d+(-) s+: a- C++($) UB+>++++ P++(+++) L(+) E--- W++(+) N++ o K? w(++=
)  V--
    !M PS+ PE- Y+ PGP+ t+ 5+ X R- tv+ b++ DI(+) D G(+) e>++ h! y?=20
------END GEEK CODE BLOCK------


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

Date: 3 Apr 1998 01:51:53 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: processing big file
Message-Id: <6g1fbp$7e4$2@comdyn.comdyn.com.au>

In article <35242A83.C371B545@singnet.com.sg>,
	sekchye <sekchye@singnet.com.sg> writes:
> I have a perl script to process a system log file.  This log file can be
> quite huge, say 5-10 MB.  I am using the perl open() function to read in

That isn't exactly huge. It isn't even large :)

> the file for processing and I am running into some problem.  The program
> complains out of memory and did not process the log file correctly.  My
> question is:
> 1.  Is there a limit in the size of the file open() can read in line by
> line?

I routinely open and process files of a GB and larger, without any
problem. It is very likely not a problem with the open() call.

> 2.  For huge file (5-10 MB), are there more other efficient functions I
> can use to read in line by line?

nope. You will have to open the file at some stage, and that's what
open is for.

Maybe you could show us the code you used, so that we have an idea of
what you are trying to do. That way we might be able to point out what
might be going wrong.

Martien


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

Date: 02 Apr 1998 17:50:03 -0800
From: Andy Tai <atai@tyrell.ucsd.edu>
Subject: RMS should be invited to O'Reilly's "Free Software Summit"
Message-Id: <ed7m57d67o.fsf@tyrell.ucsd.edu>


Mr. Tim O'Reilly will host a "Freeware Summit" according to the press
release at

http://www.oreilly.com/oreilly/press/freeware.html

Most major free software personalities will be there, but noteably
absent from the list is Richard Stallman, the most senior statesman of
Free Software.  I think the GNU Project is the oldest and the most
influential free software project, and how can it be omitted from this
significant event?  By ignoring RMS are we trying to show the message
that we can forget the hard work of RMS and GNU in the past twenty
years, now that Free Software is entering the mainstream?

I think we should write to Mr. O'Reilly (tim@oreilly.com) asking him
to reconsider.  While now is time to celebrate about the Netscape
event, the old contributors should be even more respected and
recognized.  This is the rightful thing to do for the Free Software
Community.

-- 
Li-Cheng Tai (Andy Tai) e-mail: atai@ece.ucsd.edu 

Free software: the software by the people, of the people and for the
people, worldwide.  Develop! Share! Enhance! And enjoy!

http://vision.ucsd.edu/~atai/softwarewar.gif



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

Date: 02 Apr 1998 17:41:05 -0800
From: Don Bashford <bashford@gage.scripps.edu>
Subject: Re: RMS should be invited to O'Reilly's "Free Software Summit"
Message-Id: <roogyjn0lq.fsf@gage.scripps.edu>

Andy Tai <atai@tyrell.ucsd.edu> writes:

> Mr. Tim O'Reilly will host a "Freeware Summit" according to the press
> release at
> 
> http://www.oreilly.com/oreilly/press/freeware.html
> 
> Most major free software personalities will be there, but noteably
> absent from the list is Richard Stallman....
> 
> I think we should write to Mr. O'Reilly (tim@oreilly.com) asking him
> to reconsider.... 

Not so fast!  It may be that RMS was invited but turned it down.
Do you really know?  If you follow the link from the press release to
TO'Rs essay about freeware, you will find RMS and GNU mentioned
prominently.  I hardly think TO'R can be accused of failing to
recognize the importance of RMS to freeware.


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

Date: Fri, 03 Apr 1998 02:59:13 GMT
From: =?ISO-8859-1?Q?Fran=E7ois_Pinard?= <pinard@iro.umontreal.ca>
Subject: Re: RMS should be invited to O'Reilly's "Free Software Summit"
Message-Id: <vr90pna9vp.fsf@raptor.IRO.UMontreal.CA>

Don Bashford <bashford@gage.scripps.edu> writes:

> Andy Tai <atai@tyrell.ucsd.edu> writes:
> 
> > Mr. Tim O'Reilly will host a "Freeware Summit" according to the press
> > release at
> > 
> > http://www.oreilly.com/oreilly/press/freeware.html
> > 
> > Most major free software personalities will be there, but noteably
> > absent from the list is Richard Stallman....
> > 
> > I think we should write to Mr. O'Reilly (tim@oreilly.com) asking him
> > to reconsider.... 
> 
> Not so fast!  It may be that RMS was invited but turned it down.
> Do you really know?  If you follow the link from the press release to
> TO'Rs essay about freeware, you will find RMS and GNU mentioned
> prominently.  I hardly think TO'R can be accused of failing to
> recognize the importance of RMS to freeware.

One known thing is that Richard does not praise the fact that O'Reilly sells
books for which the real sources are not available.  For this reason, he
does not want that people (would they be total outsiders to ORA) mention
ORA books on GNU lists, even when about GNU software.

-- 
Frangois Pinard                            mailto:pinard@iro.umontreal.ca
Join the free Translation Project!    http://www.iro.umontreal.ca/~pinard


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

Date: Thu, 02 Apr 1998 22:54:50 -0500
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
To: TomMornini <tmornini@netcom.com>
Subject: Unitialized values (was Re: use strict and GD)
Message-Id: <35245D8E.4F12EB01@coos.dartmouth.edu>

[posted and mailed]

Tom Mornini wrote:
> 
> Also, I'm formally complaining :-) about Perl's method of checking for
> unitialized variables. If I have code that says:
> 
> 01: my $foo='';
> 
> 63: if ($foo)
> 64:  {
> 65:   print 'foo is';
> 66:  }
> 
> Perl will complain that $foo is unitialized at line 63, if $foo didn't
> have any non-null values assigned between lines 1 and 63.

Sorry, but I just don't buy that.  Perl will *never* complain about an
uninitialized value in a boolean context, because undef is simply interpreted
as false.

~> perl -w
if (undef) { print "foo\n"; }
~>

It's only when you use an unitialized value within a more complicated
expression that you get a warning.

~> perl -w
if (0 + undef) { print "foo\n"; }
Use of uninitialized value at - line 1.
~>


> Where I come from, unitialized means just that...that you're assuming an
> initial value. Setting a variable to null is definitely initializing it,
> AFAIK!

As far as Perl knows, too.  Perl will *never* complain that the null string is
an unitialized value.  The only unitialized value is undef.

~> perl -w
$foo = '';
print $foo . 'foo', "\n";
1
~>

~> perl -w
$foo = undef;
print $foo . 'foo', "\n";
Use of uninitialized value at - line 2.
foo
~>

If you post the actual code with which you had this problem, perhaps we can
point out why you are actually getting warnings.

-- 
 _ / '  _      /         - aka -             rjk@coos.dartmouth.edu
( /)//)//)(//)/(    Ronald J. Kimball           chipmunk@m-net.arbornet.org
    /                                   http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Thu, 02 Apr 1998 22:38:53 -0500
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
Subject: Re: unpack vs. substr (was Re: Data Structure for Input File)
Message-Id: <352459D0.C2A76ABB@coos.dartmouth.edu>

Clinton Bodine wrote:
> 
> You were right, it wasn't fair.... but it did emphasize an important point
> in my program.  If I use substr, I can pick and choose which fields I want
> very easily.  If I use unpack, I'm going to have to read the entire record
> and then pick and choose.

I don't know if you would count this as reading the entire record, but you can
use the x specifier to skip fields you don't want:

  DB<1> (@cols) = unpack 'a5x5a3x9a2', "abcdefghijklmnopqrstuvwxyz";

  DB<2> x @cols
0  'abcde'
1  'klm'
2  'wx'

You can also jump to absolute positions using the @ specifier:

  DB<10> ($col2) = unpack '@10a3', "abcdefghijklmnopqrstuvwxyz";

  DB<11> x $col2
0  'klm'

Which has the same result as using substr("abcdefghijklmnopqrstuvwxyz", 10, 3);

-- 
 _ / '  _      /         - aka -             rjk@coos.dartmouth.edu
( /)//)//)(//)/(    Ronald J. Kimball           chipmunk@m-net.arbornet.org
    /                                   http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Fri, 03 Apr 1998 03:28:12 GMT
From: jgloudon@hyssop.bbn.com.bbn.com (Jason Gloudon)
Subject: Re: unpack vs. substr and SWIG/XS help
Message-Id: <slrn6i8ls3.5t.jgloudon@hyssop.bbn.com>

Clinton Bodine <Clinton.Bodine@mci.com> wrote:
>I now have to read a file that DOES have long/short signed/unsigned
>integers packed in it.  The solution I've been working on is to do
>something like this:
>
>$RecID = join("",stou_short(unpack("n*", substr($m, 27, 6))));
>                                     2-bytes per short  ^  
>where
>
>sub stou_short {
>        return unpack("S*",pack("S*",@_));
>}
>
>which converts signed to unsigned.

Network shorts seem to be treated as unsigned values as far as i've seen.
You can convert the numeric value you get to the appropriate signed
value by doing 65536 - unsigned value.

If you count your bytes correctly, the x ( A null byte) character in a template
can be used to skip bytes you aren't interested in, when doing an unpack.
This is mentioned in the unpack documentation in the manpage:

    sub substr {
        local($what,$where,$howmuch) = @_;
        unpack("x$where a$howmuch", $what);
    }


--
Jason Gloudon


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

Date: Thu, 02 Apr 1998 20:06:02 -0600
From: Mike <mhanson@arrowweb.com>
Subject: using &say("something");
Message-Id: <3524440A.7D70@arrowweb.com>

Whats wrong with this? How come it doesn't print Hello Mike How are you?
What do you have to do so it will?

#!/usr/local/bin/perl
&say("Hello Mike How are you");
sub say {
print ("Content-type: text/html\n\n");
print <<"html";
<HTML>
<HEAD>
<TITLE>Admin</TITLE>
</HEAD>
<BODY bgcolor=ffffff>
$_
</BODY>
</HTML>
html
exit;
}


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

Date: Thu, 02 Apr 1998 21:56:32 -0500
From: Bob Trieger <sowmaster@juicepigs.com>
To: mhanson@arrowweb.com
Subject: Re: using &say("something");
Message-Id: <35244FE0.5681@juicepigs.com>

Mike wrote:
> 
> Whats wrong with this? How come it doesn't print Hello Mike How are you?
> What do you have to do so it will?
> 
> #!/usr/local/bin/perl
> &say("Hello Mike How are you");
> sub say {
> print ("Content-type: text/html\n\n");
> print <<"html";
> <HTML>
> <HEAD>
> <TITLE>Admin</TITLE>
> </HEAD>
> <BODY bgcolor=ffffff>
> $_
> </BODY>
> </HTML>
> html
> exit;
> }


Because you are confusing $_ and @_

HTH

-- 
Bob Trieger               |  Titanic: big boat, bigger
sowmaster@juicepigs.com   |           iceberg, big deal


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

Date: Fri, 03 Apr 1998 22:06:32 -0500
From: Jerome Bradenbaugh <bradenb@ibm.net>
Subject: Weird Effects w/ "require"
Message-Id: <3525A3B8.CBD9FC94@ibm.net>

Here's the situation:

I've writen an application that utilizes subroutines from several
libraries I've written, and subsequently "require"d into the script. Two
of these libraries "require" another (the same) library. For some
reason, if the library is "require"d more than once, the original
script, which contains the following read function:

read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});

fails to read form data passed in. If I only "require" the library once,
all is well. The workaround is self explanatory, but I'd like to know
why. Please forward your wisdom to the address below. Thanks.


Jerry Bradenbaugh
First Union National Bank
jerome.bradenbaugh@firstunion.com



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

Date: Fri, 03 Apr 1998 02:04:43 GMT
From: jgloudon@hyssop.bbn.com.bbn.com (Jason Gloudon)
Subject: Re: Why does $# cause loss of newline?
Message-Id: <slrn6i8gvj.5t.jgloudon@hyssop.bbn.com>

John Lukas <jalukas@lucent.com> wrote:
 .
 .
 .
>I traced it down to the fact that the program of which this is a
>fragment contains (via a require):
>
>	$# = "%.6g";

man perldiag agrees with your diagnosis, the $# feature was simply badly
implemented, and attempts to modify the format of anything that looks like a 
number. Instead of removing $#, you could use local($#) in the places where
it occurs in subroutines to prevent it from affecting your output.

--
Jason Gloudon


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

Date: Thu,  2 Apr 1998 20:53:59 EST
From: dblack@saturn.superlink.net (David A. Black)
Subject: Re: Why does $# cause loss of newline?
Message-Id: <6g1ffn$e3m$1@earth.superlink.net>

Hello -

John Lukas <jalukas@lucent.com> writes:

>I expected the program:

>	chmop (my $today = qx/date '+%y%m%d'/);
>	print "$today\n";

>to print:

>	980402

>What I got was correct, except that the newline was lost; e.g.:

>	980402my-prompt:

>I traced it down to the fact that the program of which this is a
>fragment contains (via a require):

>	$# = "%.6g";

Two things you can do, both eye-sores at best:

{
   local $# = "%.6g\n";
   print $today;
}

or:

print "$today","\n";

The latter has the merit of side-stepping $# entirely, which is more
in the spirit of (not) dealing with the deprecatee.  (You'd probably
want to accompany it with a comment, though - it looks pretty ghastly.)


David Black
dblack@saturn.superlink.net




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

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

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