[20034] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2229 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Nov 28 14:05:47 2001

Date: Wed, 28 Nov 2001 11:05:08 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <1006974307-v10-i2229@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 28 Nov 2001     Volume: 10 Number: 2229

Today's topics:
    Re: Arbitrary Precision Perl Scripts for Subtraction, M (Helgi Briem)
        capturing output from Win32::AdminMisc::CreateProcessAs (John Menke)
        Display Image using CGI <litalien@americasm01.nt.com>
    Re: Display Image using CGI <cp@onsitetech.com>
    Re: Display Image using CGI <flavell@mail.cern.ch>
    Re: Display Image using CGI <flavell@mail.cern.ch>
    Re: File::Copy - Which Perl Versions Include It? <mkruse@netexpress.net>
        Filling up layout <magus@cs.tut.invalid>
        getting realtime updates from CGI script <rstarkey@austin.rr.com>
        Help with SNMP and SNMP traps (Mat)
        How do I match %5C (Troy)
    Re: How do I match %5C (Randal L. Schwartz)
    Re: How do you pronounce "Perl"? <devnull@cauce.org>
    Re: Internal Server Error (Helgi Briem)
    Re: Internal Server Error <username@this.is.a.trap.graffl.net>
    Re: Internal Server Error <godzilla@stomp.stomp.tokyo>
        newbie learning perl <darmfam@hotmail.com>
        Perl LDAP <jkezar@doc.state.vt.us>
        query exitstatus of a pipe ? (open (FH,"| program")) <pilsl_@goldfisch.at>
        recursive regexp <webmaster@docotrexpress.it>
        Regular Expression <ericd_@hotmail.com>
    Re: Using CGI.pm to obtain a list of params <wsegrave@mindspring.com>
    Re: what's a CHUNK? (Sara)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 28 Nov 2001 16:10:56 GMT
From: helgi@decode.is (Helgi Briem)
Subject: Re: Arbitrary Precision Perl Scripts for Subtraction, Multiplication, and Division Needed
Message-Id: <3c050bd5.3566950053@News.CIS.DFN.DE>

On Wed, 28 Nov 2001 15:53:10 GMT, "Basil Skordinski"
<SSEA@SSEAweb.com> wrote:

>Is there anyone out there who is willing to share their 
>Perl scripts for subtraction, multiplication, and division?  
>I'm looking for Perl scripts that will perform these operations 
>accurately on numbers with 30 digits to the right or left of 
>the decimal point.  (The Perl module Math::BigFloat
>gives me all sorts of warnings when I try to use it -- 
>needless to say, I don't have too much confidence in its 
>ability to do things correctly.)  Help
>would be greatly appreciated.  Thanks.

I think your warnings have nothing to do with
Math::BigFloat.  It works just fine and dandy
for its intended purpose.  "Needless to say", you'll
have to share this mysterious code if you want 
anyone to believe you that a standard Perl module
that has seen year of active service has suddenly
developed an "all sorts of warnings" syndrome.

Regards,
Helgi Briem



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

Date: 28 Nov 2001 09:30:16 -0800
From: jmenke@scsnet.csc.com (John Menke)
Subject: capturing output from Win32::AdminMisc::CreateProcessAsUser
Message-Id: <3a2d73ac.0111280930.40af09e@posting.google.com>

I am using the Win32::AdminMisc::CreateProcessAsUser and trying to get
the results of the command line process back into my script (similar
to using backticks). This is what I am trying.  It executes the
process OK but I do not get the output of the program output to STDOUT
as I am trying.

Has anyone done this?  I cannot use backticks because I need to
specify a timeout for the process.....

 

$input_handle = Win32::AdminMisc::GetStdHandle(STD_INPUT_HANDLE);
$output_handle = Win32::AdminMisc::GetStdHandle(STD_OUTPUT_HANDLE);
$error_handle = Win32::AdminMisc::GetStdHandle(STD_ERROR_HANDLE);




$Process = "c:\\NETSVC OracleOraHome81HTTPServer \\\\mycomputer
/query";


