Re: defining 'constants' at run time

2004-03-04 Thread Rodent of Unusual Size
Orton, Yves wrote:

 To broad-handedly cast aside the the bearer of a question's approach
 as flawed is incredibly closed minded.  Pretending that you know best
 for their situation is at worst arrogant and at best naive.
 
 Not really, the respondant is a volunteer. Its up to them how to answer.
 And if they think a posters claim that i cant use X is rubbish then
 its their perogative to say so.

i disagree with this.  it seems to be essentially the position of,
'i'm a volunteer, so i can say whatever i like -- regardless of
how insulting or belittling it may be.'

i agree with sam.  assuming you know *why* someone is doing something
a particular way (particularly when you don't agree with it) is arrogant.
commenting on it after *asking* is something else again.

 And frankly if someone either arrogant
 or naive wants to help me in a way that doesnt really help I suspect i
 would say thanks but actually... and not why the hell dont you trust
 me on this. After all they dont owe me anything, and if they thought
 they were helping why should I care if its misguided?

something explicitly labeled a rant wouldn't seem to fall into that
category. :-)

 Anyway, I was just responding ROUS'es somewhat rhetorical question about
 why people make this kind of comment. The reason IMO is that its because
 usually such comments are right on the money.

what i don't like, and which is demonstrated here, is that so-called
'free' advice in these circumstances is actually nothing of the sort.
the person asking the question is paying for the privilege -- either
by tacitly permitting the respondents to make fun of him, or by investing
lots of time in phrasing the question to avoid that.

as long as the behaviour exists, both sides should be aware of the
hidden cost.  someone who asks a question and is made fun of learns
it right away; i fear that the ones on the other side don't consciously
realise the price they're exacting for their 'free' advice.
-- 
#kenP-)}

Ken Coar, Sanagendamgagwedweinini  http://Ken.Coar.Org/
Author, developer, opinionist  http://Apache-Server.Com/

Millennium hand and shrimp!



Re: defining 'constants' at run time

2004-03-04 Thread Rodent of Unusual Size
Orton, Yves wrote:
 Rodent of Unusual Size on 03 March 2004 19:17 said
 A. Pagaltzis wrote:
 
 Offtopic rant: why do people want/use OO for things like these??? Why not
 simply have a Foo::mkconst() ?
 
 response rant: why do people always assume that they know better what is
 being attempted than the person writing the code?  there's
 a reason i'm using o-o; let's accept that and leave it at that.
 
 So when someone helpful like Aristotle sees something that looks like this he
 homes in on it.  Dont forget he offered help for free

and don't forget that he answered the question and i thanked him for it.

 The useful answers are typically like
 
 Why on earth do you want to do such a silly thing. USE THE FRIGGIN REGEX
 ALREADY.

there are people who ask questions because they don't know the answers and
are lazy; and there are people who ask questions because they don't know
the answers, haven't been able to find them, and want to learn.  i find it
is an all too common thing in established communities for those with
experience to forget that they too were once ignorant.

if the exchange had gone something like the following, it would have been
different all round:

aristotle: is there a reason you're using o-o rather than foo::mkconst?
rous: yes.

there's a difference between asking someone if they know what they're
doing -- and assuming that they don't.

 , and part of that help involved questioning why you are doing something that
  looked dumb.

actually, i believe the rant and the answer were unrelated.
-- 
#kenP-)}

Ken Coar, Sanagendamgagwedweinini  http://Ken.Coar.Org/
Author, developer, opinionist  http://Apache-Server.Com/

Millennium hand and shrimp!



Re: defining 'constants' at run time

2004-03-03 Thread Rodent of Unusual Size
Frederic Briere wrote:
 
 Sure, just pre-declare the sub, which happens at compile time:
 
   sub DOH();

um, i said i want to do it at run time.  the module doing the
defining doesn't know who's going to be calling it, and the
callers are depending on the module to make usable constant
barewords out of the names they give it.

so all the compile-time stuff doesn't help, which is why
i asked for a way to do it at run time.
-- 
#kenP-)}

Ken Coar, Sanagendamgagwedweinini  http://Ken.Coar.Org/
Author, developer, opinionist  http://Apache-Server.Com/

Millennium hand and shrimp!



Re: defining 'constants' at run time

2004-03-03 Thread Rodent of Unusual Size
A. Pagaltzis wrote:
 
 Offtopic rant: why do people want/use OO for things like these???
 Why not simply have a Foo::mkconst() ?

response rant: why do people always assume that they know better
what is being attempted than the person writing the code?  there's
a reason i'm using o-o; let's accept that and leave it at that.

 The problem is that perl doesn't know DOH is a function call
 unless it has seen a function with that name. So you have to
 declare the constant name, if not the constant value, at compile
 time. There's no way around this, period.

thank you.
-- 
#kenP-)}

Ken Coar, Sanagendamgagwedweinini  http://Ken.Coar.Org/
Author, developer, opinionist  http://Apache-Server.Com/

Millennium hand and shrimp!



defining 'constants' at run time

