[19014] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1209 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jun 28 09:05:31 2001

Date: Thu, 28 Jun 2001 06:05:13 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <993733512-v10-i1209@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 28 Jun 2001     Volume: 10 Number: 1209

Today's topics:
    Re: Automatic Perl upgrade via CPAN (Anno Siegel)
    Re: Case issue replacing a string with the contents of  (James Anderson)
    Re: command line news posting tools (Anno Siegel)
    Re: Communication error : Reason Bad file descriptor (David Efflandt)
    Re: expression match help <hafner-usenet@ze.tu-muenchen.de>
    Re: expression match help <christoph.neubauer@siemens.at>
        lvalue functions <goldbb2@earthlink.net>
        Overlapping regular expression results <pratt@biop.ox.ac.uk>
    Re: Overlapping regular expression results (Anno Siegel)
    Re: Overlapping regular expression results (Rafael Garcia-Suarez)
    Re: Overlapping regular expression results nobull@mail.com
    Re: Overlapping regular expression results (Bernard El-Hagin)
    Re: Overlapping regular expression results (Jay Tilton)
    Re: passing variables the 'right' way <sumus@aut.dk>
    Re: Starting Browser Windows <joe@bloggs.com>
    Re: system("cat ..) vs. print <christoph.neubauer@siemens.at>
    Re: system("cat ..) vs. print <christoph.neubauer@siemens.at>
    Re: system("cat ..) vs. print <christoph.neubauer@siemens.at>
    Re: Trouble with Text::ParseWords.pm (Anno Siegel)
    Re: truetype fonts in XEmacs <rovf@feriasonline.pt.invalid>
    Re: truetype fonts in XEmacs <o.moser@mobilkom.at>
    Re: truetype fonts in XEmacs (Bernard El-Hagin)
    Re: truetype fonts in XEmacs <o.moser@mobilkom.at>
    Re: Unix filepath completion within perl? <george.stevens@baesystems.com>
    Re: using System() and exec() (Villy Kruse)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 28 Jun 2001 09:47:33 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Automatic Perl upgrade via CPAN
Message-Id: <9heufl$q7j$4@mamenchi.zrz.TU-Berlin.DE>

According to Christopher Shannon <cshannon@data2design.com>:
> Nowadays whenever I try to install some modules or bundles via the CPAN
> shell, like Bundle::libnet for instance, the CPAN interactive shell starts
> downloading and installing Perl 5.6!!  I just want the bundle, not a new
> version of Perl.
> 
> Has anyone out there made a workaround for this?  Or do we "HAVE" to upgrade
> if we want to live in peace with the CPAN shell?

No, this is a bug in an earlier version of CPAN.pm.  Get the newest
version and install it manually (i.e. not using your current CPAN).

Anno


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

Date: 28 Jun 2001 02:19:22 -0700
From: james.2.anderson@bt.com (James Anderson)
Subject: Re: Case issue replacing a string with the contents of a variable.
Message-Id: <9c8d5c31.0106280119.24da7764@posting.google.com>

That got it, thanks all.

______________________________

  James Anderson
  BT Ignite Solutions
  Internal IT Support
  Network Change Coordinator
______________________________

Disclaimer:  The contents of this post are in no way affiliated with,
or written on behalf of, BT Ignite Solutions.


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

Date: 28 Jun 2001 09:05:20 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: command line news posting tools
Message-Id: <9hes0g$ll2$1@mamenchi.zrz.TU-Berlin.DE>

According to * Tong *  <sun_tong@users.sourceforge.net>:
> Philip Newton <pne-news-20010627@newton.digitalspace.net> writes:
> 
> > > - I test with a pipe command but it didn't work
> > > 
> > >  cat file | nntppost 
> > > 
> > > and neither is:
> > > 
> > >  cat file | nntppost -
> > 
> > a) "didn't work" is too vague. Did it cause your printer to shoot out
> > empty pages? Did it return an error message?
> 
> try it yourself and you can know exactly how it "didn't work"

No sir.  It's you who wants help, and it's your job to explain
why the proposed code doesn't work for you.  "Try it yourself"
is just snotty.

Moreover, the behavior of the little program may depend on lots
of conditions that depend on your setup.  It's a network program,
for one, and it will talk to different news servers when run by
different people.
 
> > b) My PSI::ESP module is not working. Showing us the code of the
> > 'nntppost' that you are using would help.
> 
> simple:
> 
> perl -Mstrict -MNet::NNTP <<'__END__' ${1+"$@"}
>     my $n = Net::NNTP->new("news");
>     my @article = <>;
>     $n->post(\@article) or die "Post error: $!";
>     $n->quit;
> __END__
> 
> Beside, also didn't work when test on command line: paste in some
> text, press ^d, nothing happened as if program was still waiting for
> something...

This is better, but still insufficient.

It may have been busy establishing an NNTP connection.  For me the
program returns after approximately 30 seconds.  How long have you
waited?

Anno


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

Date: Thu, 28 Jun 2001 08:00:56 +0000 (UTC)
From: see-sig@from.invalid (David Efflandt)
Subject: Re: Communication error : Reason Bad file descriptor
Message-Id: <slrn9jlp1m.pa1.see-sig@typhoon.xnet.com>

On Wed, 27 Jun 2001, DetUudslukkelige <nospam@notformail.com> wrote:
> Forgive me for asking again today, but this time the problem is very
> specific:
> 
> When I use my FormMail script (via SMTP) I allways get the error:
> Communication error : Reason Bad file descriptor
> 
> Below is the script. Anyone knows what I am doing wrong?

The problem does not appear to be connecting the socket, since that part
of the code works (rough as it is).  The problem may be something that the
SMTP server does not like.

The problem with the error message is that it does not really identify
what went wrong (error msg from smtp server) or where in the script (since
"Communication error" is on multiple lines).  And $! at that point just
tells you the result of closing a socket that was already closed for some
unknown reason (therefore "Bad file descriptor").

For one thing it may not like the "helo localhost" since that will not 
resolve to your internet IP.  But how are you going to know that?

In the following section change each instance of "Communication error" to 
something unique like "helo1 failed", "from1 failed", "data1 failed" using 
"helo2 failed", etc. for the autoresponder section.  Then in these and the 
"rcpt to" errors, include the smtp server response ($_).  For example:

  if (/^[45]/) { close SOCK; error ("helo1 error : Reason $_"); }

But only change the $! to $_ for lines that follow $_ = SOCK.

> }else{
>  socket(SOCK, AF_INET, SOCK_STREAM, $proto)  or error ("Socket operation
> failed : Reason $!");
>  connect(SOCK, pack('Sna4x8', AF_INET, $port, $smtpaddr)) or error
> ("Connection failed : Reason $!");
>  $oldfh = select(SOCK);
>  $| = 1; select($oldfh);$_ = <SOCK>;
>  if (/^[45]/) { close SOCK; error("Service not available : Reason $!"); }
>  print SOCK "helo localhost$CRLF"; $_ = <SOCK>;
>  if (/^[45]/) { close SOCK; error ("Communication error : Reason $!"); }
>  print SOCK "mail from: <", $email, ">$CRLF"; $_ = <SOCK>;
>  if (/^[45]/) { close SOCK; error ("Communication error : Reason $!"); }
>  foreach (split(/,/, $to)) {
>   (/<(.*)>/) ? print SOCK "rcpt to: $1$CRLF" : print SOCK "rcpt to:
><$_>$CRLF";
>   $_ = <SOCK>; if (/^[45]/) { close SOCK;error("Unknown user. Email address
> not valid"); }
>  }
>  print SOCK "data$CRLF";$_ = <SOCK>;
>  if (/^[45]/) { close SOCK; error("Communication error : Reason $!"); }
>  print SOCK "To: $toemail",      $CRLF;
>  print SOCK "From: $efrom",$CRLF;
>  print SOCK "Cc: $ccopy\n", if ($ccopy);
>  print SOCK "X-Mailer: Email manager (http://www.mycgiscripts.com/)$CRLF";
>  print SOCK "Subject: $subject",$CRLF,$CRLF;
>  $message  =~ s/\r//g;
>  $message  =~ s/\n/$CRLF/g;
>  print SOCK $etext;
>  print SOCK $CRLF, '.', $CRLF;$_ = <SOCK>;
>  if (/^[45]/) { close SOCK;error("Transfer failed : Reason $!"); }
>  print SOCK "quit", $CRLF;$_ = <SOCK>;close SOCK;
> 
> 
> if ($autoresponder) {
> 
>  socket(SOCK, AF_INET, SOCK_STREAM, $proto)  or error("Socket operation
> failed : Reason $!");
>  connect(SOCK, pack('Sna4x8', AF_INET, $port, $smtpaddr)) or
> error("Connection failed : Reason $!");
>  $oldfh = select(SOCK);
>  $| = 1; select($oldfh);$_ = <SOCK>;
>  if (/^[45]/) { close SOCK; error("Service not available : Reason $!"); }
>  print SOCK "helo localhost$CRLF"; $_ = <SOCK>;
>  if (/^[45]/) { close SOCK; error("Communication error : Reason $!"); }
>  print SOCK "mail from: <", $email, ">$CRLF"; $_ = <SOCK>;
>  if (/^[45]/) { close SOCK; error("Communication error : Reason $!"); }
>  foreach (split(/,/, $to)) {
>   (/<(.*)>/) ? print SOCK "rcpt to: $1$CRLF" : print SOCK "rcpt to:
><$_>$CRLF";
>   $_ = <SOCK>; if (/^[45]/) { close SOCK;error("Unknown user. Email address
> not valid"); }
>  }
>  print SOCK "data$CRLF";$_ = <SOCK>;
>  if (/^[45]/) { close SOCK; error("Communication error : Reason $!"); }
>  print SOCK "To: $efrom",      $CRLF;
>  print SOCK "From: $toemail",$CRLF;
>  print SOCK "X-Mailer: Email manager (http://www.mycgiscripts.com/)$CRLF";
>  print SOCK "Subject: $subject",$CRLF,$CRLF;
>  $aresp  =~ s/\r//g;
>  $aresp  =~ s/\n/$CRLF/g;
>  print SOCK $aresp;
>  print SOCK $CRLF, '.', $CRLF;$_ = <SOCK>;
>  if (/^[45]/) { close SOCK;error("Transfer failed : Reason $!"); }
>  print SOCK "quit", $CRLF;$_ = <SOCK>;close SOCK;
> 
> 
> }
> 
> 
> }

-- 
David Efflandt  (Reply-To is valid)  http://www.de-srv.com/
http://www.autox.chicago.il.us/  http://www.berniesfloral.net/
http://cgi-help.virtualave.net/  http://hammer.prohosting.com/~cgi-wiz/


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

Date: 28 Jun 2001 09:32:15 +0200
From: Walter Hafner <hafner-usenet@ze.tu-muenchen.de>
Subject: Re: expression match help
Message-Id: <srjhex1giv4.fsf@w3proj1.ze.tu-muenchen.de>

Greg Miller <greg_j_miller@agilent.com> writes:

> I want to match the expression below for "=" but *not* "==", "!=", or
> ">="
> 
> pcamsndt =((nlev==4)*cam4s+(nlev!=5)*cam5s+(nlev>=6)*cam6s)
> 
> I've come up with a few ugly expressions but I would like to have a more
> elegant way of doing it - any experts out there have a good way?

Hi!

Sorry, no advice from me, rather an additional question:

In cases like this I generally convert any "pesky" strings to sth else
and match with a simple expression, e.g. in this case:

$a = 'pcamsndt =((nlev==4)*cam4s+(nlev!=5)*cam5s+(nlev>=6)*cam6s)';
$b = $a;
$b =~ s/[=>!]=/_/g;
if ($b =~ /=/) { do_sth_with_original_expression($a) }

or sth. similar. I find this a LOT more readable than all the "look
behind", "look ahead" suggestions. :-)

I didn't benchmark this and the several suggestions, but is there sth
inherently "bad" about this solution?

-Walter


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

Date: Thu, 28 Jun 2001 11:27:19 +0200
From: Christoph Neubauer <christoph.neubauer@siemens.at>
Subject: Re: expression match help
Message-Id: <3B3AF877.572EAE17@siemens.at>

Walter Hafner wrote:

<snip>

> In cases like this I generally convert any "pesky" strings to sth else
> and match with a simple expression, e.g. in this case:
>
> $a = 'pcamsndt =((nlev==4)*cam4s+(nlev!=5)*cam5s+(nlev>=6)*cam6s)';
> $b = $a;
> $b =~ s/[=>!]=/_/g;
> if ($b =~ /=/) { do_sth_with_original_expression($a) }
>
> or sth. similar. I find this a LOT more readable than all the "look
> behind", "look ahead" suggestions. :-)
>
> <snip>

I agree.

Chr. Neubauer



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

Date: Thu, 28 Jun 2001 04:00:35 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: lvalue functions
Message-Id: <3B3AE423.EE74B6CE@earthlink.net>

Currently, perl has the :lvalue attribute to allow you to assign to a
subroutine call:

somescope: {
	my $private;
	sub func : lvalue { $private }
}

func = 4;

How difficult would it be to change perl to use a ruby-like syntax for
this?

somescope: {
	my $private;
	sub func  { $private }
	sub func= { $private = shift }
}

func = 4;

IMHO, seperate fetch and store methods make more sense than one single
function which has to stand in for both.

Maybe this wouldn't work to be put into perl5, but how about perl6?

-- 
The longer a man is wrong, the surer he is that he's right.


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

Date: Thu, 28 Jun 2001 11:57:08 +0100
From: David Pratt <pratt@biop.ox.ac.uk>
Subject: Overlapping regular expression results
Message-Id: <993726364.1463383801@news.ox.ac.uk>

Hi,

I'm trying to get _all_ the matches to a regular expression in my string
including the 'overlapping ones'.  For example :

If my string is

$seq = 'attctctctcggata'

and my reg-ex is /.ctctc/

i'd want to get both examples of tctctc, i.e. _tctctc_tc and tc_tctctc_.
the _'s indicating the found strings.

With (@found) = $seq =~ /($reg-ex)/g

@found only contains one example of tctctc, not two.

I wrote the following routing to get around this problem :

# Usage : find_all_possibles(_sequence_, _regular-expression_)
sub find_all_possibles() {
 
        my $search_seq = $_[0];
        my $reg_ex = $_[1];
 
        my $found;
        my @all_found;
 
        while ( ($found) = $search_seq =~ /($reg_ex)/)  {
                $found_at = index($search_seq, $found);
                push @all_found, $found;
                $search_seq = substr($search_seq, $found_at + 1);
        }
 
        return @all_found;
 
}       

but it's not very elegant.

Is there a way of getting at what I want with just regular expressions - i.e.
making the reg-ex start from where it found the nth occurance plus 1 character
instead of at the position + the length of the find?

I've read the perldocs on reg-ex's and searched google, but can't find what I
want.

Any help would be gratefully received.

Thanks

Dave


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

Date: 28 Jun 2001 11:43:35 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Overlapping regular expression results
Message-Id: <9hf597$3at$1@mamenchi.zrz.TU-Berlin.DE>

According to David Pratt  <pratt@biop.ox.ac.uk>:
> Hi,
> 
> I'm trying to get _all_ the matches to a regular expression in my string
> including the 'overlapping ones'.  For example :
> 
> If my string is
> 
> $seq = 'attctctctcggata'
> 
> and my reg-ex is /.ctctc/
> 
> i'd want to get both examples of tctctc, i.e. _tctctc_tc and tc_tctctc_.
> the _'s indicating the found strings.
> 
> With (@found) = $seq =~ /($reg-ex)/g
> 
> @found only contains one example of tctctc, not two.

[snippage]

A combination of pos() and \G (which are described in perlre) does
the trick:

    my $seq = 'attctctctcggata';

    my @found;
    while ( pos( $seq)++ < length( $seq) ) {
        push @found, $1 if $seq =~ /\G(.ctctc)/;
    }

You could even push [$1, pos( $seq)] onto the found list if you
want to record where the matches happened.

The upper limit in the loop could be reduced by the minimal length
of a match, but I won't go there.

Anno



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

Date: 28 Jun 2001 11:44:00 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: Overlapping regular expression results
Message-Id: <slrn9jm646.3b3.rgarciasuarez@rafael.kazibao.net>

David Pratt wrote in comp.lang.perl.misc:
} Hi,
} 
} I'm trying to get _all_ the matches to a regular expression in my string
} including the 'overlapping ones'.  For example :
} 
} If my string is
} 
} $seq = 'attctctctcggata'
} 
} and my reg-ex is /.ctctc/
} 
} i'd want to get both examples of tctctc, i.e. _tctctc_tc and tc_tctctc_.
} the _'s indicating the found strings.
} 
} With (@found) = $seq =~ /($reg-ex)/g
} 
} @found only contains one example of tctctc, not two.