$Result = Win32::AdminMisc::CreateProcessAsUser(
$Process,
"Flags" => CREATE_NEW_CONSOLE,
"XSize" => 640,
"YSize" => 400,
"X" => 200,
"Y" => 175,
"XBuffer" => 80,
"YBuffer" => 175,
"Show" => SW_SHOW,
"StdInput" => $input_handle,
"StdOutput" => $output_handle,
"StdError" => $error_handle,
"Title" => "Title: $User" . "'s $Process program",
"Fill" => BACKGROUND_BLUE |
FOREGROUND_RED |
FOREGROUND_BLUE |
FOREGROUND_INTENSITY |
FOREGROUND_GREEN,
);


if( $Result )
{
print "Successful! The new processes PID is $Result.\n";
}else{
print "Failed.\n\tError: ", Error(), "\n";
}

close QUERYFILE;

sub Error
{
return Win32::FormatMessage( Win32::GetLastError() );
}


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

Date: Wed, 28 Nov 2001 11:02:16 -0500
From: "RAL" <litalien@americasm01.nt.com>
Subject: Display Image using CGI
Message-Id: <9u31lr$1cb$1@bcarh8ab.ca.nortel.com>

Hi,

I saw an example in a book that said that I could use a perl script to
dynamically display an image when an HTML page is displayed.  For example,
in my web page, I would call this script in the following fashion:

<p><img src="http://www.skyweb.ca/cgi-bin/set_sanity_colour.pl"</p>

Now the "set_sanity_colour.pl" script would simply select and return the
location of the graphic file I wish to display.  In order to simplify
things, I have streamed down the script for this email:

====================================
#! /usr/bin/perl

$baseurl = "http://www.skyweb.ca/images/";  #don't try this @... it won't
work... ;-)
$file = "sanity_green.jpg";

print "Location: $baseurl$file\n\n";
====================================

Now, obviously, this does not seem to work.  Any suggestions as to why?

Just to let you know, I do have full access rights to the web server and the
appropriate priviledges have been given to the script file. (Apache Web
Server)

Thank you





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

Date: 28 Nov 2001 16:30:22 GMT
From: "Curtis Poe" <cp@onsitetech.com>
Subject: Re: Display Image using CGI
Message-Id: <9u33eu$jo8@dispatch.concentric.net>

"RAL" <litalien@americasm01.nt.com> wrote in message
news:9u31lr$1cb$1@bcarh8ab.ca.nortel.com...
> Hi,
>
> I saw an example in a book that said that I could use a perl script to
> dynamically display an image when an HTML page is displayed.  For example,
> in my web page, I would call this script in the following fashion:
>
> <p><img src="http://www.skyweb.ca/cgi-bin/set_sanity_colour.pl"</p>
>
> Now the "set_sanity_colour.pl" script would simply select and return the
> location of the graphic file I wish to display.  In order to simplify
> things, I have streamed down the script for this email:
>
> ====================================
> #! /usr/bin/perl
>
> $baseurl = "http://www.skyweb.ca/images/";  #don't try this @... it won't
> work... ;-)
> $file = "sanity_green.jpg";
>
> print "Location: $baseurl$file\n\n";
> ====================================
>
> Now, obviously, this does not seem to work.  Any suggestions as to why?
>
> Just to let you know, I do have full access rights to the web server and
the
> appropriate priviledges have been given to the script file. (Apache Web
> Server)
>
> Thank you

The basic of way of displaying an image is to send the appropriate
Content-type header along with the image.  To send that "sanity_green.jpg",
try the following:

    #!/usr/bin/perl -wT
    use strict;
    $!++;
    my $file = 'sanity_green.jpg';
    open IMAGE, "< $file" or die "Cannot open $file for reading: $!";
    binmode IMAGE;
    print "Content-type: image/jpeg\n\n";
    print <IMAGE>;
    close IMAGE;

Notes:

1.  binmode has no effect on many systems, but ensures that those systems
for which it *does* have an effect (e.g. Windows), no line-ending
translations are attempted.
2.  A common source of error for something like this is get the Content-type
line wrong or to send the wrong media type. Pay extra attention to that
line.

