PetaMem has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks,

inspecting the Cache::Memcached source, I stumbled across the following:

sub stats_reset { my Cache::Memcached $self = shift;

Now the "Cache::Memcached" after the "my" keyword is what puzzles me. The camel book doesn't mention anything like that in the description of my, and so I'm completely missing the semantics of it. What is it? Some kind of data type specification?

Bye
 PetaMem
    All Perl:   MT, NLP, NLU

Replies are listed 'Best First'.
Re: Weird my Syntax
by Joost (Canon) on Aug 01, 2005 at 12:44 UTC
Re: Weird my Syntax
by derby (Abbot) on Aug 01, 2005 at 12:50 UTC
    Not weird ... from perldoc -f my
    my TYPE EXPR my EXPR : ATTRS my TYPE EXPR : ATTRS A "my" declares the listed variables to be local (lexically) to the enclosing block, file, or "eval". If more than one value is listed, the list must be placed in parentheses. The exact semantics and interface of TYPE and ATTRS are still evolving. TYPE is currently bound to the use of "fields" pragma, and attributes are handled using the "attributes" pragma, or starting from Perl 5.8.0 also via the "Attribute::Handlers" module. See "Private Variables via my()" in perlsub for details, and fields, attributes, and Attribute::Handlers
    -derby
Re: Weird my Syntax
by castaway (Parson) on Aug 02, 2005 at 08:17 UTC
    I guess you missed the discussion of my Dog spot; in the Camel, I think it's in the modules chapter.

    C.