[28857] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 101 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Feb 9 21:51:50 2007

Date: Fri, 9 Feb 2007 18:50:23 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 9 Feb 2007     Volume: 11 Number: 101

Today's topics:
    Re: 'use lib' question <nan.li.g@gmail.com>
    Re: :) <tadmc@augustmail.com>
        a, b, - and c? <g_m@remove-comcast.net>
    Re: a, b, - and c? <spamtrap@dot-app.org>
    Re: a, b, - and c? <sisyphus1@nomail.afraid.com>
    Re: a, b, - and c? <g_m@remove-comcast.net>
        Apache/mod_perl server getting stuck <ignoramus799@NOSPAM.799.invalid>
    Re: Apache/mod_perl server getting stuck <ignoramus8098@NOSPAM.8098.invalid>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: 5 Feb 2007 06:37:15 -0800
From: "nan li" <nan.li.g@gmail.com>
Subject: Re: 'use lib' question
Message-Id: <1170686235.911526.69230@v45g2000cwv.googlegroups.com>

On Feb 2, 5:05 pm, John Bokma <j...@castleamber.com> wrote:
> "nan li" <nan.l...@gmail.com> wrote:
> > On Feb 2, 4:00 pm, "Paul Lalli" <mri...@gmail.com> wrote:
> >> On Feb 2, 3:35 pm, "nan li" <nan.l...@gmail.com> wrote:
>
> [..]
>
> >> > Use of uninitialized value in string at t11.pl line 5.
> >> > Empty compile time value given to use lib at t11.pl line 5
> >> > t11.pl syntax OK
>
> [..]
>
> >> use lib $ENV{XYZ};
>
> >> Paul Lalli
>
> > But if I use this, I still get the warning:
>
> No, no, you get a different one.
>
> > Empty compile time value given to use lib at t11.pl line 7
>
> Maybe because XYZ is empty...
>
> --
> John                Experienced Perl programmer:http://castleamber.com/
>
>           Perl help, tutorials, and examples:http://johnbokma.com/perl/

You are right. I didn't set XYZ :-(  Thanks a lot.




------------------------------

Date: Sat, 3 Feb 2007 09:14:39 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: :)
Message-Id: <slrnes99mv.t1e.tadmc@tadmc30.august.net>

john.swilting <john.swilting@wanadoo.fr> wrote:
>:)

Please do not drop litter in the newsgroup.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


------------------------------

Date: Sat, 3 Feb 2007 05:07:04 -0500
From: "~greg" <g_m@remove-comcast.net>
Subject: a, b, - and c?
Message-Id: <Kuidnb1VyqBDw1nYnZ2dnUVZ_sapnZ2d@comcast.com>

Why does this work...
  use strict;
  $|=1;
  sub Test
  {
    (*a,*b) = @_;
    print "$a\n$b\n";
  }
  my $A = 'this is';
  my $B = 'a test';
  Test(\$A,\$B);
(prints:
  this is
  a test)

 ...but this doesn't?
  use strict;
  $|=1;
  sub Test
  {
    (*a,*c) = @_;
    print "$a\n$c\n";
  }
  my $A = 'this is';
  my $C = 'a test';
  Test(\$A,\$C);
(Variable "$c" is not imported at ... line...
Global symbol "$c" requires explicit package name at ... line ...)

?

(Something to do with 'sort()' maybe?)












------------------------------

Date: Sat, 03 Feb 2007 05:23:56 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: a, b, - and c?
Message-Id: <m2ireja69v.fsf@Sherm-Pendleys-Computer.local>

"~greg" <g_m@remove-comcast.net> writes:

> Why does this work...

 ... undeclared $a & $b ...

> ...but this doesn't?

 ... undeclared $a & $c ...

> (Something to do with 'sort()' maybe?)

Yes, exactly. From "perldoc strict", with regard to "use strict 'vars';":

    Because of their special use by sort(), the variables $a and $b are
    exempted from this check.

sherm--

-- 
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net


------------------------------

Date: Sat, 3 Feb 2007 21:22:46 +1100
From: "Sisyphus" <sisyphus1@nomail.afraid.com>
Subject: Re: a, b, - and c?
Message-Id: <45c462f3$0$9770$afc38c87@news.optusnet.com.au>


"~greg" <g_m@remove-comcast.net> wrote in message 
news:Kuidnb1VyqBDw1nYnZ2dnUVZ_sapnZ2d@comcast.com...
> Why does this work...
>  use strict;
>  $|=1;
>  sub Test
>  {
>    (*a,*b) = @_;
>    print "$a\n$b\n";
>  }
>  my $A = 'this is';
>  my $B = 'a test';
>  Test(\$A,\$B);
> (prints:
>  this is
>  a test)
>
> ...but this doesn't?
>  use strict;
>  $|=1;
>  sub Test
>  {
>    (*a,*c) = @_;
>    print "$a\n$c\n";
>  }
>  my $A = 'this is';
>  my $C = 'a test';
>  Test(\$A,\$C);
> (Variable "$c" is not imported at ... line...
> Global symbol "$c" requires explicit package name at ... line ...)
>
> ?
>
> (Something to do with 'sort()' maybe?)
>

