Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: 'use strict' without a semicolon can be interesting

by ikegami (Patriarch)
on Jul 09, 2010 at 00:08 UTC ( [id://848787]=note: print w/replies, xml ) Need Help??


in reply to 'use strict' without a semicolon can be interesting

It seems to me like it would be nice if this gave some sort of an error.

The syntax for use is use Module EXPR;, where EXPR is an expression that returns a list of symbols to import (or a list of strictures to enable in strict's case), and that's exactly what you provided. How can Perl possible know that what you meant something other than what you told it?

still behaves the same way in perl 5.8.12.

5.8.9 is the highest release of 5.8. You probably meant 5.12.0 or 5.12.1.

Replies are listed 'Best First'.
Re^2: 'use strict' without a semicolon can be interesting
by toma (Vicar) on Jul 13, 2010 at 18:20 UTC
    Perhaps there are a limited number of strictures that use strict knows about. Perl could compare the EXPR list against the known list of possible strictures, and throw an error or warning if the EXPR is not on the list.

    I don't know if this is feasible to implement without deep changes, but it does seem possible.

    You are right, I meant perl 5.12.1!

    It should work perfectly the first time! - toma

      It already does that.

      $ perl -e'use strict "foo"' Unknown 'strict' tag(s) 'foo' at -e line 1 BEGIN failed--compilation aborted at -e line 1.

      You passed an empty list which is perfectly valid (i.e. the same as use strict;).

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (6)
As of 2025-06-24 10:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.