--
Cheers,
Curtis Poe
Senior Programmer
ONSITE! Technology
www.onsitetech.com
503.233.1418




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

Date: Wed, 28 Nov 2001 18:00:25 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Display Image using CGI
Message-Id: <Pine.LNX.4.30.0111281734240.17435-100000@lxplus023.cern.ch>

On Nov 28, RAL inscribed on the eternal scroll:

> I would call this script in the following fashion:
>
> <p><img src="http://www.skyweb.ca/cgi-bin/set_sanity_colour.pl"</p>

Indeed, but that's nothing specific to Perl...

> #! /usr/bin/perl

You've just told us you couldn't be bothered to do your homework
before posting to this group.  As such, you're on sufference...

> $baseurl = "http://www.skyweb.ca/images/";  #don't try this @... it won't
> work... ;-)
> $file = "sanity_green.jpg";
>
> print "Location: $baseurl$file\n\n";

Looks to be along the right lines, but next time let's see some
evidence that you're taking advantage of all the help that Perl itself
offers you.  Read, mark, learn and digest the new users briefing.

> Now, obviously, this does not seem to work.

Once again you disregarded the new-user cautions that you should not
merely say "doesn't work", you should tell us clearly WHAT you
observed.

>  Any suggestions as to why?

No, but if I were in this position, I would first break the problem
into parts and verify that I could make each one of them work, before
re-assembling them into a solution.  While I'm doing that, I usually
realise what it was that I got wrong, and fix it without having to
wait for an answer from usenet.  And when it does happen that I need
help, then I can post a nice clean question without extraneous detail.

And, by the way, if you provide real URLs where we can try your stuff
out for ourselves we often get more quickly to the answer.

I don't yet know whether your problem is with Perl or with the WWW
part of your task.  I'm inclined to think you'd have been better
advised to post to c.i.w.authoring.cgi, but I could turn out to be
mistaken.





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

Date: Wed, 28 Nov 2001 18:08:47 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Display Image using CGI
Message-Id: <Pine.LNX.4.30.0111281802470.17435-100000@lxplus023.cern.ch>

On Nov 28, Curtis Poe inscribed on the eternal scroll:

[excessive quotage snipped]

> The basic of way of displaying an image is to send the appropriate
> Content-type header along with the image.

You _can_ do that, sure, if you're generating the thing dynamically.

But if the final answer is a static resource, it's perfectly feasible
to redirect to its URL (in either of the two ways defined by the CGI
specification for the Location: response) if that's what the
questioner wanted to do.

None of that is a Perl question, of course.  Should be taken up on
c.i.w.authoring.cgi.

>     open IMAGE, "< $file" or die "Cannot open $file for reading: $!";
>     binmode IMAGE;

Good move; but what about the output filehandle?




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

Date: Wed, 28 Nov 2001 10:45:04 -0600
From: "Matt Kruse" <mkruse@netexpress.net>
Subject: Re: File::Copy - Which Perl Versions Include It?
Message-Id: <3c0513ae$0$19467$724ebb72@reader2.ash.ops.us.uu.net>

Helgi Briem <helgi@decode.is> wrote:
> On Wed, 28 Nov 2001 09:34:55 -0600, "Matt Kruse"
> >An average Joe web developer who wants a CGI script doesn't
> >necessarily know much about Perl,
> Since when is ignorance an excuse for incompetence?

If a web developer wants a CGI script to work, and doesn't have the power to
upgrade the version of Perl on his web server, I don't see that as
incompetence. Nor should a web developer be required to have knowledge of
Perl to get a CGI script to function correctly. This is an example of
typical Perl 'elitist' attitude, and I'll have nothing to do with that.

> >much less have control over which version of perl his web
> >host uses.
> He should ask the web host to install a newer version,
> install it himself or find a new hosting company.

1) He may not even know what Perl is, much less which version he needs or
that the version is even a problem. If a script doesn't work and gives him a
500 Internal Server Error, then to him it just doesn't work.
2) Most people certainly don't have the ability to install Perl themselves.
3) Find a new hosting company? You make it sound like that's something you
do in 15 minutes.

> In this age of daily security breaches, there is no
> excuse for an ISP to provide outdated and obsolete
> tools.

That's questionable. Not everyone can stay totally up-to-date, and not
everyone has the resources or knowledge to stay current on everything. If
Jim Bob is running his own server setup from RedHat5 or something which
might install an older version of Perl, he may have security holes, but it
may server his purposes just fine. It may even be for an Intranet, or a test
server.

In short, your attitude is what I'm trying to get around.
I work with what people have, not give them a 2-page list of requirements
that they must have before anything will work. Much of my target audience is
people who don't have the knowledge or experience of a Perl programmer or
ISP Admin. They simply want things to work. I provide them with something
that works out-of-the-box with no changes or configuration, and people
appreciate that.

If your audience is die-hard Perl developers, your attitude is fine.
If your audience is the general web-developing public, your attitude will
kill your product very quickly.

Matt Kruse
http://www.mattkruse.com/






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

Date: Wed, 28 Nov 2001 16:44:07 +0000 (UTC)
From: Haikonen Markus <magus@cs.tut.invalid>
Subject: Filling up layout
Message-Id: <slrna0a52n.c5p.magus@korppi.cs.tut.fi>

I have a layout file something like this

--- CUT ---
<P>Here's $word[1] $word[2] $randomvar</P>
--- CUT ---

I read it in @layout and try to print it out in my perl script.

foreach $line(@layout) {
 print "$line";
}

But the output is "<P>Here's $word[1] $word[2] $randomvar</P>". Is there any
way to assing those variables? Using s// is too slow (there's ~100 variables
in my layout.)

---
Markus Haikonen, Tampere University of Technology
WWW: http://makush.da.ru ICQ: 129846722 Tel: +358505369575

-Kertokaapa jotain taustastanne.
-Noh, valmistuin pääaineena käytettävyys
-HOHOHOHOHO!


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

Date: Wed, 28 Nov 2001 17:56:22 GMT
From: "Roy Starkey" <rstarkey@austin.rr.com>
Subject: getting realtime updates from CGI script
Message-Id: <az9N7.23160$tT4.1274950@typhoon.austin.rr.com>

I have a Flash GUI that is attempting to display "realtime" updates from a
Perl CGI script.  The Perl script is passing a status variable back to Flash
indicating it's current state of progress.  The Flash app is receiving the
info, but only sees the last value of that variable.  I know the Perl script
is not buffering the data because I can run it from a command line (rather
than CGI) and see output like (text in <brackets> are my notes, not part of
the output):

status=1&<delay for a few seconds>status=2&<delay for a few
seconds>status=3&

The Flash app only displays status=3.  I suspect it's receiving the 3 values
all at once, each one overwriting the previous.  I'm not sure where to ask
about this since I don't know if it's a Perl thing, a Flash thing, an Apache
thing, an HTTP protocol thing, a CGI protocol thing, or what.
Roy





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

Date: 28 Nov 2001 08:09:17 -0800
From: micerino@airtel.net (Mat)
Subject: Help with SNMP and SNMP traps
Message-Id: <61ac210a.0111280809.50ede75a@posting.google.com>

Hello:

I am working with SNMP traps for monitoring SIWTCH, Router, ethernet
card, TCP in general.


I have read some tutorial about SNMP, but I can't find any tutorial or
manual that could explain SNMP traps as good as possible.
Does anybody know any book that explain SNMP protocol and traps.
I would like to find examples about using traps with TCP.

Thanks a lot.
Mat
micerino@airtel.net


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

Date: 28 Nov 2001 08:26:03 -0800
From: troy@morpheus.net (Troy)
Subject: How do I match %5C
Message-Id: <b579fd42.0111280826.6c90f7dd@posting.google.com>

Hello...

I am having a bit of trouble.  I am new to Perl so try not to singe my
hair here...

I've got a URL string saved in a variable $proxyURL
The string itself looks something like this:
\\realserver%5Cwestulsrv%5CENL_34355101.rm

I am trying to break this out into an array using the split function. 
I am trying to isolate the real media file by itself, so I an trying
to split the string by either the "/" symbol or the "%5C" hex value,
which I believe translates to a "/" symbol.  I thought that splitting
with a \/ would do the trick, but it doesn't seem to notice the %5c,
and if I split by %5c or \%5c or \x5c then I fragment the filename if
it contains a 5, so I'm not doing that right either.

Here is what I am doing...
my @proxy_path = split (/[\/]/,$proxyURL);
and I have tried this:
my @proxy_path = split (/[\/%5C]/, $proxyURL);
and about 1 bazillion other things, anyone like to lend a hand??

Thanks,
Troy


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

Date: 28 Nov 2001 08:39:52 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: How do I match %5C
Message-Id: <m1d72297dz.fsf@halfdome.holdit.com>

>>>>> "Troy" == Troy  <troy@morpheus.net> writes:

Troy> Hello...
Troy> I am having a bit of trouble.  I am new to Perl so try not to singe my
Troy> hair here...

Troy> I've got a URL string saved in a variable $proxyURL
Troy> The string itself looks something like this:
Troy> \\realserver%5Cwestulsrv%5CENL_34355101.rm

You should be looking at URI::Escape from the LWP distribution.
Read "perldoc perlmodinstall" for information on how to install
it if it's not already installed for you.

print "Just another Perl hacker,"

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: Wed, 28 Nov 2001 18:56:59 +0100
From: Jan Pieter Kunst <devnull@cauce.org>
Subject: Re: How do you pronounce "Perl"?
Message-Id: <281120011856594526%devnull@cauce.org>

In article <m17ksb9c9d.fsf@halfdome.holdit.com>, Randal L. Schwartz
<merlyn@stonehenge.com> wrote:


> > How do you pronounce "Perl"?
> 
> Larry says it like "pearl".


That should settle it. "Pearl" it is. Thanks!

JP

-- 
Sorry, <devnull@cauce.org> is een "spam trap".
E-mail adres is <jpk"at"akamail.com>, waarbij "at" = @.


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

Date: Wed, 28 Nov 2001 16:14:58 GMT
From: helgi@decode.is (Helgi Briem)
Subject: Re: Internal Server Error
Message-Id: <3c050ced.3567230236@News.CIS.DFN.DE>

On Wed, 28 Nov 2001 15:58:45 -0000, "Andy Laurence"
<username@this.is.a.trap.graffl.net> wrote:

>> Don't do that.  It can cause lots of other problems
>> as well.  FTP from PC to Unix using ASCII mode
>> or incorporate my regex into a dos2unix utility.
>
>It's a quick fix until I sort something more permanent out.  I'm using Samba
>on the linux box and saving files directly to the network drive, which is
>where my problem comes from.  This program Mark speaks of looks to be the
>perfect solution though.

Here's my perfect solution in two lines
( The -p switch tells perl to loop around files,
modifying them in place):
#!/bin/perl -wp
 {s/\r\n*/\n/g;}

Regards,
Helgi Briem



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

Date: Wed, 28 Nov 2001 16:25:21 -0000
From: "Andy Laurence" <username@this.is.a.trap.graffl.net>
Subject: Re: Internal Server Error
Message-Id: <9u335i$5sg0r$1@ID-109625.news.dfncis.de>

> >> Don't do that.  It can cause lots of other problems
> >> as well.  FTP from PC to Unix using ASCII mode
> >> or incorporate my regex into a dos2unix utility.
> >
> >It's a quick fix until I sort something more permanent out.  I'm using
Samba
> >on the linux box and saving files directly to the network drive, which is
> >where my problem comes from.  This program Mark speaks of looks to be the
> >perfect solution though.
>
> Here's my perfect solution in two lines
> ( The -p switch tells perl to loop around files,
> modifying them in place):
> #!/bin/perl -wp
>  {s/\r\n*/\n/g;}

Genius!  Work's a treat, cheers.

Andy
--
PC-Based Multimedia System
http://www.andylaurence.pwp.blueyonder.co.uk/pcbmms
NB: Spamtrap - my name @yahoo.co.uk




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

Date: Wed, 28 Nov 2001 09:08:39 -0800
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Internal Server Error
Message-Id: <3C051A17.81B2F591@stomp.stomp.tokyo>

Andy Laurence wrote:
 
> > > > > use CGI::Carp qw(fatalsToBrowser);

> > > > You will benefit by reading your carp returned error messages:

> > > The only error message I got was

> > > Internal Server Error
> > > The server encountered an internal error or misconfiguration and was
> unable

> > This leaves only three suspect lines:

> > #!/usr/bin/perl

> > use CGI qw(:standard);
> > use CGI::Carp qw(fatalsToBrowser);
 
> <snippage>
 
> I feel such an idiot!  I looked at the scripts from the console and at the
> end of each line there is a ^M.  This I expect is a newline character
> created my the MS software I'm using to write it on.  There seems to be a ^M
> at the end of each line, so a simple s/^m//g; should see me through!


  "this type of error would be if I had a typo in #!/usr/bin/perl but
   that's fine...."


My personal expectation is when a person issues this
type of statement, I expect it to be absolutely true.
Your statement indicates you tested your Perl locale
line and, it passed this test.

If you feel to be an idiot, this should be a result
of issuing a false statement or, not personally
substantiating your conclusion via testing before
making an alleged factual statement.

However, my being a well educated and well trained
scientist, does provide me with the clear vision
of a scientifically skeptical eye; I always both
question and test my conclusions.

Perhaps my expectations of others are too high.

Nonetheless, as an educator, I found when I lower
my expectations of others, of students, learning
and performance decrease in direct proportion.

Test your conclusions well before publication.


Godzilla!
--

#!/usr/bin/perl

print "Successful Test";

exit;


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

Date: Wed, 28 Nov 2001 18:50:05 GMT
From: "Harvey" <darmfam@hotmail.com>
Subject: newbie learning perl
Message-Id: <xlaN7.131568$Yb.34674544@typhoon.tampabay.rr.com>

I'm reading "learning Perl" and have tried some of the exercises and have
had some sucsess runnitn them on Win(NT). But I've had some problems getting
them to work on a linux OS.

The following hash:

%words =qw(
        me    my
        I        it
        one    two
        be      been
);

Print "$words{me}"

returns the following error message:

"Can't modify not in scalar assignment at hash line (number), near ");"

As mentioned, this works on Win(NT) but not RH Linux. I know there are major
differences between the two versions. But I expected the basics to work. Can
anyone give me some direction with this.

Thanks in advance.




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

Date: Wed, 28 Nov 2001 12:56:20 -0500
From: Joseph Kezar <jkezar@doc.state.vt.us>
Subject: Perl LDAP
Message-Id: <3C052544.344A93D5@doc.state.vt.us>

How do I search for a specific DN inside of LDAP and return a
Net::LDAP::Entry object?
Apparently ($entry) =
$ldap->search($BASEDN,"dn='uid=jkezar,blah..'",0,@attr) does not work.
It can search for any other attribute inside LDAP just not DNs.  Why?

-- 
Joseph Kezar


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

Date: Wed, 28 Nov 2001 18:38:26 +0100
From: peter pilsl <pilsl_@goldfisch.at>
Subject: query exitstatus of a pipe ? (open (FH,"| program"))
Message-Id: <3c052114@e-post.inode.at>


I want my perl-script feed data to a different tool that expects data from 
the STDIN.
So I open a pipe 

if (open (FH,"| /usr/cyrus/bin/deliver ".$user)) {
   print FH $content;
   close FH;    
} else {$error=1;}

the open itself works fine but I need additionally query the exitstatus of 
the deliver-programm, which may be not zero (based on the content of 
$content and if $user exist in the internal database of 'deliver')

How can I do this ?

I just read the faqs and looked around at googles and hope that there is an 
easy solution to my problem. On the other said I'm afraid that I need to 
deal with the fact that opening to a pipe actually does a fork and this 
might my script prevent from ever get back the exitstatus of the forked 
programm.

In bash its very easy, so I've hope its easy in perl too:

cat content | /usr/cyrus/bin/deliver user && echo 'exit zero' || echo 'exit 
nonzero'

thnx,
peter


-- 
peter pilsl
pilsl_@goldfisch.at
http://www.goldfisch.at



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

