[25473] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 7718 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jan 31 18:10:22 2005

Date: Mon, 31 Jan 2005 15:10:14 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 31 Jan 2005     Volume: 10 Number: 7718

Today's topics:
    Re: regexp inside <> + typos in perldoc <someone@example.com>
    Re: regexp inside <> + typos in perldoc <hendrik_maryns@despammed.com>
    Re: Regular Expression Question on /i (Anno Siegel)
    Re: Regular Expression Question on /i <nospam-abuse@ilyaz.org>
    Re: Regular Expression Question on /i (Anno Siegel)
    Re: saving file attachment from mbox ? <mritty@gmail.com>
    Re: saving file attachment from mbox ? <usenet_daughter@yahoo.com>
    Re: saving file attachment from mbox ? <1usa@llenroc.ude.invalid>
    Re: Using select(2) <joe@inwap.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Mon, 31 Jan 2005 20:17:30 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: regexp inside <> + typos in perldoc
Message-Id: <unwLd.189536$KO5.73582@clgrps13>

Brian McCauley wrote:
> 
> Paul Lalli wrote:
> 
>>              ....glob() simply passes
>> its argument to be interpreted by your shell.
> 
> Not in recent Perl.
> 
>  > "Hendrik Maryns" <hendrik_maryns@despammed.com> wrote:
> 
>>> Or do these follow the syntax of my command line (WinXP, I'm afraid)?
>>
>> Yes.
> 
> No, not in recent Perl.
> 
> See perldoc -f glob.

Also:

perldoc File::Glob



John
-- 
use Perl;
program
fulfillment


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

Date: Mon, 31 Jan 2005 21:45:51 +0100
From: Hendrik Maryns <hendrik_maryns@despammed.com>
Subject: Re: regexp inside <> + typos in perldoc
Message-Id: <27KdnfQ1AstiBWPcRVnysA@scarlet.biz>

Paul Lalli schreef:

> "Hendrik Maryns" <hendrik_maryns@despammed.com> wrote in message
> news:i_SdnYXQAqMbp2PcRVnyjA@scarlet.biz...
> 
>>Hi,
>>
>>I know it is possible to read in the current dir with @list=<*.*> or
>>even <*>.
> 
> 
> Those do not do the same thing.
> 
> 
>> Now, I want to read all the current files, except for the
>>.pl-files.  I tried <*.[^(pl)]*>, but this gave me the pl files
> 
> alone!.
> 
>>  How do regexps inside <> work?
> 
> 
> They don't.  <*> syntax is a glob, not a regex.  glob() simply passes
> its argument to be interpreted by your shell.  If you really want to use
> that syntax, you'd have to figure out how you would get a listing of the
> files you want from your shell.
> 
> 
>> Or do these follow the syntax of my
>>command line (WinXP, I'm afraid)?
> 
> 
> Yes.  So determine what argument you would pass to `dir` on the command
> line, and pass that argument to the glob.
> 
> Frankly, I'd abandon the glob technique, and use a more platform
> independent method:
> opendir my $dir, '.' or die "Cannot open current directory: $!";
> 
> #read all at once:
> my @files = grep {!/\.pl$/i} readdir ($dir);
> 
> #OR, file by file:
> while ($_ = readdir($dir)){
>    next if /\.pl$/i;
>    # . . .
> }
> 
> closedir $dir;
> 
> 
> 
>>And, related: how can I get the current directory?
> 
> 
> use Cwd;
> my $curdir = getcwd;
> 
> 
>>Apart from this, I sometimes find minor typos in the docs.  Where can
> 
> I
> 
>>report those?  Via perlbug seems a bit too strong to me...
>>(e.g.: in perlretut, line 15 of "Using character classes": 'away'
> 
> should
> 
>>be 'a way')
> 
> 
> I don't understand your problem with perlbug.  The docs are part of the
> standard Perl distribution.  perlbug is for reporting errors with Perl.
> What's the dilemma?
> 
> Paul Lalli
> 

Wow, thanks for the proposals!  I'll plunge into perldoc -f glob now!

H.


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

Date: 31 Jan 2005 20:26:28 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Regular Expression Question on /i
Message-Id: <ctm49k$a63$1@mamenchi.zrz.TU-Berlin.DE>

Ilya Zakharevich  <nospam-abuse@ilyaz.org> wrote in comp.lang.perl.misc:
> [A complimentary Cc of this posting was sent to
> Anno Siegel
> <anno4000@lublin.zrz.tu-berlin.de>], who wrote in article
> <ctjj64$l7p$2@mamenchi.zrz.TU-Berlin.DE>:
> > > It is unfortunate, that some of modifiers are actually parts of a REx,
> > > while the others are part of the OP which uses the REx, but this is a
> > > legacy design...
> 
> > I know better than to accuse you of making no sense, but please, in what
> > *sense* are they part of the regex?  Textually they aren't.  That is what
> > the user sees.
> 
> Assume that separation into "the REx" and "the operator which uses the
> REx" makes some sense (one could say: it is just a script, and I do not
> care what happens inside this script; it would be hard to discuss this
> topic with such a person, right?  And in some situations this point of
> view is very productive...).  

Insightful, yes.  Productivity depends on what you want to produce.  In
the context of clpm, I'm interested in a terminology that is useful in
discussing Perl programs.  As such, its distinctions should be as obvious
as possible.  It is useful to distinguish the regex proper from the
operators that use it (m//, s///, qr//).  At the surface of things,
the modifiers are clearly part of the operators, not only textually, but
also because the operator determines which modifiers are possible.

I think, for everyday discourse it is wisest to go with that concept.
A terminology that carefully distinguishes between modifiers that are
part of the regex and others that truly belong to the operator may
carry deeper insight, but it is impractical.

> If we draw the separation line according to implementation, then the
> modifiers 's', 'm', 'i', 'x' modify the match REx, while other

/g also modifies the match in scalar context.

> modifiers modify the operator which will do the match.  Of course,
> infinitely many other ways to pass this line may be chosen; however,
> one I choose is the only one which has some pseudo-objective ground.  ;-)

I'll rather stick to the hard facts of syntax, even if they lie about
the deeper reality of implementation.  Taken to an extreme, we couldn't
discuss a program without first de-parsing it.  That is not a direction
I want to go.

> If you think so straight as you pretend ;-), try to spell out where
> this 'm' belongs to in this example:
> 
>   print for split m(foo), qw(bar), -1;

