in reply to Grabbing unknown functions from modules

#!/usr/bin/perl use strict; use warnings; package Foo; sub getAStruct { print "This is getAStruct\n"; } sub getBStruct { print "This is getBStruct\n"; } sub getCStruct { print "This is getCStruct\n"; } package main; foreach my $key (keys %Foo::) { no strict 'refs'; "Foo::$key" -> () if defined &{"Foo::$key"}; # Or: # "Foo::$key" -> () if defined *{"Foo::$key"}{CODE}; } __END__ This is getAStruct This is getCStruct This is getBStruct

Abigail

Replies are listed 'Best First'.
Re: Re: Grabbing unknown functions from modules
by Anonymous Monk on Sep 29, 2003 at 16:05 UTC
    Thanks so much Abigail, it worked beautifully ;)