You can use the pos() function. From perlfunc :

    Returns the offset of where the last "m//g" search left off for the
    variable in question [...] May be modified to change that offset.

Here's an example :

  #!/usr/local/bin/perl -lw
  use strict;
  my $seq = 'attctctctcggata';
  while ($seq =~ /(.ctctc)/g) {
    print pos($seq) - length($1), " : $1";
    pos($seq) -= length($1) - 1;
  }

And it outputs :
2 : tctctc
4 : tctctc

A probably better (but more complex, and less "flex-ible") approach is
to implement a fast search algorithm that will return all places where
the keyword "ctctc" is found in an input string without scanning it
backwards. I remember that Aho, Sethi and Ullman describe such an
algorithm in the Dragon Book, but I can't remember its name right now.
I'm sure that several regulars here see what I mean.

-- 
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
http://foldoc.doc.ic.ac.uk/foldoc/foldoc.cgi?query=dragon+book


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

Date: 28 Jun 2001 12:38:03 +0100
From: nobull@mail.com
Subject: Re: Overlapping regular expression results
Message-Id: <u9k81wzvfo.fsf@wcl-l.bham.ac.uk>

David Pratt <pratt@biop.ox.ac.uk> writes:

> If my string is
> 
> $seq = 'attctctctcggata'
> 
> and my reg-ex is /.ctctc/
>
> i'd want to get both examples of tctctc, i.e. _tctctc_tc and tc_tctctc_.
> the _'s indicating the found strings.
> 
> With (@found) = $seq =~ /($reg-ex)/g

