[13352] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 762 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Sep 10 20:07:26 1999

Date: Fri, 10 Sep 1999 17:05:11 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 10 Sep 1999     Volume: 9 Number: 762

Today's topics:
    Re: Case insensitive SQL query mrbog@my-deja.com
    Re: Case insensitive SQL query mrbog@my-deja.com
    Re: Case insensitive SQL query mrbog@my-deja.com
    Re: Could someone break this down for me? (Bill Moseley)
    Re: Could someone break this down for me? (Eric Bohlman)
    Re: Could someone break this down for me? <dove@synopsys.com>
    Re: Could someone break this down for me? <crispbcd@linux.zrz.tu-berlin.de>
    Re: Could someone break this down for me? <jeff@vpservices.com>
    Re: Could someone break this down for me? harris_m@my-deja.com
        Design Advice needed on Sending Data to Client <caithay@hotmail.com>
        display graph through CGI harris_m@my-deja.com
    Re: Find 'sendmail' with only ftp... <gellyfish@gellyfish.com>
        folder name question <kptoth@microdsi.net>
    Re: folder name question <dove@synopsys.com>
    Re: folder name question <rootbeer@redcat.com>
        Getting odd error... <Care227@ibm.net>
    Re: Getting odd error... (Bill Moseley)
    Re: Getting odd error... <rootbeer@redcat.com>
    Re: HELP!! Regular Expression GRU: Extract Text between (Kragen Sitaker)
        How constant number of iterations ? mazay@gmx.net
    Re: How constant number of iterations ? <dove@synopsys.com>
    Re: how to pass exit status on Windows NT <crispbcd@linux.zrz.tu-berlin.de>
        Need help with Matching rwswebmaster@my-deja.com
        PlRPC.pm <Louie_Liu@cmc8.com>
    Re: Programmers Needed <dwoods@ucalgary.ca>
        UNCRAP project proposal <uri@sysarch.com>
    Re: Win32::MAPI problem - reading and sending <ryan.h.bark@boeing.com>
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: Fri, 10 Sep 1999 21:57:26 GMT
From: mrbog@my-deja.com
Subject: Re: Case insensitive SQL query
Message-Id: <7rburv$1e7$1@nnrp1.deja.com>

In article <7r8boa$38k@junior.apk.net>,
  catfood@apk.net (Mark W. Schumann) wrote:
> In article <7r43rg$91l$1@nnrp1.deja.com>,  <mrbog@my-deja.com> wrote:
> >Hello, genius, guess what, there are other people to answer the
> >questions besides you. The more people in the group, the more people
to
> >answer questions. I can and have answere the questions of others, for
> >example.
>
> If you actually read this group you'd know I practically never answer
> questions.  Other people get to them first.

Well then you're proving my point FOR me. If there are so many people
getting to the questions before you can, then there's PLENTY of room
for more questions!


> >Besides that, how fucking stupid are you to think that of 2400 new
> >messages, they will all be questions? You're a programmer and I need
to
> >explain that to you?  It's more lik 10% at most.  Note I said new
> >messages not new threads.
>
> Okay, so there are 240 new threads.  You want to add to that by asking
> about unrelated issues?

YES, I DO, because there are 2400 people to answer them.

>


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Fri, 10 Sep 1999 21:59:58 GMT
From: mrbog@my-deja.com
Subject: Re: Case insensitive SQL query
Message-Id: <7rbv0n$1fe$1@nnrp1.deja.com>



>
> Except you didnt ask *anything* about Perl whatsoever - your question
> was solely about SQL - the answer would have been the same if you had
> been using Perl,C,COBOL,GWBASIC ...
>

Yes, the answer is the same no matter what language I'm using. Except,
the damn thing is, I DON'T KNOW THAT WHEN I ASK THE QUESION.

I don't know that the answer isn't perl specific unitl I GET the
answer.

Feel stupid now?




Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Fri, 10 Sep 1999 22:02:43 GMT
From: mrbog@my-deja.com
Subject: Re: Case insensitive SQL query
Message-Id: <7rbv5s$1on$1@nnrp1.deja.com>



>
> Except you didnt ask *anything* about Perl whatsoever - your question
> was solely about SQL - the answer would have been the same if you had
> been using Perl,C,COBOL,GWBASIC ...

