Install demo with module ? 
Author Message
 Install demo with module ?

Hello

I'm considering to setup MakeMaker to install a demo program that can
be used by widget when a user installs one of my Tk module.

Is that considered as a good practice ?

Thanks (and happy new year !)

PS: Has anyone an example of a MakeMaker file that can do this ?

--

-++**==--++**==--++**==--++**==--++**==--++**==--++**==
This message was posted through the Stanford campus mailing list
server.  If you wish to unsubscribe from this mailing list, send the



Tue, 24 Jun 2003 22:25:12 GMT  
 Install demo with module ?

Quote:

> Hello

> I'm considering to setup MakeMaker to install a demo program that can
> be used by widget when a user installs one of my Tk module.

> Is that considered as a good practice ?

> Thanks (and happy new year !)

> PS: Has anyone an example of a MakeMaker file that can do this ?

Here's an example using one of Nancy's widgets from the book.  Start with
a standard directory structure, something like this:

Pandora:/home/lusol/lusol/sgi/perl/atk/Mega/MM2/dir
total 26
drwxr-xr-x    2 lusol    staff       2048 Jan  5 15:43 .
drwxr-xr-x    9 lusol    staff       2048 Jan  5 09:12 ..
-rwxr-xr-x    1 lusol    staff       1943 Jan  5 15:41 Makefile.PL
-rwxr-xr-x    1 lusol    staff       4183 Oct 25  1999 NavListbox.pm
-rwxr-xr-x    1 lusol    staff        268 Jan  5 13:50 navtest.pl

NavListbox.pm is the derived megawidget and navtest.pl will your new addition
to the User Contributed Demonstrations portion of the widget program showing
how to use the new widget.

Here's navtest.pl, it's first line is a comment describing the demo, but
otherwise is a normal Perl/Tk program:

# A NavListbox sample program.
use Tk;
use Tk::NavListbox;
use strict;

my $mw = MainWindow->new;
my $nlb = $mw->NavListbox->pack;
print "NavListbox = ", $nlb, "\n";
for (qw/one two three four five six seven eight none ten/) {
    $nlb->insert('end', $_);

Quote:
}

MainLoop;

Here's the Makefile.PL I'll push (;  It's pretty generic, made to be
reused - all you do is change $pm, and it automatically generates the
test program test.pl:

Pandora:/home/lusol/lusol/sgi/perl/atk/Mega/MM2/cat Makefile.PL
use Tk::MMutil;

my $pm = 'NavListbox';

open TEST, ">test.pl" or die "Cannot open test.pl: $!";
while (<DATA>) {
    s/NavListbox/$pm/o;
    print TEST;

Quote:
}

close TEST or die $!;

Tk::MMutil::TkExtMakefile(
    NAME          => "Tk::$pm",
    DISTNAME      => "Tk-$pm",
    VERSION_FROM  => "$pm.pm",
    PM            => {'navtest.pl' =>
        '$(INST_ARCHLIB)/Tk/demos/widtrib/navtest.pl'},
    dist          => {COMPRESS => 'gzip', SUFFIX => 'gz'},
    ($] >= 5.005 ?
        (ABSTRACT => 'Navigatible Listbox',

    ),
);
__DATA__
#!perl -w
use Test;
use strict;

BEGIN { plan tests => 12 };

eval { require Tk; };

my $mw;
eval {$mw = Tk::MainWindow->new();};

ok(Tk::Exists($mw), 1, "MainWindow creation failed");
eval { $mw->geometry('+10+10'); };

my $w;
my $class = 'NavListbox';

print "Testing $class\n";
undef($w);

eval "require Tk::$class;";

eval { $w = $mw->$class(); };


if (Tk::Exists($w)) {
    eval { $w->pack; };


    eval { $mw->update; };



    eval { $mw->update; };

    eval { $w->destroy; };

    ok(!Tk::Exists($w), 1, "$class: widget not really destroyed");

Quote:
} else  {

    for (1..5) { skip (1,1,1, "skipped because widget couldn't be created"); }

Quote:
}

1;

This is the key statement you are interested in:

    PM            => {'navtest.pl' =>
        '$(INST_ARCHLIB)/Tk/demos/widtrib/navtest.pl'},

If you have to widtrib demo, them remove this line.

So, after "perl Makefile.PL", you have a Makefile and a test.pl.  After
a "make install" navtest.pl is available to widget.

Steve

'other perl hacker';$z='createText';$c=$m->Canvas(-wi,$_[1],-he,25)->grid;$c->$
En'.
'ter>',sub{$y=int(rand($m->screenheight));$m->geometry("+$y+$y")});MainLoop;
-++**==--++**==--++**==--++**==--++**==--++**==--++**==
This message was posted through the Stanford campus mailing list
server.  If you wish to unsubscribe from this mailing list, send the



Wed, 25 Jun 2003 05:42:53 GMT  
 Install demo with module ?

Quote:

>Hello

>I'm considering to setup MakeMaker to install a demo program that can
>be used by widget when a user installs one of my Tk module.