$reg-ex is not a valid Perl variable name.  I'll assume you mean $regex.

> @found only contains one example of tctctc, not two.

my @found;
push @found => $1 while $seq =~ /(?=($regex))./g;

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Thu, 28 Jun 2001 12:00:10 +0000 (UTC)
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: Overlapping regular expression results
Message-Id: <slrn9jm6n2.112.bernard.el-hagin@gdndev25.lido-tech>

On Thu, 28 Jun 2001 11:57:08 +0100, David Pratt <pratt@biop.ox.ac.uk> wrote:
>Hi,
>
>I'm trying to get _all_ the matches to a regular expression in my string
>including the 'overlapping ones'.  For example :
>
>If my string is
>
>$seq = 'attctctctcggata'
>
>and my reg-ex is /.ctctc/
>
>i'd want to get both examples of tctctc, i.e. _tctctc_tc and tc_tctctc_.
>the _'s indicating the found strings.

push @found, $1 while $seq =~ /(?=(.ctctc))/g;

Cheers,
Bernard
--
perl -l54e's yyw q q tvmrx "h\ywx ersxliv zivp legoiv"qiy;y #a-zA-Z#d-gu-z#
chefghijklmnopqrstuvwxyzcJab-def-uPwxyzc;s j j s u u s t t s r r s
ppevalpereeteueje'


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