Yes, the answer is the same regardless of what language I'm using. But
the thing is, I don't know what the answer will be WHILE I'm asking the
QUESTION.

Feel stupid now?



Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Fri, 10 Sep 1999 14:00:59 -0700
From: moseley@best.com (Bill Moseley)
Subject: Re: Could someone break this down for me?
Message-Id: <MPG.12431166edcb6d48989736@nntp1.ba.best.com>

Paul Kester (pkester@mindspring.net) seems to say...
> I am trying to find out some information on what a specific section of code
> means in a line..
> 
> The code I am inquiring about is two slashes "/\"  I have seen many
> references to it, but not what exactally it does..
> 
> Here is an example of a line that has it in the coding:
> 
> ($stocknum,$name,$price,$status) = split(/\|/,$i);

"/\" is nothing, and I doubt you have seen references to it.

The \ is escaping the |

Regular expressions are really an important thing to learn about in 
Perl.

perldoc perlre


-- 
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.


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

Date: 10 Sep 1999 21:10:04 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Could someone break this down for me?
Message-Id: <7rbs3c$d3m@dfw-ixnews11.ix.netcom.com>

Paul Kester (pkester@mindspring.net) wrote:
: I am trying to find out some information on what a specific section of code
: means in a line..
: 
: The code I am inquiring about is two slashes "/\"  I have seen many
: references to it, but not what exactally it does..
: 
: Here is an example of a line that has it in the coding:
: 
: ($stocknum,$name,$price,$status) = split(/\|/,$i);

The first argument to split() is a regular expression (perldoc -f split) 
and in regular expressions, the pipe character has a special meaning 
(perldoc perlre).  Therefore, if you want to match a literal pipe 
character, you have to escape it, which is done by prefixing it with a 
backslash (perldoc perlop and read the section on quoting operators).



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

Date: Fri, 10 Sep 1999 14:15:04 -0700
From: David Amann <dove@synopsys.com>
Subject: Re: Could someone break this down for me?
Message-Id: <37D974D8.EE72869C@synopsys.com>

Hi Paul

Paul Kester wrote:

>
> The code I am inquiring about is two slashes "/\"  I have seen many
> references to it, but not what exactally it does..
>
> Here is an example of a line that has it in the coding:
>
> ($stocknum,$name,$price,$status) = split(/\|/,$i);

What this is doing is taking a string that looks like this.
"5446464|Cool Product|456.67|In Inventory", and spliting on the "|" character,
then taking each element that it splitted out ("5446464", "Cool Product", etc.)
and setting the appropriate variable to that value. (i.e. $stockname now stores
the value 5446464, $name has 'Cool Product', etc.).

The thing that looks like '/\|/' is known as a 'regular expression'. From
"Mastering Regular Expressions" by Jefferey Frieldl:

"Regular expressions are the key to powerful, flexible, and efficient text
processing.  Regular expressions themselves, with a general pattern notation
almost like a mini programming language, allows you to describe and parse
text."

The '/' character in the regular expression basically says to start and stop
the pattern searched for.  The '|' character is the character that your
searching for.  The '\' character is an escape character.  An escape character
is needed for when your searching for 'reserved characters'.  I won't go into
them now, but Tom Christiansen's book, "Learning Perl" has a whole chapter on
regular expressions that makes things a lot easier.

So now that we have the background.  The code

($stocknum,$name,$price,$status) = split(/\|/,$i);

says
1. Take the string stored in the $i variable,
2. Search for the '|' character.
3. Split up the string on the '|' character into a list of values.
4. Store the first four elements of that list into $stocknum, $name, $price,
and $status respectively.

Hope this helps,

-=dav



>
>
> Thanks,
> Paul K.



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

Date: Fri, 10 Sep 1999 22:47:46 +0200
From: Christoph Bauer <crispbcd@linux.zrz.tu-berlin.de>
Subject: Re: Could someone break this down for me?
Message-Id: <37D96E72.B4AFB886@linux.zrz.tu-berlin.de>

Hi,

Paul Kester schrieb:
> 
> I am trying to find out some information on what a specific section of code
> means in a line..
> 
> The code I am inquiring about is two slashes "/\"  I have seen many
> references to it, but not what exactally it does..
> 
> Here is an example of a line that has it in the coding:
> 
> ($stocknum,$name,$price,$status) = split(/\|/,$i);
This one line is splitting the string $i up into $stocknum,...
delimiter is |. The 2 slashes work like brakets around the search
string. e.g.
/searchstring/
the backslash takes any special meaning off the |.

