* Fergal Daly <fer...@esatclear.ie> [2010-10-16 21:30]: > One of the reasons I had no time for Test::Deep is that my > day-job is python. While I spend a fair bit of time cursing > python, I do not miss for one minute Perl's global namespace > which drives the need for exported symbols. In python modules > are objects themselves and so you place the module object in > your namespace and access it's members.
The difference is that without doing so, you cannot get access to a module’s symbols at all in Python. In Perl, if Test::Deep is loaded, you can get to its symbols from anywhere by saying `Test::Deep::is_deeply`. Strictly and impractically speaking there is no need for im- or exporting anything at all. It’s a matter of convenience only. You could write something like this: sub usesubs { my $pkg = shift; require Carp; eval "require $pkg" or Carp::croak $@; ( map { no strict; \&{ $pkg . '::' . $_ } } @_ )[ 0 .. $#_ ]; } and then my ( $is_deeply, $set ) = usesubs qw( Test::Deep is_deeply set ); $is_deeply->( $foo, $set->( [ 1, 2, 3, 4 ] ) ); With Devel::Declare you could then even make that something like usesubs Test::Deep is_deeply, set; However. Test::Deep is not the place for experiments in fixing Perl conventions. It is not the place for experiments in improving anything other than recursive data structure comparison, which is the one thing the module is about. Foisting your ideas about how Perl (or Perl culture) should work on the users of one module who do not care about those ideas will only disgruntle them without fixing anything in the big picture. To improve something fundamental about Perl you must do it in a way that can be packaged separately from any specific module. To increase its hopes of succeeding, it should be usable with all, or at least many, existing modules, so users can subscribe to the idea without the ocean having to be boiled. Then you can evangelise it as a general new way of doing things, and if enough individual codebases adopt it, it will spread. Modules are poor place for evangelism about unrelated conventions in general, but I feel this especially strongly about Test:: modules with break-the-CPAN level adoption such as Test::Deep. -- *AUTOLOAD=*_;sub _{s/::([^:]*)$/print$1,(",$\/"," ")[defined wantarray]/e;chop;$_} &Just->another->Perl->hack; #Aristotle Pagaltzis // <http://plasmasturm.org/>