[Config] Upgrading, Need stable setup

2003-10-26 Thread Robert Friberg

Hi all,

I'm running a lot of mod_perl handlers on a
rather old Red Hat Linux, RH 6.0 on intel. Everything has
been working fine until now.

Server: Apache/1.3.6 (Unix)  (Red Hat/Linux) mod_perl/1.21
perl -V output appended at the bottom

I have created a handler for embedded perl. Pages with a
.pxp extension are parsed and wrapped in an anonymous sub,
eval'd and cached. The Apache::Request object is passed as
an arg to the sub on invocation.

Besides some occasional and seemingly random segfaults
the testsites are running fine. Surely there are a few
bugs in my code but I think its time to upgrade anyways,
maybe then the seggies will disappear.

So to the question... Are there any known issues with
Redhat 8.0 which ships with perl 5.8.0, httpd 2.0.40
and mod_perl 1.99? Or should I go for something else?


mvh,
#---
#  Robert Friberg perl,java,xml,uml,sql,delphi,
#  Systemutvecklare   c/c++,vb,php,linux,apache
#  0733-839080
#
#  Ensofus AB linuxservrar,serverhosting,
#  www.ensofus.se internetsystem, Miljö Online
#---

[EMAIL PROTECTED] rofr]$ perl -V
Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration:
  Platform:
osname=linux, osvers=2.2.1-ac1, archname=i386-linux
uname='linux porky.devel.redhat.com 2.2.1-ac1 #1 smp mon feb 1 17:44:44
est 1999 i686 unknown '
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef useperlio=undef d_sfio=undef
  Compiler:
cc='cc', optimize='-O2', gccversion=egcs-2.91.66 19990314/Linux
(egcs-1.1.2 release)
cppflags='-Dbool=char -DHAS_BOOL -I/usr/local/include'
ccflags ='-Dbool=char -DHAS_BOOL -I/usr/local/include'
stdchar='char', d_stdstdio=undef, usevfork=false
intsize=4, longsize=4, ptrsize=4, doublesize=8
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
alignbytes=4, usemymalloc=n, prototype=define
  Linker and Libraries:
ld='cc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib
libs=-lnsl -lndbm -lgdbm -ldb -ldl -lm -lc -lposix -lcrypt
libc=, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'


Characteristics of this binary (from libperl):
  Built under linux
  Compiled at Apr  6 1999 23:34:07
  @INC:
/usr/lib/perl5/5.00503/i386-linux
/usr/lib/perl5/5.00503
/usr/lib/perl5/site_perl/5.005/i386-linux
/usr/lib/perl5/site_perl/5.005



RE: Mod_perl returning perl scripts

2003-10-26 Thread Angela
Stas & Randy,

Thanks for the help. I removed file associations and renamed a test file to
have no extension. 

There are no references to perl in http.conf apart from the very end where I
have now copied from perl.conf.

And I corrected the typo ;(  The test file without an extension, along with
the others, still gets returned.

Any other ideas will be seized upon with alacrity; I'm going crazy here!

Kind regards

Angela

> Make sure that later on in httpd.conf you aren't
> redefining /perl to be handled by the default handler.
> e.g. try to move the above config to the very end of
> httpd.conf.

If you're still having problems after trying that, you might
try making sure that a Windows file association with .pl
files isn't the cause. Try renaming the script from, eg,
"testing.pl" to just "testing" to see if that helps.

-- 
best regards,
randy kobes

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.528 / Virus Database: 324 - Release Date: 16/10/2003
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.528 / Virus Database: 324 - Release Date: 16/10/2003
 




Re: [Config] Upgrading, Need stable setup

2003-10-26 Thread Ged Haywood
Hi there,

On Sun, 26 Oct 2003, Robert Friberg wrote:

> rather old Red Hat Linux, RH 6.0 on intel.
> [snip]
> Apache/1.3.6 (Unix)  (Red Hat/Linux) mod_perl/1.21

Ouch.  They do need upgrading.

> Besides some occasional and seemingly random segfaults
> the testsites are running fine.

"Segfaults" and "fine" should not be in the same sentence.
I haven't had a segfault in production for several years.

> Surely there are a few bugs in my code but I think its time to
> upgrade anyways, maybe then the seggies will disappear.

It's possible.

> Are there any known issues with Redhat 8.0 which ships with perl
> 5.8.0, httpd 2.0.40 and mod_perl 1.99?

Yes.  It's been discussed a lot here recently, check the archives.

I'd recommend Apache 1.3.28 + mod_perl 1.29.  The mod_perl 1.99 which
ships with RedHat is out of date and IMHO should not be used at all.
Version 2 of mod_perl is still experimental, if you're prepared for a
time of relative instability it might be the way to go but I wouldn't
put it on a production server.

I'm still using Perl 5.005_03 in production, but there are those who
would say I'm an old stick-in-the-mud.  You shouldn't have any problems
with 5.8.1 and even 5.8.0 should be OK if you check the archives to see
the experiences that other people have had, particularly with locale.

I've used 5.8.0 on development machines for a while with no problems
but my development boxes are a real motley bunch of homegrown systems
so that's really nothing to go by if you're stuck with RedHat.

HTH

73,
Ged.



Server Load Balancing: DNS Round-robin vs RewriteMap vs ????

2003-10-26 Thread Nigel Hamilton
Hi,

Imagine for a moment ... you're stuck on a deserted island and there's no hardware 
load balancer vendor in sight. With only coconuts, five linux servers and an Internet 
connection you need to come up with a software-based load balancing scheme.

Which would you choose and why?

1) Round Robin DNS
__