Maybe this is a little clearer.

See
perldoc -f split
perldoc perlop
for further info.

Christoph




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

Date: 10 Sep 1999 21:55:51 GMT
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Could someone break this down for me?
Message-Id: <37D97D69.54C21095@vpservices.com>

Paul Kester wrote:
> 
> The code I am inquiring about is two slashes "/\"  I have seen many
> references to it, but not what exactally it does..
> 
> Here is an example of a line that has it in the coding:
> 
> ($stocknum,$name,$price,$status) = split(/\|/,$i);

In this example "/\" by itself is meaningless.  What you need to ask is:
what is "/\|/"?  Here are the answers and also info on how you could
find those answers yourself:

From "perldoc perlop" you can learn that two forwared slashes "//" are
the symbols for the pattern matching operator, in other words anything
inside of them is treated as a regular expression pattern to be
matched.  So you now know that /\|/ means match the regular expression
"\|".

From "perldoc perlre" you can learn that a single backslash "\" inside a
regular expression means to quote the next metacharacter, in other words
to ignore any special meaning of the next character and treat it as just
a character.  So you now know that "\|" means the plain character for
the vertical bar "|" without any special meaning.  Why is it neccesary
to put the "\" in front of the "|"?  Because, by itself "|" has a
special meaning in regular expressions and we don't want to use that
special meaning, we just want to look for a plain "|".

From "perldoc -f split" you can learn that the split function takes two
arguments: a regular expression pattern and an expression of some kind. 
It uses the pattern to split apart the expression and returns a list of
the parts it has split it into.  For example ($first,$last) =
split(/:/,'Joe:Smith') would end up with $first equal to 'Joe' and $last
equal to 'Smith' because it takes the expression "Joe:Smith" and splits
it using the pattern ":".  If we used a vertical bar instead of a colon,
we could get the same results with:  split(/\|/,'Joe|Smith').

So, to return to your original example, the following would pring "TRUE"
because it splits the $i string apart using the vertical bar as a
separator:

my $i = '17|Joe|$56|in-stock';
my ($stocknum,$name,$price,$status) = split(/\|/,$i);
if(  $stocknum eq '17'
 &&  $name     eq 'Joe'
 &&  $price    eq '$56'
 &&  $status   eq 'in-stock'
){ 
    print "TRUE";
}


-- 
my ($salutation,$name) = split(/\.\.\./,'Hope this helps!...Jeff');


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

Date: Fri, 10 Sep 1999 22:59:39 GMT
From: harris_m@my-deja.com
Subject: Re: Could someone break this down for me?
Message-Id: <7rc2gl$3v3$1@nnrp1.deja.com>

split function takes first parameter which is a string to match. The
string has to be between two forward slashes like follows- / whatever /

In your example you have special character to match which is "|"
For the special character you need a other (forward) slash - which looks
like \.

So if you want to match character dot or period you will write /\./
if you want to match character slash itself you will write /\//
if you want to match character |, then you will write /\|/ - this is
what your example is using.
Harris
-----------------------------------
In article <7rbolj$i02$1@nntp5.atl.mindspring.net>,
  "Paul Kester" <pkester@mindspring.net> wrote:
> I am trying to find out some information on what a specific section of
code
> means in a line..
>
> The code I am inquiring about is two slashes "/\"  I have seen many
> references to it, but not what exactally it does..
>
> Here is an example of a line that has it in the coding:
>
> ($stocknum,$name,$price,$status) = split(/\|/,$i);
>
> It is a line from a search cgi script..
>
> Any info would be appreciated.
>
> Thanks,
> Paul K.
>
>


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Fri, 10 Sep 1999 23:57:36 GMT
From: "Caitlyn Hay" <caithay@hotmail.com>
Subject: Design Advice needed on Sending Data to Client
Message-Id: <QVgC3.2461$x7.56225409@nr1.ottawa.istar.net>

I'm new to internet programming.  I have to write a server program that
interacts with a client program.  Basically, the client program will submit
a criteria to the server via a http connection.  Based on this criteria, the
server will generate some ASCII formated data, and return it (the ASCII
data) back to the client.

