[31639] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2902 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Apr 5 18:09:26 2010

Date: Mon, 5 Apr 2010 15:09: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           Mon, 5 Apr 2010     Volume: 11 Number: 2902

Today's topics:
    Re: equivalent <pgp@doc.ic.ac.uk>
    Re: perl.libwww? <ben@morrow.me.uk>
    Re: software requirements again, take 483 <rvtol+usenet@xs4all.nl>
    Re: software requirements again, take 483 <cartercc@gmail.com>
    Re: software requirements again, take 483 <jimsgibson@gmail.com>
        STDIN number only <dpich@polartel.com>
    Re: STDIN number only <stevem_clipthis_@clubtrout.com>
    Re: STDIN number only <dpich@polartel.com>
    Re: STDIN number only <john@castleamber.com>
    Re: STDIN number only (Seymour J.)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Mon, 05 Apr 2010 12:24:58 +0100
From: Philip Potter <pgp@doc.ic.ac.uk>
Subject: Re: equivalent
Message-Id: <hpcha8$4ts$1@speranza.aioe.org>

On 03/04/2010 21:47, Uri Guttman wrote:
>>>>>> "JC" == Justin C <justin.1004@purestblue.com> writes:
> 
>   JC> In article <52ea87-2m51.ln1@osiris.mauzo.dyndns.org>, Ben Morrow wrote:
>   >> 
>   >> Quoth Justin C <justin.1003@purestblue.com>:
>   >>> 
>   >>> Well thanks a whole *huge* bunch, guys. Just when I start thinking I'm
>   >>> starting to understand what I'm doing you go and confuse the hell out of
>   >>> me! I spend a lot of my time in this group reading that I should refer
>   >>> to documentation, and then you go and contradict the damn documentation!
>   >> 
>   >> I apologise (somewhat). I was being something of a smartass, which while
>   >> generally expected on Usenet is less than helpful to those trying to
>   >> learn the language. (The group isn't solely (or even mostly) for their
>   >> benefit, of course.)
> 
>   JC> Thanks Ben, and Tad, for the follow-up on this. I'll re-read the
>   JC> Indirect Object Syntax from perlobj again later, I find that several
>   JC> read-throughs are necessary with some time to digest in between!
> 
> there isn't much more to learn. just do Foo->new() and you will be fine
> in all normal cases with little to worry about. avoid new Foo() too. the
> fact that old docs show indirect calls is irrelevent, they haven't been
> encouraged to update them to direct method calls.

Agreed. And if you want to enforce direct object syntax, you can use
indirect.pm from CPAN like this:

no indirect ':fatal';