Date: Thu, 28 Jun 2001 12:37:07 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: Overlapping regular expression results
Message-Id: <3b3b186e.16912186@news.erols.com>

On Thu, 28 Jun 2001 11:57:08 +0100, David Pratt <pratt@biop.ox.ac.uk> wrote:

>I'm trying to get _all_ the matches to a regular expression in my string
>including the 'overlapping ones'.  For example :
>
>If my string is
>$seq = 'attctctctcggata'
>and my reg-ex is /.ctctc/
>i'd want to get both examples of tctctc, i.e. _tctctc_tc and tc_tctctc_.
>the _'s indicating the found strings.
[...]
>I wrote the following routing to get around this problem :
>
># Usage : find_all_possibles(_sequence_, _regular-expression_)
>sub find_all_possibles() {
                       ^^
Ditch the prototype.  It's not consistent with the arguments passed to the
sub. 

>    my $search_seq = $_[0];
>    my $reg_ex = $_[1];
>    my $found;
>    my @all_found;
>    while ( ($found) = $search_seq =~ /($reg_ex)/)  {
>        $found_at = index($search_seq, $found);

You don't need index().
The number you want is in $-[0].

>        push @all_found, $found;
>        $search_seq = substr($search_seq, $found_at + 1);
>    }
>    return @all_found;
>}       
>but it's not very elegant.

Oh, I dunno about that.  It's an inch away from some sexy recursion.

  sub recursive_find {
    my ($search_seq, $reg_ex) = @_;
    my @all_found;
    if ( (my $found) = $search_seq =~ /($reg_ex)/ ) {
      push @all_found, $found,
        recursive_find(substr($search_seq, $-[0] + 1), $reg_ex)
    }
    return @all_found;
  }

More simply, pos() lets you tell m//g where to pick up its search.

  sub pos_find {
    my ($search_seq, $reg_ex) = @_;
    my @all_found;
    while ( $search_seq =~ /($reg_ex)/g )  {
      push @all_found, $1;
      pos($search_seq) -= length($1) - 1;
    }
    return @all_found;
  }



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

Date: 28 Jun 2001 11:33:33 +0200
From: Jakob Schmidt <sumus@aut.dk>
Subject: Re: passing variables the 'right' way
Message-Id: <m28zidvthu.fsf@pocketlife.dk>

abigail@foad.org (Abigail) writes:

> Big difference now! It looks like list assignment is generally faster than
> doing all the separate lookups and scalar assignment. The one element list
> assignment is the exception that proves the rule.

Ok - it makes sense now, thanks.

This also saves me, since my $x = shift; as an idiom is still silly
then :-)

-- 
Jakob


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

