Subdirectories and use lib

Subdirectories and use lib

am 21.07.2011 00:38:06 von sono-io

I'd like to organize a project's files into subdirectories for =
better housekeeping. I thought that use lib "."; would also include any =
subdirectories, but sadly it doesn't. Is there a way to include all =
subdirs without having a list a mile long like this?
use lib "/Applications/MAMP/cgi-bin/cart/sql/lib/Module/";
use lib "/Applications/MAMP/cgi-bin/cart/sql/lib/Params/";
use lib "/Applications/MAMP/cgi-bin/cart/sql/Business/CreditFraud/";
etc...

Or am I going about it the wrong way?

Thanks,
Marc=

--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/

Re: Subdirectories and use lib

am 21.07.2011 14:56:43 von Shlomi Fish

Hi Marc,

On Wed, 20 Jul 2011 15:38:06 -0700
Marc wrote:

> I'd like to organize a project's files into subdirectories for better
> housekeeping. I thought that use lib "."; would also include any
> subdirectories, but sadly it doesn't. Is there a way to include all subd=
irs
> without having a list a mile long like this?=20
> use lib "/Applications/MAMP/cgi-bin/cart/sql/lib/Module/";=20
> use lib "/Applications/MAMP/cgi-bin/cart/sql/lib/Params/";=20
> use lib "/Applications/MAMP/cgi-bin/cart/sql/Business/CreditFraud/"; etc.=
...
>=20
> Or am I going about it the wrong way?
>=20

I think you are.

You can load modules from lib using "use Module::SubModule;" or "use
Params::Validate" - no need to load all subdirectories. Just use "::" for
loading stuff in sub-directories. For more information see:

http://perl-begin.org/topics/modules-and-packages/

Regards,

Shlomi Fish

> Thanks,
> Marc



--=20
------------------------------------------------------------ -----
Shlomi Fish http://www.shlomifish.org/
The Case for File Swapping - http://shlom.in/file-swap

I find itâ€=99s usually safe to assume that whatever shlomif=E2=
€™s doing, there
isnâ€=99t a good reason for it.

Please reply to list if it's a mailing list post - http://shlom.in/reply .

--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/

Re: Subdirectories and use lib

am 21.07.2011 17:40:44 von sono-io

On Jul 21, 2011, at 5:56 AM, Shlomi Fish wrote:

> You can load modules from lib using "use Module::SubModule;" or "use =
Params::Validate" - no need to load all subdirectories. Just use "::" =
for loading stuff in sub-directories.

Thanks, Shlomi. That's all it took to get it to sink in.

> http://perl-begin.org/topics/modules-and-packages/

I went back and re-read chapter 10 of "Beginning Perl" and it =
_finally_ makes sense to me now.

Thanks again,
Marc


BTW, I would like to thank everyone who responds to questions like these =
on this list. I've read "Beginning Perl" twice, "Learning Perl", and a =
couple of others, but sometimes things just don't sink in until someone =
goes out of their way to give a simple explanation, and then it's like a =
switch has been thrown.

So, sincerely, thanks to everyone here who's willing to help. I'm sure =
it can be frustrating at times to put up with these questions, but it =
really does make a difference.=

--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/

Re: Subdirectories and use lib

am 21.07.2011 19:18:03 von Shlomi Fish

Hi Marc,

On Thu, 21 Jul 2011 08:40:44 -0700
Marc wrote:

> On Jul 21, 2011, at 5:56 AM, Shlomi Fish wrote:
>=20
> > You can load modules from lib using "use Module::SubModule;" or "use
> > Params::Validate" - no need to load all subdirectories. Just use "::" =
for
> > loading stuff in sub-directories.
>=20
> Thanks, Shlomi. That's all it took to get it to sink in.

You're welcome.

>=20
> > http://perl-begin.org/topics/modules-and-packages/
>=20
> I went back and re-read chapter 10 of "Beginning Perl" and it
> _finally_ makes sense to me now.

That's good.

>=20
> Thanks again,
> Marc
>=20
>=20
> BTW, I would like to thank everyone who responds to questions like these =
on
> this list. I've read "Beginning Perl" twice, "Learning Perl", and a coup=
le
> of others, but sometimes things just don't sink in until someone goes out=
of
> their way to give a simple explanation, and then it's like a switch has b=
een
> thrown.
>=20
> So, sincerely, thanks to everyone here who's willing to help. I'm sure it
> can be frustrating at times to put up with these questions, but it really
> does make a difference.

Thanks for the comment - it made me happier. I'm glad to see our help is be=
ing
appreciated.

BTW, if you want to get very quick answers to simple (and
not-so-simple) questions, feel free to come to #perl on the Freenode Intern=
et
Relay Chat (IRC) network:

http://perl-begin.org/irc/

Regards,

Shlomi Fish

--=20
------------------------------------------------------------ -----
Shlomi Fish http://www.shlomifish.org/
Apple Inc. is Evil - http://www.shlomifish.org/open-source/anti/apple/

To have bugs is human; to fix them â€=94 divine.

Please reply to list if it's a mailing list post - http://shlom.in/reply .

--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/