MOP4Import-Declare

 view release on metacpan or  search on metacpan

intro_runnable_module.pod  view on Meta::CPAN


    MainLoop unless caller;

and achieved following tricks:

=over 4

=item * When this script is executed directly, run C<Tk::MainLoop()>
so that correctly start GUI drawing and event loop.

=item * Otherwise (i.e. C<eval()>ed from clipboard and/or C<do "script">) do nothing.

=back

=head2 Let's write F<MyScript.pm> instead of F<myscript.pl>

This C<unless caller> idiom is useful not only in Tk scripts,
but also in normal perl scriptings because it enables you
to write dual purpose script: your script can be used as a module
and also as a standalone script.



( run in 2.344 seconds using v1.01-cache-2.11-cpan-84e82930d8c )