Re: extending modules

2003-10-01 Thread Kevin Pfeiffer
Hi,

In article [EMAIL PROTECTED], Jeff
'Japhy' Pinyan wrote:

 Typically, you create a sub-module.
 
   package Unix::AliasFile::Extended;
   use base 'Unix::AliasFile';
 
   sub changed_method { ... }
   sub new_method { ... }
 
   1;
 
 Then you just use Unix::AliasFile::Extended in any program where you would
 have used Unix::AliasFile.

This worked better and was easier (once I remembered to update 'ISA@') than
I expected! I ended up adding two or three new methods and modifying four.

I'm going to extend another method, and now that I've got these sorted out
into two separate modules, it's quite easy.

-K



-- 
Kevin Pfeiffer
International University Bremen
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: extending modules

2003-10-01 Thread Kevin Pfeiffer
In article [EMAIL PROTECTED], Kevin Pfeiffer wrote:
[...]
 This worked better and was easier (once I remembered to update 'ISA@')
 than I expected! I ended up adding two or three new methods and modifying
 four.

Errr, ah @ISA... (that was the Hebrew notation maybe).



-- 
Kevin Pfeiffer
International University Bremen
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: extending modules

2003-10-01 Thread Jeff 'japhy' Pinyan
On Oct 1, Kevin Pfeiffer said:

   package Unix::AliasFile::Extended;
   use base 'Unix::AliasFile';

   sub changed_method { ... }
   sub new_method { ... }

This worked better and was easier (once I remembered to update 'ISA@') than
I expected! I ended up adding two or three new methods and modifying four.

I thought 'use base ...' does that for you.

-- 
Jeff japhy Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
stu what does y/// stand for?  tenderpuss why, yansliterate of course.
[  I'm looking for programming work.  If you like my work, let me know.  ]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: extending modules

2003-09-30 Thread Kevin Pfeiffer
In article [EMAIL PROTECTED], Rob Dixon wrote:

 Kevin wrote:


 I've updated the docs and wrote ...based on version
 xxx of Unix::AliasFile by Steve Snodgrass..., etc.
 
 Mister Snodgrass is a character in The Pickwick Papers
 invented by Charles Dickens. He is no Foo or Bar.
 
 Proud of the soil on which I stand :)
 
 Rob Dixon
 Leicester
 ENGLAND

???

AFAIK (well at least I assumed) that Steve Snodgrass is also a real person
(or do people write modules using nom de plums) and the author of the
module which I corrupt.. er, extended.

In other words, you've lost me. :-)

-K


'Snodgrass,' he said, stopping suddenly, 'do not let me be balked in this
matter--do not give information to the local authorities--do not obtain the
assistance of several peace officers, to take either me or Doctor Slammer,
of the 97th Regiment, at present quartered in Chatham Barracks, into
custody, and thus prevent this duel!--I say, do not.' 

Mr. Snodgrass seized his friend's hand warmly, as he enthusiastically
replied, 'Not for worlds!' 

-- 
Kevin Pfeiffer
International University Bremen
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: extending modules

2003-09-30 Thread Kevin Pfeiffer
In article [EMAIL PROTECTED], Jeff
'Japhy' Pinyan wrote:

 On Sep 29, Kevin Pfeiffer said:
[...]
My working copy is now called AliasFilePlus.

What do I do with this if I try to share it? The changes to the module
seemed too great (and too complex) for me to place them in the main
program and too little for a submodule. I've updated the docs and wrote
...based on version xxx of Unix::AliasFile by Steve Snodgrass..., etc.
 
 Typically, you create a sub-module.
 
   package Unix::AliasFile::Extended;
   use base 'Unix::AliasFile';
 
   sub changed_method { ... }
   sub new_method { ... }
 
   1;
 
 Then you just use Unix::AliasFile::Extended in any program where you would
 have used Unix::AliasFile.

Hmmm... I'll take a look at doing this (maybe my change.


(After I clean up a couple things I'll post a link to it in case anyone is
interested in sharing critique).
 
 I'd be happy to do that for you.

Thanks, will give a holler. I'm in the refactoring mode right now (the
jargon one picks up). One thing that has influenced me is a comment from
the author of the Objects First book, who said that on the day
assignments are due he likes to throw a curve at his students (okay, now
the game has multiple players) and give them an hour to incorporate their
changes. :-0

So I go through my code thinking, what if the program name changes, what if
someone wants to add a new language for the command prompts, etc. -- helps
a lot (it seems to me) and makes my subroutines more 'focussed'.
 
-K

-- 
Kevin Pfeiffer
International University Bremen


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: extending modules

2003-09-29 Thread Rob Dixon
Kevin wrote:


 I've updated the docs and wrote ...based on version
 xxx of Unix::AliasFile by Steve Snodgrass..., etc.

Mister Snodgrass is a character in The Pickwick Papers
invented by Charles Dickens. He is no Foo or Bar.

Proud of the soil on which I stand :)

Rob Dixon
Leicester
ENGLAND



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: extending modules

2003-09-29 Thread Jeff 'japhy' Pinyan
On Sep 29, Kevin Pfeiffer said:

I'm working on a nice frontend to the Unix::AliaseFile module for managing
'aliases'. In the process I've extended a couple methods in the module and
added a new one.

There is a show_user method that returns all aliases of which a user is a
member; there's also a Toggle on/off that uses commenting to deactive but
not delete an alias (our sysadmin likes to do this); rename_user can also
now rename aliases, too, (since an alias might be a member of another alias
list).

My working copy is now called AliasFilePlus.

What do I do with this if I try to share it? The changes to the module
seemed too great (and too complex) for me to place them in the main program
and too little for a submodule. I've updated the docs and wrote ...based
on version xxx of Unix::AliasFile by Steve Snodgrass..., etc.

Typically, you create a sub-module.

  package Unix::AliasFile::Extended;
  use base 'Unix::AliasFile';

  sub changed_method { ... }
  sub new_method { ... }

  1;

Then you just use Unix::AliasFile::Extended in any program where you would
have used Unix::AliasFile.

If you want to contact the author and ask him if he'd like to release a
new version of the Unix::AliasFile module with your code in it, go right
ahead.  Should that fail, the sub-class approach above is fine.

(After I clean up a couple things I'll post a link to it in case anyone is
interested in sharing critique).

I'd be happy to do that for you.

-- 
Jeff japhy Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
stu what does y/// stand for?  tenderpuss why, yansliterate of course.
[  I'm looking for programming work.  If you like my work, let me know.  ]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]