You mean so that Tk's "widget" demo shows it ?
Good idea!

Quote:

>Is that considered as a good practice ?

>Thanks (and happy new year !)

>PS: Has anyone an example of a MakeMaker file that can do this ?

Not off hand - but all you need to do is get the demo into the "right"
sub directory of Tk.

So creating this sub-tree under your extension might suffice:

lib/Tk/demos/widtrib/your_demo.pl

--
Nick Ing-Simmons

-++**==--++**==--++**==--++**==--++**==--++**==--++**==
This message was posted through the Stanford campus mailing list
server.  If you wish to unsubscribe from this mailing list, send the



Wed, 25 Jun 2003 05:44:24 GMT  
 Install demo with module ?
Steve Lidie wrote, somewhat in error:

Quote:
> This is the key statement you are interested in:

>     PM            => {'navtest.pl' =>
>         '$(INST_ARCHLIB)/Tk/demos/widtrib/navtest.pl'},

> If you have a widtrib demo, then remove this line.

        ^
        do not

Quote:
> So, after "perl Makefile.PL", you have a Makefile and a test.pl.  After
> a "make install" navtest.pl is available to widget.

Further, the MANIFEST file is also created.
-++**==--++**==--++**==--++**==--++**==--++**==--++**==
This message was posted through the Stanford campus mailing list
server.  If you wish to unsubscribe from this mailing list, send the



Wed, 25 Jun 2003 11:53:48 GMT  
 Install demo with module ?

Quote:


> >Hello

> >I'm considering to setup MakeMaker to install a demo program that can
> >be used by widget when a user installs one of my Tk module.

> You mean so that Tk's "widget" demo shows it ?
> Good idea!

Yes. I'm currently updating the way I make my Tk packages
so that:
- a Tk's "widget" demo is installed
- make test is run in non-interactive mode (I guess that interactive
  tests are a pain in the neck for the CPAN testers)
- the test can also be run manually in interactive mode.

Steve and Nick, thanks for your help. I will try your solution
today... [Checking my agenda] Err, let's say this week ... ;-)

Cheers

--

-++**==--++**==--++**==--++**==--++**==--++**==--++**==
This message was posted through the Stanford campus mailing list
server.  If you wish to unsubscribe from this mailing list, send the



Fri, 27 Jun 2003 18:31:21 GMT  
 Install demo with module ?

Quote:

> Hello

> I'm considering to setup MakeMaker to install a demo program that can
> be used by widget when a user installs one of my Tk module.

> Is that considered as a good practice ?

> Thanks (and happy new year !)

> PS: Has anyone an example of a MakeMaker file that can do this ?

Check the Makefile.PL from the Tk-Date distribution. I added to the PM
entry both the module and the demo file. In the file is also a rule
for "make demo" included --- so the user can start the demo before
actually installing the module.

Regards,
        Slaven

From the Makefile.PL:

WriteMakefile
  (
   ...
   'PM' => {'Date.pm'   => '$(INST_LIB)/Tk/Date.pm',
            'demos/date.pl' => ($] >= 5.005
                                ? '$(INST_ARCHLIB)'
                                : '$(INST_LIB)') . '/Tk/demos/widtrib/date.pl',
           },
   ...
  );

sub MY::postamble {
        '
demo :: pure_all
        $(FULLPERL) -w -I$(SITELIBEXP)/Tk/demos/widget_lib -I$(SITEARCHEXP)/Tk/demos/widget_lib -Mblib demos/date.pl

';

Quote:
}

--
use Tk;$c=tkinit->Canvas(-he,20)->grid;$x=5;map{s!\n!!g;map{create$c 'line'=>
map{$a=-43+ord;($x+($a>>3)*2=>5+($a&7)*2)}split''}split"!";$x+=12}split/_/=>'K
PI1_+09IPK_K;-OA1_+K!;A__1;Q!7G_1+QK_3CLPI90,_+K!;A_+1!KQ!.N_K+1Q!.F_1+KN.Q__1+
KN._K+1Q!.F_1+KN.Q_+1Q__+1!KQ!.N_1;Q!7G_K3,09Q_+1!K.Q_K+1Q!.F_1+KN.Q_';MainLoop

-++**==--++**==--++**==--++**==--++**==--++**==--++**==
This message was posted through the Stanford campus mailing list
server.  If you wish to unsubscribe from this mailing list, send the



Sun, 29 Jun 2003 00:15:08 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Tk-b8 basic demo (+ installing packages, in general)

2. Tk-b8 basic demo (+ installing packages, in general)

3. widget demo for new text module features.

4. Install complains that installed modules are not found

5. Install: Sorry, but how to install a module?

6. installing new modules in newly installed linux

7. module needs to be installed in, *and* depends on modules in, a nonstandard directory

8. Need help to install BerkerlyDB module or DB_File module for Perl

9. module install problems with cpan module and gcc?

10. how to install a module (a newby on modules)

11. how to install a module (a newby on modules)

12. Can't install Net module using ppm - Can't find module

 

 
Powered by phpBB® Forum Software