[22909] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5129 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jun 24 06:07:35 2003

Date: Tue, 24 Jun 2003 03:05:07 -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           Tue, 24 Jun 2003     Volume: 10 Number: 5129

Today's topics:
    Re: chomp (@filecontents = <HANDLE>); slows down (Villy Kruse)
    Re: chomp (@filecontents = <HANDLE>); slows down (Helgi Briem)
    Re: comparing arrays <cingram@pjocsNOSPAMORHAM.demon.co.uk>
        Crypt::RC4 & cookies <southtownoutkast777@hotmail.com>
    Re: How to read and write serial port using PERL in RED (Mathachan)
    Re: Issues grabbing UTF8 web page (Simon Fairey)
    Re: Newbie help with LWP <simon.oliver@nospam.umist.ac.uk>
        Posting Guidelines for comp.lang.perl.misc ($Revision:  tadmc@augustmail.com
    Re: Problem with "system" call - multiple invocations ( <ndronen@io.frii.com>
    Re: Problem with "system" call - multiple invocations ( (Bryan Castillo)
    Re: Problem with "system" call - multiple invocations ( <anthony@no_spam.movielink.net.au>
    Re: Problem with calling an vb6 executable from perl sc <P.A.Ward@open.ac.uk>
    Re: stopping PPM3 connecting to internet for LOCAL inst <dont@want.spam>
        Unicode problems, Microsoft utf16le files <abuse@sgrail.org>
    Re: Unicode problems, Microsoft utf16le files (Sam Holden)
    Re: using SOAP::Lite to call other services. <katz@underlevel.net>
    Re: using SOAP::Lite to call other services. <katz@underlevel.net>
        V Newbie: Installing Perl modules <desfisher@NaTCH.co.uk>
    Re: V Newbie: Installing Perl modules (Sam Holden)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 24 Jun 2003 07:07:56 GMT
From: vek@station02.ohout.pharmapartners.nl (Villy Kruse)
Subject: Re: chomp (@filecontents = <HANDLE>); slows down
Message-Id: <slrnbffu6b.543.vek@station02.ohout.pharmapartners.nl>

On Mon, 23 Jun 2003 18:49:30 GMT,
    Mike Flannigan <mikeflan@earthlink.net> wrote:


>
>Helgi Briem wrote:
>
>> Go to your Start Menu.  On most Windows machines that
>> will be in the bottom left hand corner. Somewhere in your
>> menu structure is a 'Command Prompt' item.  Either use that
>> or,  Open the 'Run' menu, type in 'cmd' and Enter.
>>
>> You should get a black window box with a command prompt
>> in it that looks something like:
>>
>> C:\>
>>
>> Type a command there.  To test perl, type something like:
>>
>> C:\>perl -e "print 'Hello world';"
>>
>
>Thanks.  I didn't realize you guys were talking about a simple
>DOS command window (until yesterday that is).  I was going
>to C:\perl\bin  and typing "perl" and trying to use that window.
>I still suspect that might work, but I've given up on that and I
>am running in the DOS window now.
>


It might work, but it might be slightly disappointing when realising
that perl doesn't do anything until you invoke the EOF condition from
the keyboard (that is ctrl-Z or F6 in MS-dos, ctrl-D on unix).



Villy


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

Date: Tue, 24 Jun 2003 09:55:20 GMT
From: helgi@decode.is (Helgi Briem)
Subject: Re: chomp (@filecontents = <HANDLE>); slows down
Message-Id: <3ef81fa1.88796906@news.cis.dfn.de>

On 23 Jun 2003 19:18:26 GMT, "Tassilo v. Parseval"
<tassilo.parseval@rwth-aachen.de> wrote:

>Also sprach Mike Flannigan:
>
>> Another simple question.  What do they call all that
>> /^#\s*line\s+(\d+)\s*(?:\s"([^"]+)")?\s*$/
>> stuff I see?  I want to learn that.  I found this section below,
>> but it doesn't seem to explain their use.  Are they called
>> preprocessors, line directives, or what?
>
>No, those are regular expressions. See 
>
>    perldoc perlretut
>    perldoc perlre
>
>The first one is a tutorial after which you should know what they are
>about. The second is the reference that also covers the more esoteric
>aspects. Finally, the regular expression operators are also mentioned in
>perlop.pod (accessible via 'perldoc perlop'), under "Regexp Quote-Like
>Operators".

For a beginner, it is probably best to start with

perldoc perlrequick

a quick start guide to regular expressions.
The others are a little full-featured and may
confuse a newbie.


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

Date: Tue, 24 Jun 2003 10:50:59 +0100
From: "Clyde Ingram" <cingram@pjocsNOSPAMORHAM.demon.co.uk>
Subject: Re: comparing arrays
Message-Id: <bd96sm$1bq$1$8302bc10@news.demon.co.uk>


"perl user" <r230sl55@yahoo.com> wrote in message
news:588b17a9.0306231840.ed63c1f@posting.google.com...
> i was just wondering if it is possible to compare 3 or more rows in an
> multidimensional array?
>
Yes.  This should be possible.




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

Date: Tue, 24 Jun 2003 04:10:33 GMT
From: "David S." <southtownoutkast777@hotmail.com>
Subject: Crypt::RC4 & cookies
Message-Id: <ZaQJa.19808$hV.948230@twister.austin.rr.com>

I am currently working on a program that encrypts login information into
cookies using the RC4 module.    However I run into a problem during the
decryption process.  For example, I made up a temporary password of test123
and when decrypting (in IE) it gives me testq23.  However, in netscape it
decrypts fine.  I was wondering if anybody knows of any glitches in the
module or IE, or whatever this could be.   It might be part of the built in
character sets, because I looked at the cookies in encrypted form in both
browsers and one character showed up different..

IE ---->                                         ,¨Íe_îß
NETSCAPE--->                           ,¨Íeîß

as you can see there is obviously some sort of difference in the characters,
and i'm wondering if anybody may know the solution....

Also is there any generic guidelines for the encrypt/decrypt keys for RC4?
Is it possible that I picked an invalid key because i've tried several
different variations, however none of them seem to fix the problem...

================================
David Stinemetze
southtownoutkast777@hotmail.com
http://www.cs.utsa.edu/~dstineme
================================

============================================================
"Make a fire for a man, keep him warm for an evening.
 Set a man on fire, keep him warm for the rest of his life."
     -Unknown
============================================================

=====================================================
"I will stand my watch and set myself on the rampart,
 and watch to see what He will say to me,
 and what I will answer when I am corrected."
     -Habakkuk 2:1
=====================================================





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

Date: 23 Jun 2003 23:40:08 -0700
From: matts@1-net.com.sg (Mathachan)
Subject: Re: How to read and write serial port using PERL in REDHAT 8.0
Message-Id: <a5c9f92f.0306232240.152820b2@posting.google.com>

Thank you very much.


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

Date: 24 Jun 2003 02:28:27 -0700
From: simon.fairey@ft.com (Simon Fairey)
Subject: Re: Issues grabbing UTF8 web page
Message-Id: <af9e67d1.0306240128.6e4447f6@posting.google.com>

"Alan J. Flavell" <flavell@mail.cern.ch> wrote in message news:<Pine.LNX.4.53.0306231754070.31161@lxplus014.cern.ch>...
> On Mon, Jun 23, Simon Fairey inscribed on the eternal scroll:
> 
> Did you give Perl the remotest clue that it's supposed to be treating
> the bytestream as utf8 ?
>

Well I have use utf8 at the start, and there is no setting in LWP to
tell it to grab a page in a specific coding as far as I can see.
 
> It's a common problem, indeed.  Based on the way you're asking the
> question, I fear that you may be somewhat at sea with how it works in
> XML/HTML/XHTML/whatever, which only makes your Perl difficulties that
> much harder.
> 

I think this may well be the case as I suspect that before I even get
a look in some sort of conversion has been done. Currently the
following picks up the character:

  $xml =~ s/\225/&#8226;/g;

but I suspect this is erroneous :-( and that what it's detecting is a
null value or some such.

> There is no such "HTML entity".  Numerical character references (which
> is what &#number; references are properly called) are defined to refer
> to Unicode code points, and the range 127 to 159 decimal inclusive in
> Unicode consists of control characters, none of which are used in
> practice.   As you've already noticed, the code point for the bullet
> is up at x2022.
> 

Sorry think I'm going from old references I had lying around:

http://www.bbsinc.com/symbol.html

> > I'm obviously missing something but I'm at a loss as to what it is,
> > character sets and Unicode are turning my brain to jelly at the moment
> > :-(
> 
> That realisation usually precedes enlightenment, so there's hope for
> you yet :-)
> 
> If your XML document is supposed to be coded in iso-8859-1, then your
> only valid way to represent the bullet character is as its proper
> numerical character reference, &#x2022; or (quick reference to
> read-reckoner...) &#8226;

Do you have a link to such a reference, I'm also concerned that there
may be other characters that may come through and I'm wondering what
the 'Done Thing' is with regards converting a UTF-8 encoded XML doc
into an ISO-8859-1 XML doc.

> As usual, a minimal script that we could run for ourselves and that
> exhibited the symptoms that you're complaining of would short-cut a
> panoply of possible misunderstandings based on your possibly confused
> description of what you're aiming at.  Since you say it references a
> utf-8 -encoded document, you better put that on an accessible web
> server somewhere (if it isn't already), and tell us its URL (trying to
> include it in a news posting is just _too_ fraught with potential
> difficulties).

I've tried to get a working example up on my home page but the client
server I'm accessing the data from is restricted and I so far have
been unable to mimic it by copying the data onto my web server but I
shall continue to try although answers to some of the above may sort
me out.

Essentially I think that LWP is grabbing the files in 7-bit mode
(guessing?) and the 8-bit characters are getting nulled, when I view
the grabbed doc in IE I just see a null character whereas when I go to
the client URL that serves the XML as HTML I see bullits :-(

Cheers

Struggling Si


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

Date: Tue, 24 Jun 2003 08:39:10 +0100
From: Simon Oliver <simon.oliver@nospam.umist.ac.uk>
Subject: Re: Newbie help with LWP
Message-Id: <3EF8001E.2040301@nospam.umist.ac.uk>

When you login the server must pass a token back to the browser so that 
the browser can identify itself to the server in the next request.  This 
is normally done using a cookie but might be done using hidden form 
fields.  I can't tell without seeing the response from the server after 
successful login.

Some other points to note:

- many servers are case sensitive - are you sure the file extension
   should be uppercase?

my $status = getstore('http://192.168.2.1:88/status.HTM','info');


- there is a hidden form element that presumably tells the server which
   page you came from - you should add this to the post:

<INPUT type=hidden value=login name=page>

- I've looked through the source to the form and can't see any box in
   which to type the login name!

- try using HTML::Form to parse the web page and use the click() method
   to submit it, something like this:

my $response = $ua->get('http://192.168.2.1:88');

# Check for errors
if ($response->is_error) {
   die "Error requesting form: ", $response->status_line, "\n";
}

# Parse the form
my ($form) = HTML::Form->parse($response->content, $response->base);

# Set the parameters
$form->value(pws => $passwd);

# Submit the completed form
$response = $ua->request($form->click);

# Check for errors
if ($response->is_error) {
   die "Error submitting form: ", $response->status_line, "\n";
}

# $ response now contains the login response

-- 
   Simon Oliver



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

Date: Tue, 24 Jun 2003 02:19:29 -0500
From: tadmc@augustmail.com
Subject: Posting Guidelines for comp.lang.perl.misc ($Revision: 1.4 $)
Message-Id: <hFqdnYkrlYocZmqjXTWcqA@august.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.4 $)
    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.

    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
        "Jeopardy" (because the answer comes before the question), or
        "TOFU".

        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: 24 Jun 2003 04:09:38 GMT
From: Nicholas Dronen <ndronen@io.frii.com>
Subject: Re: Problem with "system" call - multiple invocations (Newbie)
Message-Id: <3ef7cf02$0$202$75868355@news.frii.net>

Tony <anthony@no_spam.movielink.net.au> wrote:

T> Newbie question,

T> Hi guys,

T> I need to invoke a perl script from another perlscript
T> with different parms passed to the second perl script.

T> Code snippet
T> ==============
T> my ($no1,$no2) = (0,1)
T> my $num = "single digit var from other part of program";
T> my $file = "/some/path/file_"
T> my $perl_script = "/some/path/perl_program";

T> if ($num == 1) {
T>   system "$perl_script" , "$file$no1" , "&";   # Invoke $perl_script once
T>   exit(0);
T> if ($num == 2) {
T>   system "$perl_script" , "$file$no1" , "&";   # Invoke $perl_script 2 times
T>   system "$perl_script" , "$file$no2" , "&";   # with different file name.
T>   exit(0);

The following does what you want.  See below for an explanation.

#!/usr/bin/perl
$|++;
use strict;
use warnings;
my $program = "someprogram";
my $file = "somefile";
my $num = 2;
for (1..$num) {
    system "$program $file$_ &";
}
exit(0);

T> # My "$perl_script" program takes the
T> # file name and processes it in a process that never
T> # will return, that is why I use "&" so the invoking
T> # perl script can start the next invocation when there are
T> # 2 different file names.

T> The above does not work as expected.  With $num = 2 the first
T> invocation of "$perl_script" runs but not the second one.  Killing
T> the first one using kill PID allows the second one to start, in other
T> words the "&" does not seem to do what it is supposed to do, let
T> the calling script continue with the next item on the list.

T> What am I doing wrong here?

See perldoc -f system:

	                      If there is more than one
	argument in LIST, or if LIST is an array with more
	than one value, starts the program given by the
	first element of the list with arguments given by
	the rest of the list.  If there is only one scalar
	argument, the argument is checked for shell
	metacharacters, and if there are any, the entire
	argument is passed to the system's command shell
	for parsing (this is "/bin/sh -c" on Unix plat-
	forms, but varies on other platforms). 

In other words, your invocation of system() with more than one
argument results in shell metacharacters, such as the ampersand,
being passed directly as an argument to the program.  Very loosely
speaking, it's the difference between:

	$ ls '&'

and

	$ ls &

Regards,

Nicholas

-- 
"Why shouldn't I top-post?"    http://www.aglami.com/tpfaq.html
"Meanings are another story."  http://www.ifas.org/wa/glossolalia.html


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

Date: 23 Jun 2003 23:08:29 -0700
From: rook_5150@yahoo.com (Bryan Castillo)
Subject: Re: Problem with "system" call - multiple invocations (Newbie)
Message-Id: <1bff1830.0306232208.4f6ba777@posting.google.com>

"Tony" <anthony@no_spam.movielink.net.au> wrote in message news:<pan.2003.06.24.01.20.28.773936@no_spam.movielink.net.au>...
> Newbie question,
> 
> Hi guys,
> 
> I need to invoke a perl script from another perlscript
> with different parms passed to the second perl script.
> 
> Code snippet
> ==============
> my ($no1,$no2) = (0,1)
> my $num = "single digit var from other part of program";
> my $file = "/some/path/file_"
> my $perl_script = "/some/path/perl_program";
> 
> if ($num == 1) {
>   system "$perl_script" , "$file$no1" , "&";   # Invoke $perl_script once
>   exit(0);
> if ($num == 2) {


>   system "$perl_script" , "$file$no1" , "&";   # Invoke $perl_script 2 times
    system "$perl_script $file$no1 &"; # (See below)


>   system "$perl_script" , "$file$no2" , "&";   # with different file name.
    system "$perl_script $file$no2 &"; # (See below)

>   exit(0);
> 
> # My "$perl_script" program takes the
> # file name and processes it in a process that never
> # will return, that is why I use "&" so the invoking
> # perl script can start the next invocation when there are
> # 2 different file names.
> 
> The above does not work as expected.  With $num = 2 the first
> invocation of "$perl_script" runs but not the second one.  Killing
> the first one using kill PID allows the second one to start, in other
> words the "&" does not seem to do what it is supposed to do, let
> the calling script continue with the next item on the list.

Read the docs for "system".  If you had called it with one string as a command
line, it would have been parsed for shell meta-characters.  The & symbol is 
something understood by the shell, it doesn't really mean anything to perl.
I would bet that $ARGV[2] would be equal to '&' in your 2nd script.



> 
> What am I doing wrong here?
> 
> I have tried various combinations of `` '' "" but nothing gives. 
> 
> Tony


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

Date: Tue, 24 Jun 2003 17:48:33 +1000
From: "Tony" <anthony@no_spam.movielink.net.au>
Subject: Re: Problem with "system" call - multiple invocations (Newbie)
Message-Id: <pan.2003.06.24.07.48.31.417663@no_spam.movielink.net.au>

On Tue, 24 Jun 2003 04:09:38 +0000, Nicholas Dronen wrote:

> Tony <anthony@no_spam.movielink.net.au> wrote:
> 
> T> Newbie question,

 
> T> if ($num == 1) {
> T>   system "$perl_script" , "$file$no1" , "&";   # Invoke $perl_script once
> T>   exit(0);
> T> if ($num == 2) {
> T>   system "$perl_script" , "$file$no1" , "&";   # Invoke $perl_script 2 times
> T>   system "$perl_script" , "$file$no2" , "&";   # with different file name.

 
> The following does what you want.  See below for an explanation.
> 
> #!/usr/bin/perl
> $|++;
> use strict;
> use warnings;
> my $program = "someprogram";
> my $file = "somefile";
> my $num = 2;
> for (1..$num) {
>     system "$program $file$_ &";
> }
> exit(0);

Hi Nicholas,

I had a solution using fork but was interested in knowing
how the above would work.  I tried it but could only get
1 invocation initially.

I had to modify my code a bit so that my numbers matched
(To much to explain) but your solution reduced the code
from 40 lines using fork (Forked did work nicely) to
only 5 lines (Not counting what I had anyway).

It is amazing how things can be made small and effecient...
 

Everything now works perfectly, thanks

Tony


> See perldoc -f system:
> 
> 	                      If there is more than one
> 	argument in LIST, or if LIST is an array with more

[...]

 
> In other words, your invocation of system() with more than one
> argument results in shell metacharacters, such as the ampersand,


 
> Regards,
> 
> Nicholas

-- 
--------------------------------------------------------------
To reply directly send to: anthony AT movielink DOT net DOT au
Replace AT and DOT with @ and . and mail will get through.
Any spammers will be persued until they get booted off the net



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

Date: Tue, 24 Jun 2003 10:15:10 +0100
From: "Phill.  W" <P.A.Ward@open.ac.uk>
Subject: Re: Problem with calling an vb6 executable from perl script on IIS 5
Message-Id: <bd94qt$ht5$1@yarrow.open.ac.uk>

"magpie" <magpie@optonline.net> wrote in message
news:bd7u5s$lb0$1@slb2.atl.mindspring.net...
 . . .
> I call an exe from a perl script on windows 2k web server unning IIS
> 5.0, but the script will not run when called from a web page.
 . . .
> The script works fine from direct perl and the exe works from
> command line.

Almost /certainly/ a permissions problem.
Remember, IIS is an NT Service running under the Local System
account which may not have the permissions that the executable
needs.  Also, by default, IIS actively /prevents/ ASP's running
external programs.

HTH,
    Phill  W.





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

Date: Tue, 24 Jun 2003 09:37:38 +0100
From: Chris Lowth <dont@want.spam>
Subject: Re: stopping PPM3 connecting to internet for LOCAL installs
Message-Id: <n5UJa.3090$yw5.38514@newsfep4-glfd.server.ntli.net>

Randy Kobes wrote:

> On Mon, 23 Jun 2003 13:28:49 +0100, Chris Lowth <dont@want.spam> wrote:
>>I want to use "PPM" in ActiveState perl 5.8.0 on NT4 to install a module
>>from a local file. I have downloaded the zip file and unzipped it. Then
>>run
>>        ppm install IO-Stringy.ppd
>>This hangs.
>>Running "tcpdump" on the firewall, I can see that the command is trying to
>>connect to ppm.activestate.com (which my firewall forbids - I am trying to
>>simulate a truely off-line install).
> 
> Are you running the ppm command from the same directory as
> where the ppd file is located?
> 

Yes

Oh - and sorry - the example module is IO-stringy not IO-Stringy.

-- 
Real address: chris at lowth dot sea oh em.
World's first wrist-watch PDA with Palm OS, available June 30
from Amazon.com. Order now to beat the rush!
   http://www.lowth.com/shop/wrist_pda


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

Date: Tue, 24 Jun 2003 05:03:27 GMT
From: derek / nul <abuse@sgrail.org>
Subject: Unicode problems, Microsoft utf16le files
Message-Id: <qdmffv43kflumqttmgpp2d41t7p2lepv8s@4ax.com>

I am using the following to read the file:-
The file decodes ok.

  local $/;
  $data = <SLURP>;                    # get the whole file
  $datad = decode("UTF16", $data);    # convert from utf16le to display :-)

The file starts like this:-

FF FE 53 00 49 00 4D 00 49 00 53 00 41 00 40 00


When I have modified the file, I write back with:-

$datad = encode("UTF16LE", $data);
open OUTFILE2, ">$dash9c",    or die "Cannot open $dash9c.eng for write :$!";
print OUTFILE2 $datad;

The file written to disk is like this:-

53 00 49 00 4D 00 49 00 53 00 41 00 40 00 40 00

Am I doing anything wrong?

Derek


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

Date: 24 Jun 2003 05:13:53 GMT
From: sholden@flexal.cs.usyd.edu.au (Sam Holden)
Subject: Re: Unicode problems, Microsoft utf16le files
Message-Id: <slrnbffngh.376.sholden@flexal.cs.usyd.edu.au>

On Tue, 24 Jun 2003 05:03:27 GMT, derek / nul <abuse@sgrail.org> wrote:
> I am using the following to read the file:-
> The file decodes ok.
> 
>   local $/;
>   $data = <SLURP>;                    # get the whole file
>   $datad = decode("UTF16", $data);    # convert from utf16le to display :-)
> 
> The file starts like this:-
> 
> FF FE 53 00 49 00 4D 00 49 00 53 00 41 00 40 00
> 
> 
> When I have modified the file, I write back with:-
> 
> $datad = encode("UTF16LE", $data);
> open OUTFILE2, ">$dash9c",    or die "Cannot open $dash9c.eng for write :$!";
> print OUTFILE2 $datad;
> 
> The file written to disk is like this:-
> 
> 53 00 49 00 4D 00 49 00 53 00 41 00 40 00 40 00
> 
> Am I doing anything wrong?

Not writing out the Unicode byte order mask (character 0xFEFF) at the start
of the file.

That isn't necessarily wrong, since it isn't a requirement, but it makes it
telling utf16le and utf16be apart without external metadata possible.

"encode" can't add it, since it is only meant to appear at the start of a
file/stream/whatever and it has no way of knowing that you are going to
store the the result at the start of a file...

Since you encoded to utf16le, you should make sure that 0xFF 0xFE are the
first two bytes in the file (by printing them first, for example). Perl
might provide some mechanism to do this automatically - but character codes
aren't my domain (the expert in them on this group is obvious from recent
postings).

-- 
Sam Holden



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

Date: Tue, 24 Jun 2003 00:33:18 -0500
From: Yarden Katz <katz@underlevel.net>
Subject: Re: using SOAP::Lite to call other services.
Message-Id: <867k7cox9d.fsf@underlevel.net>

Eric Amick <eric-amick@comcast.net> writes:

> On Mon, 23 Jun 2003 16:50:36 -0500, Yarden Katz <katz@underlevel.net>
> wrote:
>
>>Hi,
>>
>>  I'm using SOAP::Lite to write a few services.  I managed to get a
>>  few clients/server running correctly.
>>
>>  I'm having trouble getting SOAP::Lite to call external, non-Perl
>>  services, however.  The service I am interested in is
>>  'ValidateEmail' (see
>>  http://www.webservicex.net/ValidateEmail.asmx).
>>
>>  According to the SOAP::Lite documentation, it is perfectly valid to
>>  do:
>>
>>          print "RESULT: ", SOAP::Lite
>>            -> uri('http://www.webserviceX.NET')
>>            -> proxy('http://www.webservicex.net/ValidateEmail.asmx')
>>            -> service('http://www.webservicex.net/ValidateEmail.asmx?WSDL')
>>            -> IsValidEMail($email) . "\n";
>
> None of their examples use both proxy() and service().  Try eliminating
> the proxy().

I've tried this before (I noticed the same thing with the examples)
but have only one or only the other do not change the results.  Any
other ideas?

Appreciate your help,
-- 
Yarden Katz <katz@underlevel.net>  |  Mind the gap


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

Date: Tue, 24 Jun 2003 00:42:20 -0500
From: Yarden Katz <katz@underlevel.net>
Subject: Re: using SOAP::Lite to call other services.
Message-Id: <863ci0owub.fsf@underlevel.net>

Eric Amick <eric-amick@comcast.net> writes:

> On Mon, 23 Jun 2003 16:50:36 -0500, Yarden Katz <katz@underlevel.net>
> wrote:
>
>>Hi,
>>
>>  I'm using SOAP::Lite to write a few services.  I managed to get a
>>  few clients/server running correctly.
>>
>>  I'm having trouble getting SOAP::Lite to call external, non-Perl
>>  services, however.  The service I am interested in is
>>  'ValidateEmail' (see
>>  http://www.webservicex.net/ValidateEmail.asmx).
>>
>>  According to the SOAP::Lite documentation, it is perfectly valid to
>>  do:
>>
>>          print "RESULT: ", SOAP::Lite
>>            -> uri('http://www.webserviceX.NET')
>>            -> proxy('http://www.webservicex.net/ValidateEmail.asmx')
>>            -> service('http://www.webservicex.net/ValidateEmail.asmx?WSDL')
>>            -> IsValidEMail($email) . "\n";
>
> None of their examples use both proxy() and service().  Try eliminating
> the proxy().

I tried calling a different service with SOAP::Lite and I'm getting
similarly weird results:

use SOAP::Lite +autodispatch, +trace => debug;
my $soap = SOAP::Lite
    -> uri('http://www.worldwidedesktop.com/spellcheck')
    -> on_action(sub {sprintf '%s/%s', @_})
    -> proxy('http://www.worldwidedesktop.com/spellcheck/spellcheckservice.asmx');

$soap = $soap->SpellCheck( SOAP::Data->name(TextToCheck => 'foo') );


The SOAP message I get back is:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <soap:Fault>
      <faultcode>soap:Server</faultcode>
      <faultstring>Server was unable to process request. --&gt; Object reference not set to an instance of an object.</faultstring>
      <detail />
    </soap:Fault>
  </soap:Body>
</soap:Envelope>


This makes no sense, because the message that my snippet above
actually sent (as printed by +debug) was:

SOAP::Transport::HTTP::Client::send_receive: POST http://www.worldwidedesktop.com/spellcheck/spellcheckservice.asmx
Accept: text/xml
Accept: multipart/*
Content-Length: 544
Content-Type: text/xml; charset=utf-8

SOAPAction: http://www.worldwidedesktop.com/spellcheck/SpellCheck

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/1999/XMLSchema">
  <SOAP-ENV:Body>
    <namesp1:SpellCheck
    xmlns:namesp1="http://www.worldwidedesktop.com/spellcheck">
          <TextToCheck xsi:type="xsd:string">foo</TextToCheck>
    </namesp1:SpellCheck>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>


The message that this service expects, as written by its documentation
(at
http://www.worldwidedesktop.com/spellcheck/spellcheckservice.asmx?op=SpellCheck)
is:

POST /spellcheck/spellcheckservice.asmx HTTP/1.1
Host: www.worldwidedesktop.com
Content-Type: text/xml; charset=utf-8
Content-Length: length

SOAPAction: "http://www.worldwidedesktop.com/spellcheck/SpellCheck"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <SpellCheck xmlns="http://www.worldwidedesktop.com/spellcheck">
      <LicenseText>string</LicenseText>
      <TextToCheck>string</TextToCheck>
    </SpellCheck>
  </soap:Body>
</soap:Envelope>


As far as I can tell, the message the server documentation shows and
the one sent by my client are almost identical.  I see no reason why
this call would fail.. the service itself is functioning, so the
problem must be on my end.

Thanks a lot,
-- 
Yarden Katz <katz@underlevel.net>  |  Mind the gap


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

Date: Tue, 24 Jun 2003 09:38:58 +0100
From: "des fisher" <desfisher@NaTCH.co.uk>
Subject: V Newbie: Installing Perl modules
Message-Id: <bd9349$81g$1@newsg1.svr.pol.co.uk>

I'm a v newbie who is trying to run the checklink thingy
(http://validator.w3.org/checklink)

I've installed ActivePerl and example.pl ran ok.  I'm trying to install the
Perl modules needed by checklink.

PPM starts up fine and I've downloaded to my root directory cgi.pm.txt.

In PPM the command "install c:\cgi.pm.txt" gets the message "Searching for
'c:\cgi.pm.txt' returns no results.  Try a broader search first."
Don't understand.  Help.
I tried renaming cgi.pm.txt as cgi.pm and same result.

Thanks for your time.

-- 

keep :)ing - des fisher
 ... www.NaTCH.co.uk last updated 23 June
 ... www.EarlSohamBrewery.co.uk





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

Date: 24 Jun 2003 09:46:29 GMT
From: sholden@flexal.cs.usyd.edu.au (Sam Holden)
Subject: Re: V Newbie: Installing Perl modules
Message-Id: <slrnbfg7fl.u1i.sholden@flexal.cs.usyd.edu.au>

On Tue, 24 Jun 2003 09:38:58 +0100, des fisher <desfisher@NaTCH.co.uk> wrote:
> I'm a v newbie who is trying to run the checklink thingy
> (http://validator.w3.org/checklink)
> 
> I've installed ActivePerl and example.pl ran ok.  I'm trying to install the
> Perl modules needed by checklink.
> 
> PPM starts up fine and I've downloaded to my root directory cgi.pm.txt.
> 
> In PPM the command "install c:\cgi.pm.txt" gets the message "Searching for
> 'c:\cgi.pm.txt' returns no results.  Try a broader search first."
> Don't understand.  Help.
> I tried renaming cgi.pm.txt as cgi.pm and same result.

I think PPM installs things via .ppd files. It doesn't install .pm files
directly.

But CGI is part of core in ActivePerl so it should already be installed.

-- 
Sam Holden



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

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


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