Typeglobs, constants and sub refs

2009-09-17 Thread Matteo Riva
After reading Uri's post about projects for beginners, I took a quick look at File::Slurp source code, and I was stuck at the very beginning. My knowledge of Perl is still very beginner level, but I want - time allowing - to improve as I like the language very much. Anyway, the code starts with

Re: Typeglobs, constants and sub refs

2009-09-17 Thread Uri Guttman
MR == Matteo Riva mura...@gmail.com writes: MR After reading Uri's post about projects for beginners, I took a quick MR look at File::Slurp source code, and I was stuck at the very beginning. looking at my code is a good way to learn perl! :) MR # Install subs for various constants that

Re: Typeglobs, constants and sub refs

2009-09-17 Thread Matteo Riva
On Thu, Sep 17, 2009 at 5:56 PM, Uri Guttman u...@stemsystems.com wrote: hopefully that explains it. Unfortunately, not really :) I *know* about the symbol table and typeglobs, but I yet have to *understand* how it all works, and how to use it. My first question here - before everything else

Re: Typeglobs, constants and sub refs

2009-09-17 Thread Uri Guttman
MR == Matteo Riva mura...@gmail.com writes: MR On Thu, Sep 17, 2009 at 5:56 PM, Uri Guttman u...@stemsystems.com wrote: hopefully that explains it. MR Unfortunately, not really :) so ask a more detailed question! MR I *know* about the symbol table and typeglobs, but I yet have to

Re: Typeglobs, constants and sub refs

2009-09-17 Thread Chas. Owens
On Thu, Sep 17, 2009 at 13:34, Matteo Riva mura...@gmail.com wrote: On Thu, Sep 17, 2009 at 5:56 PM, Uri Guttman u...@stemsystems.com wrote: hopefully that explains it. Unfortunately, not really :) I *know* about the symbol table and typeglobs, but I yet have to *understand* how it all

Re: Typeglobs, constants and sub refs

2009-09-17 Thread Matteo Riva
On Thu, Sep 17, 2009 at 7:45 PM, Chas. Owens chas.ow...@gmail.com wrote: Constants have a value beyond the numbers themselves.  Let's suppose that there is a non-POSIX system that has a seek function that works quite a bit like POSIX seek, but it use different values for beginning of file,

Re: Typeglobs, constants and sub refs

2009-09-17 Thread Chas. Owens
On Thu, Sep 17, 2009 at 14:13, Matteo Riva mura...@gmail.com wrote: On Thu, Sep 17, 2009 at 7:45 PM, Chas. Owens chas.ow...@gmail.com wrote: Constants have a value beyond the numbers themselves.  Let's suppose that there is a non-POSIX system that has a seek function that works quite a bit

Re: Typeglobs, constants and sub refs

2009-09-17 Thread Uri Guttman
MR == Matteo Riva mura...@gmail.com writes: MR Hm no maybe I didn't explain myself: my doubt was not about the MR use of constants, but about the strange way of defining MR them. What I thought when reading it was: Why not just 'use MR constant ...' ?. And later But how exactly does it

Re: Typeglobs, constants and sub refs

2009-09-17 Thread Matteo Riva
On Thu, Sep 17, 2009 at 8:18 PM, Chas. Owens chas.ow...@gmail.com wrote: Ah, use constant is just sugar for what he is doing.  And, given that he is only adding the constants because they don't exist in very old versions of Perl, it is likely that he is trying to support a version of Perl

Re: Typeglobs, constants and sub refs

2009-09-17 Thread Matteo Riva
On Thu, Sep 17, 2009 at 8:22 PM, Uri Guttman u...@stemsystems.com wrote: the strange way is because that is how perl does it. perl doesn't have a proper macro mechanism which is how many langs do constants. so it needs something that is parsed in perl and subs with empty prototypes work well.

Re: Typeglobs, constants and sub refs

2009-09-17 Thread Uri Guttman
CO == Chas Owens chas.ow...@gmail.com writes: CO Ah, use constant is just sugar for what he is doing. And, given that CO he is only adding the constants because they don't exist in very old CO versions of Perl, it is likely that he is trying to support a version CO of Perl prior to