Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Testing for valid package names

by toolic (Bishop)
on Nov 25, 2013 at 21:15 UTC ( #1064299=note: print w/ replies, xml ) Need Help??


in reply to Testing for valid package names

Roughly 10% of the 4000+ .pm files installed on my system have an underscore in the name, so I guess it's not that uncommon. (Find installed Perl modules matching a regular expression)

It seems like starting a package with a number ([0-9]) is a syntax error. You might want a check of the 1st character of the name.

See also:


Comment on Re: Testing for valid package names
Download Code
Replies are listed 'Best First'.
Re^2: Testing for valid package names
by boftx (Deacon) on Nov 25, 2013 at 21:20 UTC

    Thanks!

    I thought about numbers as the first char, but that is legal for filenames so far as I know. I am still mulling that over.

    I wasn't aware of that Perl::Critic rule (not surprising) but the POD doesn't mention anything about the legal character set, only that a single-quote "'" should not be used even though it is a valid substitute for the double-colon '::' separator.

    It helps to remember that the primary goal is to drain the swamp even when you are hip-deep in alligators.
      IIRC, no (non-special) identifier is allowed to start with a number.

      Though I'm sure one can trick to enter them as key value pairs into the stash.

      Cheers Rolf

      ( addicted to the Perl Programming Language)

        You're right about numbers up front. I should have tried this to begin with:

        [jim@krakatoa perl]$ cat use23Skidoo.pl #!/usr/bin/perl -T use 5.008_008; use strict; use warnings FATAL => 'all'; use 23Skidoo; exit; __END__ [jim@krakatoa perl]$ ./use23Skidoo.pl syntax error at ./use23Skidoo.pl line 8, near "use 23" Execution of ./use23Skidoo.pl aborted due to compilation errors. [jim@krakatoa perl]$
        It helps to remember that the primary goal is to drain the swamp even when you are hip-deep in alligators.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (13)
As of 2015-07-30 13:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (271 votes), past polls