[28129] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 9493 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jul 18 09:05:55 2006

Date: Tue, 18 Jul 2006 06:05:05 -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, 18 Jul 2006     Volume: 10 Number: 9493

Today's topics:
    Re: A subroutine for gcd <bik.mido@tiscalinet.it>
    Re: A subroutine for gcd <David.Squire@no.spam.from.here.au>
    Re: Extract alternate patterns <zen13097@zen.co.uk>
    Re: Freeware IDE for perl? <ksamp@vp_removeit_.pl>
    Re: Freeware IDE for perl? <ynleder@nspark.org>
        help me <jenish.g@gmail.com>
    Re: help me <graham.removethis.t.wood@andthis.oracle.com>
        how to add a space after first word ina s entence sudip05@mailcity.com
    Re: how to add a space after first word ina s entence <nobull67@gmail.com>
    Re: how to add a space after first word ina s entence sudip05@mailcity.com
    Re: How to local-ly close a handle? <bik.mido@tiscalinet.it>
        IDE for Perl able to save as UTF-8 <ynleder@nspark.org>
    Re: matching for specific ascii decimal "non-printable  <bart@nijlen.com>
    Re: Perl and Politics <bik.mido@tiscalinet.it>
    Re: Perl and Politics <bik.mido@tiscalinet.it>
        please urgent <jenish.g@gmail.com>
    Re: please urgent <nobull67@gmail.com>
    Re: please urgent <1usa@llenroc.ude.invalid>
        Posting Guidelines for comp.lang.perl.misc ($Revision:  tadmc@augustmail.com
    Re: simulate user activity <daleif@RTFSIGNATUREimf.au.dk>
    Re: What is a type error? <jo@durchholz.org>
    Re: What is a type error? <jo@durchholz.org>
    Re: What is the global hash %_ ? <bol@adv.magwien.gv.at>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 18 Jul 2006 12:27:31 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: A subroutine for gcd
Message-Id: <ug8pb2pg701pdetvpip100hn09ajjua5n5@4ax.com>

On Mon, 17 Jul 2006 15:38:58 +0200, gamo <gamo@telecable.es> wrote:

>Does anyone knows how to write a sub for gcd?

Yes I know!

Ok, now I know you don't believe me...

  sub gcd { $_[1]?gcd($_[1],$_[0]%$_[1]):$_[0] }


Michele
-- 
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
 .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,


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

Date: Tue, 18 Jul 2006 11:50:56 +0100
From: David Squire <David.Squire@no.spam.from.here.au>
Subject: Re: A subroutine for gcd
Message-Id: <e9ieeh$ns2$1@gemini.csx.cam.ac.uk>

Michele Dondi wrote:
> On Mon, 17 Jul 2006 15:38:58 +0200, gamo <gamo@telecable.es> wrote:
> 
>> Does anyone knows how to write a sub for gcd?
> 
> Yes I know!
> 
> Ok, now I know you don't believe me...
> 
>   sub gcd { $_[1]?gcd($_[1],$_[0]%$_[1]):$_[0] }

Good old Euclid. If you want to read about why it works, see 
http://mathworld.wolfram.com/EuclideanAlgorithm.html


DS


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

Date: 18 Jul 2006 08:32:06 GMT
From: Dave Weaver <zen13097@zen.co.uk>
Subject: Re: Extract alternate patterns
Message-Id: <44bc9c86$0$9208$db0fefd9@news.zen.co.uk>

On 17 Jul 2006 14:29:45 GMT, Ben Bacarisse <spam@bsb.me.uk> wrote:
> <snip> 
> >      if($transaction =~ /(addReq|modReq|subtractReq)+?.*?(addReq)?/){
> >        print "$1..$2\n";
> >      }
> > 
<snip>
> > modReq..addReq
> 
>  The above is matched as three parts:
> 
>   "modReq"    by (addReq|modReq|subtractReq)+
>   "..addReq"  by .*
>   ""          by (addReq)

No, "..addReq" is not matched by the .*
The ".*?" matches "",  as does the "(addReq)?"
Witness:

% perl -le '"modReq..addReq" =~
    /(addReq|modReq|subtractReq)+?(.*?)(addReq)?/ and print "1:$1 2:$2 3:$3"'
1:modReq 2: 3:

Perhaps this will help the OP:

% perl -le '"modReq..addReq" =~
     /(addReq|modReq|subtractReq)+?(?=.*(addReq))?/ and print "1:$1 2:$2"'
1:modReq 2:addReq



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

Date: Tue, 18 Jul 2006 10:52:57 +0100
From: ks <ksamp@vp_removeit_.pl>
Subject: Re: Freeware IDE for perl?
Message-Id: <84bpb25g1gqvfge2lh7i7ofg4vvsa3idbj@4ax.com>

On 17 Jul 2006 05:42:01 -0700, "Robert Hicks" <sigzero@gmail.com>
wrote:

>Vim
>emacs

since i use it very often i can advise it a little. you will have to
spend some time to adjust it for Perl programming. if you decide to
pick it up than take a look at some handful modules:

ecb
tinyperl
cedet (sidebar)
tabbar
some modules for better buffer switching (e.g. icicles etc.)
take a look also at emacs wiki (http://www.emacswiki.org/cgi-bin/wiki)
where you can find a lot of modules, advises, configuration examples
etc.

in faq you will also find some advises on how to use emacs for Perl
based development.

>XEmacs
>SciTE
>Open Perl IDE
>The Crimson Editor
>ConTEXT
>CPad

i've also seen Eclipse with EPIC plugin. it's doing fine.

>Spend a little $$:
>
>Komodo
>Textmate
>Affrus

best regards,
ks


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

Date: Tue, 18 Jul 2006 12:27:14 +0200
From: Yohan N. Leder <ynleder@nspark.org>
Subject: Re: Freeware IDE for perl?
Message-Id: <MPG.1f26d5ebfcd5f32a989890@news.tiscali.fr>

In article <1153136255.591399.69120@i42g2000cwa.googlegroups.com>, 
jtpryan@gmail.com says...
> Can anybody recommend good ones?
> 
> Thanks,
> Jim
> 
> 

Perl Express is freeware and nice unless if you want to save your source 
as UTF-8 : see a thread I've just opened before to post this reply to 
you, this same day in the same newsgroup.


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

Date: 18 Jul 2006 01:33:13 -0700
From: "jeni" <jenish.g@gmail.com>
Subject: help me
Message-Id: <1153211593.254791.20660@75g2000cwc.googlegroups.com>

suggest any online free docs for handling MS Word using Win32::OLE.
no one documentation gives the different methods to access MSWord.
pls help me



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

Date: Tue, 18 Jul 2006 09:46:51 +0100
From: Graham Wood <graham.removethis.t.wood@andthis.oracle.com>
Subject: Re: help me
Message-Id: <8A1vg.16$JA.104@news.oracle.com>

jeni wrote:

> suggest any online free docs for handling MS Word using Win32::OLE.
> no one documentation gives the different methods to access MSWord.
> pls help me
> 
perldoc Win32::OLE

http://groups.google.com/group/comp.lang.perl.misc/search?group=comp.lang.perl.misc&q=Win32%3A%3AOLE&qt_g=1

965 results for Win32::OLE

Somewhere in there should contain what you need.

Graham



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

Date: 18 Jul 2006 04:12:28 -0700
From: sudip05@mailcity.com
Subject: how to add a space after first word ina s entence
Message-Id: <1153221148.418567.191960@s13g2000cwa.googlegroups.com>

Hi All,
        I am having a senmtence. After the first word, I have to add a
single space there...can anybody gimme a coincise code. I tried
breaking up the sentence, but it removes the spaces also which I dont
want.

Code snippet
first line: selects lineString example: "int *ptr ptr is a pointer"

if($lineString =~ m/(\s*\@param\s*)\*(.*\r*\n*)/)
   {
        $lineString = $1.$2;   /*$1 is "int " $2 is "ptr is a pointer"
*/

I have to produce output like "int ptr(then 1 single space) is a
pointer". So I have to manipulate $2 in such a way that after first
word in $2, there goes another extra space.



Can anybody help.

Thanks,

sudip



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

Date: 18 Jul 2006 04:53:13 -0700
From: "Brian McCauley" <nobull67@gmail.com>
Subject: Re: how to add a space after first word ina s entence
Message-Id: <1153223593.125526.317120@m73g2000cwd.googlegroups.com>

sudip05@mailcity.com wrote:

>         I am having a senmtence. After the first word, I have to add a
> single space there...can anybody gimme a coincise code.

s/(\w+)/$1 /;

Somehow, I suspect that's not what you meant.

> first line: selects lineString example: "int *ptr ptr is a pointer"
>
> if($lineString =~ m/(\s*\@param\s*)\*(.*\r*\n*)/)
>    {
>         $lineString = $1.$2;   /*$1 is "int " $2 is "ptr is a pointer"
> */

That is not valid Perl - it will not compile.

There was no '@params' in your example input so your pattern will not
match.

That yo you think the pattern /(.*\r*\n*)/ matches?

> I have to produce output like "int ptr(then 1 single space) is a
> pointer". So I have to manipulate $2 in such a way that after first
> word in $2, there goes another extra space.

The dolar-digit variables are readonly.  You need to copy the string to
an ordinary scalar variable then manipulate it in the usual way. (e.g.
with s///).

Please produce minimal but complete code to illustrate your quesrtion.

> Can anybody help.

Only if you describe what you want to achive in term that other people
could possibly understant.



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

Date: 18 Jul 2006 05:20:32 -0700
From: sudip05@mailcity.com
Subject: Re: how to add a space after first word ina s entence
Message-Id: <1153225232.530596.233000@s13g2000cwa.googlegroups.com>

Hi Brian,
            I am sorry..yes, u r very true...the code that I gave wont
work, but you gave the corect solution(inserting a space after the
first word in a sntence)...thanks a lot..... :-)

~Ciao


Brian McCauley wrote:
> sudip05@mailcity.com wrote:
>
> >         I am having a senmtence. After the first word, I have to add a
> > single space there...can anybody gimme a coincise code.
>
> s/(\w+)/$1 /;
>
> Somehow, I suspect that's not what you meant.
>
> > first line: selects lineString example: "int *ptr ptr is a pointer"
> >
> > if($lineString =~ m/(\s*\@param\s*)\*(.*\r*\n*)/)
> >    {
> >         $lineString = $1.$2;   /*$1 is "int " $2 is "ptr is a pointer"
> > */
>
> That is not valid Perl - it will not compile.
>
> There was no '@params' in your example input so your pattern will not
> match.
>
> That yo you think the pattern /(.*\r*\n*)/ matches?
>
> > I have to produce output like "int ptr(then 1 single space) is a
> > pointer". So I have to manipulate $2 in such a way that after first
> > word in $2, there goes another extra space.
>
> The dolar-digit variables are readonly.  You need to copy the string to
> an ordinary scalar variable then manipulate it in the usual way. (e.g.
> with s///).
>
> Please produce minimal but complete code to illustrate your quesrtion.
>
> > Can anybody help.
>
> Only if you describe what you want to achive in term that other people
> could possibly understant.



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

Date: Tue, 18 Jul 2006 10:31:05 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: How to local-ly close a handle?
Message-Id: <ol6pb2dd29n3ic5obua302nricjbcbqmej@4ax.com>

On Sun, 16 Jul 2006 13:57:29 +0000 (UTC), kj <socyl@987jk.com.invalid>
wrote:

>One would think that one of the few good uses left for the keyword
>"local" would be to "local-ly" close an open handle, like this:

"local" is an adjective, "locally" is an adverb. Perl (up to) 5 does
not really support adverbs, while they will be a pervasive concept in
Perl 6. I'm not suggesting you to wait till the beast is up and
running, just pointing it out FYI.


Michele
-- 
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
 .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,


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

Date: Tue, 18 Jul 2006 12:23:44 +0200
From: Yohan N. Leder <ynleder@nspark.org>
Subject: IDE for Perl able to save as UTF-8
Message-Id: <MPG.1f26d51c8bce05a298988f@news.tiscali.fr>

I'm using Komodo and, sometimes, PerlExpress because of its better 
ergonomic language help (docked at left side) and its nice feature about 
CGI input (tab rather than simple dlgbox and with possibility to save a 
set to a file anywhere on disk). However, Komodo has a big big advantage 
: it's able to save source in UTF-8, while (unless mistake) PE can't.

So, here is my question : what's the IDE for Perl which provides an 
editor able to save any (not a general config, but file per file) source 
file in any charset you want, including UTF-8 ?

The list :

- ActiveState Komodo 3.5 : yes
- Perl Express 2.5 : no
 ...


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

Date: 18 Jul 2006 04:36:30 -0700
From: "Bart Van der Donck" <bart@nijlen.com>
Subject: Re: matching for specific ascii decimal "non-printable character"
Message-Id: <1153222589.975084.271590@m79g2000cwm.googlegroups.com>

Jack wrote:

> I have "decimal 28 nonprintables" in my file as delimiters, this I
> know.
> How do I match to it ?  I tried the following and they dont seem to be
> detecting - any ideas ?
> if ($_ =~ m/\028/) { print " a ";  }
> if ($_ =~ m/028/) { print " 0 ";  }
> if ($_ =~ m/28/) { print " 1 ";  }
> if ($_ =~ m/-d '\028'/) { print " 2 ";}

if (/\x@{[sprintf'%x',28]}/i) { print 'OK' }

> Also, does someone know how to detect newlines (carriage returns) as
> the first character in a string (in this case a variable where I read
> in a file record... I tried the below and it too is not detecting !
> if ($newline =~ m/^\n/) { print " newline " ; }

if ($newline=~/^(\x0A|\x0D|\x85|\x0C)/i) { print 'OK' }

-- 
 Bart



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

Date: Tue, 18 Jul 2006 10:31:03 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Perl and Politics
Message-Id: <eu5pb2tdg89cm3beesrah7bhhm7lf5jk4g@4ax.com>

On 14 Jul 2006 12:24:48 -0700, ilikesluts@gmail.com wrote:

>I was wondering if the perl community shares common political beliefs,
>if so what are they?

I strongly second the impression that you're a troll, but here's my
take on your question, anyway: there's nothing that would make me
believe some sort of political belief could be shared amongst the Perl
community, and occasional debates in PerlMonks, which is slightly more
tolerant to OT content than clpmisc tend to confirm this obvious
guess.


Michele
-- 
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
 .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,


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

Date: Tue, 18 Jul 2006 10:31:04 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Perl and Politics
Message-Id: <g56pb2dp1ru9vppsfmaqlss08ofd3ubajn@4ax.com>

On 14 Jul 2006 13:58:55 -0700, ilikesluts@gmail.com wrote:

>be forthright and straight forward.  I think that being straight
>forward is the basis of and good communications

I second that. Unfortunately it's not always as easy as it may seem,
especially because one may be shy or may not possess a very good
expressiveness or may not even be a native English speaker.

OTOH there's one simple techincal device that is also at the basis of
good communications *in USENET*. It doesn't involve excessive skills
since it is a matter of just a few keystrokes: it's called "quoting
properly" which in particular involves not to top-post and to trim the
quoted material, but thus far I have seen you avoiding it. So may I
ask you as an act of kindness to the group to be so gentle and conform
to this simple behavioural practice?


Michele
-- 
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
 .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,


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

Date: 18 Jul 2006 01:30:55 -0700
From: "jeni" <jenish.g@gmail.com>
Subject: please urgent
Message-Id: <1153211455.848855.246790@i42g2000cwa.googlegroups.com>

how to read ms word document and manipulate the document using
win32::OLE.



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

Date: 18 Jul 2006 04:54:54 -0700
From: "Brian McCauley" <nobull67@gmail.com>
Subject: Re: please urgent
Message-Id: <1153223694.260574.175140@p79g2000cwp.googlegroups.com>

On a scale of 1 to 10 you subject line scores about -10000.



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

Date: Tue, 18 Jul 2006 12:41:46 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: please urgent
Message-Id: <Xns9804588E45E92asu1cornelledu@127.0.0.1>

"Brian McCauley" <nobull67@gmail.com> wrote in 
news:1153223694.260574.175140@p79g2000cwp.googlegroups.com:

> On a scale of 1 to 10 you subject line scores about -10000.

Fallen victim to Google Groups, huh? ;-)

Sinan
-- 
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)

comp.lang.perl.misc guidelines on the WWW:
http://augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html



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

Date: 18 Jul 2006 07:22:22 GMT
From: tadmc@augustmail.com
Subject: Posting Guidelines for comp.lang.perl.misc ($Revision: 1.6 $)
Message-Id: <44bc8c2d$0$57737$ae4e5890@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.6 $)
    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://www.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: Tue, 18 Jul 2006 10:00:03 +0200
From: Lars Madsen <daleif@RTFSIGNATUREimf.au.dk>
Subject: Re: simulate user activity
Message-Id: <e9i4e3$9si$1@news.net.uni-c.dk>


> 
> use random number generator:
> http://faq.perl.org/perlfaq4.html#How_do_I_get_a_rando
> 
> I would put a list of programs in the script, and use the random number
> generator to
> - start a program at a random time
> - choose randomly which program to start
> - choose randomly how long the program should be running
> 
> Michael

my thought exactly

I have a small test that uses fork to start the programs, and then the parent 
can time out and kill the child.

since I'd like to have several programs running at the same time, I think I'll 
need a dual fork or similar, but I think I almost have it done.

-- 

/daleif (remove RTFSIGNATURE from email address)

LaTeX FAQ:      http://www.tex.ac.uk/faq
LaTeX book:     http://www.imf.au.dk/system/latex/bog/    (in Danish)
Remember to post minimal examples, see URL below
http://www.tex.ac.uk/cgi-bin/texfaq2html?label=minxampl


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

Date: Tue, 18 Jul 2006 12:48:11 +0200
From: Joachim Durchholz <jo@durchholz.org>
Subject: Re: What is a type error?
Message-Id: <e9ieii$mn6$1@online.de>

Marshall schrieb:
> Chris Smith wrote:
>> Joachim Durchholz <jo@durchholz.org> wrote:
>> I *think* I understand Marshall here.  When you are saying "assignment",
>> you mean assignment to values of attributes within tuples of the cell.
>> When Marshall is saying "assignment", he seems to mean assigning a
>> completely new *table* value to a relation; i.e., wiping out the entire
>> contents of the relation and replacing it with a whole new set of
>> tuples.  Your assignment is indeed less powerful than DML, whereas
>> Marshall's assignment is more powerful than DML.
> 
> Exactly.

Ah well. I never meant that kind of assignment.

Besides, all the aliasing possibilities already happen at the field 
level, so it never occurred to me that whole-table assignment might 
enter into the picture.

Regards,
Jo


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

Date: Tue, 18 Jul 2006 13:27:55 +0200
From: Joachim Durchholz <jo@durchholz.org>
Subject: Re: What is a type error?
Message-Id: <e9igt2$r0f$1@online.de>

Marshall schrieb:
> No. The variable is the table, not the records.

In your examples, yes.

 > Relations are not arrays.

They are, in all ways that matter for aliasing:
They are a collection of mutable data, accessible via selector values.

> Records are not lvalues.

Agreed, but they have identity. An lvalue is an identity that you can 
track in software; record identity is untrackable in standard SQL, but 
it's real enough to create aliasing problems.

> I would propose that variables have identity, and values do not.

What's a "variable", by that definition?
It can't be "something that has a name in a program", since that would 
exclude variables on the heap.
Another definition would be "something that may have a different value 
if I look at it sometime later", but then that would include SQL records 
as well. Besides, the temporal aspect is problematic, since it's unclear 
whether the "it" some time later is still the same as the "it" before 
(if you have a copying garbage collector, you'd have to somehow 
establish identity over time, and we're full circle back at defining 
identity).

Personally, I say "two things are identical / have the same identity", 
if they are (a) equal and (b) stay equal after changing just one of 
them. That's a nice local definition, and captures exactly those cases 
where aliasing is relevant in the first place (it's actually that 
"changing here also changes there" aspect that makes aliasing so dangerous).
It also covers SQL records. Well, they do have aliasing problems, or 
problems that are similar enough to them, so I'd say this is a 
surprising but actually interesting and useful result of having that 
definition.

> In part this is via the supplied definition of identity, in which, when
> you change one thing, if something else changes as well, they
> share identity. Since one cannot change values, they necessarily
> lack identity.

I agree that immutable values don't have identity (or, rather, that 
identity isn't an interesting concept for them since it's already 
subsumed under equality).

>> It's certainly not storage location:
>> if you DELETE a record and then INSERT it with the same values, it may
>> be allocated somewhere entirely else, and our intuition would say it's
>> not "the same" (i.e. not identical).
> 
> Well, it would depend on how our intuition had been primed. If it
> was via implementation techniques in low level languages, we
> might reach a different conclusion than if our intuition was primed
> via logical models and relation theory.

Sure.

However, since I'm interested in practical consequences for programming, 
I'm looking for definitions that allow me to capture those effects that 
create bugs.
In the case of identity, I'd say that's aliasing.

>> Since intuition gives me ambivalent results here, I'll go back to my
>> semiformal definition (and take the opportunity to make it a bit more
>> precise):
>> Two path expressions (lvalues, ...) are aliases if and only if the
>> referred-to values compare equal, and if they stay equal after applying
>> any operation to the referred-to value through either of the path
>> expressions.
> 
> Alas, this leaves me confused. I don't see how a path expression
> (in this case, SELECT ... WHERE) can be an l-value. You cannot
> apply imperative operations to the result.

It's not SELECT...WHERE..., it's WHERE... that's an lvalue.
And you can indeed use it with UPDATE, so yes it's an lvalue by my book. 
(A given WHERE clause may become invalid or refer to a different record 
after some updates, so it's not the kind of lvalue that you have in a C 
program.)

 > (Also I think the use
> of equality here is too narrow; it is only necessary to show that
> two things both change, not that they change in the same way.)

Sorry for using misleading terminology.
An "alias" is when two names refer to an identical object (both in real 
life and IMHO in programming), and that's what I wrote.
"Aliasing" is the kind of problems that you describe.

> I was under the impression you agred that "i+2" was not
> a "path expression".

Yes, but [i+2] is one.

In the same vein, "name = 'John'" is an expression, "WHERE name = 
'John'" is a path expression.

 > If our hypothetical language lacks record
> identity, then I would say that any query is simply an expression
> that returns a value, as in "i+2."

As long as the data is immutable, yes.
The question is how equality behaves under mutation.

>> On the other hand, variable addresses as tangible identities don't hold
>> much water anyway.
>> Imagine data that's written out to disk at program end, and read back
>> in. Further imagine that while the data is read into main memory,
>> there's a mechanism that redirects all further reads and writes to the
>> file into the read-in copy in memory, i.e. whenever any program changes
>> the data, all other programs see the change, too.
>> Alternatively, think about software agents that move from machine to
>> machine, carrying their data with them. They might be communicating with
>> each other, so they need some means of establishing identity
>> ("addressing") the memory buffers that they use for communication.
> 
> These are exactly why content-based addressing is so important.
> Location addressing depends on an address space, and this
> concept does not distribute well.

I think that's an overgeneralization. URLs have distributed well in the 
past.

>>  > I don't know what "new" would be in a value-semantics, relational
>>> world.
>> It would be INSERT.
>>
>> Um, my idea of "value semantics" is associated with immutable values.
>> SQL with INSERT/DELETE/UPDATE certainly doesn't match that definition.
> 
> Sorry, I was vague. Compare, in OOP, the difference between a value
> object and a "regular" object.

Yes, one if mutable, the other is not.
I'm not sure how that relates to SQL though.

>>>> Filters are just like array indexing: both select a subset of variables
>>>> from a collection.
>>> I can't agree with this wording. A filter produces a collection
>>> value from a collection value. I don't see how variables
>>> enter in to it.
>> A collection can consist of values or variables.
>>
>> And yes, I do think that WHERE is a selection over a bunch of variables
>> - you can update records after all, so they are variables! They don't
>> have a name, at least none which is guaranteed to be constant over their
>> lifetime, but they can be mutated!
> 
> We seem to have slipped back from the hypothetical relation language
> with only assignement back to SQL.

This all started with your claim that SQL does not have identities and 
aliasing problems, which grew out of a discussion of what identities and 
aliases and aliasing really are.
Hypothetical relation languages are interesting to illustrate fine 
points, but they don't help with that.

Anyway, if a hypothetical relational language is what you wish to 
discuss, let me return to an even more general model: I'm pretty sure 
that any language that has
a) collections
b) means of addressing individual items
c) means of changing individiual items
has aliasing problems, and that the indidual items have identity.

