Using Modules once

B

Brian

Hi All-
I am getting the hang of some Perl approaches to situations. But one
thing is bothering me. Perhaps this has been written about somewhere.
Pointers appreciated.

Can you do something in general with a set of perl package files to
make it into a 'run once program' instead of installing it?

--

Today, I want to use a set of files that reads Palm OS .pdb
databases. I will likely not ever look at this again, or perhaps once
more a long time from now. Although the author seems to have done an
earnest job in making a very full set of packages, his namespace
choices were poor, in that he uses names like Mail, Raw and DateBook.
It looks to me like those files are going to be tossed into a flat
list in man and perl INC directories. That sounds unlucky.

SO what I did was:

a) copy the source code for each package called out in the desired
final program, into a same source, but removing the 'use xxx' line.

b) did so for all the required packages in reverse order, so the final
program comes last, the most basic package is first.

that seems to work, though I haven't poked at it much. please advise
 
P

Paul Lalli

Hi All-
I am getting the hang of some Perl approaches to situations. But one
thing is bothering me. Perhaps this has been written about somewhere.
Pointers appreciated.

Can you do something in general with a set of perl package files to
make it into a 'run once program' instead of installing it?

--

Today, I want to use a set of files that reads Palm OS .pdb
databases. I will likely not ever look at this again, or perhaps once
more a long time from now. Although the author seems to have done an
earnest job in making a very full set of packages, his namespace
choices were poor, in that he uses names like Mail, Raw and DateBook.
It looks to me like those files are going to be tossed into a flat
list in man and perl INC directories. That sounds unlucky.

SO what I did was:

a) copy the source code for each package called out in the desired
final program, into a same source, but removing the 'use xxx' line.

b) did so for all the required packages in reverse order, so the final
program comes last, the most basic package is first.

that seems to work, though I haven't poked at it much. please advise


Why not just install them somewhere other than your normal library?

perl Makefile.PL PREFIX=~/lib/UseOnlyOnce/
make
make test
make install

Then within a script that wants to use it:
use lib "$ENV{HOME}/lib/UseOnlyOnce";
use Mail;
use Raw;
use DateBook;


Just a suggestion,
Paul Lalli
 
B

Brian

...

Why not just install them somewhere other than your normal library?

perl Makefile.PL PREFIX=~/lib/UseOnlyOnce/
make
make test
make install

Then within a script that wants to use it:
use lib "$ENV{HOME}/lib/UseOnlyOnce";
use Mail;
use Raw;
use DateBook;

Just a suggestion,
Paul Lalli

It looks like the Perl fiels would go in the specified directory, but
the man files would not. However, the man files are called Palm::xxx,
so they could be identitified.

the package trick did work, also.. more ideas welcome
 
R

Robert 'phaylon' Sedlacek

Hi Brian,
I am getting the hang of some Perl approaches to situations. But one
thing is bothering me. Perhaps this has been written about somewhere.
Pointers appreciated.

Can you do something in general with a set of perl package files to
make it into a 'run once program' instead of installing it?

You might want to take a look at the PAR[1] distribution. It allows you
to bundle dependencies into an archive. It goes so far that you can also
include the perl interpreter and make it an executable.

HTH,
..phaylon

[1] http://search.cpan.org/dist/PAR
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top