What is the standard way of doing this?  My first thought was to send the
ASCII data back to the client line by line.  But then, how would the client
know how many lines there are?  On second thought, maybe I can save the
ASCII data to a temp file, and let the client download it.  But then, what
if there are more than one client request with different criteria - that
means I have to generate different files.  All these questions pop up, I
need to know the standard way of doing this?

Any resources would be appreciated.
TIA
cait








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

Date: Fri, 10 Sep 1999 23:07:24 GMT
From: harris_m@my-deja.com
Subject: display graph through CGI
Message-Id: <7rc2v5$4au$1@nnrp1.deja.com>

I have Excel spreadsheet which creates graph. I could use Perl OLE
interface and maniputate excel spreadsheet.

Is there any way my CGI script can display the graph from Excel on Web
browser? One way would be to save Excel graph in bit map format (how?)
and send out HTML code which will refer to the bitmap created.

Anyone has done something like this or some pointers how to do this?
Thank you.
Harris


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: 10 Sep 1999 20:36:15 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Find 'sendmail' with only ftp...
Message-Id: <7rbq3v$lp$1@gellyfish.btinternet.com>

On 09 Sep 1999 21:57:00 +0200 Kai Henningsen wrote:
> efflandt@xnet.com (David Efflandt)  wrote on 28.08.99 in <slrn7sem5h.173.efflandt@efflandt.xnet.com>:
> 
>> The most common path is /usr/lib/sendmail (not in your path, so 'which' or
> 
> I suspect these days the most common path is /usr/sbin/sendmail.
> 

*I* suspect that most systems that actually have a /usr/sbin and have 
sendmail installed there will have linked /usr/lib/sendmail as well.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Fri, 10 Sep 1999 18:56:15 -0400
From: "Jake" <kptoth@microdsi.net>
Subject: folder name question
Message-Id: <rtj2pc3n1iv71@corp.supernews.com>

Hi,

Does anybody know how a perl script can identify the current folder that it
is residing in? For example, can the script process.cgi identify that it is
currently residing in a folder named Alabama?

Thanks in advance. -- JR




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

Date: Fri, 10 Sep 1999 16:38:26 -0700
From: David Amann <dove@synopsys.com>
Subject: Re: folder name question
Message-Id: <37D99672.D3895EDE@synopsys.com>

Hi Jake,

Jake wrote:

> Does anybody know how a perl script can identify the current folder that it
> is residing in? For example, can the script process.cgi identify that it is
> currently residing in a folder named Alabama?

I would probably use the backticks or system function to find this out.  For
example, under UNIX, you could run the following script to output the directory
your CGI script is running in.

--------------------
#!/usr/local/bin/perl

use CGI;

print header(),
      start_html();

my $directory = `pwd`;

print $directory;
----------------------

The 'pwd' command is UNIX short hand for print the working directory.  This is
not the world's greatest solution, but it's the one I came up with on the spot.

Hope this helps,
-=dav





>
> Thanks in advance. -- JR



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

Date: Fri, 10 Sep 1999 17:02:34 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: folder name question
Message-Id: <Pine.GSO.4.10.9909101650070.16999-100000@user2.teleport.com>

On Fri, 10 Sep 1999, Jake wrote:

> Does anybody know how a perl script can identify the current folder
> that it is residing in? For example, can the script process.cgi
> identify that it is currently residing in a folder named Alabama?

Sure, it just checks that './hound_dog' is a symlink to 'Zeke'. :-)

Just to be certain, you're wanting to know the location of the script, not
the current working directory. Right? (They're not guaranteed to be the
same, of course.)

But you probably want to use $0 to find the script's name, bearing in mind
that it may be relative to the original working directory, with all that
that implies. Also, in unlikely cases too esoteric to describe here, you
may not be able to get the directory name at all.

And a security note: If you're writing a CGI program which would store
data in "the same directory" as it's stored in, instead of some hard-coded
directory elsewhere, that's probably a bad idea. Of course, the details of
that aren't Perl-specific, so they'd be off-topic in this newsgroup.

Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Fri, 10 Sep 1999 18:05:03 -0400
From: Drew Simonis <Care227@ibm.net>
Subject: Getting odd error...
Message-Id: <37D9808F.EDFCB9B9@ibm.net>


Firstly, I want to thank all who assisted with my previous problem.
I tried to thank everyone who e-mailed me directly, but I may not have
so I want to do so here.  

Thanks.

Now,
I have the first part of my script handled, and the extra chars are 
being removed as are the lines that I do not want.  (I knew how to do
that bit  =), but now I am getting an odd error.  My code snippet:



open(PARSED, "phone.parsed") or die "Can't open input file: $!,
stopped";

	while (<PARSED>) { 

		($1,$2,$3,$4,$5,$6,$7) = split(/,/, $_);		


	}

is returning:

Modification of a read-only value attempted at phone.pl line 72,
<PARSED> 
chunk 1.

I have tried many incarnations of the file handle, and have even set the 
file permissions wide open.  The script is running under the same 
owner and group, but everyone has r/w permission on the file.  

Besides that, i didn't think I was changing the file anyway.  I've
checked my books, and return to the best source of assistance I know.
Is there something obvious I am overlooking???

-Drew


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

Date: Fri, 10 Sep 1999 15:49:16 -0700
From: moseley@best.com (Bill Moseley)
Subject: Re: Getting odd error...
Message-Id: <MPG.12432ac4b7dd8e45989737@nntp1.ba.best.com>

Drew Simonis (Care227@ibm.net) seems to say...
> 		($1,$2,$3,$4,$5,$6,$7) = split(/,/, $_);

Yuck!

> is returning:
> 
> Modification of a read-only value attempted at phone.pl line 72,
> <PARSED> 
> chunk 1.

No kidding?  Why are you using such ugly variable names?

perldoc perlre and read about $1.

> I have tried many incarnations of the file handle, and have even set the 
> file permissions wide open.  The script is running under the same 
> owner and group, but everyone has r/w permission on the file.

Doing good research, but looking in all the wrong places.

-- 
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.


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

Date: Fri, 10 Sep 1999 16:10:03 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Getting odd error...
Message-Id: <Pine.GSO.4.10.9909101608430.16999-100000@user2.teleport.com>

On Fri, 10 Sep 1999, Drew Simonis wrote:

> 		($1,$2,$3,$4,$5,$6,$7) = split(/,/, $_);		

> is returning:
> 
> Modification of a read-only value attempted at phone.pl line 72,

Yes, $1 is a read-only variable. It belongs to Perl. See perlvar for more
information. Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Fri, 10 Sep 1999 21:16:05 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: HELP!! Regular Expression GRU: Extract Text between two HTML Tags
Message-Id: <pyeC3.2780$N77.172641@typ11.nn.bcandid.com>

In article <37d940ac_3@news5.newsfeeds.com>,
Daniel Ulrich <shades__@mitec.net> wrote:
>$_=$yourhtml
>/\<body\>([\n|\r|.]*)\<\/body\>/i;

Your [] are wrong.  . inside [] is not special; | inside [] is not
special and is not necessary.

You could more simply match . with the /s modifier.

However, this doesn't really get what you want.

perl -we '$_="<i>one</i>\n and <i>another</i>"; /\<i\>(.*)\<\/i\>/is; print "$1\n"'

finds the following:
one</i>
 and <i>another

 . . . which is maybe not what you wanted, because instead of returning 
the content of one HTML element, it returned the content of two of them, 
some unmatched tags, and some other text.

By the way, the \ on the <> are unnecessary, though harmless.  <> are
not metacharacters in Perl regular expressions.

You might be tempted to try to use minimal matches (.*?) to avoid the
overshot problem described above.  But that doesn't work either; that
screws you when it nests: in
<blockquote>asdf<blockquote>jkl;</blockquote>1234</blockquote>, if you
ask for the content of the outer blockquote, it should include 1234.

There might be a way to do this with Perl regular expressions; I hear
rumors that they are Turing-complete now.  I shudder when I hear such
evil rumors.

Use HTML::Parse, or some other HTML parser.

Kragen
[crossposting removed; I only posted in comp.lang.perl.misc]
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Thu Sep 09 1999
60 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: Fri, 10 Sep 1999 23:34:42 GMT
From: mazay@gmx.net
Subject: How constant number of iterations ?
Message-Id: <7rc4ih$5ft$1@nnrp1.deja.com>