Now you've lost me again.  What has the role of 'm' in the split expression
to do with the distinctions among the /gmisox... modifiers?

Of course there is something strange about the first parameter of split(),
it is not evaluated like a function parameter would (and split() doesn't
have a prototype).  As far as I'm concerned, that's a peculiarity of the
syntax introduced by the keyword "split" and has little to do with regular
expressions and their operators.

Anno


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

Date: Mon, 31 Jan 2005 20:46:04 +0000 (UTC)
From:  Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: Regular Expression Question on /i
Message-Id: <ctm5ec$2gij$1@agate.berkeley.edu>

[A complimentary Cc of this posting was sent to
Anno Siegel
<anno4000@lublin.zrz.tu-berlin.de>], who wrote in article <ctm49k$a63$1@mamenchi.zrz.TU-Berlin.DE>:
> as possible.  It is useful to distinguish the regex proper from the
> operators that use it (m//, s///, qr//).  At the surface of things,
> the modifiers are clearly part of the operators, not only textually, but
> also because the operator determines which modifiers are possible.

Aha, you see: the stuff which "is in REx" is always possible, since it
is has no relation to operator.  ;-)

> I think, for everyday discourse it is wisest to go with that concept.
> A terminology that carefully distinguishes between modifiers that are
> part of the regex and others that truly belong to the operator may
> carry deeper insight, but it is impractical.

I do not thing one can put practical/impractical under one hat.  There
may be many situations where I would not mention that these guys are
parts of a REx (TEACHING is CHEATING).  However, IMO c.l.p.m is mature
enough to eat this and profit from it.

> > If we draw the separation line according to implementation, then the
> > modifiers 's', 'm', 'i', 'x' modify the match REx, while other

> /g also modifies the match in scalar context.

AFAIK, /g does not modify the REx.  All it does is "try to match this
REx at larger offsets if it succeeds".

> I'll rather stick to the hard facts of syntax, even if they lie about
> the deeper reality of implementation.  Taken to an extreme, we couldn't
> discuss a program without first de-parsing it.  That is not a direction
> I want to go.

Well, if you do not like Perl, you know where you need to go.  I tried
to decrease this problem with CPerl, but not everybody uses it.
Unless you know where is closing char of a REx, you cannot seriously
discuss its work...

