in reply to Re: "use strict" not too strict
in thread "use strict" not too strict
The problem is that *{$name}{CODE} is as expected, undef for symbol foo, and not undef for symbol bar, but it is also undef for symbol boo. That is, there's no way to distinguish at the symbol table level between an undefined subprogram name, and a scalar, because both will have#!/usr/bin/perl -w use strict; use English; use vars qw($boo); $a = foo() if 0; sub bar {} END { no strict 'refs'; my $table = '::'; SYMBOL: for my $sym (sort {lc($a) cmp lc($b)} keys %{$table}) { next if $sym =~ /::$/ or $sym =~ /^[A-Z0-9]/; my $name = $table . $sym; next if $name =~ /^::\W/; foreach my $thing qw(ARRAY HASH IO) { if (defined *{$name}{$thing}) { next SYMBOL; } } print "Look at this!\n"; unless (defined *{$name}{CODE}) { warn "Possible undefined routine '$sym'"; } } }
Hmph.defined(*foo{SCALAR}) && !defined(*foo{CODE})
| -- | |||||||
|
| ||||||
| ...Nexcerpt...Connecting People With Expertise | |||||||
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: "use strict" not too strict (go!)
by tye (Sage) on Jul 17, 2003 at 16:57 UTC | |
|
Re: Re: Re: "use strict" not too strict
by tilly (Archbishop) on Jul 17, 2003 at 17:40 UTC | |
|
Re^3: "use strict" not too strict
by Aristotle (Chancellor) on Jul 17, 2003 at 19:22 UTC | |
by Mur (Pilgrim) on Jul 17, 2003 at 20:56 UTC | |
by Aristotle (Chancellor) on Jul 17, 2003 at 22:47 UTC |