Sorry for that newbie like question:
But how is the best (shortest !! = without an explicit counter)
syntax for a constant number of iterations in a loop ?
I can't remember the exact syntax. It was something like

loop (7) {  ...  }

or

do (7) { ... }

In my perl books only the counter oriented syntax
is described.

Bye

Marc


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Fri, 10 Sep 1999 16:51:07 -0700
From: David Amann <dove@synopsys.com>
Subject: Re: How constant number of iterations ?
Message-Id: <37D9996B.CFBB7196@synopsys.com>

Hi Marc,

mazay@gmx.net wrote:

> Sorry for that newbie like question:
> But how is the best (shortest !! = without an explicit counter)
> syntax for a constant number of iterations in a loop ?

Try

    for(1..7) {
        # do whatever 7 times
    }

Hope this helps,
-=dav




>
>
> Marc
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.



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

Date: Fri, 10 Sep 1999 23:31:55 +0200
From: Christoph Bauer <crispbcd@linux.zrz.tu-berlin.de>
Subject: Re: how to pass exit status on Windows NT
Message-Id: <37D978CB.38F26792@linux.zrz.tu-berlin.de>

Hi,

Yuri Shtil schrieb:
> 
> Hi, all
> 
> I have a perl script that calls an another perl script via a system
> call:
> 
> $stat = system("SCript2");
> 
> I am trying to pass the status from script2. I tried exit with 0, 1, -1.
> Somehow
> the $stat in the caller script is always 0, and so is $? variable.
> 
> Any idea what gives ?

I wrote a little code to verify this. I'm did this on win98 with ASperl
5.004_2.
I managed to get either the return value $?, or the standard output of
the script. single comment for return(there is more than one way),
double comment for stdout.
------------noop.pl
print "I am noop $$\n";

if (! @ARGV) {
  print "$$ on $^X ver $]\n";
  print "$$ starting child\n";
# system('c:\Programme\perl\bin\perl.exe noop.pl gibber');# works :)
  system(qq($^X $0 gibber)); #works ;-)
# $stat=qx($^X $0 gibber); # doesn't work :(
# $stat=qx(c:\\Programme\\perl\\bin\\perl.exe noop.pl gibber); #:´(
# $stat=qx(dir); print $stat; # works! %-\

##  open (CHILD,"$^X $0 gibber|") or die "I'm $$ something went
wrong\n";
##  @childs_output=<CHILD>;
##  close CHILD;
## print "My child said:\n @childs_output END\n";#works except for $?.
  print "$$ got $?\n";
}
else {
print "$$: this NOOP thing is boring, I'm off\n";
exit 1;
}
exit 0;
--------------

Maybe this helps..
Christoph



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

Date: Fri, 10 Sep 1999 21:58:41 GMT
From: rwswebmaster@my-deja.com
Subject: Need help with Matching
Message-Id: <7rbuua$1f3$1@nnrp1.deja.com>

I need some assistance in matching from parts of
a file.  In the example below, I am searching
from the string "TLH" to "CIG", which
incorporates about 15 lines of data.  I can
search and find the data, but it puts the matched
portion into 1 big glob of data that can be
broken up by each word, but I want it to spit out
a line by line representation.  The code I am
using is below that breaks the matched portion
into each word and any help would be GREATLY
appreciated.


open(FILE, "forecasts/ngm/NGMMOS.txt");
undef $/;
my $names ="";
my @names = ();
$f = <FILE>;

while ($f =~/TLH(.*?)CIG/s) {
 $names = $1;
  $f= $';
  @names = split " " , $names;
  last;
  $a=0;
  foreach $el (@names) {
  $a++;
  }
}

close(FILE);
$/="\n";


David Spivey


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Fri, 10 Sep 1999 16:42:17 -0700
From: "Louie Liu" <Louie_Liu@cmc8.com>
Subject: PlRPC.pm
Message-Id: <BHgC3.372$Wt1.16870@typhoon-sf.snfc21.pbi.net>

Hi all,

We are trying to implement PlRPC for Win32 and having problem.  I was
wondering any success out there.  If so, can someone please help....

Thanks..





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

Date: Fri, 10 Sep 1999 15:07:40 -0700
From: Dan Woods <dwoods@ucalgary.ca>
To: Martin <contact@nativetongues.com>
Subject: Re: Programmers Needed
Message-Id: <7rbs5n$l1a@ds2.acs.ucalgary.ca>

