in reply to Hiding my variables
You just need to declare the variable as a properly scoped lexical.
That should give you both private variables and functions, invisible from outside the file. --Paris Sinclairpackage My::Object; use strict; use warnings; our @EXPORT_OK = qw( private ); my $_private_string = "Hello"; my $_private_code = sub { return $_[0] . " World" }; sub public { return &$_private_code( $_private ); } 1; __END__
|
|---|