Date: Wed, 28 Nov 2001 18:53:13 +0100
From: Luciano Ponte <webmaster@docotrexpress.it>
Subject: recursive regexp
Message-Id: <9u38cm$k9b$1@nreada.inwind.it>

I have a file on a single line:

xxxxx(variable text)xxx<prefix>string1<suffix>xxxxx(variable 
text)xxx<prefix>string2<suffix>xxx ... and so on for 20 times.

I need to extract string1, string2 ...string20 and put them on a new file.
How to do this?

Thanks

Luciano


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

Date: Wed, 28 Nov 2001 13:17:00 -0500
From: "Eric D." <ericd_@hotmail.com>
Subject: Regular Expression
Message-Id: <uS9N7.8535$Ju6.2152860@news20.bellglobal.com>

Hi,

How do you denote the ) character in regular expression so it's seen as a )
character and NOT a special character?

I tried:

/ \Q)\E /

and

/ \) /

either works.

Thanks,
Eric




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

Date: Wed, 28 Nov 2001 11:09:55 -0600
From: "William Alexander Segraves" <wsegrave@mindspring.com>
Subject: Re: Using CGI.pm to obtain a list of params
Message-Id: <9u363r$h9v$1@slb4.atl.mindspring.net>

"Benjamin Goldberg" <goldbb2@earthlink.net> wrote in message
news:3C047DF7.CE872B77@earthlink.net...
> > Suppose each generation has variable names, e.g.,
> [snip]
> > Name_G1
> > Address_G1
> > ...
> > Name_G12
> > Address_G12
>

> There's no need to do that ugly series of s/// things you suggest.
> And if one *were* doing something like that, it would be done as:
>    s/G(\d+)$/$1 + 1/e;
> which would do all those changes with just a single substitution.

Actually, this doesn't work, as the variable names may be embedded somewhere
in the name-value pair that has not been packed yet, rather than at the end,
as suggested by the above code. Changing the code to:

    s/G(\d+)+/$1 + 1/e;

causes all instances to be matched and replaced; but the "G" is dropped in
the replacements, causing the following corruptions of the variable names:

Name_1
Address_1
 ...
Name_12
Address_12

Except for the problem with the replacement dropping the "G", the modified
substitution has the desired effect, as a generation identifier in the
variable name may appear anywhere in a name-value pair.

IMO, your approach has great promise, once I solve the problem with the
dropped "G" in the replacement.

Thanks for your suggestions, Benjamin.

Bill Segraves
Auburn, AL






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

Date: 28 Nov 2001 09:47:27 -0800
From: genericax@hotmail.com (Sara)
Subject: Re: what's a CHUNK?
Message-Id: <776e0325.0111280947.677cee31@posting.google.com>

Robert Sherman <rsherman@ce.gatech.edu.SPAMBLOCK> wrote in message news:<9u1hgo$bd6$1@news-int.gatech.edu>...
> In article <776e0325.0111271756.120bc6e2@posting.google.com>, Sara wrote:
> > Got this..
> > 
> > Use of uninitialized value at ./procex.pl line 105, <IN> chunk 11.
> > 	main::export_recx ('HASH(0x821d890)') called at ./procex.pl line
> > 
> > 
> > [tux@tuxy ~]$ perldoc -q chunk
> > No documentation for perl FAQ keyword `chunk' found
> > 
> > looked in Camel index under "Chunk", no entry
> > 
> > Use of uninitialized value at ./process_mem.pl line 105, <IN> chunk
> > 11.
> > 	main::export_freeuser('HASH(0x821d890)') called at ./process_mem.pl
> > line
> > 
> > does chunk 11 mean the 11th hash element if I was to do a keys %hash?
> > Since hashes are not ordered I'm uncertain what info this chunk
> > thingie tells me!
> > 
> > Thanks,
> > GX
> 
> a quick search of groups.google.com will turn up the following thread:
> Documentation: What is a chunk - exactly? 
> go check it out...

Nevermind the previous guy answered the actual question instead of
forking, and with about the same amount of energy..

Cheers!
GX


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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.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.

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 V10 Issue 2229
***************************************


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