perl automatic module loading like in php

I am creating a bigger application in Perl, and I am wondering whether something like class autoloading similar to php’s can be done in Perl?

I checked catching exceptions and $SIG{__DIE__} redefining etc., but this doesn't seem to be solution because it will be stopped on first “cannot find method new via package”, and then to load every module I should again call the whole program.

One solution could be to maybe scan all files in my lib and give it to @INC at runtime, but I don’t know whether this is good solution — probably not.

Do anybody have a suggestion?


Well, you probably want to read up on the following:

None of those are quite the same as PHP's approach though.

However, it really is best practice to list all "normal" dependencies. This makes it easier to build installers / deploy to CPAN etc. There are a bunch of other modules that deal with loading plugins, where you really don't know what to load until runtime.

Is there some difficulty with figuring out your dependencies, or do you just want to avoid a bunch of "use" statements at the top of each file?

Need Your Help


sql sql-server tsql union derived-table

I want to create a new table in SQL Server with the following query. I am unable to understand why this query doesn't work.

Trying to change the color of a shape used in textView background

android android-canvas android-view android-drawable

I have a drawable oval defined in xml with a white background. I am setting this circle as the background resource of my textView inside my gridAdapter.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.