Module name with dash (or is it hypen?)
am 06.02.2010 17:34:43 von Michael Ellery
Does anyone know if/how module names with dashes are supported in perl?
I just happened to name one of my packages with a dash in it and I
wasn't able to load it ("use my-package;" fails with a strange error). I
wonder if there is some special trick to load modules with names like
this or is it simply not allowed?
Thanks,
Mike Ellery
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Module name with dash (or is it hypen?)
am 06.02.2010 18:55:17 von Serguei Trouchelle
Michael Ellery wrote:
> Does anyone know if/how module names with dashes are supported in perl?
Not supported at all. Identifier can only be a string beginning with a letter or underscore, and containing letters,
underscores, and digits. Package name is actually a namespace, which consists of identifiers, divided by double colon or
apostrophe (old style, not recommended).
I'm not aware of any other programming language that supports hyphen as a part of identifier, so it's strange that you
tried this with Perl.
> I just happened to name one of my packages with a dash in it and I
> wasn't able to load it ("use my-package;" fails with a strange error).
You are not even able to make this package pass syntax check, "package anything-like-that;" construction should fail.
--
Serguei Trouchelle
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Module name with dash (or is it hypen?)
am 06.02.2010 20:16:31 von jwkenne
On Feb 6, 2010, at 12:55 PM, Serguei Trouchelle wrote:
> I'm not aware of any other programming language that supports hyphen as a part of identifier, so it's strange that you
> tried this with Perl.
COBOL, the LISP family, and Inform 7 come to mind. COBOL and Inform 7 resolve the minus/hyphen ambiguity by requiring spaces around minus. LISP does not include conventional arithmetic expressions.
Perl, of course, is part of the CPL family, which is part of the larger ALGOL family, which includes the overwhelming majority of languages.
--
John W Kennedy
"Those in the seat of power oft forget their failings and seek only the obeisance of others! Thus is bad government born! Hold in your heart that you and the people are one, human beings all, and good government shall arise of its own accord! Such is the path of virtue!"
-- Kazuo Koike. "Lone Wolf and Cub: Thirteen Strings" (tr. Dana Lewis)
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs