[19437] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1632 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Aug 27 21:20:41 2001

Date: Mon, 27 Aug 2001 18:20:22 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <998961622-v10-i1632@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Mon, 27 Aug 2001     Volume: 10 Number: 1632

Today's topics:
        Statistics for comp.lang.perl.misc <gbacon@cs.uah.edu>
    Re: This has got to be a bug (Abigail)
    Re: Two simple structures! but what is the difference? <gnarinn@hotmail.com>
    Re: Two simple structures! but what is the difference? <Pcmann1@btinternet.com>
    Re: Two simple structures! but what is the difference? <tinamue@zedat.fu-berlin.de>
    Re: Two simple structures! but what is the difference? <ren@tivoli.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Mon, 27 Aug 2001 19:22:01 -0000
From: Greg Bacon <gbacon@cs.uah.edu>
Subject: Statistics for comp.lang.perl.misc
Message-Id: <tol7epbfbq86d0@corp.supernews.com>

Following is a summary of articles spanning a 7 day period,
beginning at 20 Aug 2001 20:24:26 GMT and ending at
27 Aug 2001 19:49:17 GMT.

Notes
=====

    - A line in the body of a post is considered to be original if it
      does *not* match the regular expression /^\s{0,3}(?:>|:|\S+>|\+\+)/.
    - All text after the last cut line (/^-- $/) in the body is
      considered to be the author's signature.
    - The scanner prefers the Reply-To: header over the From: header
      in determining the "real" email address and name.
    - Original Content Rating (OCR) is the ratio of the original content
      volume to the total body volume.
    - Find the News-Scan distribution on the CPAN!
      <URL:http://www.perl.com/CPAN/modules/by-module/News/>
    - Please send all comments to Greg Bacon <gbacon@cs.uah.edu>.
    - Copyright (c) 2001 Greg Bacon.
      Verbatim copying and redistribution is permitted without royalty;
      alteration is not permitted.  Redistribution and/or use for any
      commercial purpose is prohibited.

Excluded Posters
================

perlfaq-suggestions\@(?:.*\.)?perl\.com
faq\@(?:.*\.)?denver\.pm\.org

Totals
======

Posters:  324
Articles: 1204 (505 with cutlined signatures)
Threads:  319
Volume generated: 2328.6 kb
    - headers:    1004.1 kb (19,550 lines)
    - bodies:     1236.2 kb (39,677 lines)
    - original:   735.1 kb (26,129 lines)
    - signatures: 87.1 kb (1,656 lines)

Original Content Rating: 0.595

Averages
========

Posts per poster: 3.7
    median: 1.0 post
    mode:   1 post - 166 posters
    s:      7.0 posts
Posts per thread: 3.8
    median: 3 posts
    mode:   1 post - 92 threads
    s:      4.8 posts
Message size: 1980.5 bytes
    - header:     854.0 bytes (16.2 lines)
    - body:       1051.4 bytes (33.0 lines)
    - original:   625.2 bytes (21.7 lines)
    - signature:  74.1 bytes (1.4 lines)

Top 10 Posters by Number of Posts
=================================

         (kb)   (kb)  (kb)  (kb)
Posts  Volume (  hdr/ body/ orig)  Address
-----  --------------------------  -------

   62   162.6 ( 50.0/109.6/ 57.1)  Benjamin Goldberg <goldbb2@earthlink.net>
   55   123.4 ( 57.4/ 47.0/ 27.7)  tassilo.parseval@post.rwth-aachen.de
   50    87.7 ( 39.0/ 48.6/ 18.9)  Anno Siegel <anno4000@lublin.zrz.tu-berlin.de>
   39    75.1 ( 31.1/ 30.0/  9.8)  Ilya Martynov <ilya@martynov.org>
   34    73.8 ( 38.8/ 30.3/ 17.6)  tadmc@augustmail.com
   33    71.9 ( 31.1/ 34.7/ 30.8)  abigail@foad.org
   32    80.4 ( 27.3/ 53.1/ 43.0)  "Godzilla!" <godzilla@stomp.stomp.tokyo>
   21    51.2 ( 17.3/ 29.7/ 17.8)  mgjv@tradingpost.com.au
   19    28.2 ( 11.1/ 17.1/  9.0)  gnarinn@hotmail.com
   17    25.2 ( 12.5/ 12.6/  7.1)  Samneric <samneric@tigerriverOMIT-THIS.com>

These posters accounted for 30.1% of all articles.

Top 10 Posters by Volume
========================

  (kb)   (kb)  (kb)  (kb)
Volume (  hdr/ body/ orig)  Posts  Address
--------------------------  -----  -------

 162.6 ( 50.0/109.6/ 57.1)     62  Benjamin Goldberg <goldbb2@earthlink.net>
 123.4 ( 57.4/ 47.0/ 27.7)     55  tassilo.parseval@post.rwth-aachen.de
  87.7 ( 39.0/ 48.6/ 18.9)     50  Anno Siegel <anno4000@lublin.zrz.tu-berlin.de>
  80.4 ( 27.3/ 53.1/ 43.0)     32  "Godzilla!" <godzilla@stomp.stomp.tokyo>
  75.1 ( 31.1/ 30.0/  9.8)     39  Ilya Martynov <ilya@martynov.org>
  73.8 ( 38.8/ 30.3/ 17.6)     34  tadmc@augustmail.com
  71.9 ( 31.1/ 34.7/ 30.8)     33  abigail@foad.org
  57.8 ( 13.8/ 43.9/ 28.7)     17  Yves Orton <demerphq@hotmail.com>
  51.2 ( 17.3/ 29.7/ 17.8)     21  mgjv@tradingpost.com.au
  34.1 ( 13.7/ 20.1/ 10.8)     14  Ren Maddox <ren@tivoli.com>

These posters accounted for 35.1% of the total volume.

Top 10 Posters by OCR (minimum of five posts)
==============================================

         (kb)    (kb)
OCR      orig /  body  Posts  Address
-----  --------------  -----  -------

0.896  (  5.0 /  5.5)      7  "Peter Mann" <Pcmann1@btinternet.com>
0.888  ( 30.8 / 34.7)     33  abigail@foad.org
0.850  (  3.4 /  4.0)      5  "Just in" <justin.devanandan.allegakoen@intel.com>
0.839  ( 10.9 / 13.0)     11  Carlos C . Gonzalez <miscellaneousemail@yahoo.com>
0.829  ( 10.6 / 12.8)      7  Ian Boreham <ianb@ot.com.au>
0.818  (  2.4 /  3.0)      6  70262.1046@compuserve.com
0.811  ( 43.0 / 53.1)     32  "Godzilla!" <godzilla@stomp.stomp.tokyo>
0.805  (  5.5 /  6.9)     11  Rafael Garcia-Suarez <rgarciasuarez@free.fr>
0.782  (  6.5 /  8.3)      5  "Steffen Müller" <tsee@gmx.net>
0.759  (  6.8 /  8.9)      8  Kira <callgirl@la.znet.com>

Bottom 10 Posters by OCR (minimum of five posts)
=================================================

         (kb)    (kb)
OCR      orig /  body  Posts  Address
-----  --------------  -----  -------

0.390  ( 18.9 / 48.6)     50  Anno Siegel <anno4000@lublin.zrz.tu-berlin.de>
0.382  (  2.1 /  5.4)      7  "William Alexander Segraves" <wsegrave@mindspring.com>
0.380  (  1.6 /  4.2)      6  "Rob - Rock13.com" <rob_13@excite.com>
0.341  (  1.3 /  3.9)      5  Rainer Klier <Rainer.Klier@erl.sbs.de>
0.329  (  1.8 /  5.5)      5  "Jon 'The Mensch'" <vemba72@youknowwhattodo.hotmail.com>
0.328  (  9.8 / 30.0)     39  Ilya Martynov <ilya@martynov.org>
0.314  (  4.1 / 13.0)      8  "David Hilsee" <davidhilseenews@yahoo.com>
0.262  (  4.0 / 15.3)      9  Michael Budash <mbudash@sonic.net>
0.247  (  2.9 / 11.7)     11  l_pantin@hotmail.com
0.198  (  2.6 / 13.2)     14  "John W. Krahn" <krahnj@acm.org>

60 posters (18%) had at least five posts.

Top 10 Threads by Number of Posts
=================================

Posts  Subject
-----  -------

   25  Openning a file
   20  pl or not pl, that is the question
   19  warnings with cgi will crash Win32 perl core
   19  Perl OO needs the opposite of SUPER::
   17  It's to AM for me to think
   17  $1 as subroutine parameter - problems
   16  Last index of array referenced in a scalar??
   13  quick(?) programming question for perl newbie
   13  join
   13  one character at a time

These threads accounted for 14.3% of all articles.

Top 10 Threads by Volume
========================

  (kb)   (kb)  (kb)  (kb)
Volume (  hdr/ body/ orig)  Posts  Subject
--------------------------  -----  -------

  78.1 ( 16.3/ 61.3/ 42.3)     19  warnings with cgi will crash Win32 perl core
  57.4 ( 21.3/ 35.0/ 21.0)     19  Perl OO needs the opposite of SUPER::
  56.4 ( 26.1/ 26.2/ 14.8)     25  Openning a file
  38.7 ( 15.4/ 20.3/ 12.1)     17  It's to AM for me to think
  35.9 ( 16.3/ 17.6/ 11.2)     20  pl or not pl, that is the question
  32.6 ( 14.8/ 16.1/  7.9)     16  Last index of array referenced in a scalar??
  30.7 (  9.2/ 20.9/ 18.5)     11  Sex or Perl?  Which is better?
  29.2 ( 11.9/ 17.1/  5.6)     13  quick(?) programming question for perl newbie
  28.5 ( 13.4/ 14.0/  8.9)     17  $1 as subroutine parameter - problems
  27.7 (  8.8/ 18.8/  9.5)     10  CGI redirect

These threads accounted for 17.8% of the total volume.

Top 10 Threads by OCR (minimum of five posts)
==============================================

         (kb)    (kb)
OCR      orig /  body  Posts  Subject
-----  --------------  -----  -------

0.894  (  3.8/   4.2)      5  System call
0.885  ( 18.5/  20.9)     11  Sex or Perl?  Which is better?
0.821  (  1.5/   1.9)      5  Accessing Microsoft SQL Server (version 6+) from ActiveState Perl?
0.808  (  2.1/   2.7)      5  simple question im sure
0.798  (  8.7/  10.9)     10  Perl help
0.792  (  2.5/   3.2)      6  days since 1/1/1970
0.762  ( 10.0/  13.1)     11  Is element in array
0.756  (  3.6/   4.8)      7  help with searching for occurances of......
0.753  (  4.4/   5.8)      7  Hashref to coderef?
0.747  (  7.6/  10.1)     11  Performance : Shell X Perl

Bottom 10 Threads by OCR (minimum of five posts)
=================================================

         (kb)    (kb)
OCR      orig /  body  Posts  Subject
-----  --------------  -----  -------

0.441  (  2.1 /  4.7)      5  This has got to be a bug
0.436  (  6.3 / 14.5)      6  sysread problem on socket
0.430  (  2.6 /  6.0)      7  round off operator on Perl?
0.426  (  2.6 /  6.2)      7  Telnet front-end
0.401  (  1.5 /  3.7)      5  How do I sort a 2D-array by three different columns with perl
0.360  (  1.8 /  5.0)      6  references and strict
0.357  (  1.2 /  3.4)      5  elegant substitutions
0.350  (  1.9 /  5.5)      5  perl comments
0.328  (  5.6 / 17.1)     13  quick(?) programming question for perl newbie
0.127  (  2.9 / 22.7)      5  fwd: Sex or perl?

85 threads (26%) had at least five posts.

Top 10 Targets for Crossposts
=============================

Articles  Newsgroup
--------  ---------

      26  comp.lang.perl.modules
      10  alt.perl
       6  alt.ascii-art
       6  comp.lang.perl
       5  alt.games.half-life.tfclassic
       4  comp.unix.shell
       3  comp.text.xml
       3  microsoft.public.xml
       3  comp.sys.hp.hpux
       2  comp.lang.tcl

Top 10 Crossposters
===================

Articles  Address
--------  -------

       9  Yves Orton <demerphq@hotmail.com>
       4  jake johnson <jake@omnimode.com>
       4  "Belphegor" <globalpunk@hotmail.com>
       4  Dan Sheppard <dans@chiark.greenend.org.uk>
       3  Samneric <samneric@tigerriverOMIT-THIS.com>
       3  Eli the Bearded <eli@there-is-no-more-qzto.com>
       3  "Jay Flaherty" <fty@mediapulse.com>
       2  jari.aalto@poboxes.com
       2  "Gareth Hinton" <gareth.hinton@btinternet.com>
       2  Hansang Bae <hbae_@_nyc.rr.com.REMOVE_>


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

Date: 27 Aug 2001 22:15:26 GMT
From: abigail@foad.org (Abigail)
Subject: Re: This has got to be a bug
Message-Id: <slrn9olhk3.q9e.abigail@alexandra.xs4all.nl>

art blair (arthur@ablair.physics.wisc.edu) wrote on MMCMXVI September
MCMXCIII in <URL:news:9m8poo$hj4$1@news.doit.wisc.edu>:
:: Thanx to all. \Q \E worked. 
:: I need to get a better perl book.


Yeah, and you don't want \Q and \E.

If you want to find out whether string $sub is contained in string $str,
one uses index().

If one want to find out whether two strings are equal, one uses eq.


It looks like you want one of these.



Abigail
-- 
0=~("\050\077\173\160\162\151\156\164\042\112\165\163\164\040\141\156\157\164".
"\150\145\162\40\120\145\162\154\40\110\141\143\153\145\162\134\156\42\175\51")


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

Date: Mon, 27 Aug 2001 19:09:03 +0000
From: gnari <gnarinn@hotmail.com>
Subject: Re: Two simple structures! but what is the difference?
Message-Id: <998939343.0260699167847633.gnarinn@hotmail.com>

In article <9mdc4o$67u$1@plutonium.btinternet.com>,
Peter Mann <Pcmann1@btinternet.com> wrote:

>
>#-------------------------
># Structure 2
> my $check;
>  if (defined $fragment) {
>        $check = check_fragement()

here you are calling function check_fragement()

>  }
>  else
>  {
>        $check = check_base()

here you are calling check_base

>  }
>#-------------------------
>
>
> my $success  = $link->$check();

what are you trying to do?
do you want to do
  my $success  = $link->check_fragement();
or 
  my $success  = $link->check_base();

depending on $fragment?

if so, may i suggest you just do
    my $success  = (defined $fragment) ? $link->check_fragement()
                                       : $link->check_base();

it is much clearer than doing symbolic method calls,
evals or method references.

gnari



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

Date: Mon, 27 Aug 2001 21:34:40 +0100
From: "Peter Mann" <Pcmann1@btinternet.com>
Subject: Re: Two simple structures! but what is the difference?
Message-Id: <9meaqf$8kn$1@plutonium.btinternet.com>

Dear All,
What I was trying to achieve is probably more clearer in the code extract
below. The subroutine 'check' calls either check_fragment or check_base
depending on whether the condition if '$fragment is defined'.
At the moment 'method 1' works (I have indicated which bit this refers to in
the code).  But i was wanting to strucure is like 'method 2'. But I cant get
it to work! The reason for wanting to re-structure my program in this way is
for 2 reasons.
    It will cut down on the computation cost due to not have to calls
addition sub's, since then it can all be
implemented in one function.
   Check_base and check_fragment have common locally declared variables, so
it would be neater code if i could put it all in one function.

So I thought that if the program could be restructured, the functions could
be put in each case of the if-then-else statement. The function
'check_fragement' would be in the IF block, and the 'check_base' would be in
the ELSE block.
So whilst this appears simple to re-structure, I am having problems with the
way I was hopeing to do it. Could someone please tell me if this is possible
and makes sense! Or is it asking for problems?

Thanks very much in advance! Any suggestions would be greatly appreciated.
    Regards
            - Pete



sub check
{
    my $link = shift;
    my $uri  = $link->{uri};
    exists $Link::Check{$uri} and
         return $Link::Check{$uri};

    my $fragment = $link->{fragment};

#--------method 1-----------------------
    my $check    = defined $fragment ? 'check_fragment' :
           'check_base';
#--------------------------------------------

#--------method 2-----------------------
    my $check;
    if (defined $fragment) {
      $check = check_fragement()
    }
    else
    {
      $check = check_base()
    }
#----------------------------------------

    my $success  = $link->$check();
    $Link::Check{$uri} = $success;
    $success
}


sub check_fragment
{
    my $link     = shift;
    my $base     = $link->{base};
    my $fragment = $link->{fragment};

    my $page     = new Page $base;
    my $parser   = $page->parse;
    defined $parser or return '';

    $parser->check_fragment($fragment)
}


sub check_base
{
    my $link = shift;
    my $base = $link->{base};

    my $ua       = new LWP::UserAgent;
    my $request  = new HTTP::Request HEAD => $base;
    my $response = $ua->request($request);

    $response->code==500 and do       # Some servers don't like HEAD
requests
    {
 $request  = new HTTP::Request GET => $base;
 $response = $ua->request($request);
    };

    $response->is_success;
}




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

Date: 27 Aug 2001 22:00:50 GMT
From: Tina Mueller <tinamue@zedat.fu-berlin.de>
Subject: Re: Two simple structures! but what is the difference?
Message-Id: <9mefui$1r6f5$2@fu-berlin.de>

Peter Mann <Pcmann1@btinternet.com> wrote:
> What I was trying to achieve is probably more clearer in the code extract
> below.

nope, it isn't. at least not for me. maybe i'm missing something. you
got several solutions to your problem but you aren't
commenting on a signle one of them. what was it you
didn't understand?

  my $var = $test ? 'one' : 'two';
means:
  my $var;
  if ($test) {
    $var = 'one'
  }
  else {
    $var = 'two'
  }

> #--------method 1-----------------------
>     my $check    = defined $fragment ? 'check_fragment' :
>            'check_base';

here you are assigning strings to $check.

> #--------method 2-----------------------
>     my $check;
>     if (defined $fragment) {
>       $check = check_fragement()

here you are assigning the result of the sub check_fragement()
to $check. but that was already said.

hth, tina

-- 
http://www.tinita.de \  enter__| |__the___ _ _ ___
tina's moviedatabase  \     / _` / _ \/ _ \ '_(_-< of
search & add comments  \    \ _,_\ __/\ __/_| /__/ perception
---   Warning: content of homepage hopelessly out-dated   ---


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

Date: 27 Aug 2001 16:56:32 -0500
From: Ren Maddox <ren@tivoli.com>
Subject: Re: Two simple structures! but what is the difference?
Message-Id: <m3g0adtbe7.fsf@dhcp9-161.support.tivoli.com>

On Mon, 27 Aug 2001, Pcmann1@btinternet.com wrote:

> sub check
> {
>     my $link = shift;
>     my $uri  = $link->{uri};
>     exists $Link::Check{$uri} and
>          return $Link::Check{$uri};
> 
>     my $fragment = $link->{fragment};
> 
> #--------method 1-----------------------
>     my $check    = defined $fragment ? 'check_fragment' :
>            'check_base';
> #--------------------------------------------

method 1 sets $check to either the string 'check_fragment' or the
string 'check_base'.

> #--------method 2-----------------------
>     my $check;
>     if (defined $fragment) {
>       $check = check_fragement()
>     }
>     else
>     {
>       $check = check_base()
>     }
> #----------------------------------------

method 2 sets $check to the result of calling either check_fragement()
(typo?) or check_base() -- notably with no arguments.

>     my $success  = $link->$check();

This uses a symbolic reference (bad!) to call either check_fragment()
or check_base() from method 1 as a method -- which means that $link
will be the first argument.

>     $Link::Check{$uri} = $success;
>     $success
> }
> 
> 
> sub check_fragment
> {
>     my $link     = shift;

expects an argument...

>     my $base     = $link->{base};
>     my $fragment = $link->{fragment};
> 
>     my $page     = new Page $base;
>     my $parser   = $page->parse;
>     defined $parser or return '';
> 
>     $parser->check_fragment($fragment)
> }
> 
> 
> sub check_base
> {
>     my $link = shift;

expects an argument...

>     my $base = $link->{base};
> 
>     my $ua       = new LWP::UserAgent;
>     my $request  = new HTTP::Request HEAD => $base;
>     my $response = $ua->request($request);
> 
>     $response->code==500 and do       # Some servers don't like HEAD
> requests
>     {
>  $request  = new HTTP::Request GET => $base;
>  $response = $ua->request($request);
>     };
> 
>     $response->is_success;
> }

Here is method 3:

sub check
{
    my $link = shift;
    my $uri  = $link->{uri};
    exists $Link::Check{$uri} and
         return $Link::Check{$uri};

    my $fragment = $link->{fragment};

    my $success;
    if (defined $fragment) {
      $success = $link->check_fragment();
    } else {
      $success = $link->check_base();
    }

    $Link::Check{$uri} = $success;
}


-- 
Ren Maddox
ren@tivoli.com


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

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.  

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 V10 Issue 1632
***************************************


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