Click here to get back home

The 'if' module

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
The 'if' module Sisyphus 06-01-2006
|--> Re: The 'if' module Gunnar Hjalmars...06-01-2006
Posted by Sisyphus on June 2, 2006, 10:19 pm
Please log in for more thread options



> Sisyphus wrote:
> > > Sisyphus wrote:
> > > > D:\pscrpt\if>cat try.pl
> > > > use if $^O =~ /another/, MODULE => "Non::Existent";
> > > > print "OK\n";
> > >
> > > You've misread the documentation (which, admittedly, is sparse). You
> > > are supposed to pass the module name as the second argument, and any
> > > arguments you would normally pass to use or import() as the remaining
> > > arguments. So this should be:
> > >
> > > use if $^O =~ /another/, "Non::Existent";
> >
> > Yes, that was my first attempt but it produced the error:
> >
> > Too few arguments to `use if' (some code returning an empty list in list
> > context?) at D:/perl58_M/5.8.8/lib/if.pm line 7.
> > BEGIN failed--compilation aborted at try.pl line 2.
>
> I do feel the need to point out that this error message told you
> exactly what the problem was.

I don't think this is the forum to discuss your needs.
I'm also not so sure that you and I would agree on the meaning of "exactly".
The term "some code" does not strike me as being all that exact.

> I'm confused as to why you chose to
> disregard it and instead change the syntax of your module call
> syntax...
>

I "chose to disregard it" ??

The arrogance of that assertion is, of course, insulting. The fact that it's
false doesn't really bother me.

Cheers,
Rob



Posted by Paul Lalli on June 3, 2006, 7:35 am
Please log in for more thread options


Sisyphus wrote:
> > Sisyphus wrote:
> > > > use if $^O =~ /another/, "Non::Existent";
> > >
> > > Yes, that was my first attempt but it produced the error:
> > >
> > > Too few arguments to `use if' (some code returning an empty list in list
> > > context?) at D:/perl58_M/5.8.8/lib/if.pm line 7.
> > > BEGIN failed--compilation aborted at try.pl line 2.
> >
> > I do feel the need to point out that this error message told you
> > exactly what the problem was.
>
> I don't think this is the forum to discuss your needs.
> I'm also not so sure that you and I would agree on the meaning of "exactly".
> The term "some code" does not strike me as being all that exact.

'some code' on line 2, which was:
use if $^O =~ /another/, "Non::Existent";
Exactly how many parts of that code do you think can return an empty
list in list context?

> > I'm confused as to why you chose to
> > disregard it and instead change the syntax of your module call
> > syntax...
> >
>
> I "chose to disregard it" ??

Sure seems that way to me. Your original message to this newsgroup
contained a piece of code that was presumably your latest attempt. It
was counter to the way the module's call syntax is supposed to be
given. It bared no resemblence to any fix suggested by the error
message. Further, your original post made absolutely no mention of the
original attempt, or of the error message that you later told us it
gave you.

> The arrogance of that assertion is

It's an assumption, based on evidence presented by your posts. Not an
assertion.

>, of course, insulting.

I'm sorry you felt insulted.

> The fact that it's false doesn't really bother me.

Okay. Please explain to me what you did when you saw that error
message. Because your apparent next attempt at the module call
certainly had nothing to do with anything the error message told you.

I'm really not interested in getting into an argument about this, so
this will be my last message in this thread. You're welcome to have
the last word.

Paul Lalli


Posted by Sisyphus on June 4, 2006, 7:22 am
Please log in for more thread options



> >
> > I "chose to disregard it" ??
>
> It's an assumption, based on evidence presented by your posts. Not an
> assertion.

Yeah - but I read that as an unqualified assertion rather than an assumption
(and I still do read it that way) - and that's what really irked me. Still -
I shouldn't have snapped - and I apologise for so doing.

>
> Okay. Please explain to me what you did when you saw that error
> message. Because your apparent next attempt at the module call
> certainly had nothing to do with anything the error message told you.
>

Well - you'll note that "my next attempt at the module call" added an extra
argument - which *did* have something to do with what the error message told
me. Not only that, but it worked to the extent that the script compiled
without any warnings being issued, and behaved as expected - iff CONDITION
was true. I think I was also sucked in by my own (false) assumption that I
knew what "use if CONDITION" (from the docs) meant. I was therefore lead to
concentrate on the "MODULE => ARGUMENTS" bit (which I wasn't sure about).

Beyond that I don't see much point in providing details on my (flawed)
thought processes.

Anyway - thanks again for the original explanation. The elaboration I
provided in my follow-up was meant simply to demonstrate that I understood
the points you had made.

Cheers,
Rob



Posted by Ilya Zakharevich on June 5, 2006, 1:30 am
Please log in for more thread options


[A complimentary Cc of this posting was sent to
Sisyphus
> > Okay. Please explain to me what you did when you saw that error
> > message. Because your apparent next attempt at the module call
> > certainly had nothing to do with anything the error message told you.
> >
>
> Well - you'll note that "my next attempt at the module call" added an extra
> argument - which *did* have something to do with what the error message told
> me. Not only that, but it worked to the extent that the script compiled
> without any warnings being issued, and behaved as expected - iff CONDITION
> was true. I think I was also sucked in by my own (false) assumption that I
> knew what "use if CONDITION" (from the docs) meant. I was therefore lead to
> concentrate on the "MODULE => ARGUMENTS" bit (which I wasn't sure about).
>
> Beyond that I don't see much point in providing details on my (flawed)
> thought processes.

I do. A little bit of history: when I designed if.pm, I had no the
idea that CONDITION is subject to cryptocontext. When somebody
reported this behaviour as a bug, the best "solution" I got was to try
to detect this situation (only possible when module is called without
arguments!), and provide a readable error message.

The current error message may be improved a lot. I welcome everybody
to think the message over and try to make it more clear. Likewise,
for

use if CONDITION, strict => 'refs';

with CONDITION returning en empty list, what the module sees is
CONDITION := 'strict', MODULE := 'refs'. Since there is no refs.pm,
the if.pm could also detect this, and emit a similar message.

Patches welcome,
Ilya

Similar ThreadsPosted
Lower case module name for non-pragma module January 4, 2005, 10:19 am
RFC: New module 'Module::Bundled::Files' August 26, 2005, 3:49 pm
help with an MD5.pm module!! September 3, 2005, 11:39 pm
Looking for RTP module December 9, 2004, 9:17 pm
module for FFT May 9, 2005, 3:06 pm
Module may not be right one? April 27, 2006, 12:57 pm
The 'if' module June 1, 2006, 8:26 pm
use module March 3, 2007, 5:13 am
Name my Module! July 27, 2007, 6:46 pm
Yet another TL1 module August 7, 2007, 4:12 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap