in reply to I really need help making a module.

Basically, I'm making a Bioperl module. It's supposed to be in the package Bio::DB::CCDS. It has a few global variables and doesn't use a "$self" variable. Does it need to?

Probably. You've decided it goes into "Bio::DB" so it should follow the conventions/interface of the existing project

Should @EXPORT use qw?

Thats not the question to ask, the question is should you export anything (the answer is no)

Should each function named in it have a & sign before it?

If you still think its important to know, Exporter answers it

How do I create a working module and put it in the correct directory? How would I have to modify the Makefile?

You start with module-starter, then you install the module. A Guide to Installing Modules

In between you probalby want to copy/paste some ideas from one of the Bio::DB:: modules, say Bio::DB::Fasta. You'll notice it has "$self" and doesn't use Exporter.

zentara package/module tutorial

  • Comment on Re: I really need help making a module.

Replies are listed 'Best First'.
Re^2: I really need help making a module.
by adur (Initiate) on Aug 19, 2015 at 16:09 UTC
    From what I see, I seems like @EXPORT makes methods in the module available for use, but without having to reference the module, meaning this - $blah->somemethod - wouldn't be necessary. So, I'll remove this, thank you. I've never used & and it's never given me problems. I used module-starter and it didn't give me an option to put it in the correct directory. It tried to erase Bio::DB. I'll try again with your link. It installed a file to usr/local/man/man3 that isn't perl code. What is it? I was trying to install it in usr/share/perl5/Bio/DB/. Bio::DB::Fasta uses another module as a base and from what I see, it seems like $self is only used when parent methods are called. I'm not really using anything as a base except for Exporter, so I'm guessing that if I use $self, it will just be an Exporter object. What if I don't use exporter? Is $self required for it to work? I spent an hour looking for a module that doesn't use any other module and also uses arguments, but couldn't find any. Do I need to use $self to use other methods within the module?

      From what I see, I seems like @EXPORT makes methods in the module available for use, but without having to reference the module, meaning this - $blah->somemethod - wouldn't be necessary. So, I'll remove this, thank you.

      I've never used & and it's never given me problems.

      I used module-starter and it didn't give me an option to put it in the correct directory. It tried to erase Bio::DB. I'll try again with your link. It installed a file to usr/local/man/man3 that isn't perl code. What is it? I was trying to install it in usr/share/perl5/Bio/DB/.

      Bio::DB::Fasta uses another module as a base and from what I see, it seems like $self is only used when parent methods are called. I'm not really using anything as a base except for Exporter, so I'm guessing that if I use $self, it will just be an Exporter object. What if I don't use exporter?

      Is $self required for it to work? I spent an hour looking for a module that doesn't use any other module and also uses arguments, but couldn't find any. Do I need to use $self to use other methods within the module? And can I include global variables in the module? I have two hashes and a scalar at the top.