(Actually all programming languages with mutation and any kind of 
reference fit that description: the "collection" is the pool of 
variables, the "means of addressing" is the references, and "means of 
changing" is the mutation.)

>>  > One can filter either a collection constant or
>>> a collection variable; if one speaks of filtering a collection
>>> variable, on is really speaking of filtering the collection value
>>> that the variable currently contains; filtering is not an operation
>>> on the variable as such, the way the "address of" operator is.
>>> Note you can't update the result of a filter.
>> If that's your definition of a filter, then WHERE is not a filter,
>> simple as that.
> 
> Fair enough! Can you correct my definition of filter, though?

I can't. You were using the term "filter", and seemed to apply it to 
WHERE but assume something that didn't match WHERE.
I wasn't rejecting your definition but that you applied the term to 
something that didn't match it.

Oh, and personally, I'd say a filter is something that selects items 
from a collection, be collection or items mutable or not. But that's 
just my personal definition, and I'll be happy to stick with anything 
that's remotely reasonable ;-)

> Your English is extraordinary. I could easily conclude that you
> were born in Boston and educated at Harvard, and either have
> Germanic ancestry or have simply adopted a Germanic name
> out of whimsy. If English is not your native tongue, there is no
> way to detect it.

Thanks :-)

But, no, my last visit to an English-speaking country was decades ago. 
Attribute my English to far too much time in technical newsgroups, and 
far too much googling ;-)
I'm pretty sure that my oral English is much, much worse, and that I've 
got a heavy German accent. I'd just try to improve on that if I were to 
relocate to GB or the US (and maybe that's just what made the difference 
for my English: constant striving for improvement).