2004-03-02 Thread Rodent of Unusual Size
tell me to piss off for asking here, if you like, but i'm not on
any other perl lists due to traffic.  besides, the responses and
advice here have been higher quality. :-)

i want to be able to define 'constants' in a module at run time,
rather than at compile time.  'use constant' does it too early.
for example:

use Foo;
my $foo = new Foo;
$foo-mkconst('DOH', 25);
printf(DOH=%d\n, DOH);

the result i'm looking for is 'DOH=25' on stdout.  however,
all i've managed to get is either an error about DOH being a
non-integer, or an unopened filehandle.  i've tried things
like having mkconst() do

my $name = caller() . ::$_[0];
eval(\*$name = sub () { $_[1]; });

and that will work -- IFF the caller refers to DOH as DOH.

evidently the usage of DOH in the caller has already been fetched
from the symbol table (and found wanting) before the method has
been called.  is there any way to defeat that?

(i hope i'm explaining this lucidly.)
-- 
#kenP-)}

Ken Coar, Sanagendamgagwedweinini  http://Ken.Coar.Org/
Author, developer, opinionist  http://Apache-Server.Com/

Millennium hand and shrimp!




Re: capturing carp()s in module tests?

2004-02-19 Thread Rodent of Unusual Size
Smylers wrote:
 
 Indeed it would be irritating for people to have to install a module
 just so they can test your module.  But that's no reason to skip the
 test for those who do have it installed.
 
 Couldn't you put in a conditional test that only executes if require-ing
 Test::Warn succeeds?

i didn't skip the tests; i used the $SIG{__WARN__} method in the
specific test script.  works a treat.
-- 
#kenP-)}

Ken Coar, Sanagendamgagwedweinini  http://Golux.Com/coar/
Author, developer, opinionist  http://Apache-Server.Com/

Millennium hand and shrimp!



Re: proposed Text::Charnames

2004-02-12 Thread Rodent of Unusual Size
david wrote:
 
 it might also make sense under Constant::

there's a Constant:: namespace?  i don't see it listed.. h'm.
-- 
#kenP-)}

Ken Coar, Sanagendamgagwedweinini  http://Golux.Com/coar/
Author, developer, opinionist  http://Apache-Server.Com/

Millennium hand and shrimp!



Re: proposed Text::Charnames

2004-02-09 Thread Rodent of Unusual Size
david wrote:
 
 call the module ASCII::TTYish and have it import all the old names
 as constant functions.

er, no existing ASCII:: namespace.  how about Convert::TTYnames ?
-- 
#kenP-)}

Ken Coar, Sanagendamgagwedweinini  http://Golux.Com/coar/
Author, developer, opinionist  http://Apache-Server.Com/

Millennium hand and shrimp!



proposed Text::Charnames

2004-02-05 Thread Rodent of Unusual Size
i've been looking for this functionality but haven't [yet] found it,
so i'm thinking of providing it.  the questions are: a) is it
already there and ive just missed it, and b) if not, what namespace
should it be in?

the functionality in question is providing access to the names of
ascii (et alia?) control characters.  e.g., 0x01 (ctrl/a) is 'soh'
(start of header), 0x11 (ctrl/q) is 'xon', et cetera.

i'm inclined toward Text::Charnames[::ASCII] or the like.  any comments/
suggestions?
-- 
#kenP-)}

Ken Coar, Sanagendamgagwedweinini  http://Golux.Com/coar/
Author, developer, opinionist  http://Apache-Server.Com/

Millennium hand and shrimp!




Re: proposed Text::Charnames

2004-02-05 Thread Rodent of Unusual Size
Eric Cholet wrote:

 Le 5 févr. 04, à 13:33, Elizabeth Mattijsen a écrit :

 Wouldn't something like that be generateble from Encode?  Or is 
 already part of Encode?
 
 It isn't part of Encode, I guess since it has nothing to do with 
 encodings--
 but there is charnames.pm that you can use to get Unicode names:
 
 % perl -e 'use charnames(); print charnames::viacode(0x01)'
 START OF HEADING

true enough -- but there doesn't appear to be anything that
handles the old 2-to-3-character names (ACK, NAK, XOFF, DEL,
et cetera).  i have a need for these short versions.

are you suggesting that it's not worth wasting time on a cpan
module for this?  or that it should be folded into or namespaced
under charnames?  if neither of the above, suggestions for an
appropriate module name are welcome..
-- 
#kenP-)}

Ken Coar, Sanagendamgagwedweinini  http://Golux.Com/coar/
Author, developer, opinionist  http://Apache-Server.Com/

Millennium hand and shrimp!



c parsing tools?

2003-09-19 Thread Rodent of Unusual Size
i have a need to examine a bunch of c files to locate all
invocations of a small set of routines.  i need to know where
they occur (line number and file), and their argument lists,
even if they're hidden in macros or inlined .h files.

someone suggested that there's already some sort of toolset
in the cpan world that can do this sort of thing; can anyone
provide me with more information?

thanks!
-- 
#kenP-)}

Ken Coar, Sanagendamgagwedweinini  http://Golux.Com/coar/
Author, developer, opinionist  http://Apache-Server.Com/

Millennium hand and shrimp!