The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.


B::Stash - show what stashes are loaded


B::Stash has a poor side-effect only API and is only used by perlcc and B::C, and there its usability is also inferior.

It hooks into CHECK and prints a comma-seperated list of loaded stashes (package names) prefixed with -u.

With the xs option stashes with XS modules only are printed, prefixed with -x.

With the -D option some debugging output is added.

Note that the resulting list of modules from B::Stash is usually larger and more inexact than the list of used modules determined by the compiler suite (C, CC, Bytecode).


  # typical usage:
  perlcc -stash -e'use IO::Handle;'

  perlcc -stash -v3 -e'use IO::Handle;'
  Stash: main strict Cwd Regexp Exporter Exporter::Heavy warnings DB
         attributes Carp Carp::Heavy Symbol PerlIO SelectSaver

  perl -c -MB::Stash -e'use IO::Handle;'
  => -umain,-uIO

  perl -c -MB::Stash=xs -e'use IO::Handle;'
  => -xre,-xCwd,-xRegexp,-xIO

  perl -c -MO=Stash=xs,-D -e'use IO::Handle;'
  => -xre,-xCwd,-xRegexp,-xIO

  perl -c -MO=C,-dumpxs -e'use IO::Handle;'
  perlcc.lst: -xre,-xCwd,-xRegexp,-xIO


Vishal Bhatia <> I(1999), Reini Urban I(2011)


B::C has a superior two-pass stash scanner.