Acme::Innuendo - polite access to Perl's private parts


Acme-Innuendo documentation Contained in the Acme-Innuendo distribution.

Index


Code Index:

NAME

Top

Acme::Innuendo - polite access to Perl's private parts

SYNOPSIS

Top

  use Acme::Innuendo;

  # Create an alias

  nudge_nudge( special_place(), "alias_sub",
    wink_wink( special_place(), "some_sub" )
  );

  # Walk the symbol table

  walk_the_dog( special_place(), sub {
    my ($namespace, $symbol, $ref) = @_;
    print $namespace, $symbol, "\n";
  } );




DESCRIPTION

Top

This module provides an alternative method of addressing the symbol table for those who condider it akin to "touching Perl's genitals."

special_place
  $root_namespace = special_place();

  $module_namespace = special_place( $module_name );

Returns the name space of the specified module, or the root namespace if no module is specified.

wink_wink
  $ref = wink_wink( $namespace, $symbol );

Returns the glob for the symbol in the given namespace, if it exists.

nudge_nudge
  nudge_nudge( $namespace, $symbol, $ref );

Changes or adds the symbol in the namespace.

walk_the_dog
  walk_the_dog( $namespace, sub { ... } );

Walks a namespace and sends symbol information to the callback routine.

SEE ALSO

Top

This module is a bit of humor. For more serious applications, see the following modules on CPAN:

  Alias
  Devel::LexAlias
  Lexical::Alias
  Package::Alias
  Tie::Alias
  Tie::Alias::Array
  Tie::Alias::Handle
  Tie::Alias::Hash
  Variable::Alias

AUTHOR

Top

Robert Rothenberg <rrwo at cpan.org>

current Maintainer: Rene Schickbauer <rene.schickbauer at gmail.com>

REPORTING BUGS

Top

We don't know of any bugs, but that doesn't mean there aren't any. Please the CPAN bugtracker or mail Rene Schickbauer directly.

COPYRIGHT AND LICENSE

Top


Acme-Innuendo documentation Contained in the Acme-Innuendo distribution.

package Acme::Innuendo;

use 5.006001;
use strict;
use warnings;

require Exporter::Lite;

our @ISA = qw(Exporter::Lite);

our @EXPORT_OK = ( );

our @EXPORT = qw(
  special_place nudge_nudge wink_wink walk_the_dog
);

our $VERSION = '0.03';
$VERSION = eval $VERSION;  # see L<perlmodstyle>

sub special_place {
  my $namespace = shift || 'main';
  if (defined $namespace) {
    $namespace .= '::';
  }
  no strict 'refs';
  return *$namespace;
}

sub nudge_nudge {
  my ($root, $sym, $value) = @_;
  $root->{$sym} = $value;
}

sub wink_wink {
  my ($root, $sym) = @_;
  return $root->{$sym};
}


sub walk_the_dog {
  my $root     = shift;
  my $callback = shift || sub { };

  return unless ($root);

  foreach my $sym (keys %$root) {
    my $ref = $root->{$sym};
    if ($sym =~ m/::$/)  {
      walk_the_dog($ref, $callback), if ($sym ne 'main::');
    }
    else {
      &$callback($root,$sym,$ref);
    }
  }
}


1;
__END__