Please take our Survey
logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

Re: ModPerl2/Apache2 - Error handling return codes -RegistryCooker.pm:"Argu: msg#00193

apache.mod-perl.devel

Subject: Re: ModPerl2/Apache2 - Error handling return codes -RegistryCooker.pm:"Argument""isn't numeric ...& bottom of web page say:OK the server encounteredaninternal.....

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
khmb1@xxxxxxxxxxxxx
 

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 -----
To: khmb1@xxxxxxxxxxxxx
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
--- EarthLink: It's your Internet.
 
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
qplus.devel/200...    network.jabber....    debian.qa-packa...    encryption.gpg....    python.dabo.dev...    uclinux.devel/2...    science.mathema...    recreation.pesc...    kernel.ck/2004-...    mozilla.devel.e...    tex.latex.prosp...    ietf.multi6/200...    bbc.cvs/2002-11...    xfree86.newbie/...    jakarta.taglibs...    altlinux.hardwa...    comedi/2002-05/...    horde.bugs/2004...    games.diplomacy...    finance.e-gold....    web.dom.test-su...    lang.ruby.rails...    os.netbsd.devel...    video.gstreamer...   
Home | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe

Navigation