Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^4: Perl allows package names consisting entirely of colons

by tobyink (Abbot)
on Nov 27, 2012 at 16:30 UTC ( #1005879=note: print w/ replies, xml ) Need Help??


in reply to Re^3: Perl allows package names consisting entirely of colons
in thread Perl allows package names consisting entirely of colons

"why disallow it?"

I never meant to imply that it should be disallowed. I was just expressing surprise that it is not disallowed, given that Perl does place limits on what tokens may appear in a package declaration.

Why disallow package 123 and package 123:: but allow package ::123? The tokens allowed to follow package are have interesting but seemingly arbitrary restrictions, which have nothing to do with what names are actually usable for naming functions, variables, etc...

use 5.010; use strict qw( vars subs ); use warnings; # Package name contains whitespace; sub name begins with leading colon +. *{"123 :::x"} = sub { say "hello" }; # Yet it can be called. &{"123 :::x"};
perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'


Comment on Re^4: Perl allows package names consisting entirely of colons
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1005879]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (11)
As of 2014-12-22 09:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (113 votes), past polls