Regards,
Jo


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

Date: Tue, 18 Jul 2006 12:06:33 +0200
From: "Ferry Bolhar" <bol@adv.magwien.gv.at>
Subject: Re: What is the global hash %_ ?
Message-Id: <1153217194.786395@proxy.dienste.wien.at>

John W. Krahn:

>> All Sigil-Punctuation variables are special, whether perl uses them or
not.

"Special" in this context means:

o) You can't specify a package name with them

o) They always refer to package "main" (and therefore, there is no need
    to declare them, even with "use strict")

o) You can't use (and declare) them as lexicals (with "my").

This applies to _all_ sigil punctation variables, whether the are described
in perlvar or not. Those described in perlvar have additional functionality.
Those not described there may have one in the future, so you shouldn't
use them nevertheless.

> Is this behavior documented somewhere?

Yes. From perlmod:

<< Only identifiers starting with letters (or underscore) are stored
in a package's symbol table.  All other symbols are kept in package
"main", including all punctuation variables, like $_. >>

BTW: In addition, the symbols ENV, SIG, INC, STDIN, STDERR,
STDOUT, ARGV and ARGVOUT are always searched in package
"main", although you can declare them as lexicals or use them in other
packages by using the full-qualified name (makes no sense IMHO,
but it isn't disallowed). Note that this applies to all kind of variables
with the identifiers above, so it applies also (e.g.) to $INC and @ENV,
although these variables (currently) have no special meanning.

PS: Until Perl 5.8.8, "%_" has no special functionality.

Greetings, Ferry

-- 
Ing. Ferry Bolhar
Municipality of Vienna, Department 14
A-1010 Vienna / AUSTRIA
E-mail: bol@adv.magwien.gv.at




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

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


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