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

Re: defining 'constants' at run time

2004-03-02 Thread Frederic Briere
On Tue, Mar 02, 2004 at 05:42:07AM -0500, Rodent of Unusual Size wrote: non-integer, or an unopened filehandle. i've tried things like having mkconst() do my $name = caller() . ::$_[0]; eval(\*$name = sub () { $_[1]; }); Look at constant.pm for a cleaner way to do this, using a closure.

Re: defining 'constants' at run time

2004-03-02 Thread Simon Cozens
[EMAIL PROTECTED] (Rodent Of Unusual Size) writes: 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? No. -- There seems no plan because it is all plan.

Re: AW: defining 'constants' at run time

2004-03-02 Thread Simon Cozens
[EMAIL PROTECTED] (Jochen Stenzel) writes: the base technique is to build a use constant statement at runtime and evaluate it via eval(). % perl -w -Mstrict -le 'eval use constant FOO = 3; print FOO' Name main::FOO used only once: possible typo at -e line 1. print() on unopened filehandle FOO

Re: defining 'constants' at run time

2004-03-02 Thread Brad Lhotsky
- Forwarded message from Brad Lhotsky [EMAIL PROTECTED] - From: Brad Lhotsky [EMAIL PROTECTED] To: Rodent of Unusual Size [EMAIL PROTECTED] Subject: Re: defining 'constants' at run time Date: Tue, 2 Mar 2004 14:01:06 -0500 User-Agent: Mutt/1.4i Message-ID: [EMAIL PROTECTED] Any reason

Re: defining 'constants' at run time

2004-03-02 Thread Brad Lhotsky
I forgot to CC the group.. but now I realized, when I originally read his post I thought he was looking to define a variable once and then leave it read only for the rest of the program execution which is why I suggested the following. However, I realize now that he's just trying to avoid

Re: defining 'constants' at run time

2004-03-02 Thread A. Pagaltzis
* Jochen Stenzel [EMAIL PROTECTED] [2004-03-02 12:19]: the base technique is to build a use constant statement at runtime and evaluate it via eval(). No, if you are using constant.pm, the technique is to require constant; constant-import(FOO = 'bar'); eval(EXPR) is usually a red flag. --

Re: IO::Epoll

2004-03-02 Thread A. Pagaltzis
* Bruce J Keeler [EMAIL PROTECTED] [2004-03-02 09:57]: IO::Epoll exposes the low-level epoll system calls (epoll_create, epoll_ctl and epoll_wait), but it also has a higher-level OO API designed to be a drop-in replacement for IO::Poll. As a stopgap solution f.ex to test the stability of your

Re: advice needed on Lingua::Identification

2004-03-02 Thread A. Pagaltzis
* [EMAIL PROTECTED] [EMAIL PROTECTED] [2004-02-26 17:29]: I'm putting together some things I have and creating a module named Lingua::Identification. Just a comment on the name: personally, I'd much prefer ::Identify. It's half as long, says exactly the same thing, and it feels less awkward to

Re: defining 'constants' at run time

2004-03-02 Thread A. Pagaltzis
* Rodent of Unusual Size [EMAIL PROTECTED] [2004-03-02 11:43]: 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);

RE: defining 'constants' at run time

2004-03-02 Thread Pearce, Martyn
Are you sure that you want to do this? As you're working at runtime, will you gain anything in defining a constant rather than simply a global, or better, package-scope variable? Mx. -Original Message- From: Rodent of Unusual Size [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 02, 2004

Re: IO::Epoll

2004-03-02 Thread Rocco Caputo
On Mon, Mar 01, 2004 at 08:08:01PM -0800, Bruce J Keeler wrote: The epoll subsystem is a new, (currently) Linux-specific variant of poll(2). It is designed to offer O(1) scalability over large numbers of watched file descriptors. You need at least Linux 2.5.44 and a recent C library to use