Hmm....
 
I think most of it is working -- however ....
 
Is there a way to have sub routines that are in my main program available to be called from code in the module?
 
This is where I was thinking that blessing would make the code in the module act as if it were a part of my main program... but i am not to sure how to implement this.
 
The code I want to pull out of my main and put into a module establishes a connection to another program -- I then send command from that app back to my perl program by calling subroutine names. However if the code for establishing the connection is now not apart of the main -- as in my module now -- the subroutine is not available to me now relative to the module? Or is it?
 
Thanks for any  help or direction here...
 
John

Martin Leese <[EMAIL PROTECTED]> wrote:
"John V. Pataki" <[EMAIL PROTECTED]>

> I am going to attempt to take some large chunks (subrtouines) of my code
> I keep duplicating and turn them into a module or two...
>
> 1) Any tips?

See below.

> 2) I tried running pl2pm and it seems it only found 3 of the many
> subroutines to add to the EXPORT array -- and then I see many 'sub'
> entries to the EXPORT_OK array. Has anyone seen this? What is either
> wrong with my .pl file or with pl2pm that this is doing this?

pl2pm - Rough tool to translate Perl4 .pl files to Perl5 .pm modules.

This doesn't look like what you want to do.

> 3) When will I know if I will need to use things like 'bless' with the
> creation of my module - I am not really famiiliar with this wonder how
> much time it will take to come up to speed w! ith this before I can just
> transfer over working functionality into working module.

No idea.


TIPS:

1.1) Read Chapter 11 of the "Camel" book.

1.2) Here is a short module to get you started:

#!/usr/bin/perl
#
package ISOutilities;
require Exporter;
#
our @ISA = qw(Exporter);
our @EXPORT = qw(fixDate);
our @EXPORT_OK = qw(codeTopologyLevel moreSubs);
our %EXPORT_TAGS = (codeStuff => [qw(codeTopologyLevel yetMoreSubs)]);
our $VERSION = 1.00; # unused
#
# Public domain modules
use Spreadsheet::ParseExcel;
#
sub fixDate
{
my ($date) = @_;
#...
return $date;
}

sub codeTopologyLevel
#...

1; # modules always end in '1'

Here is how to use it:

use ISOUtilities; # allow access to @EXPORT, ie fixDate
use ISOUtilitiesuse qw(codeTopologyLevel); # allow access to codeTopologyLevel
use ISOutilities qw(:codeStuff); # allow access to codeStuff


Regards,
Martin

_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


John V. Pataki
Logged in to my Yahoo Mail account on the web.
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to