Hello Stan,
 
Nice mesg'g:  A RegistryCooker.pm edit took and the server started fine - yet when I'm executing  a cookie script (noted below) I'm gettting the "Dude, your just killed $r!(/var/www/sec/cooky)" ....  Same with the other .pl's.
 
Best Regards,
Adolph Torres
[EMAIL PROTECTED]
 

cooky.pl
-----------------------------------------
  #!/usr/bin/perl -w
 
  use strict;
  #use Test::Cookie;
  use CGI;
  use CGI::Cookie;
  use vars qw($q $switch $status $sessionID);
 
  init();
  print_header();
  print_status();
 
  ### <-- subroutines --> ###
 
  # the init code
  ###########
  sub init{
    $q = new CGI;
 
    $switch = $q->param("switch") ? 1 : 0;
 
      # try to retrieve the session ID
              # fetch existing cookies
    my %cookies = CGI::Cookie->fetch;
    $sessionID = exists $cookies{'sessionID'}
       ? $cookies{'sessionID'}->value : '';
 
      # 0 = not running, 1 = running
    $status = $sessionID ? 1 : 0;
 
      # switch status if asked to
    $status = ($status+1) % 2 if $switch;
 
    if ($status){
        # preserve sessionID if exists or create a new one
      $sessionID ||= generate_sessionID() if $status;
    } else {
        # delete the sessionID
      $sessionID = '';
    }
 
  } # end of sub init
 
  #################
  sub print_header{
      # prepare a cookie
    my $c = CGI::Cookie->new
      ('-name'    => 'sessionID',
       '-value'   => $sessionID,
       '-expires' => '+1h');
 
    print $q->header
      (-type   => 'text/html',
       -cookie => $c);
 
  } # end of sub print_header
 

  # print the current Session status and a form to toggle the status
  #################
  sub print_status{
 
    print qq{<HTML><HEAD><TITLE>Cookie</TITLE></HEAD><BODY>};
 
      # print status
    print "<B>Status:</B> ",
          $status
            ? "Session is running with ID: $sessionID"
            : "No session is running";
 

      # change status form
    my $button_label = $status ? "Stop" : "Start";
    print qq{<HR>
         <FORM>
           <INPUT TYPE=SUBMIT NAME=switch VALUE=" $button_label ">
         </FORM>
           };
 
    print qq{</BODY></HTML>};
 
  } # end of sub print_status
 
  # A dummy ID generator
  # Replace with a real session ID generator
  ########################
  sub generate_sessionID {
    return scalar localtime;
  } # end of sub generate_sessionID
 
----------------------------------------------------------------------------------------------------------------------
 
 
----- Original Message -----
From: Stas Bekman
To: [EMAIL PROTECTED]
Sent: 8/22/2003 10:55:25 AM
Subject: Re: ModPerl2/Apache2 - Error handling return codes -RegistryCooker.pm:"Argument""isn't numeric ...& bottom of web page say:OK the server encounteredaninternal.....

Adolph Torres wrote:
> Fri Aug 22 10:37:59 PDT 2003
> Hello again,
> Here is the result of those edits on this system.  And I'm more than
> willing to continue working this if you would like - but had to back it
> out as you'll see below.
>
> Adolph Torres
> -------------------------------------------------------------------------------
>
>
> #-> Snip of new edit to RegistryCooker.pm:
>
>     { # run the code and preserve warnings setup when it's done
>         no warnings;
>         my $r_iv=$$r;#people do things...
>         eval{$cv->($r,@_)};
>         unless(ref($r) eq 'SCALAR' && $$r==$r_iv){
>           warn "dude, your just killed \$r!($self->{FILENAME})\n";
>           $$r=$r_iv;#restore the IV slot
>         ModPerl::Global::special_list_call(END => $package);
>     }
 
were you manually adjusting the code? You lost the closing brace. Just save
this patch as a file /tmp/patch and then apply it with
 
cd modperl-2.0/Modperl-Registry
patch -p0 < /tmp/patch
 
Index: lib/ModPerl/RegistryCooker.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/ModPerl-Registry/lib/ModPerl/RegistryCooker.pm,v
retrieving revision 1.35
diff -u -r1.35 RegistryCooker.pm
--- lib/ModPerl/RegistryCooker.pm    23 Mar 2003 04:52:24 -0000    1.35
+++ lib/ModPerl/RegistryCooker.pm    22 Aug 2003 07:30:27 -0000
@@ -181,7 +181,14 @@
 
      { # run the code and preserve warnings setup when it's done
          no warnings;
+
+        my $r_iv = $$r; # people do things...
          eval { $cv->($r, @_) };
+        unless (ref($r) eq 'SCALAR' && $$r == $r_iv) {
+            warn "dude, you just killed \$r! ($self->{FILENAME})\n";
+            $$r = $r_iv; # restore the IV slot
+        }
+
          ModPerl::Global::special_list_call(END => $package);
      }
 
 
 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
 

 
--- Adolph Torres
--- [EMAIL PROTECTED]
--- EarthLink: It's your Internet.
 

Reply via email to