in reply to Re^2: Class::Std :default parameter
in thread Class::Std :default parameter

I apologize -- the parens problem is because it's unbalanced, but, you're right, it's more subtle than what I originally said. The parameter list for an attribute isn't really parsed normally. From attributes:

An attribute list is a sequence of attribute specifications, separa +ted by whitespace or a colon (with optional whitespace). Each attribute specification is a simple name, optionally followed by a parenthesi +sed parameter list. If such a parameter list is present, it is scanned +past as for the rules for the "q()" operator. (See "Quote and Quote-like Operators" in perlop.) The parameter list is passed as it was found +, however, and not as per "q()". Some examples of syntactically valid attribute lists: switch(10,foo(7,3)) : expensive Ugly('\(") :Bad _5x5 locked method Some examples of syntactically invalid attribute lists (with annotation): switch(10,foo() # ()-string not balanced Ugly('(') # ()-string not balanced 5x5 # "5x5" not a valid identifier Y2::north # "Y2::north" not a simple identifi +er foo + bar # "+" neither a colon nor whitespac +e

Reading between the lines, the difference in the "Ugly" specs above seems to be the use of the backslash on the "(" in the first example. You might try backspacing your inner "(" and see if that helps.

If the parens problem is fixed, you will need the use statement after the package statement because Class::Std exports subroutines that the attributes mechanism looks for in the current package when an attribute is detected. See my post, Re: Class::Std : How does MODIFY_HASH_ATTRIBUTES work? for details.

-xdg

Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.