Bind enables you to map a domain name to multiple IP addresses 
(e.g., search.turbo10.com -> 130.54.23.24, 130.54.23.34). Setting the 
DNS time to live (TTL) to 60 seconds helps to prevent caching the IP address.

The disadvantages of DNS round-robin include:
* client DNS caching(?) may reduce the random distribution of traffic in the cluster 
(is it that bad?)
* it does not take account of load on any individual server
* a server may fail and users may experience a dropped connection

The advantages of DNS round-robin include:
* simple to implement
* no load is born by the server to distribute the load (e.g., no need to process 
Apache RewriteMap)
* no need for a 'point' machine to accept all incoming hits

... or ...

2) Apache Rewrite Map
_
This alternative can distribute the load randomly and also selectively based on the 
URL (e.g., http://turbo10.com/?u=1212 --> 130.54.23.24, http://turbo10.com/?u=1211 --> 
130.54.23.25).

The disadvantages include:
* a machine must act as a proxy for all requests.
* there is an extra network socket connection required between proxy and server.
* all HTTP headers need to be inspected and rewritten.
* proxyReversePass is needed to send cookies back to the client.
* more complex to implement than DNS round-robin

The advantages include:
* the RewriteMap file can be updated based on load averages in the cluster. Allowing 
heavily loaded machines to receive less traffic and lightly load machines to receive 
more.
* a cron job could update the map file based on load averages.
* if a server goes down it can be removed from the RewriteMap (i.e., and the cluster) 
immediately making the loss of a server invisible to the end user.

... or ...

3) Other Software-Based Load Balancing Solution
___



Regards,


NIge

Nigel Hamilton


Re: Server Load Balancing: DNS Round-robin vs RewriteMap vs ????

2003-10-26 Thread Ged Haywood
Hi there,

On Sun, 26 Oct 2003, Nigel Hamilton wrote:

> you're stuck on a deserted island and there's no hardware load balancer vendor in 
> sight

Bliss.

> With only coconuts, five linux servers and an Internet connection

Throw the servers in the sea.  Enjoy the coconuts.

> you need to come up with a software-based load balancing scheme.

The topic has been raised recently on the List, and as Stas pointed
out, this is not the most appropriate forum.

http://www.gossamer-threads.com/archive/mod_perl_C1/modperl_F7/OT:_high_availability/load_balancing_solutions_P84515/

73,
Ged.




[OT] Re: Server Load Balancing: DNS Round-robin vs RewriteMap vs ????

2003-10-26 Thread John Fricker
Nigel,

In building a testlab at work, I was faced with the same dilemma. 
Initially I used RRDNS to balance load between two web servers and found 
that IE cached IP addresses. This made for disappointing results.

I did find two interesting software products though. Balance 
 and Pound 
. I tried Balance first since it 
was written in C, had a small footprint, and had very few features (it's 
only a tcp proxy with round robin balancing and fail over). For the last 
month, I've used it successfully with intense loads and I've been 
perfectly happy with it. On a 1GHz Athlon (no doubt overkill), I can 
sustain hundreds of connections and many megabits of throughput without 
appreciable latency or cpu load. I use it to proxy http and https 
connections flawlessly. To top it off, it compiled and was usable within 
a few minutes. Reading the documentation took less time than the compile 
and configuring it was even quicker at that. As a C programmer, I 
appreciated the source code and was satisfied with the competence of the 
authors (the munich.net folks).