> > If you think so straight as you pretend ;-), try to spell out where
> > this 'm' belongs to in this example:
> > 
> >   print for split m(foo), qw(bar), -1;
> 
> Now you've lost me again.  What has the role of 'm' in the split expression
> to do with the distinctions among the /gmisox... modifiers?

You want a simple non-ambiguous answer in one situation.  I just show
a similar situation with similar lack of an obvious answer.

I trust that we understand each other's POVs enough, right?  Is it
productive to continue this discussion?  If not, maybe let it rest on
Google?  ;-)

Yours,
Ilya


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

Date: 31 Jan 2005 20:55:53 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Regular Expression Question on /i
Message-Id: <ctm60p$b1d$1@mamenchi.zrz.TU-Berlin.DE>

Ilya Zakharevich  <nospam-abuse@ilyaz.org> wrote in comp.lang.perl.misc:

> I trust that we understand each other's POVs enough, right?  Is it
> productive to continue this discussion?  If not, maybe let it rest on
> Google?  ;-)

Very well.

Anno


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

Date: Mon, 31 Jan 2005 20:29:06 GMT
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: saving file attachment from mbox ?
Message-Id: <mywLd.396$f%5.102@trndny03>

"Mad Scientist Jr" <usenet_daughter@yahoo.com> wrote in message
news:1107200666.339171.312910@z14g2000cwz.googlegroups.com...
> Can someone explain (i am working in .net, but perl would be ok) how
to
> save a file attachment from the raw email mbox file? For example:
>

Searching CPAN (http://search.cpan.org) for 'Mbox' returns several
results.  Have you tried any of those yet?  If you show us the
attempt(s) you've made, we can probably help you figure out what's
wrong.

Paul Lalli



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

Date: 31 Jan 2005 12:54:16 -0800
From: "Mad Scientist Jr" <usenet_daughter@yahoo.com>
Subject: Re: saving file attachment from mbox ?
Message-Id: <1107204856.493373.89650@c13g2000cwb.googlegroups.com>

thanks for your reply. i haven't attempted anything yet, i have no idea
where to start. is it encoded in some kind of binhex format? i will
check CPAN... thanks again



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

Date: 31 Jan 2005 20:57:09 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: saving file attachment from mbox ?
Message-Id: <Xns95EFA2475C8E7asu1cornelledu@132.236.56.8>

"Mad Scientist Jr" <usenet_daughter@yahoo.com> wrote in 
news:1107204856.493373.89650@c13g2000cwb.googlegroups.com:

> thanks for your reply. 

Who are you talking to? Please provide some context.

> i haven't attempted anything yet, i have no idea
> where to start.

This would be a good time to read the posting guidelines for 
comp.lang.perl.misc.

> is it encoded in some kind of binhex format? 

Is what encoded in some kind of binhex format? Come to think of it, what is 
"some kind of binhex format"?

> i will check CPAN ...

That would be a good idea. Then show us your attempt at dealing with 
whatever your issues and I am sure someone will be able to help.

Sinan 



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

Date: Mon, 31 Jan 2005 11:16:42 -0800
From: Joe Smith <joe@inwap.com>
Subject: Re: Using select(2)
Message-Id: <M9ednQ4MTsOAGWPcRVn-ow@comcast.com>

memyself_ wrote:

>  my($scount, $stime)=
>  CORE::select( $read_bits,
>                 $write_bits,
>                 $err_bits, 1);
> 
> In my program, $scount is allways equal to -1,
> and $read_bits, $write_bits, $err_bits, to 0.

You did not show us where you were setting $read_bits and such
to be nonzero.  You have to set them before each time select()
is called.

   $rb = one bit for each file handle you will be reading from
   $wb = one bit for each file handle you will be writing to
   $eb = $rb | $wb;
   $ms = 1.0;		# seconds for the timeout
   ($scount,$stime) = select( $read_bits=$rb, $write_bits=$wb,
	$error_bits=$eb, $ms);
   warn "Invalid arguments presented to select()" if $scount < 0;
   if ($scount == 0) {
      print "No file handles are ready for I/O\n";
   } else {
      print "Can do I/O: r=$read_bits w=$write_bits e=$error_bits\n";
   }
   print "$stime seconds left before timeout\n" if $stime;

Use 'perldoc -f select' for more info.
Use comp.lang.perl.misc (and not comp.lang.perl) next time.
	-Joe


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

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.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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


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