Mercurial > pidgin
comparison libpurple/plugins/perl/scripts/function_list.pl @ 16573:fab49a6e9b25
Add a script I've found handy to make sure the perl APIs look right, it also
helped test that my Pidgin:: changes actually worked.
| author | Etan Reisner <pidgin@unreliablesource.net> |
|---|---|
| date | Sat, 28 Apr 2007 06:02:47 +0000 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 16572:390987ecddf3 | 16573:fab49a6e9b25 |
|---|---|
| 1 $MODULE_NAME = "List all Purple:: (and Pidgin::) functions"; | |
| 2 use Purple; | |
| 3 # Uncomment this to print the Pidgin:: functions as well. | |
| 4 #use Pidgin; | |
| 5 | |
| 6 # All the information Purple gets about our nifty plugin | |
| 7 %PLUGIN_INFO = ( | |
| 8 perl_api_version => 2, | |
| 9 name => "Perl: $MODULE_NAME", | |
| 10 version => "0.1", | |
| 11 summary => "Print to standard output all the functions under the Purple:: (and Pidgin::) packages", | |
| 12 description => "Print to standard output all the functions under the Purple:: (and Pidgin::) packages", | |
| 13 author => "Etan Reisner <deryni\@gmail.com>", | |
| 14 url => "http://sourceforge.net/users/deryni9/", | |
| 15 id => "functionlist", | |
| 16 | |
| 17 load => "plugin_load", | |
| 18 unload => "plugin_unload" | |
| 19 ); | |
| 20 | |
| 21 sub plugin_init { | |
| 22 return %PLUGIN_INFO; | |
| 23 } | |
| 24 | |
| 25 sub print_array { | |
| 26 my $array = shift; | |
| 27 | |
| 28 my @arr = sort @$array; | |
| 29 foreach $mod (@arr) { | |
| 30 my @sub; | |
| 31 | |
| 32 foreach $key (sort keys %{$mod}) { | |
| 33 if ($key =~ /::$/) { | |
| 34 push @sub, "$mod$key"; | |
| 35 } else { | |
| 36 print "$mod$key\n"; | |
| 37 } | |
| 38 } | |
| 39 print_array(\@sub); | |
| 40 } | |
| 41 } | |
| 42 | |
| 43 sub plugin_load { | |
| 44 my $plugin = shift; | |
| 45 my @purplearray; | |
| 46 my @pidginarray; | |
| 47 | |
| 48 foreach $key (sort keys %Purple::) { | |
| 49 if ($key =~ /::$/) { | |
| 50 push @purplearray, "Purple::$key"; | |
| 51 } else { | |
| 52 print "Purple::$key\n"; | |
| 53 } | |
| 54 } | |
| 55 print_array(\@purplearray); | |
| 56 | |
| 57 foreach $key (sort keys %Pidgin::) { | |
| 58 if ($key =~ /::$/) { | |
| 59 push @pidginarray, "Pidgin::$key"; | |
| 60 } else { | |
| 61 print "Pidgin::$key\n"; | |
| 62 } | |
| 63 } | |
| 64 print_array(\@pidginarray); | |
| 65 } | |
| 66 | |
| 67 sub plugin_unload { | |
| 68 my $plugin = shift; | |
| 69 } |