Martin wrote:
> Moral: Get a contract before you do a damned thing and be in the same
> country as the contractor.

Since I am getting into offline contracting work, do you have
any sample contracts, invoices, non-disclosure, license agreements,
etc type of forms to share (perhaps download from a web page).
Can you provide any other pointers ?

I recently finished a java applet for ATI Technologies (video
card makers), and I now have a Perl/Java contract lined up
based on percentage.  Do most good perl programmers get paid
(or quote) by the hour, by the project, or a percentage ?

Thanks...Dan.    (please include direct response if possible)
http://www.4loops.com


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

Date: 10 Sep 1999 18:09:28 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: UNCRAP project proposal
Message-Id: <x7zoyul8pz.fsf@home.sysarch.com>


well, i actually have been requested to help my home town's web site
with a search engine. here is a fine opportunity to create the first
UNCRAP cgi program. i will write out some specs and challenge some of
you intermediates perl hackers to do it. then the submitted code will be
reviewed here and the best code will get put into the archive by jeff
pinyan. we have to get the ball rolling somewhere.


the basic needs of the search engine is to search for some keywords in a
set of directory trees. it returns the file names of hits in a nice
htmlish way. here are some of the design rules:

uses CGI.pm for parsing and for some/most of the html output

uses File::Find.pm to navigate the dir trees.

uses strict and -w

no backwhacked quotes or unchecked open calls.

no really obscure perl nor any newbie perl. 

assume perl 5.005 is being used. use its features.

very basic design:

if no cgi params, print a form and exit.

get the search terms, make a proper regex with qr//.

call Find::File with the list of dirs (config value in the code).

filter files/dirs based on suffixes, depth, etc. the list of filter
stuff is config values in the code.

slurp in the whole file and match against regex

save names matched files.

output pretty html of matched filenames with links to the files.


once we have a decent structure of code, we can add bells and whistles
like better input form and output html, more complex query handling and
better dir/file filtering. but we need a solid functioning script first.
this is not meant for large complex sites but for smaller ones that can
afford the full text search hit each time. this is a useful thing for
many smaller sites.

so if you want to create this, or make a team to do so, here is your
chance.  i expect this to take only a few hours of dedicated time.  i
and others will help you or guide your design but i/we don't want to
code these. so this can be a group education project as well. we hope
that the UNCRAP programs will not only be a useful cgi/code resource but
examples of code worthy of being used for teaching perl to the unwashed
masses.

uri


-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com
"F**king Windows 98", said the general in South Park before shooting Bill.


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

Date: Fri, 10 Sep 1999 23:16:48 GMT
From: "Ryan Bark" <ryan.h.bark@boeing.com>
Subject: Re: Win32::MAPI problem - reading and sending
Message-Id: <FHvA0G.6nD@news.boeing.com>

Where is the Win32::MAPI module? I can't find it anywhere?

<shapirojNOSPAM@logica.com> wrote in message
news:MPG.12433788649b582a989685@news.logica.co.uk...
>
> Well, I wanted to do some automated processing of the mail I receive at
> work, where everything is done via Microsoft Exchange/Outlook, so I was
> delighted to find Win32::MAPI. But it's acting a bit wacky. I don't know
> if it's the module, or imapi.dll, or my system's mapi dll.
>
> What I want to do is examine all the mail in my in-box, and, if the
> subject line matches a pattern, send out an e-mail, (not necessarily to
> the same person), and then delete the original mail. What happens is a
> bit inconsistent, but generally I get too many people in my To: list. A
> boiled-down piece of code that exhibits the problem follows:
>
> --------Start code
> #!/perl/bin/perl.exe -w
> use strict;
> use Win32::MAPI ('Yes', 'No') ;
>
> my($obj)=new Win32::MAPI(UseDefProfile=>Yes);
>
> my $dest;
> $dest = 'shapirojsXXX@XXXhotmail.com';
>
> my $msgTxt = 'Hey, you can ignore this. It\'s a test';
> my $subject = "Low level mailing test";
> my %data;
>
> if($obj->IsMAPI){print "MAPI okay...\n"}
> else{die "\n MAPI is not available!\n"}
>
> if($obj->Logon() ) { print "Logon okay...\n" }
> else{ die "Can't logon!";}
>
>
> my $i = 0; # don't process too many!
> while( $obj->Next() and ++$i < 5) {
>
>         %data=(LeaveUnread=>1, NoAttachments=>1, UnreadOnly=>0,
> HeaderOnly=>0);
>
>
>         $obj->Read(\%data);
>
>         print "\nFrom: " . $data{Originator} . " Subject: " .
> $data{Subject} . " ";
>         print "Date: " . $data{DateRecvd} . "\n";
>         next if $data{ Subject } !~ /sendtestmsg/;
>
>         print "Found Subject line with 'sendtestmsg'\n";
>
>         print "Processing active msg: From: " . $data{Originator}."
> Subject: ".$data{Subject}."\n";
>         print "Date: " . $data{DateRecvd} . "\n";
>         #print "Message: ".$data{Text}."\n";
>
>
>         print "\nGoing to send message to $dest\n";
>
>         # Send the mail
>         %data = ();
>         $data{Text} = $msgTxt;
>     $data{Subject} = $subject;
>     $data{To} = [ $dest ];
>     $data{ShowDialog} = 0;
>
>         if( not $obj->Send(\%data) ) {
>                 print "Couldn't send mail to ", $dest, "\n";
>                 print "Error: ", $obj->LastError;
>                 next;
>                 }
>
>
> #       $obj->Delete();
> }
>
> $obj->Logoff() ;
> undef $obj;
> ---------- End Code
>
> The problem varies depending on $dest. With my hotmail account, the To:
> list contains 2 addresses, one invalid
> "'shapirojsXXX@XXXhotmail.com'" <shapirojsXXX@XXXhotmail.c>
>
> the other valid
>
> "'shapirojsXXX@XXXhotmail.com'" <shapirojsXXX@XXXhotmail.com>
>
> (spam-proofing this message is getting to be a pain).
>
> When I send it too my work address ( which is where the script runs), I
> get from 3 to 8 copies of my work address in the To: list. When I send it
> to a friend, I get a list of my work address and my friends address.
>
> I dug into MAPI.pm, and verified in Send()
>
> --->    print "In MAPI.pm, rcpt is --$recipient--\n";
>
>         my($Ret)=$SendMail->Call($data->{Text},$recipient,$CC,$Bcc,
>         $data->{Subject}, $Attachment,$data->{ShowDialog},
>         $data->{Acknowledge},$obj->{handle},$Ptr1);
>
> that the $recipient list is correct. So as far as I can tell, either the
> SendMail function in imapi.dll is picking-up information left around from
> previous calls (maybe to ReadMail), or my installed MAPI is acting goofy.
> I'm having no problems using Microsoft Exchange to read/send my mail.
> Would it be possible to get the code for imapi.dll? That would probably
> help me pinpoint the problem.
>
>
> And while I've got the attention of all the MAPI interested people, I've
> got a question about the general strategy. What I really want to do is
>
> [following is psuedo-Perl, where $msg is some abstract object, not a
> Win32::MAPI blessed reference.]
>
> foreach $msg ( mailbox ) {
>     push @mymsgs, $msg->id if ($msg->subject has the right format);
> }
>
> foreach $msg->id ( @mymsgs) {
>         Read( $msg );
>         Create new e-mail;
>         Send new e-mail;
>         delete $msg;
> }
>
>
>
> I can't do this with Win32::MAPI, and I don't know if I can do it with
> MAPI at all. Reading the MAPI documents I got from the Microsoft web
> site, it looks like Send, Read, and Delete use a MessageID to specify the
> message being processed. Would it be possible to add forms of
> Win32::MAPI->Read and Win32::MAPI->Delete that referred to a messageID.
> I'm guessing that Win32::MAPI is maintaining some sort of "Current
> MessageID" inside the dll, and so I can only operate on that message. As
> you can see in my script above, I've commented out the Delete. It was
> behaving even more strangely when that was in. I couldn't figure out what
> was supposed to happen when I deleted the "current" message, and then did
> Next().
>
> Anyways, TIA for all the help, and thank you Amine for providing
> Win32::MAPI.
>
>
> Jonathan Shapiro
> shapirojsXXX@XXXhotmail.com




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

Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 1 Jul 99)
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" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. 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" from
almanac@ruby.oce.orst.edu. 

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 V9 Issue 762
*************************************


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