[Koha-devel] eval "use Some::Module"

Edgar Fuß ef at math.uni-bonn.de
Sun Aug 7 12:59:29 CEST 2011


There are several places in Koha (I blindly copied one of them myself) that do
	eval "use Some::Module"
without checking $@ afterwards.

Not being a Perl expert myself, I thought that was some clever thing I didn't understand. I lately asked my personal Perl guru about it, and he replied is was plain broken.

In fact, it leads to strange errors when sending an email to a bookseller fails.

The relevant files are
acqui/addorderiso2709.pl, acqui/basketgroup.pl and tools/inventory.pl. There is one correct use in t/db_dependent/lib/KohaTest.pm

There is also this strange use of ``eval require'':

BEGIN {
    # find Koha's Perl modules
    # test carefully before changing this
    use FindBin;
    eval { require "$FindBin::Bin/kohalib.pl" };
}

all over the place. I can't make any sense out of this.


More information about the Koha-devel mailing list