in reply to What CODE typeglob slot is my anonymous sub in?

Your use of uc is what is causing your problem I think:

#! perl -slw use strict; my @types = qw( date integer text timestamp ); foreach my $type (@types) { my $function = uc $type; no strict 'refs'; *$function = sub { # line 1 "$type.anon" if ( looks_like_number( $_[0] ) ) { die "Datatype '$type' does not require a numeric length '$ +_[0]'"; } return { type => $type, @_ }; }; print *$function; } __END__ C:\test>junk6 *main::DATE *main::INTEGER *main::TEXT *main::TIMESTAMP

Remove it and you get:

C:\test>junk6 *main::date *main::integer *main::text *main::timestamp

Is that what you are after?


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."

Replies are listed 'Best First'.
Re^2: What CODE typeglob slot is my anonymous sub in?
by Ovid (Cardinal) on Apr 24, 2007 at 10:26 UTC

    See shmem's response below, and my response in turn. It doesn't solve my problem, but it's a lot closer. I'm not sure if my problem can be solved.

    Cheers,
    Ovid

    New address of my CGI Course.