[25640] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 7882 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Mar 15 09:05:35 2005

Date: Tue, 15 Mar 2005 06:05:13 -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           Tue, 15 Mar 2005     Volume: 10 Number: 7882

Today's topics:
        [perl-python] unicode study with unicodedata module <xah@xahlee.org>
    Re: [Q]: How to sort first abc, then 123? <pilkowsk@informatik.uni-marburg.de>
    Re: [Q]: How to sort first abc, then 123? <pilsl@goldfisch.at>
    Re: Extract data using Curl Unix Command & Perl Script  <ifiaz@hotmail.com>
        Posting Guidelines for comp.lang.perl.misc ($Revision:  tadmc@augustmail.com
    Re: problem writing to stdin of child process (john)
    Re: problem writing to stdin of child process (Anno Siegel)
    Re: regular expression help with apostrophe <wyzelli@yahoo.com>
    Re: regular expression help with apostrophe <phaylon@dunkelheit.at>
    Re: regular expression help with apostrophe <pilkowsk@informatik.uni-marburg.de>
    Re: regular expression help with apostrophe <bernard.el-haginDODGE_THIS@lido-tech.net>
    Re: replace multiple spaces between words with single s (Anno Siegel)
    Re: Tracking Routines That Caused An Error <nobull@mail.com>
    Re: Tracking Routines That Caused An Error <pilkowsk@informatik.uni-marburg.de>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 15 Mar 2005 02:10:42 -0800
From: "Xah Lee" <xah@xahlee.org>
Subject: [perl-python] unicode study with unicodedata module
Message-Id: <1110881442.714844.20210@l41g2000cwc.googlegroups.com>

python has this nice unicodedata module that deals with unicode nicely.

#-*- coding: utf-8 -*-
# python

from unicodedata import *

# each unicode char has a unique name.
# one can use the =E2=80=9Clookup=E2=80=9D func to find it

mychar=3Dlookup('greek cApital letter sIgma')
# note letter case doesn't matter
print mychar.encode('utf-8')

m=3Dlookup('CJK UNIFIED IDEOGRAPH-5929')
# for some reason, case must be right here.
print m.encode('utf-8')

# to find a char's name, use the =E2=80=9Cname=E2=80=9D function
print name(u'=E5=A4=A9')

basically, in unicode, each char has a number of attributes (called
properties) besides its name. These attributes provides necessary info
to form letters, words, or processing such as sorting, capitalization,
etc, of varous human scripts. For example, Latin alphabets has two
forms of upper case and lower case. Korean alphabets are stacked
together. While many symbols corresponds to numbers, and there are also

combining forms used for example to put a bar over any letter or
character. Also some writings systems are directional. In order to form

these symbols for display or process them for computing, info of these
on each char is necessary.

the rest of functions in unicodedata return these attributes.

see unicodedata doc:
http://python.org/doc/2.4/lib/module-unicodedata.html

Official word on unicode character properties:
http://www.unicode.org/uni2book/ch04.pdf

--
i don't know what's the state of Perl's unicode. Is there something
similar?

--
this post is archived at
http://xahlee.org/perl-python/unicodedata_module.html

 Xah
 xah@xahlee.org
 http://xahlee.org/PageTwo_dir/more.html



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

Date: Tue, 15 Mar 2005 09:14:18 +0100
From: Fabian Pilkowski <pilkowsk@informatik.uni-marburg.de>
Subject: Re: [Q]: How to sort first abc, then 123?
Message-Id: <MPG.1ca0b7c1ffa2ee999898d8@news.individual.de>

* Ilya Zakharevich wrote:
> 
> Tested:
> 
>   map {s/^~//; $_} sort map {s/^(?=[~\d])/~/; $_} @data;
> 
> (one '^' inserted, and commas replaced by semicolon).

Sorry, but I can't get it out yet. If the unsorted @data is like

    my @data = qw( And64 And8 Nand64 Nand8 );

the desired output should be

    qw( And8 And64 Nand8 Nand64 );

Within your first map (therewith I mean the back one), you searched for 
those strings beginning with a tilde or a number, to insert a new tilde 
in front of them. For the given strings this will never match ;(

Hence the sort call is doing its standard string comparison which won't 
change the data (the four element above are sorted this way already). 
Deleting the previously added (respectively not added) tildes is quite 
understandable.

> 
> Hope this helps,

Even now I don't understand how adding tildes could be used to solve 
this sorting problem.

regards,
fabian


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

Date: Tue, 15 Mar 2005 12:12:19 +0100
From: peter pilsl <pilsl@goldfisch.at>
Subject: Re: [Q]: How to sort first abc, then 123?
Message-Id: <4236c348$1@e-post.inode.at>

HEB wrote:
> 
> I'm not sure if the X-No-archive really works, but
> if it does, I hope I can keep my opinion to myself. :)
> 

So then you should not post to usenet, cause its a public place.
Especially in technical groups the monopolistic google-archive of all 
usenet-postings is a very important thing, so people dont need to 
ask/answer the same questions, but simply look up in the archive.

p

-- 
http://www2.goldfisch.at/know_list


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

Date: 15 Mar 2005 00:19:18 -0800
From: "ifiaz" <ifiaz@hotmail.com>
Subject: Re: Extract data using Curl Unix Command & Perl Script from Webpage
Message-Id: <1110874758.533274.62480@l41g2000cwc.googlegroups.com>

Thanks Tad,

I tried using your script for the latest results, and it works like a
wonder:

I used a for loop like this on the main part of the script.

### For Loop for the script below
 my $regno;
 for ($regno=2225683; $regno<=2226000; $regno=$regno+1) {
 my($num, $name, $college, @lines) = get_grades( $regno );
### For Loop for the script above


### Script change as follows in get_grades function for the latest
results###
   my $request = POST
"http://www.chennaionline.com/msuniversity/result1.asp",
      [
         'Codeid' => "BA1TO4",
         'Exam_Registration_Number' => $id,
      ] ;
### Change the above in your code ###


But, both your version of the script and my version stops after
processing approx. the 90th student number unconditionally although the
loop extends beyond that.

Could you or someone explain why? and how I can correct this?

I know it has been a long time.


Tad McClellan wrote:
> Fiaz Idris <ifiaz@hotmail.com> wrote:
>
> > I have used curl and perl script to extract data from sequence
> > of webpages before.
>
>
> Why not just ditch curl and do it with Perl alone?
>
> See this Perl FAQ:
>
>      How do I automate an HTML form submission?
>
>
> > But, in the following case I couldn't find a way to do it.
> >
> > So, if someone can guide me a better way
>
>
> I like to use the Web Scraping Proxy (wsp.pl) for developing
> my many web-scraping programs:
>
>    http://www.research.att.com/~hpk/wsp/
>
> It is a huge timesaver in reverse-engineering how to get to what you
want.
>
>
> > The webpage is the following:
> >
> > http://www.chennaionline.com/msuniversity/submit.asp?code=BA
> >
> > and I have to extract the Registration numbers from 2225683 to
> > 2225867.
>
>
> > redirected to a file and then use regular expressions to extract
the
>
>
> Using regular expressions to parse HTML can be a bad idea.
>
> Especially since the data you want is in a table.
>
> Use the HTML::TableExtract module instead of fragile regexes.
>
>
> > I can't find a correct way to locate the URL which will return the
> > results
>
>
> See where it says
>
>    <form name="examresult" action="result.asp" method="post">
>
> ??
>
> You take the "submit.asp..." stuff off of the URL that you got
> the <form> page from, and put "result.asp" in its place.
>
>    http://www.chennaionline.com/msuniversity/result.asp
>
>
> > How can I do it in this case?
>
>
> Let wsp.pl write a request for you (you'll probably need to edit it a
bit),
> and use the LWP::UserAgent module to submit the request.
>
>
> > If there is a complete alternative to do it. Please guide me.
>
>
> Here you go:
>
> ----------------------------------------
> #!/usr/bin/perl
> use strict;
> use warnings;
> use LWP::UserAgent;
> use HTTP::Request::Common;
> use HTML::TableExtract;
> use Data::Dumper;
>
> my($num, $name, $college, @lines) = get_grades( '2225684' );
>
> print "num: $num\n";
> print "name: $name\n";
> print "college: $college\n";
>
> print Dumper \@lines;
>
>
>
> sub get_grades {
>    my($id) = @_;
>
>    my $request = POST
"http://www.chennaionline.com/msuniversity/result.asp",
>       [
>          'Codeid' => "BA",
>          'Exam_Registration_Number' => $id,
>       ] ;
>
>    my $agent = new LWP::UserAgent();
>    my $response = $agent->request( $request );
>    return() unless $response->is_success;
>    my $content = $response->content();
>
>
>    ###  Registration No., Name, College (by table position)
>    my $te = new HTML::TableExtract( count => 2, depth => 1  );
>    $te->parse($content);
>
>    my($table) = $te->tables();
>    my @rows = $te->rows($table);
>
>    my $regnum  = $rows[0][1];
>    my $name    = $rows[1][1];
>    my $college = $rows[2][1];
>
>
>    ### grades  (by table headers)
>    $content =~ s/Subject\s*Code/Subject Code/;  # patch silly web
page
>    $te = new HTML::TableExtract( headers => ['Subject Code',
>                                              'Marks',
>                                              'Result'
>                                             ]
>                                );
>    $te->parse($content);
>
>    @rows = ();  # re-used from above
>    foreach my $ts ($te->table_states) {
>       foreach my $row ($ts->rows) {
>          next if $row->[0] =~ /CONTROLLER OF EXAMINATION/;
>          my %course;
>          @course{ qw/subject marks result/ } = @$row; # a "hash
slice"
>          push @rows, \%course;
>       }
>    }
>
>    return $regnum, $name, $college, @rows;
> }
>
> ----------------------------------------
>
>
> Web scraping is a blast!
>
>
> --
>     Tad McClellan                          SGML consulting
>     tadmc@augustmail.com                   Perl programming
>     Fort Worth, Texas



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

Date: 15 Mar 2005 08:22:15 GMT
From: tadmc@augustmail.com
Subject: Posting Guidelines for comp.lang.perl.misc ($Revision: 1.5 $)
Message-Id: <42369b36$0$23565$8b463f8a@news.nationwide.net>

Outline
   Before posting to comp.lang.perl.misc
      Must
       - Check the Perl Frequently Asked Questions (FAQ)
       - Check the other standard Perl docs (*.pod)
      Really Really Should
       - Lurk for a while before posting
       - Search a Usenet archive
      If You Like
       - Check Other Resources
   Posting to comp.lang.perl.misc
      Is there a better place to ask your question?
       - Question should be about Perl, not about the application area
      How to participate (post) in the clpmisc community
       - Carefully choose the contents of your Subject header
       - Use an effective followup style
       - Speak Perl rather than English, when possible
       - Ask perl to help you
       - Do not re-type Perl code
       - Provide enough information
       - Do not provide too much information
       - Do not post binaries, HTML, or MIME
      Social faux pas to avoid
       - Asking a Frequently Asked Question
       - Asking a question easily answered by a cursory doc search
       - Asking for emailed answers
       - Beware of saying "doesn't work"
       - Sending a "stealth" Cc copy
      Be extra cautious when you get upset
       - Count to ten before composing a followup when you are upset
       - Count to ten after composing and before posting when you are upset
-----------------------------------------------------------------

Posting Guidelines for comp.lang.perl.misc ($Revision: 1.5 $)
    This newsgroup, commonly called clpmisc, is a technical newsgroup
    intended to be used for discussion of Perl related issues (except job
    postings), whether it be comments or questions.

    As you would expect, clpmisc discussions are usually very technical in
    nature and there are conventions for conduct in technical newsgroups
    going somewhat beyond those in non-technical newsgroups.

    The article at:

        http://www.catb.org/~esr/faqs/smart-questions.html

    describes how to get answers from technical people in general.

    This article describes things that you should, and should not, do to
    increase your chances of getting an answer to your Perl question. It is
    available in POD, HTML and plain text formats at:

     http://mail.augustmail.com/~tadmc/clpmisc.shtml

    For more information about netiquette in general, see the "Netiquette
    Guidelines" at:

     http://andrew2.andrew.cmu.edu/rfc/rfc1855.html

    A note to newsgroup "regulars":

       Do not use these guidelines as a "license to flame" or other
       meanness. It is possible that a poster is unaware of things
       discussed here.  Give them the benefit of the doubt, and just
       help them learn how to post, rather than assume 

    A note about technical terms used here:

       In this document, we use words like "must" and "should" as
       they're used in technical conversation (such as you will
       encounter in this newsgroup). When we say that you *must* do
       something, we mean that if you don't do that something, then
       it's unlikely that you will benefit much from this group.
       We're not bossing you around; we're making the point without
       lots of words.

    Do *NOT* send email to the maintainer of these guidelines. It will be
    discarded unread. The guidelines belong to the newsgroup so all
    discussion should appear in the newsgroup. I am just the secretary that
    writes down the consensus of the group.

Before posting to comp.lang.perl.misc
  Must
    This section describes things that you *must* do before posting to
    clpmisc, in order to maximize your chances of getting meaningful replies
    to your inquiry and to avoid getting flamed for being lazy and trying to
    have others do your work.

    The perl distribution includes documentation that is copied to your hard
    drive when you install perl. Also installed is a program for looking
    things up in that (and other) documentation named 'perldoc'.

    You should either find out where the docs got installed on your system,
    or use perldoc to find them for you. Type "perldoc perldoc" to learn how
    to use perldoc itself. Type "perldoc perl" to start reading Perl's
    standard documentation.

    Check the Perl Frequently Asked Questions (FAQ)
        Checking the FAQ before posting is required in Big 8 newsgroups in
        general, there is nothing clpmisc-specific about this requirement.
        You are expected to do this in nearly all newsgroups.

        You can use the "-q" switch with perldoc to do a word search of the
        questions in the Perl FAQs.

    Check the other standard Perl docs (*.pod)
        The perl distribution comes with much more documentation than is
        available for most other newsgroups, so in clpmisc you should also
        see if you can find an answer in the other (non-FAQ) standard docs
        before posting.

    It is *not* required, or even expected, that you actually *read* all of
    Perl's standard docs, only that you spend a few minutes searching them
    before posting.

    Try doing a word-search in the standard docs for some words/phrases
    taken from your problem statement or from your very carefully worded
    "Subject:" header.

  Really Really Should
    This section describes things that you *really should* do before posting
    to clpmisc.

    Lurk for a while before posting
        This is very important and expected in all newsgroups. Lurking means
        to monitor a newsgroup for a period to become familiar with local
        customs. Each newsgroup has specific customs and rituals. Knowing
        these before you participate will help avoid embarrassing social
        situations. Consider yourself to be a foreigner at first!

    Search a Usenet archive
        There are tens of thousands of Perl programmers. It is very likely
        that your question has already been asked (and answered). See if you
        can find where it has already been answered.

        One such searchable archive is:

         http://groups.google.com/advanced_group_search

  If You Like
    This section describes things that you *can* do before posting to
    clpmisc.

    Check Other Resources
        You may want to check in books or on web sites to see if you can
        find the answer to your question.

        But you need to consider the source of such information: there are a
        lot of very poor Perl books and web sites, and several good ones
        too, of course.

Posting to comp.lang.perl.misc
    There can be 200 messages in clpmisc in a single day. Nobody is going to
    read every article. They must decide somehow which articles they are
    going to read, and which they will skip.

    Your post is in competition with 199 other posts. You need to "win"
    before a person who can help you will even read your question.

    These sections describe how you can help keep your article from being
    one of the "skipped" ones.

  Is there a better place to ask your question?
    Question should be about Perl, not about the application area
        It can be difficult to separate out where your problem really is,
        but you should make a conscious effort to post to the most
        applicable newsgroup. That is, after all, where you are the most
        likely to find the people who know how to answer your question.

        Being able to "partition" a problem is an essential skill for
        effectively troubleshooting programming problems. If you don't get
        that right, you end up looking for answers in the wrong places.

        It should be understood that you may not know that the root of your
        problem is not Perl-related (the two most frequent ones are CGI and
        Operating System related), so off-topic postings will happen from
        time to time. Be gracious when someone helps you find a better place
        to ask your question by pointing you to a more applicable newsgroup.

  How to participate (post) in the clpmisc community
    Carefully choose the contents of your Subject header
        You have 40 precious characters of Subject to win out and be one of
        the posts that gets read. Don't waste them. Take care while
        composing them, they are the key that opens the door to getting an
        answer.

        Spend them indicating what aspect of Perl others will find if they
        should decide to read your article.

        Do not spend them indicating "experience level" (guru, newbie...).

        Do not spend them pleading (please read, urgent, help!...).

        Do not spend them on non-Subjects (Perl question, one-word
        Subject...)

        For more information on choosing a Subject see "Choosing Good
        Subject Lines":

         http://www.cpan.org/authors/id/D/DM/DMR/subjects.post

        Part of the beauty of newsgroup dynamics, is that you can contribute
        to the community with your very first post! If your choice of
        Subject leads a fellow Perler to find the thread you are starting,
        then even asking a question helps us all.

    Use an effective followup style
        When composing a followup, quote only enough text to establish the
        context for the comments that you will add. Always indicate who
        wrote the quoted material. Never quote an entire article. Never
        quote a .signature (unless that is what you are commenting on).

        Intersperse your comments *following* each section of quoted text to
        which they relate. Unappreciated followup styles are referred to as
        "top-posting", "Jeopardy" (because the answer comes before the
        question), or "TOFU" (Text Over, Fullquote Under).

        Reversing the chronology of the dialog makes it much harder to
        understand (some folks won't even read it if written in that style).
        For more information on quoting style, see:

         http://web.presby.edu/~nnqadmin/nnq/nquote.html

    Speak Perl rather than English, when possible
        Perl is much more precise than natural language. Saying it in Perl
        instead will avoid misunderstanding your question or problem.

        Do not say: I have variable with "foo\tbar" in it.

        Instead say: I have $var = "foo\tbar", or I have $var = 'foo\tbar',
        or I have $var = <DATA> (and show the data line).

    Ask perl to help you
        You can ask perl itself to help you find common programming mistakes
        by doing two things: enable warnings (perldoc warnings) and enable
        "strict"ures (perldoc strict).

        You should not bother the hundreds/thousands of readers of the
        newsgroup without first seeing if a machine can help you find your
        problem. It is demeaning to be asked to do the work of a machine. It
        will annoy the readers of your article.

        You can look up any of the messages that perl might issue to find
        out what the message means and how to resolve the potential mistake
        (perldoc perldiag). If you would like perl to look them up for you,
        you can put "use diagnostics;" near the top of your program.

    Do not re-type Perl code
        Use copy/paste or your editor's "import" function rather than
        attempting to type in your code. If you make a typo you will get
        followups about your typos instead of about the question you are
        trying to get answered.

    Provide enough information
        If you do the things in this item, you will have an Extremely Good
        chance of getting people to try and help you with your problem!
        These features are a really big bonus toward your question winning
        out over all of the other posts that you are competing with.

        First make a short (less than 20-30 lines) and *complete* program
        that illustrates the problem you are having. People should be able
        to run your program by copy/pasting the code from your article. (You
        will find that doing this step very often reveals your problem
        directly. Leading to an answer much more quickly and reliably than
        posting to Usenet.)

        Describe *precisely* the input to your program. Also provide example
        input data for your program. If you need to show file input, use the
        __DATA__ token (perldata.pod) to provide the file contents inside of
        your Perl program.

        Show the output (including the verbatim text of any messages) of
        your program.

        Describe how you want the output to be different from what you are
        getting.

        If you have no idea at all of how to code up your situation, be sure
        to at least describe the 2 things that you *do* know: input and
        desired output.

    Do not provide too much information
        Do not just post your entire program for debugging. Most especially
        do not post someone *else's* entire program.

    Do not post binaries, HTML, or MIME
        clpmisc is a text only newsgroup. If you have images or binaries
        that explain your question, put them in a publically accessible
        place (like a Web server) and provide a pointer to that location. If
        you include code, cut and paste it directly in the message body.
        Don't attach anything to the message. Don't post vcards or HTML.
        Many people (and even some Usenet servers) will automatically filter
        out such messages. Many people will not be able to easily read your
        post. Plain text is something everyone can read.

  Social faux pas to avoid
    The first two below are symptoms of lots of FAQ asking here in clpmisc.
    It happens so often that folks will assume that it is happening yet
    again. If you have looked but not found, or found but didn't understand
    the docs, say so in your article.

    Asking a Frequently Asked Question
        It should be understood that you may have missed the applicable FAQ
        when you checked, which is not a big deal. But if the Frequently
        Asked Question is worded similar to your question, folks will assume
        that you did not look at all. Don't become indignant at pointers to
        the FAQ, particularly if it solves your problem.

    Asking a question easily answered by a cursory doc search
        If folks think you have not even tried the obvious step of reading
        the docs applicable to your problem, they are likely to become
        annoyed.

        If you are flamed for not checking when you *did* check, then just
        shrug it off (and take the answer that you got).

    Asking for emailed answers
        Emailed answers benefit one person. Posted answers benefit the
        entire community. If folks can take the time to answer your
        question, then you can take the time to go get the answer in the
        same place where you asked the question.

        It is OK to ask for a *copy* of the answer to be emailed, but many
        will ignore such requests anyway. If you munge your address, you
        should never expect (or ask) to get email in response to a Usenet
        post.

        Ask the question here, get the answer here (maybe).

    Beware of saying "doesn't work"
        This is a "red flag" phrase. If you find yourself writing that,
        pause and see if you can't describe what is not working without
        saying "doesn't work". That is, describe how it is not what you
        want.

    Sending a "stealth" Cc copy
        A "stealth Cc" is when you both email and post a reply without
        indicating *in the body* that you are doing so.

  Be extra cautious when you get upset
    Count to ten before composing a followup when you are upset
        This is recommended in all Usenet newsgroups. Here in clpmisc, most
        flaming sub-threads are not about any feature of Perl at all! They
        are most often for what was seen as a breach of netiquette. If you
        have lurked for a bit, then you will know what is expected and won't
        make such posts in the first place.

        But if you get upset, wait a while before writing your followup. I
        recommend waiting at least 30 minutes.

    Count to ten after composing and before posting when you are upset
        After you have written your followup, wait *another* 30 minutes
        before committing yourself by posting it. You cannot take it back
        once it has been said.

AUTHOR
    Tad McClellan <tadmc@augustmail.com> and many others on the
    comp.lang.perl.misc newsgroup.



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

Date: 15 Mar 2005 02:46:42 -0800
From: lqueryvg@gmail.com (john)
Subject: Re: problem writing to stdin of child process
Message-Id: <9190653e.0503150246.43158967@posting.google.com>

Big and Blue <No_4@dsl.pipex.com> wrote in message news:<IcCdnUFCopeG3avfRVnysA@pipex.net>...
> john wrote:
> 
> > #!/usr/bin/perl
> > use strict;
> > use warnings;
> > 
> > use IO::Handle;
> > use IO::Pipe;
> > 
> > my $cr = IO::Handle->new();     # child reader
> > my $pw = IO::Handle->new();     # child writer
> > 
> > new IO::Pipe($cr, $pw) or die 'pr/cw pipe';
> 
>     Have you read the IO::Pipe documentation?
> (e.g. http://search.cpan.org/~nwclark/perl-5.8.6/ext/IO/lib/IO/Pipe.pm)
> 
>     It starts with (almost) exactly what you want under the SYNOPSIS.  (It 
> has the child writing to the parent - just swap the if/else codew blocks).

I've seen this on my travels, but for some reason it didn't sink in
that this was what I needed. Terms such as "re-blessed" confuse me and
I've been sticking to stuff that I *thought* I understood. Anyway
you're right. This is exactly what I need and it'll make my code a lot
neater. I was going to post the modified and working testcase, however
it's so close to the example in the IO:Pipe doc that there doesn't
seem much point.

> 
>     No need to mention IO::Handle (IO::Pipe gets them for you).

I'm using autoflush in my larger program, but you're right; it's not
needed in this testcase.

> 
> 
> >   my $fd = fileno($cr);
> >   open(my $stdin, "<", \$fd) or die "STDIN open: $!";
> >   *STDIN = $stdin;
> > 
> >   my $line = <STDIN>;   # hopefully reading from the parent
> 
>     Not sure why you would want to do this anyway.  You shouldn't be 
> reading from STDIN - you want to read from the read-side of the pipe opened 
> in the parent.  Don't assume that just because your want to read from it 
> you have to make it STDIN.  STDIN is "STanDard INput" - reading from a pipe 
> isn't "standard" in this sense.

The children will each exec an external command which will read from
stdin, and the parent has to manage sending data to each.

Thanks for your help "Big and Blue".


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

Date: 15 Mar 2005 10:50:05 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: problem writing to stdin of child process
Message-Id: <d16ekt$5mo$1@mamenchi.zrz.TU-Berlin.DE>

john <lqueryvg@gmail.com> wrote in comp.lang.perl.misc:
> Hello everyone,
> 
> I have a program which forks multiple children and needs to have
> bidirectional communication with each child. Each child needs to use
> STDIN and STDOUT to talk back to the parent.

Have you considered IPC::Open2?

Anno


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

Date: Tue, 15 Mar 2005 12:30:13 GMT
From: "Peter Wyzl" <wyzelli@yahoo.com>
Subject: Re: regular expression help with apostrophe
Message-Id: <pzAZd.198459$K7.26457@news-server.bigpond.net.au>

"Tad McClellan" <tadmc@augustmail.com> wrote in message
news:slrnd3cog8.52n.tadmc@magna.augustmail.com...
> dmalhotr2001@yahoo.com <dmalhotr2001@yahoo.com> wrote:
>
> > I have a regular expression [^\']+ that checks whether there's a
> > apostrophe in a particular string.
>
>
> Single quotes are not special, there is no need to backslash them.
>
>
> > I would want it to ignore it if Local's Settings folder has an
> > apostrophe.
>
>
> What is a Local's Settings folder?

That is like asking "What is a /usr/var directory?"

Whilst not a direct equivalent, it is a common enough environment to be
accepted as known by any competent windows user.

Never mind.  I think the question is just as valid without the specific
example,

"How do I tell if the filename part of the string has a single quote, and
ignore the rest of the pathname?"

 ...

use File::Basename;

is a good start...

P




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

Date: Tue, 15 Mar 2005 13:38:01 +0100
From: phaylon <phaylon@dunkelheit.at>
Subject: Re: regular expression help with apostrophe
Message-Id: <pan.2005.03.15.12.38.01.684058@dunkelheit.at>

Peter Wyzl wrote:

> That is like asking "What is a /usr/var directory?"

Wouldn't say "/usr/var" is a "fully qualified" pathname. "Local Settings
Folder" is not.

> Whilst not a direct equivalent, it is a common enough environment to be
> accepted as known by any competent windows user.

Some people haven't seen Windows for a long time :D

-- 
http://www.dunkelheit.at/
      ...and in darkness bind them.



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

Date: Tue, 15 Mar 2005 09:37:09 +0100
From: Fabian Pilkowski <pilkowsk@informatik.uni-marburg.de>
Subject: Re: regular expression help with apostrophe
Message-Id: <MPG.1ca0bd2515c4e9c69898d9@news.individual.de>

* Bob Walton wrote:

> Well, it isn't too clear what you want.  I have assumed you want=20
> a regexp that will match if a Windoze path and file name has no=20
> apostrophe in the filename portion, and will fail to match if the=20
>   filename portion of the path and file name contains one or more=20
> apostrophes.  If that is correct, try:
>=20
> use warnings;
> use strict;
> while(<DATA>){
>     chomp;
>     /(?:.*\\|^)[^']+$/
>        ?
>        print "$_ has no apostrophe in filename\n"
>        :
>        print "$_ has at least one apostrophe in filename\n";
> }
> __END__
> just a path\

If your string could be "just'a'path\" then your code will say there is=20
"at least one apostrophe in filename" -- but it's just a path without a=20
filename ;-)

Hence, I'd change the latter =BB+=AB in your regex to =BB*=AB, so that it c=
ould=20
match on empty filenames too.

regards,
fabian


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

Date: Tue, 15 Mar 2005 14:19:42 +0100
From: "Bernard El-Hagin" <bernard.el-haginDODGE_THIS@lido-tech.net>
Subject: Re: regular expression help with apostrophe
Message-Id: <Xns961A91C1B5C60elhber1lidotechnet@62.89.127.66>

"Peter Wyzl" <wyzelli@yahoo.com> wrote:

> "Tad McClellan" <tadmc@augustmail.com> wrote in message
> news:slrnd3cog8.52n.tadmc@magna.augustmail.com...
>> dmalhotr2001@yahoo.com <dmalhotr2001@yahoo.com> wrote:
>>
>> > I have a regular expression [^\']+ that checks whether there's
>> > a apostrophe in a particular string.
>>
>>
>> Single quotes are not special, there is no need to backslash
>> them. 
>>
>>
>> > I would want it to ignore it if Local's Settings folder has an
>> > apostrophe.
>>
>>
>> What is a Local's Settings folder?
> 
> That is like asking "What is a /usr/var directory?"


No, it's like asking "What is a Local's Settings folder?"

 
> Whilst not a direct equivalent, it is a common enough environment
> to be accepted as known by any competent windows user.


Being a "competent Windows user" (which sounds like an oxymoron to me) 
is not a requirement of posting here. In this regard, the OP was 
flawed, because it assumed OS dependant knowledge.

 
> Never mind.  I think the question is just as valid without the
> specific example,
> 
> "How do I tell if the filename part of the string has a single
> quote, and ignore the rest of the pathname?"


But the OP didn't ask that. At least not clearly.


> use File::Basename;
> 
> is a good start...


It certainly is.


-- 
Cheers,
Bernard


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

Date: 15 Mar 2005 10:58:13 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: replace multiple spaces between words with single space.
Message-Id: <d16f45$5mo$2@mamenchi.zrz.TU-Berlin.DE>

Walter Roberson <roberson@ibd.nrc-cnrc.gc.ca> wrote in comp.lang.perl.misc:
> In article <d14iaq$d4i$1@newsx.cc.uic.edu>,
> Shashank Khanvilkar  <shashank@mia.ece.uic.edu> wrote:
> :Suppose I have a variable defined as:
> 
> :$a = "This is     a   good       example";
> 
> :Note that there are multiple blanks between the words.
> :If i want to convert the above string to
> :$b = "This is a good example"
> 
> :Is there any shortcut to do the above.
> 
> ($b = $a) =~ s/ +/ /g;

tr/// does that a bit faster:

    ($b = $a) =~ tr/ //s;

Anno


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

Date: Tue, 15 Mar 2005 08:12:46 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: Tracking Routines That Caused An Error
Message-Id: <d16537$p26$1@sun3.bham.ac.uk>

Hal Vaughan wrote:

> I've seen Java programmers get errors from the compiler, or when a program
> crashes.  These error messages include a list of not just the line where
> the error occurred, but also list of all the subroutines that show which
> subroutine called which subroutine until the list ends in the actual line
> of the error.
> 
> So what's this called,

"Stack dump" (or "stack trace").

> and can I do it in Perl?

See the Carp module.



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

Date: Tue, 15 Mar 2005 09:56:09 +0100
From: Fabian Pilkowski <pilkowsk@informatik.uni-marburg.de>
Subject: Re: Tracking Routines That Caused An Error
Message-Id: <MPG.1ca0c193c7256b29898da@news.individual.de>

* Hal Vaughan wrote:
> 
> I know there's a name for what I'm looking for, and if I knew it, I'd Google
> for it, but that's a danger of being self-taught.
> 
> I've seen Java programmers get errors from the compiler, or when a program
> crashes.  These error messages include a list of not just the line where
> the error occurred, but also list of all the subroutines that show which
> subroutine called which subroutine until the list ends in the actual line
> of the error.
> 
> So what's this called,

It's called a *stack trace*.

> and can I do it in Perl?

Before doing your own stack tracing it's simpler to use the Carp module.

    use Carp;
    $SIG{__WARN__} = \&Carp::carp;
    $SIG{__DIE__} = \&Carp::carp;

Depending on what you want to trigger.

regards,
fabian


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

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


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