I'm planning on putting Pound through the paces also but since Balance 
works so well for exactly what I need I'm not terribly motivated. Pound 
has many more features and seems comparable to the Arrowpoint systems we 
use for load balancing and fail over in our production environment. So 
maybe someday I'll have a Pound v. Arrowpoint showdown.

I'd love to hear from others with similar experience.

--John

Nigel Hamilton wrote:

Hi,

Imagine for a moment ... you're stuck on a deserted island and there's no hardware load balancer vendor in sight. With only coconuts, five linux servers and an Internet connection you need to come up with a software-based load balancing scheme.

Which would you choose and why?

1) Round Robin DNS
__
Bind enables you to map a domain name to multiple IP addresses 
(e.g., search.turbo10.com -> 130.54.23.24, 130.54.23.34). Setting the 
DNS time to live (TTL) to 60 seconds helps to prevent caching the IP address.

The disadvantages of DNS round-robin include:
* client DNS caching(?) may reduce the random distribution of traffic in the cluster 
(is it that bad?)
* it does not take account of load on any individual server
* a server may fail and users may experience a dropped connection
The advantages of DNS round-robin include:
* simple to implement
* no load is born by the server to distribute the load (e.g., no need to process 
Apache RewriteMap)
* no need for a 'point' machine to accept all incoming hits
... or ...

2) Apache Rewrite Map
_
This alternative can distribute the load randomly and also selectively based on the URL 
(e.g., http://turbo10.com/?u=1212 --> 130.54.23.24, http://turbo10.com/?u=1211 --> 
130.54.23.25).
The disadvantages include:
* a machine must act as a proxy for all requests.
* there is an extra network socket connection required between proxy and server.
* all HTTP headers need to be inspected and rewritten.
* proxyReversePass is needed to send cookies back to the client.
* more complex to implement than DNS round-robin
The advantages include:
* the RewriteMap file can be updated based on load averages in the cluster. Allowing 
heavily loaded machines to receive less traffic and lightly load machines to receive 
more.
* a cron job could update the map file based on load averages.
* if a server goes down it can be removed from the RewriteMap (i.e., and the cluster) 
immediately making the loss of a server invisible to the end user.
... or ...

3) Other Software-Based Load Balancing Solution
___

Regards,

NIge

Nigel Hamilton
 





AW: Mod_perl returning perl scripts

2003-10-26 Thread B. Fongo
I got a similar problem sometime ago; for some unknown reason, it worked
alright after I restarted Apache afresh. Perhaps it may help you too.
Let me know how you finally solve the problem.

Good luck

Babs

> -Ursprüngliche Nachricht-
> Von: Angela [mailto:[EMAIL PROTECTED] 
> Gesendet: Sonntag, 26. Oktober 2003 00:01
> An: [EMAIL PROTECTED]
> Betreff: Mod_perl returning perl scripts
> 
> 
> Hi,
> 
> I'm using Apache with Mod_Perl configured on a win XP box.
> Perl scripts prepare WML cards to return to a CGI request. 
> This works fine
> if requests come from mobile phones.resh
> However, if I type the url into my HTML web browser pointing to a perl
> script that expects WML to call it, the script, (that is the perl code
> itself, not the output from the script), gets sent back to 
> the requestor for
> saving!! 
> 
> I really don't want to lose my code this way!
> I have this in my perl.conf file:-
> 
> Alias /perl/ "C:/Apache2/perl/
> 
>   SetHandler perl-script
>   PerlResponseHandler ModPerl::Registry
>   Options +ExecCGI
>   PerlOptions +ParseHeaders
> 
> 
> What can I do to stop files with a *.pl mask being returned to a user?
> 
> All help appreciated!
> 
> Angela
> 
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.528 / Virus Database: 324 - Release Date: 16/10/2003
>  
> 
> 
> 




RE: Mod_perl returning perl scripts

2003-10-26 Thread Randy Kobes
On Sun, 26 Oct 2003, Angela wrote:

> Stas & Randy,
>
> Thanks for the help. I removed file associations and renamed a test file to
> have no extension.
>
> There are no references to perl in http.conf apart from the very end where I
> have now copied from perl.conf.
>
> And I corrected the typo ;(  The test file without an extension, along with
> the others, still gets returned.
>
> Any other ideas will be seized upon with alacrity; I'm going crazy here!

In your script, are you sending a header such as
   print "Content-type: text/html\n\n";
or some such, such that the browser knows it should display
the contents?

-- 
best regards,
randy


[OT] Re: Server Load Balancing: DNS Round-robin vs RewriteMap vs ????

2003-10-26 Thread Nigel Hamilton
HI John,

Thanks for the options and sharing your experience.

I'm only starting to realise what a can of worms this is ... and
it's certainly a topic where hearing the experience of others is
invaluable. So I hope Ged and Stas don't get too peeved if we indulge in
some [OT] load balancing banter. ;-)

I was worried about DNS caching and your IE experience does not
bode well for the round robin option. Did you set the TTL to less than 60
seconds?

Here are the suggested options so far:

* round robin dns
* RewriteMap
* djbdns/tinydns allows dynamic IP address changes for round-robin
load balancing and handling a failed server
* setting up a linux server as a load balancer - 
http://www.linuxvirtualserver.org
* mod_backhand and wackamole
* Balance (http://balance.sf.net)
* Pound (http://www.apsis.ch/pound/index.html)
* custom application level redirects

I suppose there are two parts to the load balancing problem: 
directing the hits (i.e., requests), and clustering the application.

'Directing the hits' sounds conceptually straight-forward - a bit
like watering the garden - so you would think there would be a clear 'best 
way to do it' - so I'm sure I'm not alone in wanting to hear other's 
experiences?


Nige

Nigel Hamilton
email:  [EMAIL PROTECTED]
tel:+44 (0) 207 987 5460
fax:+44 (0) 207 987 5468

http://turbo10.com  Search Deeper. Browse Faster.



Mod_perl returning perl scripts

2003-10-26 Thread B. Fongo
Besides that, you need to explicitly tell mod_perl to always send a
header to the browser, by adding: "PerlSendHeader on" to the http.conf
as follows:

Alias /perl/ "C:/Apache2/perl/

SetHandler perl-script
PerlHandler Apache::Registry
PerlSendHeader on
Options ExecCGI
 

This should help


Babs


-Ursprüngliche Nachricht-
Von: B. Fongo [mailto:[EMAIL PROTECTED] 
Gesendet: Sonntag, 26. Oktober 2003 16:12
An: 'Randy Kobes'
Betreff: AW: Mod_perl returning perl scripts


Besides that, you need to explicitly tell mod_perl to always send a
header to the browser, by adding: "PerlSendHeader on" to the http.conf
as follows:

Alias /perl/ "C:/Apache2/perl/

SetHandler perl-script
PerlHandler Apache::Registry
PerlSendHeader on
Options ExecCGI
 

This should help


Babs

> -Ursprüngliche Nachricht-
> Von: Randy Kobes [mailto:[EMAIL PROTECTED] 
> Gesendet: Sonntag, 26. Oktober 2003 15:45
> An: Angela
> Cc: [EMAIL PROTECTED]
> Betreff: RE: Mod_perl returning perl scripts
> 
> 
> On Sun, 26 Oct 2003, Angela wrote:
> 
> > Stas & Randy,
> >
> > Thanks for the help. I removed file associations and 
> renamed a test file to
> > have no extension.
> >
> > There are no references to perl in http.conf apart from the 
> very end where I
> > have now copied from perl.conf.
> >
> > And I corrected the typo ;(  The test file without an 
> extension, along with
> > the others, still gets returned.
> >
> > Any other ideas will be seized upon with alacrity; I'm 
> going crazy here!
> 
> In your script, are you sending a header such as
>print "Content-type: text/html\n\n";
> or some such, such that the browser knows it should display
> the contents?
> 
> -- 
> best regards,
> randy
> 




Re: Mod_perl returning perl scripts

2003-10-26 Thread Randy Kobes
On Sun, 26 Oct 2003, B. Fongo wrote:

> Besides that, you need to explicitly tell mod_perl to always send a
> header to the browser, by adding: "PerlSendHeader on" to the http.conf
> as follows:
>
> Alias /perl/ "C:/Apache2/perl/
> 
> SetHandler perl-script
> PerlHandler Apache::Registry
> PerlSendHeader on
> Options ExecCGI
>  

That's true ... However, in mod_perl 2 (which Angela is
using),
   PerlSendHeader On
has been replaced by
   PerlOptions +ParseHeaders
which was present in the config file being used.

-- 
best regards,
randy


Re: [OT] Re: Server Load Balancing: DNS Round-robin vs RewriteMap vs ????

2003-10-26 Thread Les Mikesell
From: "Nigel Hamilton" <[EMAIL PROTECTED]>

> I was worried about DNS caching and your IE experience does not
> bode well for the round robin option. Did you set the TTL to less than 60
> seconds?

Individual IE clients will cache the DNS response indefinately regardless
of the TTL. However statistically each has an equal chance of using
each address.  A test with one or a few clients won't show it especially
if they use the same dns server and start at the same time, but it does
work with large numbers of clients.  Also if DNS returns multiple
addresses and the first choice does not respond, IE will move on to
the next in the list - other browsers may not do this as well.

---
  Les Mikesell
[EMAIL PROTECTED]




RE: Mod_perl returning perl scripts

2003-10-26 Thread Angela
Babs wrote:-

>I got a similar problem sometime ago; for some unknown reason, it worked
>alright after I restarted Apache afresh. Perhaps it may help you too. Let
>me know how you finally solve the problem.

>Besides that, you need to explicitly tell mod_perl to always send a header
>to the browser, by adding: "PerlSendHeader on" to the http.conf as follows:

Thanks Babs. I tried that! I think you may have altered something in the
conf file or something. And, despite Randy's assertion otherwise I added
'PerlSendHeader on' just now to no effect.

Randy wrote:-

>In your script, are you sending a header such as
>   print "Content-type: text/html\n\n";
>or some such, such that the browser knows it should display
>the contents?

Thanks Randy. I think(?) the issue is that the browser doesn’t know the
contents because the header returned is a wap header i.e. 'Content-Type:
text/vnd.wap.wml'. The browser then assumes it's a file download and
promptly does just that! Although having said that, I have a browser plug-in
that should fire up if the response is wml. It doesn't.

But, while writing this I thought 'I wonder what Netscape does'? You guys
are going to love this! Can you believe that Netscape does as it should and
fires up my plug-in? Well it does. It seems this is an IE Explorer-Mod_perl
specific problem! 

I still need to stop files being downloaded by IE users though!

Kind regards to all,

Angela


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.528 / Virus Database: 324 - Release Date: 16/10/2003
 




Re mod_perl returning perl scripts

2003-10-26 Thread Angela
Aaah! I feel incredibly foolish! And I apologize for wasting the time of you
good people here.

I watched Internet explorer download the file and saw that the filename
corresponded with my script name. When I tried to open it from the download
option, it opened a command window that promptly closed. I assumed it was my
original perl script trying to execute and falling over. I NEVER actually
opened the file to look what it was! I assumed that because it was named
*.pl it was a perl file. I had also seen an entry in my Apache logs where it
looked as if someone had got a .pl file sent to them. Reminds me of a boss I
once had; he said "never ass-u-me anything; if you do it might make and
'ass' out of 'u' and 'me'". Well, it's certainly caught me this time.

I had just created a test file, that returns WML, to publish at
http://www.activitae.com/perl/modPerlTest.pl?param=Hello%20World  and saw it
download. I ran it; and, as before, the command window came and went. I
thought double check Angela before you make a fool of yourself... and bingo
the file is wml text! 

Sorry everyone; I'll crawl away and die now.

Kind regards

PS For those vary of links, modPerlTest.pl referred to above contains

#!/usr/bin/perl -w
use strict;
use CGI::WML;

my $query = CGI::WML->new();
my $param=$query->param('param');
my $text="You sent $param";
$text.="How now brown cow eating the cool green grass.";
$text.="Peter Piper picked a peck of pickled pepper.";
  my $content=$query->p($text);
print
 #$query->header(-cache_control=>'No-cache; forua=true'),
 $query->header(),
 $query->start_wml(),
 $query->template(-content=>$query->prev()),
 $query->card(-id=>"test card",
  -title=>"Test WAP Card",
  -content=>$content),
 $query->end_wml();


Angela

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.528 / Virus Database: 324 - Release Date: 16/10/2003
 




Re: Server Load Balancing: DNS Round-robin vs RewriteMap vs ????

2003-10-26 Thread Dzuy Nguyen
3) Linux Virtual Server (LVS) http://www.linuxvirtualserver.org/

Nigel Hamilton wrote:

Hi,

Imagine for a moment ... you're stuck on a deserted island and there's no hardware load balancer vendor in sight. With only coconuts, five linux servers and an Internet connection you need to come up with a software-based load balancing scheme.

Which would you choose and why?

1) Round Robin DNS
__
Bind enables you to map a domain name to multiple IP addresses 
(e.g., search.turbo10.com -> 130.54.23.24, 130.54.23.34). Setting the 
DNS time to live (TTL) to 60 seconds helps to prevent caching the IP address.

The disadvantages of DNS round-robin include:
* client DNS caching(?) may reduce the random distribution of traffic in the cluster 
(is it that bad?)
* it does not take account of load on any individual server
* a server may fail and users may experience a dropped connection
The advantages of DNS round-robin include:
* simple to implement
* no load is born by the server to distribute the load (e.g., no need to process 
Apache RewriteMap)
* no need for a 'point' machine to accept all incoming hits
... or ...

2) Apache Rewrite Map
_
This alternative can distribute the load randomly and also selectively based on the URL 
(e.g., http://turbo10.com/?u=1212 --> 130.54.23.24, http://turbo10.com/?u=1211 --> 
130.54.23.25).
The disadvantages include:
* a machine must act as a proxy for all requests.
* there is an extra network socket connection required between proxy and server.
* all HTTP headers need to be inspected and rewritten.
* proxyReversePass is needed to send cookies back to the client.
* more complex to implement than DNS round-robin
The advantages include:
* the RewriteMap file can be updated based on load averages in the cluster. Allowing 
heavily loaded machines to receive less traffic and lightly load machines to receive 
more.
* a cron job could update the map file based on load averages.
* if a server goes down it can be removed from the RewriteMap (i.e., and the cluster) 
immediately making the loss of a server invisible to the end user.
... or ...

3) Other Software-Based Load Balancing Solution
___

Regards,

NIge

Nigel Hamilton
 




using modules in if...else

2003-10-26 Thread Andrey A. Kudrin
Hello ,

Hello!
I have a problem and can't get it how to solve it.
When I'm using 'use Module;' in if..elsif statement I've got situation when
all modules is included.
For example (from code snippets bellow) if I call edit_info it makes
My::Info and My::Setting to be used and I can't use global variables in
edit_info, only in last elsif statement (change_settings).
Use of global variables is critical for this code.

I tried in this way
eval ("use My::Info; &edit_info();");

It works, but in some strange manner, I need to reload page few times to
make it works, before that I see module export errors in log.


Can anyone suggest me someting?
I'll really appreciate any help.

main.cgi
===
#!/usr/bin/perl -w
package main;

use strict;
use CGI::Apache qw/:standard/;
use CGI::Cookie;
use Apache::DBI;

use lib qw (.);
use Rc::Config();

use vars qw(%cfg);
*cfg = \%Rc::Config::cfg;

use vars qw($dbh $q);

$q = new CGI;

if ($q->param('action') eq 'login')
  {
&login();
  }
elsif ($q->param('action') eq 'edit_info')
  {
use My::Info;
   &edit_info();
  }
elsif ($q->param('action') eq 'change_settings')
  {
use My::Settings;
   &change_settings();
  }


My::Info.pm

package My::Info;
use strict;

use lib qw(../);

use Rc::Config();

use vars qw(%cfg);
*cfg = \%Rc::Config::cfg;

use Exporter;

use vars qw(@ISA @EXPORT @EXPORT_OK);


@ISA = qw(Exporter);
@EXPORT  = qw(edit_info $dbh $q);
@EXPORT_OK   = qw();

use vars qw($dbh $q);

sub edit_info
  {
 ..
  }
1;

My::Settings.pm

package My::Settings;
use strict;

use lib qw(../);

use Rc::Config();

use vars qw(%cfg);
*cfg = \%Rc::Config::cfg;

use Exporter;

use vars qw(@ISA @EXPORT @EXPORT_OK);


@ISA = qw(Exporter);
@EXPORT  = qw(change_settings $dbh $q);
@EXPORT_OK   = qw();

use vars qw($dbh $q);

sub change_settings
  {
 ..
   }
1;
  

---
Sincerely yours,
Andrey A. Kudrin,
mailto:[EMAIL PROTECTED]