Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

What is it adding to my symbol table?

by CharlesClarkson (Curate)
on Feb 04, 2002 at 01:42 UTC ( #143141=snippet: print w/ replies, xml ) Need Help??


I was curious about how well behaved my new classes were and wrote this to find what new symbols were being added to the symbol table.

Just change 'use Posix' to whatever module you would like to check.

Update:Changed the first comment to show the modules in my example are all optional.

use strict;
use warnings;

# Load any modules you don't want tested before the BEGIN
# You don't have to load the modules above - just any
# you want to load and exclude before the tested module(s)

    my %before;
    @before{keys %::} = (1) x keys %::;
    $before{DATA} = 1;
    sub before { $before{$_[0]} }

# Put the module(s) you're testing here.
use POSIX;

for ( sort keys %:: ) {
    printf "% 25s => %s\n", $_, $::{$_} unless before $_;

Comment on What is it adding to my symbol table?
Download Code

Back to Snippets Section

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: snippet [id://143141]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2015-11-26 07:10 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (696 votes), past polls