Date: Thu, 28 Jun 2001 12:22:53 GMT
From: "Joe Bloggs" <joe@bloggs.com>
Subject: Re: Starting Browser Windows
Message-Id: <xkF_6.79869$XL1.1840970@nlnews00.chello.com>


"Jenda Krynicky" <Jenda@Krynicky.cz> wrote in message
news:1103_993652558@JENDA...
>
> Actualy
> system('start','iexplore.exe','http://localhost');
> should be all you need.

Actually I dunno where the start comes from, i.e.

system('C:\Program Files\Internet Explorer\IEXPLORE.EXE',
'http://localhost');




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

Date: Thu, 28 Jun 2001 11:35:20 +0200
From: Christoph Neubauer <christoph.neubauer@siemens.at>
Subject: Re: system("cat ..) vs. print
Message-Id: <3B3AFA58.31D2BFCD@siemens.at>

Armin Wenz wrote:

> <snip>

> After the Content-Type line I wanted to do a
> system ("cat $cert_file");
> and nothing happens
> <snip>

What happens, if you try:

(system ("cat $cert_file") == 0) or (die "$");

Chr. Neubauer




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

Date: Thu, 28 Jun 2001 11:40:01 +0200
From: Christoph Neubauer <christoph.neubauer@siemens.at>
Subject: Re: system("cat ..) vs. print
Message-Id: <3B3AFB71.18D617D8@siemens.at>



Christoph Neubauer wrote:

>
> What happens, if you try:
>
> (system ("cat $cert_file") == 0) or (die "$");

oops !
should be, of course:

(system ("cat $cert_file") == 0) or (die "$!");

>
>
> Chr. Neubauer



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

Date: Thu, 28 Jun 2001 14:17:31 +0200
From: Christoph Neubauer <christoph.neubauer@siemens.at>
Subject: Re: system("cat ..) vs. print
Message-Id: <3B3B205A.1E37398C@siemens.at>



Armin Wenz wrote:

> Christoph Neubauer wrote:
> > What happens, if you try:
> > (system ("cat $cert_file") == 0) or (die "$!");
>
> It works as well - everything's fine
> Can you explain it ?
>

No, sorry.

CN



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

Date: 28 Jun 2001 09:39:50 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Trouble with Text::ParseWords.pm
Message-Id: <9heu16$q7j$1@mamenchi.zrz.TU-Berlin.DE>

According to David Hutchins <david.j.hutchins@intel.com>:
> I can't get the ParseWords module work correctly, it always returns an empty
> array
> as shown in the debugging output below:
> ======================================
> main::update_ptf_file(h:/djhutchi/bin/cc_update_ptf.pl:204):
> 204:                            @words = &parse_line($delim, 0, $_);
>   DB<2> s
> Text::ParseWords::parse_line(C:/Perl/lib/Text/ParseWords.pm:54):
> 54:         my($delimiter, $keep, $line) = @_;
>   DB<2>
> Text::ParseWords::parse_line(C:/Perl/lib/Text/ParseWords.pm:55):
> 55:         my($quote, $quoted, $unquoted, $delim, $word, @pieces);
>   DB<2> p $delimiter
> |
>   DB<3> p $line
> :VALUE(OPT)   | TOLERANCE(OPT)   | POWER(OPT)   | JEDEC_TYPE(OPT)   |
> PART_NUMBER   | PACK_TYPE
>   DB<4> p $keep
> 0
>   DB<5> r
> list context return from Text::ParseWords::parse_line:
>   empty array
> ======================================
> I have tried changnig the delimiter to include quotes, set $keep to both 0 &
> 1, but nothing works :(
> Any hints?

The delimiter is interpreted as a regex, which means that "|" has
a special meaning.  Escape it as '\|' and all will be well.  Perhaps
it's best to provide a regex for the delimiter, then this becomes
much clearer:

    my @words = Text::ParseWords::parse_line( qr(\|), 0, $_);

Anno


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

Date: 28 Jun 2001 09:22:48 +0200
From: Ronald Fischer <rovf@feriasonline.pt.invalid>
Subject: Re: truetype fonts in XEmacs
Message-Id: <7qfels5rruf.fsf@demchh2msx.icn.siemens.de>

Oliver Moser <o.moser@mobilkom.at> writes:

> 	I know, the question isn't Perl specific, but I thought
> someone of you gurus might know how to use truetype fonts in XEmacs.

May I kindly ask you why you post this question in comp.lang.perl.misc,
and not in alt.acme.exploding.newsgroup or soc.atheism? Of course if
this does not bring you the responses you had hoped for, you could also
consider comp.emacs.xemacs as a last resort.

Ronald
-- 
To reduce spam in my inbox, the address given in the Reply-To: header is
not guaranteed to live longer than 1 month after the article was
posted. My permanent address is (after deleting the XXX): 
Ronald Otto Valentin Fischer <rovfXXX@operamail.com>


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

Date: Thu, 28 Jun 2001 10:33:13 +0200
From: Oliver Moser <o.moser@mobilkom.at>
Subject: Re: truetype fonts in XEmacs
Message-Id: <scqljtom6jck4d1dk8be9kdgc6f09sh3fa@4ax.com>

On 28 Jun 2001 09:22:48 +0200, Ronald Fischer
<rovf@feriasonline.pt.invalid> wrote:

>Oliver Moser <o.moser@mobilkom.at> writes:
>
>> 	I know, the question isn't Perl specific, but I thought
>> someone of you gurus might know how to use truetype fonts in XEmacs.
>
>May I kindly ask you why you post this question in comp.lang.perl.misc,
>and not in alt.acme.exploding.newsgroup or soc.atheism? Of course if
>this does not bring you the responses you had hoped for, you could also
>consider comp.emacs.xemacs as a last resort.
>
>Ronald

Hi Ronald,

	I am  sorry for posting an XEmacs question in a Perl NG, but I
already posted my problem in comp.emacs.xemacs 2 times, with no
response. I think  that many Perl programmers use XEmacs as the editor
of their choice, so I thought the chance to get a positive response
would not be that  bad.

regards,
	Oliver
 ------------------------------
Oliver Moser
mobilkom austria AG & Co. KG
IT://mob.app
Mobil: +43-664-331-2544
mailto:o.moser@mobilkom.at


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

Date: Thu, 28 Jun 2001 08:39:13 +0000 (UTC)
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: truetype fonts in XEmacs
Message-Id: <slrn9jlqud.112.bernard.el-hagin@gdndev25.lido-tech>

On Thu, 28 Jun 2001 10:33:13 +0200, Oliver Moser <o.moser@mobilkom.at> wrote:
>On 28 Jun 2001 09:22:48 +0200, Ronald Fischer
><rovf@feriasonline.pt.invalid> wrote:
>
>>Oliver Moser <o.moser@mobilkom.at> writes:
>>
>>> 	I know, the question isn't Perl specific, but I thought
>>> someone of you gurus might know how to use truetype fonts in XEmacs.
>>
>>May I kindly ask you why you post this question in comp.lang.perl.misc,
>>and not in alt.acme.exploding.newsgroup or soc.atheism? Of course if
>>this does not bring you the responses you had hoped for, you could also
>>consider comp.emacs.xemacs as a last resort.
>>
>>Ronald
>
>Hi Ronald,
>
>	I am  sorry for posting an XEmacs question in a Perl NG, but I
>already posted my problem in comp.emacs.xemacs 2 times, with no
>response. I think  that many Perl programmers use XEmacs as the editor
>of their choice, so I thought the chance to get a positive response
>would not be that  bad.

Many Perl programmers also use Head and Shoulders as their shampoo
of choice, but you wouldn't ask about hair care here, would you?

Cheers,
Bernard
--
perl -l54e's yyw q q tvmrx "h\ywx ersxliv zivp legoiv"qiy;y #a-zA-Z#d-gu-z#
chefghijklmnopqrstuvwxyzcJab-def-uPwxyzc;s j j s u u s t t s r r s
ppevalpereeteueje'


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

Date: Thu, 28 Jun 2001 10:56:33 +0200
From: Oliver Moser <o.moser@mobilkom.at>
Subject: Re: truetype fonts in XEmacs
Message-Id: <lkrljtsduscrsv4jv7ebqe6q4g43oi4ass@4ax.com>

On Thu, 28 Jun 2001 08:39:13 +0000 (UTC),
bernard.el-hagin@lido-tech.net (Bernard El-Hagin) wrote:

>On Thu, 28 Jun 2001 10:33:13 +0200, Oliver Moser <o.moser@mobilkom.at> wrote:
>>On 28 Jun 2001 09:22:48 +0200, Ronald Fischer
>><rovf@feriasonline.pt.invalid> wrote:
>>
>>>Oliver Moser <o.moser@mobilkom.at> writes:
>>>
>>>> 	I know, the question isn't Perl specific, but I thought
>>>> someone of you gurus might know how to use truetype fonts in XEmacs.
>>>
>>>May I kindly ask you why you post this question in comp.lang.perl.misc,
>>>and not in alt.acme.exploding.newsgroup or soc.atheism? Of course if
>>>this does not bring you the responses you had hoped for, you could also
>>>consider comp.emacs.xemacs as a last resort.
>>>
>>>Ronald
>>
>>Hi Ronald,
>>
>>	I am  sorry for posting an XEmacs question in a Perl NG, but I
>>already posted my problem in comp.emacs.xemacs 2 times, with no
>>response. I think  that many Perl programmers use XEmacs as the editor
>>of their choice, so I thought the chance to get a positive response
>>would not be that  bad.
>
>Many Perl programmers also use Head and Shoulders as their shampoo
>of choice, but you wouldn't ask about hair care here, would you?
>
>Cheers,
>Bernard

That's really a great comparison, but actually I expected a more
helpful answer, anyway. Maybe  you should do some statistics on the
favourite hygiene products of Perl programmers.

Prost,
Oliver

 ------------------------------
Oliver Moser
mobilkom austria AG & Co. KG
IT://mob.app
Mobil: +43-664-331-2544
mailto:o.moser@mobilkom.at


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

Date: Thu, 28 Jun 2001 08:27:23 +0100
From: George Stevens <george.stevens@baesystems.com>
Subject: Re: Unix filepath completion within perl?
Message-Id: <3B3ADC5B.8E06292D@baesystems.com>

>
>
> It doesn't look like you can do that using Term::Complete.  You would
> have to you change the completion list on the fly when the user inputs
> a "/" (and change it back when they backspace over it).  Complete
> doesn't provide for that.
>
> You will probably have to do it yourself, possibly starting from the
> code in Complete.pm (it still won't be easy).
>

Yeah, sadly that's the only solution that I could come up with, which as you say,
won't be easy, but at least Complete is a small module.

> There may be a way to use a shell that does file completion to do
> the input (and echo back the result), but I haven't thought about
> that much.

I never thought of that one at all, so that's a useful lead.

Thanks for your help, much appreciated.

George




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

Date: 28 Jun 2001 08:17:00 GMT
From: vek@pharmnl.ohout.pharmapartners.nl (Villy Kruse)
Subject: Re: using System() and exec()
Message-Id: <slrn9jlpvr.fia.vek@pharmnl.ohout.pharmapartners.nl>

On Thu, 28 Jun 2001 00:32:18 -0400,
    Benjamin Goldberg <goldbb2@earthlink.net> wrote:


>
>defined( my $pid = fork ) or die "Couldn't fork in parent: $!\n";
>if( !$pid ) {
>	exit if fork;
>	exec { "/path/to/sendsms" } "sendsms", 
>		-d => "0$nbappel",
>		-m => join ",", @corps[0,1],
>		"pe245";
>	die "Could not exec /path/to/sendsms: $!\n";
>} else {
>	waitpid($pid,0);
>}
>
>The second fork is important for umm... I forget, but it's important :)
>If this is being used in a CGI program, then you should close STDOUT
>somewhere between the if(!$pid) and the exec.
>



The second fork creates a grand child which will be immidiately orphaned
and your parent process can wait on the child which will go avay immidiately
after having crated the crandchild.  Thus you won't have any problems
with defunct zombies floating around.  The orphaned grandchild will be
adopted by the init process, which will take care of the wait()ing in
due course.

The grandchild processs should also close STDIN and STDERR, or re-open
them to for example "/dev/null", so they won't interfere with STDIN
and STDOUT in the parent process.


Villy


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

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


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