in reply to What does @_[OBJECT, ARG0, ARG1] mean?
When you encounter things like this in the future, the Debugger is very useful. In particular, look at the X vars... (or V Package::Name vars...) commands. Try, for example,
DB<1> X OBJECT $OBJECT = 123
There's nothing special about constants. All that constant.pm does is create a method in the package that returns the value you gave, by cleverly using import through use. Here's the relevant parts from constant.pm in 5.12.3:
#===================================================================== +== # import() - import symbols into user's namespace # # What we actually do is define a function in the caller's namespace # which returns the value. The function we create will normally # be inlined as a constant, thereby avoiding further sub calling # overhead. #===================================================================== +== sub import { #... #note: $full_name is set to "Package_I_Was_Called_From::ConstantNa +me", for each constant you provide #if you have a scalar, it basically does *$full_name = sub () { $scalar }; #and if you have an array: *$full_name = sub () { @list }; #... }
Note: In the debugger output above, you may have noticed that it appeared as a regular variable. Indeed, in Perl 5.8 (as I understand it), constant.pm had some magic added to it so that scalars are simply added into the symbol table, appearing to be a package variable. Still, you can't really use them as variables, as you can observe here:
DB<6> x &OBJECT 0 123 DB<7> x $OBJECT 0 undef
|
|---|