Re: magic import of extensions?
> Actually, i think the 'use MyPackage' statement is what Edwin is trying > avoid, hence the term "magic" ... ? Yep, thats exactly what I am looking for. > It's not really a good idea to do this, but you could create a second perl > command in another location (or rename it in the same location ...) which > says: Well, we have some reasons to do it this way: we want to provide a range of commands to people that do not need much more than our functions ... maybe they need for loops from time to time, or simple if / elseifs - but not much more. Most of these people do not have ANY idea of perl. If we can provide this "magic" extensions it would be extremly easy for them to use our functions - they would just need to know about - our functions and their args - how to write a loop in perl - how to write if statements Our users are really just interested in the commands that we provide for them - they do not care what language is "around" those commands. Therefore accessing our subs should be as simple as possible for them. thx for the help, edwin günthner -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: magic import of extensions?
On Tue, Aug 07, 2001 at 02:38:52PM -0400, Bob Showalter wrote: > > export PERL5LIB=-MMyPackage > > That should be PERL5OPT, not PERL5LIB Right, thanks. I had even looked it up to make sure too -- Paul Johnson - [EMAIL PROTECTED] http://www.pjcj.net -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: magic import of extensions?
> -Original Message- > From: Paul Johnson [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, August 07, 2001 2:25 PM > To: Edwin Günthner > Cc: [EMAIL PROTECTED] > Subject: Re: magic import of extensions? > > > On Tue, Aug 07, 2001 at 04:30:12PM +0200, Edwin Günthner wrote: > > > .. so what I am looking for is a mechanism > > to automatically load MyPackage whenever > > Perl starts. Is that possible? > > export PERL5LIB=-MMyPackage That should be PERL5OPT, not PERL5LIB -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: magic import of extensions?
On Tue, Aug 07, 2001 at 04:30:12PM +0200, Edwin Günthner wrote: > .. so what I am looking for is a mechanism > to automatically load MyPackage whenever > Perl starts. Is that possible? export PERL5LIB=-MMyPackage Or the equivalent for your shell. But it's really not terribly sociable. Your program won't run properly unless the environment is configured, and you may even break some other programs. Is it really that bad to have your programmers use the appropriate module? -- Paul Johnson - [EMAIL PROTECTED] http://www.pjcj.net -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: magic import of extensions?
Actually, i think the 'use MyPackage' statement is what Edwin is trying avoid, hence the term "magic" ... ? It's not really a good idea to do this, but you could create a second perl command in another location (or rename it in the same location ...) which says: /old/perl -MMyPackage $* Then, whenever you call this new script, it would call the regular perl command with the added bonus of your wonderful package. Like i said, though, i wouldn't recommend this for scripting, since the use command is about as easy and you might screw other things up. It might be nice for command-line execution, though ... -Original Message- From: Tu, Hanming [mailto:[EMAIL PROTECTED]] Sent: Tuesday, August 07, 2001 10:39 AM To: 'Edwin Günthner'; [EMAIL PROTECTED] Subject: RE: magic import of extensions? Yes. Here is how 1) In your MyPackage.pm, you import the Exporter module as require Exporter; our @ISA = qw(Exporter); our @EXPORT = qw(init doThis doThat); 2) install MyPackage in a search directory, i.e., including your path in @INC 3) Then in your scr.pl or other programmer's scripts use MyPackage; Those subs will be imported into the scripts. Hanming -Original Message- From: Edwin Günthner [mailto:[EMAIL PROTECTED]] Sent: Tuesday, August 07, 2001 10:30 AM To: [EMAIL PROTECTED] Subject: magic import of extensions? Hi there, I am wondering if it is possible to create my own module and to allow programers to use it without any importing or so. For example, if MyPackage has subs like "init", "doThis", "doThat" - is it possible to have a script that looks like: scr.pl: init; doThis $someArg; doThat $anotherArg $oneMore; and just run it with > perl scr.pl .. so what I am looking for is a mechanism to automatically load MyPackage whenever Perl starts. Is that possible? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: magic import of extensions?
Yes. Here is how 1) In your MyPackage.pm, you import the Exporter module as require Exporter; our @ISA = qw(Exporter); our @EXPORT = qw(init doThis doThat); 2) install MyPackage in a search directory, i.e., including your path in @INC 3) Then in your scr.pl or other programmer's scripts use MyPackage; Those subs will be imported into the scripts. Hanming -Original Message- From: Edwin Günthner [mailto:[EMAIL PROTECTED]] Sent: Tuesday, August 07, 2001 10:30 AM To: [EMAIL PROTECTED] Subject: magic import of extensions? Hi there, I am wondering if it is possible to create my own module and to allow programers to use it without any importing or so. For example, if MyPackage has subs like "init", "doThis", "doThat" - is it possible to have a script that looks like: scr.pl: init; doThis $someArg; doThat $anotherArg $oneMore; and just run it with > perl scr.pl .. so what I am looking for is a mechanism to automatically load MyPackage whenever Perl starts. Is that possible? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]