[23280] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5500 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Sep 14 03:05:51 2003

Date: Sun, 14 Sep 2003 00:05:09 -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           Sun, 14 Sep 2003     Volume: 10 Number: 5500

Today's topics:
    Re: $SIG{__DIE__} doesn't make sense when using CGI::Ca (David)
        equivalent of php function decbin (Thomas Theakanath)
    Re: equivalent of php function decbin <ict@eh.org>
    Re: killfiling (was Re: Perl DBMS) <krahnj@acm.org>
    Re: killfiling (was Re: Perl DBMS) <ge0rge@Talk21.com>
    Re: Matching { } braces ??? <NoSpamPlease@bellsouth.net>
        Modifying a HP/GL2 output file using Perl <shemond@hotmail.com>
    Re: Modifying a HP/GL2 output file using Perl <bwalton@rochester.rr.com>
        Outlook Address Books and Perl? <nospam@thanksanyway.org>
        Pattern Match Question.. <NoSpamPlease@bellsouth.net>
    Re: Pattern Match Question.. <krahnj@acm.org>
    Re: readline() on closed fielhandle? (Tad McClellan)
    Re: readline() on closed fielhandle? (Jay Tilton)
        s/$pattern_to_match/$pattern_to_replace/ -- how can i u (Mithras)
    Re: s/$pattern_to_match/$pattern_to_replace/ -- how can (Jay Tilton)
        Send email using Perl <ningli2000@worldnet.att.net>
    Re: Send email using Perl <spam@thecouch.homeip.net>
        Sendmail::Milter to remove headers <danny@lennon.postino.com>
    Re: system call question (Tad McClellan)
    Re: system call question <ebohlman@earthlink.net>
    Re: system call question <krahnj@acm.org>
    Re: system call question <trammell+usenet@hypersloth.invalid>
    Re: system call question <no-email-please@defunked.net>
    Re: variable-width negative look-behind emulation <pinyaj@rpi.edu>
    Re:  <bwalton@rochester.rr.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 13 Sep 2003 20:52:00 -0700
From: dz1976@hotmail.com (David)
Subject: Re: $SIG{__DIE__} doesn't make sense when using CGI::Carp
Message-Id: <c27dfcf4.0309131952.332067f1@posting.google.com>

Jo Oberman <johanoberm@gmx.de> wrote in message news:<p8b4mv4k3mmqno0p02139v63f0m9shig7c@4ax.com>...
> Me and my cgi-script have the following problem.
> 
> I'm using the package CGI::Carp (which installs internally some
> $SIG{__DIE___} handlers).

this is only partly true. CGI::Carp only overwrites $SIG{__DIE__} if
you use 'fatalsToBrowser'. check the source (inside the import()
function) of CGI::Carp to see what i mean.

> In addition my script defines an own handler methods for
> $SIG{__DIE__}.
> 
> My suggestion was, that my definition is "overwritting" the defintion
> of CGI::Carp.
> But that doesn't seem to be right.
> 
> Here is my example:
> 
> Perl-Skript:
> ---------------
> use CGI::Carp;
>  
>  $SIG{__DIE__} = \&myDie;
>  sub myDie {
>     print "<b>ERROR-Message: $_[0]</b>";
>  }
> eval {     
>   print "Content-type: text/html\n\n";
>  print "Just some text<br>";
>  
>  die "I'm dying. Please help!";
>  
>  print "some text never shown";
> };
> 
> 
> When running the skript I get the following message (notice the wrong
> module and line number)
> 
> Just some text
> ERROR-Message: I'm dying. Please help! at
> d:/dev_soft/apache/Perl/lib/CGI/Carp.pm line 301.
> 
> 
> So it seems that the CGI:Carp definition of $SIG{__DIE__} is somewhat
> alive. It is called before my own signal-handler is activated.
> 
> What is the way to undo the CGI::Carp handler definitions?

technically, you can't. because CGI::Carp does its magic by
overwritting the global die function with:

*CORE::GLOBAL::die = \&CGI::Carp::die;

once this is done, you can never get back the real die function.
CGI::Carp does store the global die function inside one of its
function named realdie().

> Just wanna know 1.) why CGI::Carp::die handler is still active when I
> overwrite it with my own handler and 

your $SIG{__DIE__} handler is still active and CGI::Carp never
overwrites your handler. it's just that your die() function never
really reach the global die function anymore so your handler is never
called. the die function you call in your script goes to
CGI::Carp::die which does not involve your handler.

> 2.) how I can prevent it? 

you can't but you can fake it by saying:

use CGI::Carp;
use subs qw(die);

and then provide your own version of die instead:

sub die{
   #--
   #-- do whatever you want to do here.
   #--
   exit(1);
}

die "now this goes to the above die function instead, not
CGI::Carp::die\n";

you can, of course, hack the CGI::Carp code yourself to prevent that
from happening but are you sure you don't think CGI::Carp is doing the
Right Thing?


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

Date: 13 Sep 2003 17:45:34 -0700
From: thomastk@hotmail.com (Thomas Theakanath)
Subject: equivalent of php function decbin
Message-Id: <78b857d2.0309131645.5c38f187@posting.google.com>

Perl-php gurus,

I need to port a php program to Perl and wonder the equivalent of
decbin function in PHP could be the following:

sub decbin  {
   my $num=shift;
   my $str = unpack("b*",pack("N",$num));
   return $str;
}

Regards
Thomas.


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

Date: 14 Sep 2003 12:24:06 +1000
From: Iain Truskett <ict@eh.org>
Subject: Re: equivalent of php function decbin
Message-Id: <slrnbm7kpt.msa.ict@gytha.anu.edu.au>

* Thomas Theakanath <thomastk@hotmail.com>:
> I need to port a php program to Perl and wonder the
> equivalent of decbin function in PHP could be the
> following:

perlfaq4 - "How do I convert between numeric representations/bases/radixes?"

http://faq.perl.org/perlfaq4.html#How_do_I_convert_bet


The FAQ is worth a good read through so you have an idea of
what is in it.


cheers,
-- 
Iain.


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

Date: Sat, 13 Sep 2003 22:42:05 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: killfiling (was Re: Perl DBMS)
Message-Id: <3F639D2D.726F862A@acm.org>

Tad McClellan wrote:
> 
> ge0rge <ge0rge@Talk21.com> wrote:
> 
> > (murmuring to myself - bloody hell! what the matter with these yanks? Is
> > their sense of humour really that different?)
> 
> No, it's just that we don't _have_ a sense of humour.
> 
> We have a sense of humor.
> 
> We're saving some vowels for a "rainy day".

Well, _some_ of us have a sense of humour, we're not all from the U.S.A.

> With a carefully tuned killfile, I'll still be answering _some_
> questions, rather than zero answers with the alternative.

You are being _way_ too modest Tad.  According to the stats posted here
you have an interesting definition of _some_.

:-)

John
-- 
use Perl;
program
fulfillment


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

Date: Sun, 14 Sep 2003 02:14:35 +0100
From: "ge0rge" <ge0rge@Talk21.com>
Subject: Re: killfiling (was Re: Perl DBMS)
Message-Id: <bk0fe4$nkr8p$1@ID-175222.news.uni-berlin.de>

<OT>
"John W. Krahn" <krahnj@acm.org> wrote in message
news:3F639D2D.726F862A@acm.org...
> Tad McClellan wrote:
 ...
> > No, it's just that we don't _have_ a sense of humour.
> > We have a sense of humor.
> > We're saving some vowels for a "rainy day".

Tad, that's the spirit! and no smiley required. I either get it or I don't.

 ...
> You are being _way_ too modest Tad.  According to the stats posted here
> you have an interesting definition of _some_.

I can see that too and that is enough to earn my admiration. However, my
suspicion about different sense of humour is confirmed - he snipped the bit
about my pretend hesitancy when calling him nuts and gave me a straight
explanation. So, I'm going to explain it to the yanks (note - yanks is
almost affectionate not a derogatory term) - are you nuts = hey I can't do
what you are asking, it's too long, too complicated or whatever. It does not
mean that I literally think you are nuts (though you may well be!).

Phew, all this explaining is mentally draining. So, first thing to-morrow,
I'm off for a good knock-up on the squash court. I'll make it last at least
half an hour. Do I see wry smiles from the yanks?

ge0rge  (positively my last post on this thread)
--
Let me put it this way: today is going to be a learning experience.




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

Date: Sat, 13 Sep 2003 18:44:14 -0400
From: "Rodney" <NoSpamPlease@bellsouth.net>
Subject: Re: Matching { } braces ???
Message-Id: <I1N8b.2000$KN1.198@bignews2.bellsouth.net>

Thanks all.

I found the problem.  It was a faulty set of braces that "I" did... not a
PERL issue.

I made the mistake of writing a lot of code without testing it as I went
along.  I was starting to get that "this will never work" feeling.... but I
couldn't stop writing because I had to get the code out of my head.

As I suspected.... deep in the bowels of that code was errant syntax.

I ended up having to REM out everything... then add it back in... 1 piece at
a time, until it blew up.

I lesson I "thought" I learned several times before.  :(

Thanks again for your help.
-- 
 ...
    `·.¸¸.·´¯`·.¸¸.·´¯`·->  rodney




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

Date: Sat, 13 Sep 2003 22:34:17 -0400
From: Steve Hemond <shemond@hotmail.com>
Subject: Modifying a HP/GL2 output file using Perl
Message-Id: <bmQ8b.12436$fC5.1666237@news20.bellglobal.com>

Hi gurus,

I read some docs about Perl and I think it would be the best language to
suit my acutal need.

I have to change plotter pen widths from an HP/GL2 output file with specific
widths. An HP/GL2 is a plain-text file filled with plotter commands. The
one I need to check are :
PSx (where x = pen number) = PEN SELECT
PWx (where x = width) = PEN WIDTH

In that kind of file, you will see PS1 followed by a bunch of coordinates
and stuff. From there you can see that every command after the PS1 is for
the PEN NUMBER ONE. I have to check where the PW is, and affect a new width
right after it. I have to do this to all pens. I already know which width
goes for each pen. My problem is that the number of caracters between each
PSx and PWx are different from time to time.

Unless anyone has a better idea it would probably need to read the file byte
per byte, and when a PSx is read, the program will remember the current
pen, and when reaching the next PWx, it will affect the corresponding width
for the current pen.

Is there an quick and effective way to do such kind of things with Perl?
From what I've read, I can make a Perl script read a file LINE by LINE but
I don't know about reading byte per byte.

Any ideas?

Thanks in advance,

Steve


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

Date: Sun, 14 Sep 2003 03:50:52 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Modifying a HP/GL2 output file using Perl
Message-Id: <3F63E598.5030703@rochester.rr.com>

Steve Hemond wrote:

> Hi gurus,
> 
> I read some docs about Perl and I think it would be the best language to
> suit my acutal need.
> 
> I have to change plotter pen widths from an HP/GL2 output file with specific
> widths. An HP/GL2 is a plain-text file filled with plotter commands. The
> one I need to check are :
> PSx (where x = pen number) = PEN SELECT
> PWx (where x = width) = PEN WIDTH
> 
> In that kind of file, you will see PS1 followed by a bunch of coordinates
> and stuff. From there you can see that every command after the PS1 is for
> the PEN NUMBER ONE. I have to check where the PW is, and affect a new width
> right after it. I have to do this to all pens. I already know which width
> goes for each pen. My problem is that the number of caracters between each
> PSx and PWx are different from time to time.
> 
> Unless anyone has a better idea it would probably need to read the file byte
> per byte, and when a PSx is read, the program will remember the current
> pen, and when reaching the next PWx, it will affect the corresponding width
> for the current pen.
> 
> Is there an quick and effective way to do such kind of things with Perl?
> From what I've read, I can make a Perl script read a file LINE by LINE but
> I don't know about reading byte per byte.
> 
> Any ideas?


Unless your files are huge (>10 Mb), you should probably slurp them into 
a string, operate on the string with a well-crafted substitution, and 
write it out again.  Perhaps something like:

use strict;
use warnings;
my $in;
my %width=(1=>3,2=>8,3=>5); # pen number => width
{local $/;$in=<DATA>;}
$in=~s/PS(\d+)(.*?)PW(\d+)/"PS$1$2PW".$width{$1}/egs;
print $in;
__END__
xxxPS1blahblahPW13blahblahPS2blahPW1blahPS3blahPW2etcetc
and some more PS1 blah PW123 blah blah blah

That outputs:

D:\junk>perl junk363.pl
xxxPS1blahblahPW3blahblahPS2blahPW8blahPS3blahPW5etcetc
and some more PS1 blah PW3 blah blah blah

D:\junk

The above requires that there be no whitespace between the PS and the 
digit follow, and the same for the PW field.  It also assumes there will 
be only one PW field following a given PS field (if there could be more 
than one, something slightly fancier would be needed).  Note that if you 
neglect to assign a given pen a width value, the corresponding PW field 
will not have a digit.


 ...


> Steve

-- 
Bob Walton



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

Date: Sat, 13 Sep 2003 21:18:17 -0700
From: "Mark" <nospam@thanksanyway.org>
Subject: Outlook Address Books and Perl?
Message-Id: <sr6dnfUu84Wbcf6iXTWc-g@speakeasy.net>

Are there any modules available that can read and/or write address books for
Microsoft Outlook or Outlook Express? I couldn't find what I need on CPAN.

Thanks
-Mark




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

Date: Sat, 13 Sep 2003 18:35:50 -0400
From: "Rodney" <NoSpamPlease@bellsouth.net>
Subject: Pattern Match Question..
Message-Id: <OVM8b.1986$KN1.1898@bignews2.bellsouth.net>

I want to replace all instances of the combination of   \"  with  \&quot;

Using the Regex code below, I end up replacing ALL  "  with  &guot;  and all
\"  with  \&guot;
How can I make it ONLY replace the combination of  \" ?

$TextBlockToConvert =~ s/\"/\quot;/g;

NOTE:
The combination of  \"  may or may not have other characters butting up
against either or both sides of it.


Thanks,
-- 
 ...
    `·.¸¸.·´¯`·.¸¸.·´¯`·->  rodney




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

Date: Sat, 13 Sep 2003 22:49:45 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Pattern Match Question..
Message-Id: <3F639EF9.2DDE4F85@acm.org>

Rodney wrote:
> 
> I want to replace all instances of the combination of   \"  with  \&quot;
> 
> Using the Regex code below, I end up replacing ALL  "  with  &guot;  and all
> \"  with  \&guot;
> How can I make it ONLY replace the combination of  \" ?
> 
> $TextBlockToConvert =~ s/\"/\quot;/g;

The backslash character is special in double quoted strings so you have
to escape it if you want a literal backslash character.

$TextBlockToConvert =~ s/\\"/&quot;/g;



John
-- 
use Perl;
program
fulfillment


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

Date: Sat, 13 Sep 2003 17:04:05 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: readline() on closed fielhandle?
Message-Id: <slrnbm752l.3u7.tadmc@magna.augustmail.com>

Geoff Cox <geoff.cox@blueyonder.co.uk> wrote:

> would you recommend any program which automates the
> formatting?


vi or emacs


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Sat, 13 Sep 2003 22:42:36 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: readline() on closed fielhandle?
Message-Id: <3f639c37.3722755@news.erols.com>

Geoff Cox <geoff.cox@blueyonder.co.uk> wrote:

: On Sat, 13 Sep 2003 20:51:28 GMT, tiltonj@erols.com (Jay Tilton)
: wrote:

: >Win98 will also say "Permission denied" when your program tries to open
: >a directory as if it is a file.
: 
: the email addresses are in files which are in a folder with no
: sub-folders so it cannot be this, can it?

Instead of asking me, ask your program to give you that information.

    find ( sub {
        if( -d $_ ) {
            warn "'$_' is a subdirectory.\n";
            return;
        }
        # rest of subroutine goes here
     }, $dir);



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

Date: 13 Sep 2003 21:34:06 -0700
From: mybulkmail@myrealbox.com (Mithras)
Subject: s/$pattern_to_match/$pattern_to_replace/ -- how can i use matched expressions?
Message-Id: <59c108c9.0309132034.79366359@posting.google.com>

Hi all,

I want to use the substitution operator with variables rather than
string literals -- no problem, right?

My problem comes when I try to use the $1, $2, etc. variables to refer
to the matched expressions.
For example:

$pattern_to_match = 'I am (.*)';
$pattern_to_replace = 'You are $1';
$line =~ s/$pattern_to_match/$pattern_to_replace/g;

For example, if $line contains 'I am green', I want it to be replace
with 'You are green'.
However, the code fragment above would result in 'You are ' -- the $1
variable doesn't work as the match substitution...

Can anyone help me out?
I realize I may be able to work something out with the s///e option,
but this looks a little too complex for what I want to do.

TIA


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

Date: Sun, 14 Sep 2003 06:05:23 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: s/$pattern_to_match/$pattern_to_replace/ -- how can i use matched expressions?
Message-Id: <3f64035b.30131027@news.erols.com>

mybulkmail@myrealbox.com (Mithras) wrote:

: I want to use the substitution operator with variables rather than
: string literals -- no problem, right?
: 
: My problem comes when I try to use the $1, $2, etc. variables to refer
: to the matched expressions.
: For example:
: 
: $pattern_to_match = 'I am (.*)';
: $pattern_to_replace = 'You are $1';

Don't let yourself call the replacement string a "pattern."
Badly named variables will only bring confusion.

: $line =~ s/$pattern_to_match/$pattern_to_replace/g;
: 
: For example, if $line contains 'I am green', I want it to be replace
: with 'You are green'.
: However, the code fragment above would result in 'You are ' -- the $1
: variable doesn't work as the match substitution...
: 
: Can anyone help me out?
: I realize I may be able to work something out with the s///e option,
: but this looks a little too complex for what I want to do.

Not all that complex.

    my $pattern_to_match = 'I am (.*)';
    my $string_to_replace = '"You are $1"';
    my $line = 'I am green';
    $line =~ s/$pattern_to_match/$string_to_replace/eeg;
    print $line;



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

Date: Sun, 14 Sep 2003 01:02:32 GMT
From: "Ning li" <ningli2000@worldnet.att.net>
Subject: Send email using Perl
Message-Id: <I6P8b.140824$3o3.10064623@bgtnsc05-news.ops.worldnet.att.net>

Hi,

   I am new to Perl and I would like to know the Perl equivalent of this
Unix mail command:

     mailx -s "My Subject Here" jdoe@mail.com < my_file_name

 Thanks in advance.

 Nick Li






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

Date: Sat, 13 Sep 2003 23:02:36 -0400
From: Mina Naguib <spam@thecouch.homeip.net>
Subject: Re: Send email using Perl
Message-Id: <aTQ8b.105439$0_5.2437248@weber.videotron.net>

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1

Ning li wrote:
> Hi,
> 
>    I am new to Perl and I would like to know the Perl equivalent of this
> Unix mail command:
> 
>      mailx -s "My Subject Here" jdoe@mail.com < my_file_name

system qq|mailx -s "My Subject Here" jdoe@mail.com < my_file_name|;

or

`mailx -s "My Subject Here" jdoe@mail.com < my_file_name`;

or

open (FH, "| mailx") or die . .;
print to FH

or the best, perl-ish way :

perldoc Net::SMTP

Best of luck.


-----BEGIN xxx SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQE/Y9pMeS99pGMif6wRAggqAKCLN9K5lM5fzboinKZpr9WrymPeBgCgjBhT
wcLgZCyIeLgdcTK2tCyIaF8=
=EVL3
-----END PGP SIGNATURE-----



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

Date: Sat, 13 Sep 2003 22:13:55 GMT
From: "Danny Aldham" <danny@lennon.postino.com>
Subject: Sendmail::Milter to remove headers
Message-Id: <DEM8b.144441$la.3049995@news1.calgary.shaw.ca>

I am trying to use the Sendmail::Milter module to remove a
Disposition-Notification-To header from email messages. The man pages
suggest that:
if ($headerf eq "Disposition-notification-to") {
                print "Found $headerf  to $headerv \n";
                $ctx -> chgheader($headerf,0,"") || warn "Error on 0 $! \n"
;
                $ctx -> chgheader($headerf,1,"") || warn "Error on 1 $! \n"
;
                print "CTX is $ctx \n";
        return SMFIS_CONTINUE;
}

this code should work. But I get an Error on 0 and 1, with no code returned.
I have tried setting $headerv = "" but also with no joy.
Has anyone any successful experience removing headers with this module?

Danny Aldham




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

Date: Sat, 13 Sep 2003 17:06:53 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: system call question
Message-Id: <slrnbm757t.3u7.tadmc@magna.augustmail.com>

J. Smith <noemailplease@defunked.net> wrote:

> system("$bfish") or warn ("$!");
         ^      ^           ^  ^
         ^      ^           ^  ^

   perldoc -q vars

      What's wrong with always quoting "$vars"?


system($bfish) or warn($!);


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: 13 Sep 2003 22:45:08 GMT
From: Eric Bohlman <ebohlman@earthlink.net>
Subject: Re: system call question
Message-Id: <Xns93F5B60D2EA48ebohlmanomsdevcom@130.133.1.4>

"J. Smith" <noemailplease@defunked.net> wrote in 
news:vm744i46nl3h6b@corp.supernews.com:

> If I call an external program like so:
> system("$bfish") or warn ("$!");
> # Everything is ok
> 
> But when I pass parameters like so:
> system("$bfish","/E","/I:$file","/O:$file.fish","/Q","/P:$bfishpwd") or
> warn("$!");
> # I get the "Warning: Something's wrong ....", but it still works.

That means that the external program is returning a non-zero exit status in 
the second case, but not the first.  To find out why, you need to determine 
the exit status you're getting (perldoc -f system will tell you how) and 
then find out what the external program means by it.

Since system() doesn't set $!, the text of the warning you print is going 
to be meaningless and misleading.


> 
> If I use die instead of warn, the program obviously dies.
> So can someone tell me what's going on?
> 
> I get a warning, but it still works.
> Am I passing parameters the wrong way?
> 
> I'm running WinXP pro.
> 
> Thanks.
> 
> 



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

Date: Sat, 13 Sep 2003 22:46:12 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: system call question
Message-Id: <3F639E24.9EA1E5C8@acm.org>

"J. Smith" wrote:
> 
> If I call an external program like so:
> system("$bfish") or warn ("$!");
> # Everything is ok
> 
> But when I pass parameters like so:
> system("$bfish","/E","/I:$file","/O:$file.fish","/Q","/P:$bfishpwd") or
> warn("$!");
> # I get the "Warning: Something's wrong ....", but it still works.
> 
> If I use die instead of warn, the program obviously dies.
> So can someone tell me what's going on?
> 
> I get a warning, but it still works.
> Am I passing parameters the wrong way?

If you read the documentation for the system function you will see that
it DOES NOT return true on success and false on failure as you seem to
assume.

perldoc -f system


John
-- 
use Perl;
program
fulfillment


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

Date: Sat, 13 Sep 2003 22:45:54 +0000 (UTC)
From: "John J. Trammell" <trammell+usenet@hypersloth.invalid>
Subject: Re: system call question
Message-Id: <slrnbm77h2.ia5.trammell+usenet@hypersloth.el-swifto.com.invalid>

On Sat, 13 Sep 2003 16:48:05 -0500, J. Smith <noemailplease@defunked.net> wrote:
> If I call an external program like so:
> system("$bfish") or warn ("$!");
> # Everything is ok
> 
> But when I pass parameters like so:
> system("$bfish","/E","/I:$file","/O:$file.fish","/Q","/P:$bfishpwd") or
> warn("$!");
> # I get the "Warning: Something's wrong ....", but it still works.
> 
> If I use die instead of warn, the program obviously dies.
> So can someone tell me what's going on?
> 

Read "perldoc -f system", paying close attention to system()'s return
value.  And what's with all the useless quotes?  Those things don't
grow on trees ya know!



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

Date: Sat, 13 Sep 2003 21:42:35 -0500
From: "J. Smith" <no-email-please@defunked.net>
Subject: Re: system call question
Message-Id: <vm7lcnm01djg52@corp.supernews.com>


Thank you Eric.
All is well now. No more warnings.
Super!!

"Eric Bohlman" <ebohlman@earthlink.net> wrote in message
news:Xns93F5B60D2EA48ebohlmanomsdevcom@130.133.1.4...
> "J. Smith" <noemailplease@defunked.net> wrote in
> news:vm744i46nl3h6b@corp.supernews.com:
>
> > If I call an external program like so:
> > system("$bfish") or warn ("$!");
> > # Everything is ok
> >
> > But when I pass parameters like so:
> > system("$bfish","/E","/I:$file","/O:$file.fish","/Q","/P:$bfishpwd") or
> > warn("$!");
> > # I get the "Warning: Something's wrong ....", but it still works.
>
> That means that the external program is returning a non-zero exit status
in
> the second case, but not the first.  To find out why, you need to
determine
> the exit status you're getting (perldoc -f system will tell you how) and
> then find out what the external program means by it.
>
> Since system() doesn't set $!, the text of the warning you print is going
> to be meaningless and misleading.
>
>
> >
> > If I use die instead of warn, the program obviously dies.
> > So can someone tell me what's going on?
> >
> > I get a warning, but it still works.
> > Am I passing parameters the wrong way?
> >
> > I'm running WinXP pro.
> >
> > Thanks.
> >
> >
>




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

Date: Sat, 13 Sep 2003 22:01:48 -0400
From: Jeff 'japhy' Pinyan <pinyaj@rpi.edu>
Subject: Re: variable-width negative look-behind emulation
Message-Id: <Pine.SGI.3.96.1030913220055.85446A-100000@vcmr-64.server.rpi.edu>

On 13 Sep 2003, Xavier Noria wrote:

>I was playing with variable-width negative look-behind emulation and
>worked out this regexp that supports assertions about substrings of
>the pre-match:
>
>    /^.*(??{ index($&,"foo") == -1 ? "" : "(?!)" })bar/
>
>That matches "bar" if it is not preceded at any point by "foo". I know
>that can be achieved by reverse + negative look-ahead but this has to
>be considered an exercise (that comes from a question in freenode#perl
>that required a single regexp to solve the problem).

You could use

  /^(?:[^f]*|f+(?!f|oo))*bar/;

-- 
Jeff Pinyan            RPI Acacia Brother #734            2003 Rush Chairman
"And I vos head of Gestapo for ten     | Michael Palin (as Heinrich Bimmler)
 years.  Ah!  Five years!  Nein!  No!  | in: The North Minehead Bye-Election
 Oh.  Was NOT head of Gestapo AT ALL!" | (Monty Python's Flying Circus)



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

Date: Sat, 19 Jul 2003 01:59:56 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: 
Message-Id: <3F18A600.3040306@rochester.rr.com>

Ron wrote:

> Tried this code get a server 500 error.
> 
> Anyone know what's wrong with it?
> 
> if $DayName eq "Select a Day" or $RouteName eq "Select A Route") {

(---^


>     dienice("Please use the back button on your browser to fill out the Day
> & Route fields.");
> }
 ...
> Ron

 ...
-- 
Bob Walton



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

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


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