⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 程嶏清单13-2.txt

📁 < linux网络编程工具>>配套源码
💻 TXT
字号:
程序清单13-2:access_symtable.pl
#!/usr/bin/perl
#Dumping All Symbols in a Package
package DUMPVAR;
sub dumpvar {
        my ($packageName) = @_;
        local (*alias);             # a local typeglob
    # We want to get access to the stash corresponding to the package
    # name
        *stash = *{"${packageName}::"};  # Now %stash is the symbol table
    $, = " ";                        # Output separator for print
        # Iterate through the symbol table, which contains glob values
    # indexed by symbol names.
    while (($varName, $globValue) = each %stash) {
           print "$varName ============================= \n";
          *alias = $globValue;
          if (defined ($alias)) {
            print "\t \$$varName $alias \n";
          }
          if (defined (@alias)) {
            print "\t \@$varName @alias \n";
          } 
          if (defined (%alias)) {
            print "\t \%$varName ",%alias," \n";
            }
       }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -