How to check the return status?

2001-12-17 Thread Alexei V. Alexandrov

Hello everyone,

  I have a question that i can not resolve. The module dynamicaly
  loads other modules to handle specific urls like this:

  [snip]
my $handle = 'My::Module';

eval {
(my $h = $handle) =~ s!::!/!ig;
require $h . .pm;
};

if (!$@) {
   if ($handle-can( handler )) {
$r-handler( perl-script );
$r-push_handlers( PerlHandler = \{${handle}::handler} );
??
   }
}
  [snip]

  In this way the control is passed to another module. The module can
  return OK, SERVER_ERROR, etc... How can i check the return status so
  i can handle it (cache the output for example if the module returned
  OK)

  Thanks for any advice.
  
--- 
 Best regards,
 Alexei V. Alexandrov




Dynamic configuration.

2000-11-17 Thread Alexei V. Alexandrov

Hello everyone,

  I`m writing a module to process templates on which our web server is
  built.  This  module  is  invoked  during PerlInitHandler. We have a
  global  configuration  for  our  site  which  is  a  plain text file
  containing a hash like this:
  {
 bgcolor = '',
 text = '',
  }
  etc...
  
  This  configuration  can  be  changed  using a simple web page or by
  uploading  it  directly  using  FTP.  Since my module processes each
  request  it  does  $cfg  =  do '/path/to/config'. Doing this on each
  request  can  be  time consuming -- i want to load the configuration
  again  after the modification time of the configuration has changed.
  After  reading the guide i have found a snippet of code which i have
  inserting  in the handler function of my module. So the module looks
  like this now:

  [...]
  use vars qw ($VERSION %MODIFIED);
  [...]
  *My::Apache::Module::handler = \ApacheRequestInit;
  sub ApacheRequestInit {
  [...]
  my $file = '/path/to/config';
  $^M  =  (stat  $file)[9];  #  even  if  not set -- does not work
 #  correctyly
  if (!$MODIFIED{$file} and $MODIFIED{$file} != -M $file) {
 unless ($auth_config = do $file) {
if ( $@ ) {
   $r-log_error( "Unable to load configuration." );
   return SERVER_ERROR;
}
 }
 $r-log_error( "Configuration reloaded..." );
 $MODIFIED{$file} = -M $file;
 $r-log_error("Modification time: " . $MODIFIED{$file});
  }
  [...]
  }

  I  have  restarted the server on which i test all the code and began
  to  watch  ErrorLog  to  see  if it works. On each request my module
  reloads  the  configuration  again,  but  the  modification  was not
  changed. Going to /perl-status i check the MODIFIED hash and see the
  path  to the configuration with the modification value and even so i
  think it is because i set my module to handle all request comming to
  the   root  location  /.  What  shall  i  do  properly  handle  the
  modification time of a file in my module?

  Any help will be great. Thanks in advance.
  
Best regards,
Alexei V. Alexandrov ([EMAIL PROTECTED])



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Using plugins in modules.

2000-09-06 Thread Alexei V. Alexandrov

Hello modperl,

  There is a module i have written for site managment and i would like to extend
  it with support for plugins and i don`t know where to start from. I would like
  it  uppon  startup scan a directory for plugins and then import functions from
  found  plugins  and  also  provide  a list af available modules when calling a
  specific  function.  Can  anyone  help me to solve this problem or to point me
  somewhere where i can read about it.

Best regards,
Alexei V. Alexandrov   [AA4460, AVA32-RIPN, AA1829-RIPE]

*** Alexei V. Alexandrov -- www.elcomsoft.com  [EMAIL PROTECTED] ***
*** PGP Fingerprint:9F23 7153 51D4 FD8F  4E7F D4DF E0FA E400 ***






mod_perl on Win32

2000-07-11 Thread Alexei V. Alexandrov

Hello modperl,

  I`m trying to get ApacheModulePerl.dll to work on a Windows 98 machine. I have
  compiled perl apache and tring to build the module but the linker says it can
  not link the module because of an unresolved symbol _ap_validate_password. Has
  anyone succeded to run the module under win98? I will try to build it myself
  but it would be nice if you could send me a copy of your module.

  Thanks in advance.

Best regards,
Alexei V. Alexandrov   [AA4460, AVA32-RIPN, AA1829-RIPE]

*** Alexei V. Alexandrov -- www.elcomsoft.com  [EMAIL PROTECTED] ***
*** PGP Fingerprint:9F23 7153 51D4 FD8F  4E7F D4DF E0FA E400 ***






[newbie]: Catching apache output.

2000-05-25 Thread Alexei V. Alexandrov

Hello modperl,

  The problem i would like to solve is that i want to catch the actual
  output from the apache. I have bought "Writing apache modules with
  perl and C" there are two examples on how to write thing like Echo
  or NavBar. These two scripts just parse the actual file that is
  requested by the client. The thing i want to make is that a module
  written in perl can catch the output (any script [php, cgi, etc.],
  any html file) and parse the output and make some changes to it (say
  like parsing href tags). Where should i look?

Best regards,
Alexei V. Alexandrov   [AA4460, AVA32-RIPN, AA1829-RIPE]
----
*** Alexei V. Alexandrov --- www.elcomsoft.com --- [EMAIL PROTECTED] ***






Help me to learn...

2000-05-16 Thread Alexei V. Alexandrov

Dear mod_perl users,

  I`m new to programming using mod_perl just for learning i wrote some
  simple modules and i want to write a more complex module for solving
  the following task:

  There are many .zip files on our server in the web root directory. I
  want to write a kind of module to view the contents of the zip file
  using unzip program. I don`t want to place zip files in a spechial
  folder and so on... What is the best way to do it.

  Thank you for any help.

Best regards,
Alexei V. Alexandrov   [AA4460, AVA32-RIPN, AA1829-RIPE]

*** Alexei V. Alexandrov --- www.elcomsoft.com --- [EMAIL PROTECTED] ***