mlgvalt has asked for the wisdom of the Perl Monks concerning the following question:
This is from a class constructor (“new”); it is setting the class hash variable ‘Post” to a subroutine that was passed in ($args{‘Post”}). If that is false or not defined, then it sets the class variable ‘Post’ to sub {1;}. This is where I am lost. What is sub {1;} ? A forward declaration to a subroutine which is… ??? I am guessing that { ;} is part of the sub declaration and not a hash, but I can’t remember what “1” should represent. Or maybe this is something else entirely.$self->{'Post'} = ($args{'Post'} or sub {1;});
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: what is sub {1;}
by ikegami (Patriarch) on May 27, 2008 at 07:56 UTC | |
|
Re: what is sub {1;}
by moritz (Cardinal) on May 27, 2008 at 07:58 UTC | |
by mandarin (Hermit) on May 27, 2008 at 09:00 UTC | |
by moritz (Cardinal) on May 27, 2008 at 09:11 UTC | |
by ruzam (Curate) on May 27, 2008 at 14:06 UTC | |
by moritz (Cardinal) on May 27, 2008 at 14:14 UTC | |
by ikegami (Patriarch) on May 27, 2008 at 09:06 UTC | |
by DrHyde (Prior) on May 27, 2008 at 09:15 UTC | |
|
Re: what is sub {1;}
by mhearse (Chaplain) on May 27, 2008 at 09:03 UTC | |
|
Re: what is sub {1;}
by rovf (Priest) on May 27, 2008 at 09:00 UTC | |
|
Re: what is sub {1;}
by TGI (Parson) on May 27, 2008 at 17:05 UTC | |
by DrHyde (Prior) on May 27, 2008 at 18:18 UTC |