Yep - in that $a and $b are special (as you probably know).
So, as soon as you name the variable(s) something other than 'a' or 'b', you 
need to take extra steps.

This does the right thing:

  use strict;
  use warnings;
  $|=1;
  sub Test
  {
    our ($x, $y);
    (*x,*y) = @_;
    print "$x\n$y\n";
  }
  my $A = 'this is';
  my $C = 'a test';
  Test(\$A,\$C);

Cheers,
Rob 




------------------------------

Date: Sat, 3 Feb 2007 05:58:44 -0500
From: "~greg" <g_m@remove-comcast.net>
Subject: Re: a, b, - and c?
Message-Id: <ebCdneiAWM1-91nYnZ2dnUVZ_sWdnZ2d@comcast.com>


very satisfying! :)

thanks, all

~greg





------------------------------

Date: Tue, 06 Feb 2007 15:38:50 -0600
From: Ignoramus799 <ignoramus799@NOSPAM.799.invalid>
Subject: Apache/mod_perl server getting stuck
Message-Id: <P6KdnQfB4KD3aFXYnZ2dnUVZ_tunnZ2d@giganews.com>

Lately, in the last week or so, my Apache server with mod_perl began
to get stuck.

How can I find out where (in mod_perl code) am I stuck, can I maybe
send some signal to apache and get a dump of current state of its
subprocesses, including state of mod_perl code. 

Thanks

i


------------------------------

Date: Fri, 09 Feb 2007 06:53:54 -0600
From: Ignoramus8098 <ignoramus8098@NOSPAM.8098.invalid>
Subject: Re: Apache/mod_perl server getting stuck
Message-Id: <Iu-dnZ-hEqh_81HYnZ2dnUVZ_sHinZ2d@giganews.com>

I found the solution, it is here:

http://perl.apache.org/docs/1.0/guide/debug.html

Using the Perl Trace

To see where an httpd is "spinning", try adding this to your script or
a startup file:

  use Carp ();
  $SIG{'USR2'} = sub { 
     Carp::confess("caught SIGUSR2!");
  };

The above code assigns a signal handler for the USR2 signal. This
signal has been chosen because it's least likely to be used by the
other parts of the server.

We check the registered signal handlers with help of
Apache::Status. What we see at http://localhost/perl-status?sig is :

  USR2 = \&MyStartUp::__ANON__

MyStartUp is the name of the package I've used in mine startup.pl.

After applying this server configuration, let's use this simple code
example, where sleep(10000) will emulate a hanging process:

  debug/perl_trace.pl
  -------------------
  $|=1;
  print "Content-type:text/plain\r\n\r\n";
  print "[$$] Going to sleep\n";
  hanging_sub();
  sub hanging_sub {sleep 10000;}

We execute the above script as
http://localhost/perl/debug/perl_trace.pl, we have used $|=1; and
printed the PID with $$ to learn what process ID we want to work with.

No we issue the command line, using the PID we have just saw being
printed to the browser's window:

  % kill -USR2 PID

And watch this showing up at the error_log file:

  caught SIGUSR2!
      at /home/httpd/perl/startup/startup.pl line 32
  MyStartUp::__ANON__('USR2') called 
      at /home/httpd/perl/debug/perl_trace.pl line 5
  Apache::ROOT::perl::debug::perl_trace_2epl::hanging_sub() called 
      at /home/httpd/perl/debug/perl_trace.pl line 4
  Apache::ROOT::perl::debug::perl_trace_2epl::handler('Apache=SCALAR(0x8309d08)') 
    called 
      at /usr/lib/perl5/site_perl/5.005/i386-linux/Apache/Registry.pm 
        line 140
  eval {...} called 
      at /usr/lib/perl5/site_perl/5.005/i386-linux/Apache/Registry.pm
        line 140
  Apache::Registry::handler('Apache=SCALAR(0x8309d08)') called 
      at PerlHandler subroutine `Apache::Registry::handler' line 0
  eval {...} called 
      at PerlHandler subroutine `Apache::Registry::handler' line 0

We can clearly see that the process "hangs" in the code executed at
line 5 of the /home/httpd/perl/debug/perl_trace.pl script, and it was
called by the hanging_sub() routine defined at line 4.

On Tue, 06 Feb 2007 15:38:50 -0600, Ignoramus799 <ignoramus799@NOSPAM.799.invalid> wrote:
> Lately, in the last week or so, my Apache server with mod_perl began
> to get stuck.
>
> How can I find out where (in mod_perl code) am I stuck, can I maybe
> send some signal to apache and get a dump of current state of its
> subprocesses, including state of mod_perl code. 
>
> Thanks
>
> i


------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V11 Issue 101
**************************************


home help back first fref pref prev next nref lref last post