F
Franklin Lee
Hi All,
Now I have some pl and pm files in /opt/myapp/bin.
But some pm (the same name with previous) may exit dir /opt/myapp/newbin.
If this dir exist, I want to use the pm in it.
So I write below codes:
/opt/myapp/bin/app.pl
**********************************************
BEGIN {
if(-r /opt/myapp/newbin) {
unshift(@INC, "/opt/myapp/newbin");
} else {
unshift(@INC, "/opt/myapp/bin");
}
}
#my code begin....
require "mymodule.pm";
use strict;
.....
***************************************************
It seems work. The program load the PM in /opt/myapp/newbin/mymodule.pm.
But I don't see this kind of example some where.
So I want to know if it is a good one orthere exist better solution?
Thank you!
Franklin
Now I have some pl and pm files in /opt/myapp/bin.
But some pm (the same name with previous) may exit dir /opt/myapp/newbin.
If this dir exist, I want to use the pm in it.
So I write below codes:
/opt/myapp/bin/app.pl
**********************************************
BEGIN {
if(-r /opt/myapp/newbin) {
unshift(@INC, "/opt/myapp/newbin");
} else {
unshift(@INC, "/opt/myapp/bin");
}
}
#my code begin....
require "mymodule.pm";
use strict;
.....
***************************************************
It seems work. The program load the PM in /opt/myapp/newbin/mymodule.pm.
But I don't see this kind of example some where.
So I want to know if it is a good one orthere exist better solution?
Thank you!
Franklin