Hi, Brandon! My name is Dave, and I'm... a perloholic.
I'm not entirely clear on your server configuration and how the application is invoked. You mention that you're using a module called app.pm, but you didn't say whether it's run directly by the server (probably using mod_perl or similar) or if there's some other (probably CGI/fCGI) script which you control that loads app.pm, then accesses its functions.
So I'm going to make these assumptions, which would fit a fairly common configuration:
Assumption 1) You have a CGI (or similar) script which I'll call index.cgi.
Assumption 2) There are two separate copies of index.cgi, one in /home/www/AppCode and one in /home/staging/AppCode.
Assumption 3) Each index.cgi has its corresponding app.pm in the same directory as the index.cgi itself.
If these assumptions are accurate, you have two options for how to get this working the way you want, both of which are fairly simple:
Option 1) Similar to what's described in the Perl Module Mechanics document you linked, you can set the environment variable
in the web server config for each of the virtual hosts. It might be a little tricky to work out how to make this setting in your environment, but it doesn't require changing the index.cgi source code at all.
Option 2) Edit index.cgi and, somewhere near the top (not the very first line, but before app.pm is referenced in any way), add the line
use lib '.';
This is dead simple and independent of your web server configuration, but it requires a (minor) change to index.cgi at a time when you might want to avoid making any changes.
Both options work by telling perl to look in the same directory as the script (index.cgi) itself first, before going off to /usr/lib/perl5 and looking there. If index.cgi and app.pm are in different directories, replacing the "." with the appropriate relative path (../MyApp/lib or whatever) should handle that. Just don't use an absolute path (one that starts with "/") or else both versions will look in the same place, which is what we're trying to avoid here.
If you have any problems, or if any of my assumptions are wrong, just let me know and we can try to work the details out.