in reply to Visibility of Subroutines within modules,

You can rely on convention, and simply name things with an underscore as the first character of the sub's name (and put in a note to the fact). If anyone gets burned by using the private interface, it's their own fault.

A truly private option would be to stash coderefs in a lexically declared hash.

package Foo; my %hidden = ( bar => sub { print "Bar\n"; }, ... ); sub something_public { my( $baz, $quux ) = @_; return $hidden{bar}->( $baz + 5, reverse $quux ); }

Replies are listed 'Best First'.
Re: Re: Visibility of Subroutines within modules,
by ceedee (Sexton) on Mar 26, 2002 at 00:45 UTC
    (disregard the mispost above) In reference to the hash declaration am I able to declare variables contained within the hash like my %hidden = ( bar=>sub { my $foo = shift; print $foo; } ); Instead of using one line of code per entry?