(This isn't necessarily a good idea, particularly if you're working with
existing code; but I feel the arguments for its use are similar to 'use
strict')

Phil


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

Date: Mon, 5 Apr 2010 15:44:56 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: perl.libwww?
Message-Id: <8k9p87-97j.ln1@osiris.mauzo.dyndns.org>


Quoth "Galen Henderson" <galen@hendersonsoftware.com>:
> Hi, Ben.  Thanks for the reponse.  My comments below...
> 
> On Thu, 1 Apr 2010 11:45:00 UTC, Ben Morrow <ben@morrow.me.uk> wrote:
> 
> snip
> 
> > 
> > I don't understand why this is trying to build a file called
> > ParserMK.dll. On my system the shared library is called
> > 
> >     blib/arch/auto/HTML/Parser/Parser.so
> > 
> > (without the 'MK'). Is this usual on OS/2?
> 
> I haven't been building Perl modules on OS/2 for very long but from 
> what I've seen, the MK is not added to the other dlls I've built.

OK.

> > There should be a section starting
> > 
> >     XS(boot_HTML_Parser);
> >     XS(boot_HTML_Parser)
> >     {
> >     #ifdef dVAR
> >         dVAR; dXSARGS;
> >     #else
> >         dXSARGS;
> >     #endif
> 
> This is in the parser.c source file.

OK.

> > in Parser.c. The XS() macro expands into a suitable function prototype.
> > Is it not there? Can you run nm (or some local equivalent) on Parser.o
> > to see if the symbol is defined? Can you post the link line(s) make is
> > trying to use, to make sure it's picking up the right files?
> 
> Here is the gcc build command:
> 
> gcc  -Zdll -Zomf  Parser.o -O2 -fomit-frame-pointer -falign-loops=2 
> -falign-jump
> s=2 -falign-functions=2 -s  -o blib/arch/auto/HTML/Parser/ParserMK.dll
>  \
>   /perl5/lib/5.10.0/os2/CORE/libperl.a -lsocket 
> /perl5/lib/5.10.0/os2/CORE/libpe
> rl_override.a Parser.def        \
>   || ( U:/PERL5/BIN/PERL.EXE -MExtUtils::Command -e 'rm_f' -- 
> blib/arch/auto/HTM
> L/Parser/ParserMK.dll && sh -c false )
> 
> nm shows the symbol as _boot_HTML__Parser.  I'm stumped.

Me too, I'm afraid. Try building some other XS module (List::Util is
provbably a good choice); if that fails in the same way, mail
perl5-porters@perl.org; otherwise, file a bug with HTML::Parser.

Ben



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

Date: Mon, 05 Apr 2010 12:30:28 +0200
From: "Dr.Ruud" <rvtol+usenet@xs4all.nl>
Subject: Re: software requirements again, take 483
Message-Id: <4bb9bbc4$0$22938$e4fe514c@news.xs4all.nl>

Shmuel (Seymour J.) Metz wrote:

> IMHO, if the business process owner signs off on the specifications then
> it's his responsibility if they're wrong.

Do they really still exist, these environments where they write up 
specifications and sign them off and such? What a waste!

Go and work in a communicative environment, where the "business" and the 
"developers" continuously share and improve the business knowledge, and 
help each other to get results, with noticeable improvements every day.

Most goals should never be defined, they should just remain a general 
idea to works towards to. *Why try to fork reality?* Adapt to it, and 
reality will work for you.

-- -- --

When I look back on successful changes of a larger scale, there was 
often an Idea-A, -B and -C. The Idea-C approach was worked on in the 
early stages, gets labeled as "research", and remains available as both 
a reference and still an alternative.

Idea-B is there for if Idea-A is achieved much quicker than anticipated. 
The Idea-A is about 60% of Idea-B (or even less).

The funny thing is that when work on Idea-A is started, there is also 
work started on parts of Idea-B that are not in Idea-A. That superfluous 
part of the work has its role, but gets postponed with the first signs 
of trouble.

Then it is firmly decided to get Idea-A done first. But of course, the 
"Idea-A" at that moment is different from the "Idea-A" at the start. It 
has evolved and matured. That it still gets called by the same name, is 
important too.

-- 
Ruud


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

Date: Mon, 5 Apr 2010 07:06:50 -0700 (PDT)
From: ccc31807 <cartercc@gmail.com>
Subject: Re: software requirements again, take 483
Message-Id: <dc596a51-5d7f-47e2-865a-271c31c528ea@i37g2000yqn.googlegroups.com>

On Apr 5, 6:30=A0am, "Dr.Ruud" <rvtol+use...@xs4all.nl> wrote:
> Do they really still exist, these environments where they write up
> specifications and sign them off and such? What a waste!

I work with many clients to whom ordering a script or a report is like
ordering a desk or a chair. You submit a purchase order, and the item
when delivered does what it should. I often get requests for reports
asking for "all" of something, for example, "all" people matching a
specific criteria. The client, who expects a list of several dozen at
most, screams and hollers when I deliver a list of 350,000 plus. The
client's problem is that he hasn't fully specified all relevant
criteria. My problem is that I don't know his relevant criteria -- he
might very well want "all" of something.

I think of this as the "don't touch a hot stove" lesson. You can tell
a child many, many times that, if he touches a hot stove, he will get
burned, and it doesn't do any good. However, let him touch a hot stove
once, and the lesson is learned forever.

(I used to call this the "don't play in the street" lesson until my
wife told me that wasn't humorous at all.)

> Go and work in a communicative environment, where the "business" and the
> "developers" continuously share and improve the business knowledge, and
> help each other to get results, with noticeable improvements every day.

In this day, having a job can be a lot more important that the
communicativeness of the environment.

> Most goals should never be defined, they should just remain a general
> idea to works towards to. *Why try to fork reality?* Adapt to it, and
> reality will work for you.

I agree with this totally. I think that the requirements should be
defined precisely ('total' equals the product of 'quantity' of each
line item and 'cost' of each line item for all line items). Software
is infinitely malleable, unlike a physical item, and I totally agree
that recognition and acceptance of this malleability is essential to
writing good software.

CC


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

Date: Mon, 05 Apr 2010 09:38:41 -0700
From: Jim Gibson <jimsgibson@gmail.com>
Subject: Re: software requirements again, take 483
Message-Id: <050420100938417800%jimsgibson@gmail.com>

In article
<dc596a51-5d7f-47e2-865a-271c31c528ea@i37g2000yqn.googlegroups.com>,
ccc31807 <cartercc@gmail.com> wrote:

> On Apr 5, 6:30 am, "Dr.Ruud" <rvtol+use...@xs4all.nl> wrote:
> > Do they really still exist, these environments where they write up
> > specifications and sign them off and such? What a waste!
> 
> I work with many clients to whom ordering a script or a report is like
> ordering a desk or a chair. You submit a purchase order, and the item
> when delivered does what it should. I often get requests for reports
> asking for "all" of something, for example, "all" people matching a
> specific criteria. The client, who expects a list of several dozen at
> most, screams and hollers when I deliver a list of 350,000 plus. The
> client's problem is that he hasn't fully specified all relevant
> criteria. My problem is that I don't know his relevant criteria -- he
> might very well want "all" of something.

This has traditionally been known as the "Bring me a rock" method of
project management. Your boss tells you "bring me a rock". So you bring
him one. It is not the rock he wants. He says "no, bring me a different
rock". Repeat.

Google for it:

<http://bringmearock.blogspot.com/>

<http://workingsmarter.typepad.com/my_weblog/2008/12/bring-me-a-differen
t-rock.html>

-- 
Jim Gibson


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

Date: Mon, 05 Apr 2010 12:54:17 -0500
From: Don Pich <dpich@polartel.com>
Subject: STDIN number only
Message-Id: <QYidnX3Hp_dUvifWnZ2dnUVZ_rydnZ2d@polarcomm.com>

This is a simple script I am trying to write to have a number that is 
between 0 and 254.


CODE:
$OCT1_COUNT = 1;

while ($OCT1_COUNT == 1)
{
  print "\nWhat is the First number?  ";
  $OCT1 = <STDIN> ;
    if (($OCT1 < -1) || ($OCT1 > 255))
      {
	print "That number is not between 0 and 255.  Please enter a real 
number.\n";
      }
    else
      {
	chomp ($OCT1);
	$OCT1_COUNT++;
      }
}


What I want to do is that if a user enters anything but a number from 0 
to 254, they will get the print statement above.  If it is a number, then 
flow it through.  I am having a very tough time trying to have this just 
entered as a number.  I have tried various regex examples to fix this.  
But none will kick out an error if I enter a string of text.

different regex strings I've tried:

$OCT1 =~ s/.*?(\d+).*/$1/;
m/^-?\d+$/
m/^-?\d+[\/|\.]\d+$/



TIA


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

Date: Mon, 05 Apr 2010 11:19:53 -0700
From: Steve M <stevem_clipthis_@clubtrout.com>
Subject: Re: STDIN number only
Message-Id: <ZWpun.26562$3D3.8@newsfe19.iad>

On 4/5/2010 10:54 AM, Don Pich wrote:
> This is a simple script I am trying to write to have a number that is
> between 0 and 254.
>
>
> CODE:
> $OCT1_COUNT = 1;
>
> while ($OCT1_COUNT == 1)
> {
>    print "\nWhat is the First number?  ";
>    $OCT1 =<STDIN>  ;
>      if (($OCT1<  -1) || ($OCT1>  255))
>        {
> 	print "That number is not between 0 and 255.  Please enter a real
> number.\n";
>        }
>      else
>        {
> 	chomp ($OCT1);
> 	$OCT1_COUNT++;
>        }
> }
>
>
> What I want to do is that if a user enters anything but a number from 0
> to 254, they will get the print statement above.  If it is a number, then
> flow it through.  I am having a very tough time trying to have this just
> entered as a number.  I have tried various regex examples to fix this.
> But none will kick out an error if I enter a string of text.
>
> different regex strings I've tried:
>
> $OCT1 =~ s/.*?(\d+).*/$1/;
> m/^-?\d+$/
> m/^-?\d+[\/|\.]\d+$/
>
>
>
> TIA

I'm sure I'm missing something here, but if it is entered as a decimal 
integer, and leaving aside a total lack of error trapping, what is wrong 
with:

my $num = '255'; # or 'fred' or whatever


$num =~ s/\D//g;

if( length $num == 0 or $num < 0 or $num > 255 ){ print "num no good" }
else{ print "num is $num" ;}


\s


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

Date: Mon, 05 Apr 2010 15:16:53 -0500
From: Don Pich <dpich@polartel.com>
Subject: Re: STDIN number only
Message-Id: <m5KdnT2uZ9yo2CfWnZ2dnUVZ_sadnZ2d@polarcomm.com>

Thank you, Steve!  I am still in elementary school writing perl scripts.  
So this helped my efforts out.  It worked great!


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

Date: Mon, 05 Apr 2010 15:21:13 -0500
From: John Bokma <john@castleamber.com>
Subject: Re: STDIN number only
Message-Id: <87aathmz0m.fsf@castleamber.com>

Don Pich <dpich@polartel.com> writes:

> Thank you, Steve!  I am still in elementary school writing perl scripts.  
> So this helped my efforts out.  It worked great!

In that case:

Try to understand why 

 print "hello" == 0

reports 1 (true)

since it's related with the problem you had.

On top of that: put at the top of your program:

use strict;
use warnings;

To save yourself some time...

-- 
John Bokma                                                               j3b

Hacking & Hiking in Mexico -  http://johnbokma.com/
http://castleamber.com/ - Perl & Python Development


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

Date: Mon, 05 Apr 2010 17:36:38 -0400
From: Shmuel (Seymour J.) Metz <spamtrap@library.lspace.org.invalid>
Subject: Re: STDIN number only
Message-Id: <4bba57e6$2$fuzhry+tra$mr2ice@news.patriot.net>

In <QYidnX3Hp_dUvifWnZ2dnUVZ_rydnZ2d@polarcomm.com>, on 04/05/2010
   at 12:54 PM, Don Pich <dpich@polartel.com> said:

>This is a simple script I am trying to write to have a number that is 
>between 0 and 254.

Do you want to discard extraneous characters or treat them as errors? If
the latter, why would you use s///? If the number has to be positive, why
allow a minus sign?

Try something like if ($OCT =~ /^\d+$/ && $OCT < 256) {...} else {print
 ...}

-- 
Shmuel (Seymour J.) Metz, SysProg and JOAT  <http://patriot.net/~shmuel>

Unsolicited bulk E-mail subject to legal action.  I reserve the
right to publicly post or ridicule any abusive E-mail.  Reply to
domain Patriot dot net user shmuel+news to contact me.  Do not
reply to spamtrap@library.lspace.org



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

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:

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests. 

#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 V11 Issue 2902
***************************************


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