[12892] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 302 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jul 29 19:07:19 1999

Date: Thu, 29 Jul 1999 16:05:19 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 29 Jul 1999     Volume: 9 Number: 302

Today's topics:
    Re: Comparing Scalars <tchrist@mox.perl.com>
    Re: Help install <gellyfish@gellyfish.com>
        How do I access the array stored in a given memory loca <yxie@po-box.mcgill.ca>
    Re: How do I access the array stored in a given memory  (Larry Rosler)
    Re: How to determine a date in the past (Malcolm Ray)
    Re: How to determine a date in the past <tchrist@mox.perl.com>
    Re: How to trim a String <tchrist@mox.perl.com>
    Re: How to trim a String <aqumsieh@matrox.com>
    Re: I need fast help <aqumsieh@matrox.com>
        Installing modules - make errors <savio.fonseca@usa.net>
    Re: is process still running? <tchrist@mox.perl.com>
    Re: LanMAN error! <carvdawg@patriot.net>
    Re: NEWSFLASH: Supremes rule anti-advert-ware illegal <ltl@rgsun5.viasystems.com>
    Re: OOP question. (Eugene van der Pijll)
    Re: OOP question. <tchrist@mox.perl.com>
    Re: OOP question. (Damian Conway)
        Outputting a HTTP Header <norris@mdo.net>
    Re: paging text <gellyfish@gellyfish.com>
    Re: paging text <johnp@vcimail.com.remove.me>
    Re: Perl 5.005_58 ... a bug. (Ilya Zakharevich)
        Problems compiling Perl 5.005.02 on HP-UX 10.20 <ilya@speakeasy.org>
    Re: Problems compiling Perl 5.005.02 on HP-UX 10.20 <ilya@speakeasy.org>
    Re: running Perl and Linux from a boot-cd? <gellyfish@gellyfish.com>
    Re: two forms interact with one script? <gellyfish@gellyfish.com>
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: 29 Jul 1999 15:32:15 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Comparing Scalars
Message-Id: <37a0c85f@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, jverk@mediaone.net writes:
:I'm having a problem comparing 3 scalars.  In english, here's what I'm
:trying to do:
:
:if $scalar1 and $scalar2 and $scalar3 eq ""
:  then do this
:else do this
:
:My problem is I don't know the correct way to write the comparison
:between the variables.  If all three variables are null, then do this.

There is no null.

:If at least one of the variables has a value (any value) then do this.

:But how do I write this?

Since I get to use any value, I'm going to choose 37.  It's a nice value.
Let's say you want to see whether $scalar1 and $scalar2 are both equal
to 37.

    if ($scalar1 == 37 && $scalar2 == 37) {
	# do case when both are 37
    } else {
	# do case when either one isn't 37
    } 

Of course, if you had chosen as your random value "perl", then it would 
look rather different; that is:

    if ($scalar1 eq 'perl' && $scalar2 eq 'perl') {
	# do case when both are perl
    } else {
	# do case when either one isn't perl
    } 

And of course, if you have Perlian Nature, instead of numeric or
stringwise equality, you might write something more like this:

    if ($scalar1 =~ /^perl$/ && $scalar2 =~ /^perl$/) {
	# do case when both are perl
    } else {
	# do case when either one isn't perl
    } 

or more conservatively like this:

    if ($scalar1 =~ /^\s*perl\s*$/si && $scalar2 =~ /^\s*perl\s*$/si) {
	# do case when both are perl
    } else {
	# do case when either one isn't perl
    } 

This doesn't extend well to a zillion values.  However, this isn't bad:

    if (3 == grep { $_ == 37 } $scalar1, $scalar2, $scalar3) {
	# do case when all three variables are 37
    } else {
	# do case when at least one isn't 37
    } 

or

    if (3 == grep { $_ eq 'perl' } $scalar1, $scalar2, $scalar3) {
	# do case when all three variables are perl
    } else {
	# do case when at least one isn't perl
    } 

And the pattern version is nifty:

    if (3 == grep { /^perl$/ } $scalar1, $scalar2, $scalar3) {
	# do case when all three variables are perl
    } else {
	# do case when at least one isn't perl
    } 

    if (3 == grep { /^\s*perl\s*$/si } $scalar1, $scalar2, $scalar3) {
	# do case when all three variables are perl
    } else {
	# do case when at least one isn't perl
    } 

That's a bit magical though, because if you add $scalar4, you might
forget to cahnge the leading 3 to 4.  It's slightly better in the
case of a generic array.

    if (@array == grep { $_ == 37 } @array) { 
	# do case when all members of the array are 37
    } else {
	# do case when at least one isn't 37
    } 

or with eq:

    if (@array == grep { $_ eq 'perl' } @array) { 
	# do case when all members of the array are perl
    } else {
	# do case when at least one isn't perl
    } 

or case-insensibly with eq:

    if (@array == grep { lc() eq 'perl' } @array) { 
	# do case when all members of the array are perl
    } else {
	# do case when at least one isn't perl
    } 

or embracing the Path of Perl, with a pattern match:

    if (@array == grep { /^perl$/si } @array) { 
	# do case when all members of the array are perl
    } else {
	# do case when at least one isn't perl
    } 

And yes, these pretty much all whinge at you if something isn't defined
and you didn't forget to use the -w flag, like if there are holes in
the array.  But you often want this alert.

Since I can use any value, I'll now define "any value" to be "any true
value".  Life if really very much simpler if you can manage arrange your
data so this definition works for you.  Often you can.

    if ($scalar1 || $scalar2 || $scalar3) {
	# do case when one or more are true
    } else {
	# do case when all are false
    } 

or you could use

    unless ($scalar1 || $scalar2 || $scalar3) {
	# do case when all are false
    } else {
	# do case when one or more are true
    } 

Which is much better than some crazy De Morgan transformation.

If you're wholly concerned about holes:

    if (@array == grep { defined() } @array) { 
	# do case when all members of the array are defined
    } else {
	# do case when at least one isn't defined
    } 

I'll bet you didn't expect this posting. :-)

--tom
-- 
Fancy algorithms are slow when n is small, and n is usually small. --Rob Pike


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

Date: 29 Jul 1999 21:34:32 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Help install
Message-Id: <7nqhd8$s9$1@gellyfish.btinternet.com>

On Thu, 29 Jul 1999 21:41:41 +0300 Igor Lior wrote:
> Hello!
> Help me to install Perl Win32 on server Apache 1.3.6 (Win32)
> 

Download Perl for Win32 from <http://www.activestate.com/ActivePerl/>
and install it (i.e. run the executable and answer the question as
appropriate) then read the relevant part of the Win32 specific FAQ
that has been installed in the Activeperl item in your start menu.

If you have any further questions about the configuration of your
web server to do anything then you will want to ask in the group
comp.infosystems.www.servers.ms-windows

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Thu, 29 Jul 1999 22:30:14 GMT
From: Mac Xie <yxie@po-box.mcgill.ca>
Subject: How do I access the array stored in a given memory location?
Message-Id: <37A0D512.F2E894BB@po-box.mcgill.ca>

Hi,

I like to ask someone to help me on the following problem.


Here is the code:
------------------------

foreach $i (@temp)
{
   undef @array;
   ....
   $hash{$i} = \@array;
}


I am using the same @array for different $i. However, information in
@array is not appended.

when I did "print %hash;"   here is an example of what I get.

304-200-1ARRAY(0x2aaa08)304-487-1ARRAY(0x2aaa08)304-487-2ARRAY(0x2aaa08)304-211-1ARRAY(0x2aaa08)304-211-2ARRAY(0x2aaa08)

I noticed that the memory addresses for each key are the same!

And then I tried to obtain the contents in the hash by doing the
following in another procedure:
---------------------
foreach $j (keys %hash)
{
    print "$j  ";
   foreach $k(@ {$hash{$j}})
   {
     print "$k ";
   }
   print "\n"; 
}


I was able to obtain the values inside the array only if the hash
contains one key and one scalar. However, if there are more than one set
of values, then nothing will be displayed.

I suspect the problem is that I am using the same array for different
keys.
Or maybe there is other problem that i am not aware of. 

My objective is to obtain all the information inside %hash.

So how do i solve this problem ?


Thank you in advance.
Xie


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

Date: Thu, 29 Jul 1999 15:43:26 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: How do I access the array stored in a given memory location?
Message-Id: <MPG.120a78ea76f02bc7989d73@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <37A0D512.F2E894BB@po-box.mcgill.ca> on Thu, 29 Jul 1999 
22:30:14 GMT, Mac Xie <yxie@po-box.mcgill.ca> says...
 ...
> foreach $i (@temp)
> {
>    undef @array;
>    ....
>    $hash{$i} = \@array;
> }
> 
> 
> I am using the same @array for different $i. However, information in
> @array is not appended.
 ...
> I suspect the problem is that I am using the same array for different
> keys.

It is.  There are two approaches, equally acceptable.

  foreach $i (@temp)
  {
     my @array;
     ....
     $hash{$i} = \@array;
  }

  foreach $i (@temp)
  {
     undef @array;
     ....
     $hash{$i} = [ @array ];
  }

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 29 Jul 1999 21:14:19 GMT
From: M.Ray@ulcc.ac.uk (Malcolm Ray)
Subject: Re: How to determine a date in the past
Message-Id: <slrn7q1h1b.cu5.M.Ray@carlova.ulcc.ac.uk>

On 29 Jul 1999 17:27:18 GMT, Mesarchm <mesarchm@aol.com> wrote:
>This will subtract 1 day from the current date.  You can change how far it goes
>back my adding to the 24,60,60 (Days, Hours, Minutes)
>
>my ($ss, $mi, $hh, $dd, $mm, $yy) = localtime(time - (*24 * 60 * 60));

What about days which don't have 24 hours?
-- 
Malcolm Ray                           University of London Computer Centre


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

Date: 29 Jul 1999 15:59:05 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: How to determine a date in the past
Message-Id: <37a0cea9@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, 
    M.Ray@ulcc.ac.uk (Malcolm Ray) writes:
:What about days which don't have 24 hours?

man perlfaq4

  How do I find yesterday's date?

    The `time()' function returns the current time in seconds since
    the epoch. Take twenty-four hours off that:

        $yesterday = time() - ( 24 * 60 * 60 );

    Then you can pass this to `localtime()' and get the individual
    year, month, day, hour, minute, seconds values.

    Note very carefully that the code above assumes that your days
    are twenty-four hours each. For most people, there are two days
    a year when they aren't: the switch to and from summer time
    throws this off. A solution to this issue is offered by Russ
    Allbery.

        sub yesterday {
            my $now  = defined $_[0] ? $_[0] : time;
            my $then = $now - 60 * 60 * 24;
            my $ndst = (localtime $now)[8] > 0;
            my $tdst = (localtime $then)[8] > 0;
            $then - ($tdst - $ndst) * 60 * 60;
        }
        # Should give you "this time yesterday" in seconds since epoch relative to
        # the first argument or the current time if no argument is given and
        # suitable for passing to localtime or whatever else you need to do with
        # it.  $ndst is whether we're currently in daylight savings time; $tdst is
        # whether the point 24 hours ago was in daylight savings time.  If $tdst
        # and $ndst are the same, a boundary wasn't crossed, and the correction
        # will subtract 0.  If $tdst is 1 and $ndst is 0, subtract an hour more
        # from yesterday's time since we gained an extra hour while going off
        # daylight savings time.  If $tdst is 0 and $ndst is 1, subtract a
        # negative hour (add an hour) to yesterday's time since we lost an hour.
        #
        # All of this is because during those days when one switches off or onto
        # DST, a "day" isn't 24 hours long; it's either 23 or 25.
        #
        # The explicit settings of $ndst and $tdst are necessary because localtime
        # only says it returns the system tm struct, and the system tm struct at
        # least on Solaris doesn't guarantee any particuliar positive value (like,
        # say, 1) for isdst, just a positive value.  And that value can
        # potentially be negative, if DST information isn't available (this sub
        # just treats those cases like no DST).
        #
        # Note that between 2am and 3am on the day after the time zone switches
        # off daylight savings time, the exact hour of "yesterday" corresponding
        # to the current hour is not clearly defined.  Note also that if used
        # between 2am and 3am the day after the change to daylight savings time,
        # the result will be between 3am and 4am of the previous day; it's
        # arguable whether this is correct.
        #
        # This sub does not attempt to deal with leap seconds (most things don't).
        #
        # Copyright relinquished 1999 by Russ Allbery <rra@stanford.edu>
        # This code is in the public domain

-- 
Churchill's Commentary on Man: Man will occasionally stumble over the
truth, but most of the time he will pick himself up and continue on.


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

Date: 29 Jul 1999 15:54:38 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: How to trim a String
Message-Id: <37a0cd9e@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, 
    Uri Guttman <uri@sysarch.com> writes:
:>>>>> "FN" == Faisal Nasim <swiftkid@bigfoot.com> writes:
:  FN> ( local $_ = shift ) =~ s/^\s+|\s+$//gs;
:	$_[0] =~ s/^\s+|\s+$//g;
:and no need for the /s as there is no . in the regex.

But there is a ^ and a $.

Anyway, do you two realize how slow your approach is?

--tom
-- 
"Of course, on the system *I* administrate, vi is symlinked to ed.
Emacs has been replaced by a shell script which 1) Generates a syslog
message at level LOG_EMERG; 2) reduces the user's disk quota by 100K;
and 3) RUNS ED!!!!!!" -- Patrick J. LoPresti


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

Date: Thu, 29 Jul 1999 16:30:40 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: How to trim a String
Message-Id: <x3y6733dwr3.fsf@tigre.matrox.com>


lr@hpl.hp.com (Larry Rosler) writes:

> Why do we persist in showing inefficient solutions, when the efficient 
> ones are just as easy to learn?
> 
>       $str =~ tr/ //d;

I totally agree .. and this is even one whole character shorter for
the lazy person in you:

	$str =~ y/ //d;

Ala



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

Date: Thu, 29 Jul 1999 16:14:56 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: I need fast help
Message-Id: <x3y7lnjdxhc.fsf@tigre.matrox.com>


ladlad@my-deja.com writes:

> Use
> open(MY,">FILETST");

NO! NEVER!
ALWAYS check whether your open() succeeded or not, or else you'll be
writing to an undefined filehandle and will lose all your data:

	open MY, ">FILETEST" 
		or die "Couldn't create FILETEST: $!\n";

HTH,
Ala



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

Date: Thu, 29 Jul 1999 22:40:07 GMT
From: Savio Fonseca <savio.fonseca@usa.net>
Subject: Installing modules - make errors
Message-Id: <7nql85$ao1$1@nnrp1.deja.com>



Hi -,
I am trying to install a CRYPT module  in perl and as per the install
instructions, one does the following:

                    perl Makefile.PL
                    make
                    make test
                    make install.

However, I am getting errors in the "make" section itself. The include
is looking for a file
    <machine/types.h> which is not present.
However, I have set the Makefile Include Path to use /usr/include/sys as
:
 CCFLAGS= -I/usr/local/include -I/usr/include/sys
                    (where the types.h file is present)

 I still keep seeing a lot of errors in the make process.

 Does anyone have a solution to this ?

 Thanx

 Savio Fonseca
--
To abandon something halfway is to fail completely


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: 29 Jul 1999 15:35:47 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: is process still running?
Message-Id: <37a0c933@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, 
    mrduane@my-deja.com writes:
:Is there a function call available that can tell me if a UNIX process is
:still running, given that I have the pid?

Try comp.unix.programmer

--tom
-- 
    /* now make a new head in the exact same spot */
            --Larry Wall in cons.c from the perl source code


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

Date: Thu, 29 Jul 1999 18:43:51 -0400
From: HC <carvdawg@patriot.net>
Subject: Re: LanMAN error!
Message-Id: <37A0D927.15BD876E@patriot.net>

Giovanni,

I'm not sure I understand your logic...it seems flawed.  If you are using a
file
that contains all the names of the servers, then you shouldn't be getting the
error you are reporting...that the function is dying if it hits a server that
is not
an NT machine.  Just take that machine out of the list!

I've run into a very similar problem in the past, and was told by Jens that
basically
he couldn't reproduce it.  You should try contacting Jens to see what he has to

say about it.

Giovanni Davila wrote:

> I'm trying to retrieve all shares on NT servers but if the server is not an
> NT machine then I get this error: "Error: Runtime exception" and my program
> aborts!
>
> I'm using NetShareEnum and I'm running a script that looks for a file that
> contains all the server names.
>
> Anyone knows how to continue with the program execution and not abort?
> Thank you.



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

Date: 29 Jul 1999 20:50:00 GMT
From: lt lindley <ltl@rgsun5.viasystems.com>
Subject: Re: NEWSFLASH: Supremes rule anti-advert-ware illegal
Message-Id: <7nqepo$99b$1@rguxd.viasystems.com>

Jonathan Stowe <gellyfish@gellyfish.com> wrote:

:>Spooky - no sooner had I posted that than 207.87.178.66 showed up in my
:>server log <shiver>

Inside joke?

ksh: nslookup
> set q=ptr
> 66.178.87.207.in-addr.arpa
*** ... can't find 66.178.87.207.in-addr.arpa: Non-existent host/domain
> 

Or is there another method to find the source of that mysterious address?

-- 
// Lee.Lindley   /// Programmer shortage?  What programmer shortage?
// @bigfoot.com  ///  Only *cheap* programmers are in short supply.
////////////////////    50 cent beers are in short supply too.


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

Date: 29 Jul 99 20:39:40 GMT
From: pijll@phys.uu.nl (Eugene van der Pijll)
Subject: Re: OOP question.
Message-Id: <pijll.933280780@ruunat.phys.uu.nl>

In <7nqdhm$l5n$1@towncrier.cc.monash.edu.au> damian@cs.monash.edu.au (Damian
Conway) writes:
>pijll@phys.uu.nl (Eugene van der Pijll) writes:
>   > But you're using two classes, that looks like cheating to me.
>I didn't see anything about not using other classes as well.

Well, the words of the original poster were:
   I came across an exercise that instructed
   me to create a class C that inherits from classes A and B in that
   order. The trick was, if a C object should have a particular value (in
   this case, instance variable "name" has value "blah") the order of
   inheritance should be reversed.

It's quite explicit: the class C should inherit from A and B, or B and A.
As this sounds like an exercise in a book, or something like that,
I presume that that's exactly what they (the author(s) of the book) mean.

>Besides, genius consists of knowing when to draw outside the lines ;-)

>   > Besides, it's not a correct solution, IMHO:
>   > what if the name of an object is changed?
>   > $c1->set_name('blah') should rebless $c1 into the package AntiC, no?

>Sure, but that wasn't part of the original spec.

Hmmm.  It says "if a C object should have a particular value...". I
suppose this could be taken to mean: at creation of the option, but
that does not sound very useful to me. (Not that I can come up with
a useful application for my code :-).

>   > My solution would be to have 1 class only, but with an @ISA which is
>   > only determinated when a method is called:

>It also assumes that C is accessed *only* through its inherited methods -
>that's C's methods do nothing of their own. In my experience, that
>never happens.

This objection I don't understand. Why can't I place a method in C?
As this method then exists, AUTOLOAD would not be called, so @ISA
would not be set, but you don't need @ISA in this case, as
the method is defined in C.

In fact, I think your code is worse in this regard: each method that
you would normally put in C, you now have to put in both C and AntiC.

>If you *really* needed all C objects to be actually blessed into class C,
>that wouldn't be hard to achieve (and without jiggling @ISA on the fly):

<snip another implementation>

>Now both $c1 and $c2 are C's, but all method requests are
>forwarded to the appropriate helper class, which takes care of
>the desired inheritance order. Note that methods can be added to
>either helper class, as is usually required.

Ah, you mean, you want the two classes to differ in more than their
inheritance order. OK, in that case, two sep(e|a)rate classes would
be my first choice as well. But my understanding of the problem was
that the inheritance order would be the only difference.

>This version is a more traditional implementation of the
>envelope/letter idiom, but gains us very little in Perl, apart from the
>satisfaction of having ref return 'C' on both objects. And the cost of
>that satisfaction, in terms of method call overhead, is substantial.

Well, I think that in overhead, my implementation still wins. I tested
my solution (after Randal pointed out something to do with a "lookup
table"), and it seems to be 10 to 20 times slower then 'normal'
multiple inheritance. This was quite a pleasant surprise to me: as I 
had not heard of that cache, I often have been a bit wary of OOP
because of the overhead.

>And, of course, it carries the heavy karmic burden of having "cheated".

Eh, you did see that smiley that I did not put there, right? :-)

BTW, I do hope you realise that the code I posted did not come from
some "real" program, that I have never produced something like it,
and that I probably never will...

Eugene
--
         \
      Eugene van der Pijll  : pijll@phys.uu.nl
--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--


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

Date: 29 Jul 1999 15:50:41 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: OOP question.
Message-Id: <37a0ccb1@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, pijll@phys.uu.nl (Eugene van der Pijll) writes:
:two sep(e|a)rate classes 

And what, pray tell, is "sep(e|a)rate"?

--tom
-- 
    "That's okay.  Anyone whose opinion he cares about already knows that
    he doesn't care about their opinion."
    	--Larry Wall


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

Date: 29 Jul 1999 22:55:09 GMT
From: damian@cs.monash.edu.au (Damian Conway)
Subject: Re: OOP question.
Message-Id: <7nqm4d$sur$1@towncrier.cc.monash.edu.au>

pijll@phys.uu.nl (Eugene van der Pijll) writes:

   > In <7nqdhm$l5n$1@towncrier.cc.monash.edu.au> damian@cs.monash.edu.au (Damian
   > Conway) writes:
   > >pijll@phys.uu.nl (Eugene van der Pijll) writes:
   > >   > But you're using two classes, that looks like cheating to me.
   > >I didn't see anything about not using other classes as well.

   > Well, the words of the original poster were:
   >    I came across an exercise that instructed
   >    me to create a class C that inherits from classes A and B in that
   >    order. The trick was, if a C object should have a particular value (in
   >    this case, instance variable "name" has value "blah") the order of
   >    inheritance should be reversed.

Objection, m'lud! It doesn't say "reversed _in class C_"! :-)


   > >   > My solution would be to have 1 class only, but with an @ISA which is
   > >   > only determinated when a method is called:

   > >It also assumes that C is accessed *only* through its inherited methods -
   > >that's C's methods do nothing of their own. In my experience, that
   > >never happens.

   > This objection I don't understand. Why can't I place a method in C?
   > As this method then exists, AUTOLOAD would not be called, so @ISA
   > would not be set, but you don't need @ISA in this case, as
   > the method is defined in C.

And what if it calls SUPER::method? Then you're stuck with C's default
inheritance, unless you do the local @ISA trick in every explicit
method as well :-(


   > In fact, I think your code is worse in this regard: each method that
   > you would normally put in C, you now have to put in both C and AntiC.

Unless they both inherit it from D :-)


   > <snip another implementation>

   > >Now both $c1 and $c2 are C's, but all method requests are
   > >forwarded to the appropriate helper class, which takes care of
   > >the desired inheritance order. Note that methods can be added to
   > >either helper class, as is usually required.

   > Ah, you mean, you want the two classes to differ in more than their
   > inheritance order. OK, in that case, two sep(e|a)rate classes would
   > be my first choice as well. But my understanding of the problem was
   > that the inheritance order would be the only difference.

Well, since it's a stupid exercise in the first place, that may well be
the case :-)


   > BTW, I do hope you realise that the code I posted did not come from
   > some "real" program, that I have never produced something like it,
   > and that I probably never will...

No one's accusing you, Eugene.

You were smart enough to solve the problem that way,
so you're certainly smart enough *not* solve the problem that way. :-)

Damian


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

Date: Thu, 29 Jul 1999 17:08:47 -0700
From: "news.mdo.net" <norris@mdo.net>
Subject: Outputting a HTTP Header
Message-Id: <jn3o3.941$IE.19784@typ21b.nn.bcandid.com>

Hi all,
 I am trying to figure out how to redirect to a document that is in a
password protected directory on NT system without giving that
login/password information to the user. Can I override the HTTP headers and
replace them with what I want to use and will NT parse and accept them
before automatically kicking out a login request to the user?

Something like this:?

sub give_access {
print "Location:  $url/protected/\n\n";
print "REMOTE_USER = $user\n";
print "AUTH_PASS = $pass\n";
}


thanks!!!
jason@purehtml.com




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

Date: 29 Jul 1999 21:42:29 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: paging text
Message-Id: <7nqhs5$sc$1@gellyfish.btinternet.com>

On Thu, 29 Jul 1999 13:50:48 -0400 John Pavlakis wrote:
> How do I page text read from STDIN or a file so it does not scroll all at
> once? I am using NT and Unix. Thank you.
> 

If you want to do this purely in Perl then you will want to count
the number of lines output and when that gets to the number of lines
that will fit on the screen you pause until the user supplies some
indication that they want to continue then go back and start counting the 
lines from 1 again.

Of course you might be better off with whatever pager it is that you might
find on your system - more, less, pg.  Hey you might be able to scroll
back up your output in your command prompt without doing anything.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Thu, 29 Jul 1999 17:36:49 -0400
From: "John Pavlakis" <johnp@vcimail.com.remove.me>
Subject: Re: paging text
Message-Id: <rq1idb$0$37nspbj$3e@corp.supernews.com>

That was bad...

I tried piping to more within the script, and when you press "q" to exit
more, it doesn't exit. Is there a built in function or do I have to do some
nasty shit like reading the number of lines in the console and setting up a
format to stop at the end of a screen? Sounds messy and unportable.

--
John Pavlakis
Systems Administrator
http://www.virtualcommunitiesinc.com
Remove the "remove.me" from my email
johnp@vcimail.com.remove.me
Greg Bacon <gbacon@itsc.uah.edu> wrote in message
news:7nq7bs$9kk$1@info2.uah.edu...
> In article <37A0A798.3C9CE689@cybersurf.net>,
> Matt <mattk@cybersurf.net> writes:
> : you need to read _more_ documentation
>
> In this case, it could also be better to read less documentation. :-)
>
> Greg
> --
> The great mass of men lead lives of quiet desperation.
>     -- Thoreau




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

Date: 29 Jul 1999 21:33:50 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Perl 5.005_58 ... a bug.
Message-Id: <7nqhbu$q74$1@charm.magnus.acs.ohio-state.edu>

[A complimentary Cc of this posting was sent to Daniel Grisinger 
<dgris@perrin.dimensional.com>],
who wrote in article <m3pv1b1c6o.fsf@moiraine.dimensional.com>:
> "Faisal Nasim" <swiftkid@bigfoot.com> writes:
> 
> > perl -V is broken!

> You can't run _58 properly without first applying the tiny
> patch Ilya posted[0] to p5p shortly after _58 was released.

Yes, it was my fault.  But *unless* you want -V working (which I
appreciate a lot!), this patch is not needed.  Apparently nothing else
uses these exports from Config which my (earlier) memory-saving patch
broke.

Ilya


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

Date: Thu, 29 Jul 1999 21:10:33 GMT
From: Ilya <ilya@speakeasy.org>
Subject: Problems compiling Perl 5.005.02 on HP-UX 10.20
Message-Id: <rq1gq9$0$37nspbj$3e@corp.supernews.com>

Here is the output of make command. Why is this happening and what can be done
about it?


root#glaxapp7:/usr/local/bin/perl-5.005.02 > make
        `sh  cflags libperl.a miniperlmain.o`  miniperlmain.c
          CCCMD =  gcc -DPERL_CORE -c -D_HPUX_SOURCE -I/usr/local/include -O   
In file included from /usr/local/lib/gcc-lib/hppa1.1-hp-hpux/2.5.8/include/sys/param.h:30,
                 from /usr/include/limits.h:313,
                 from /usr/local/lib/gcc-lib/hppa1.1-hp-hpux/2.5.8/include/syslimits.h:9,
                 from /usr/local/lib/gcc-lib/hppa1.1-hp-hpux/2.5.8/include/limits.h:14,
                 from /usr/include/locale.h:65,
                 from perl.h:338,
                 from miniperlmain.c:11:
/usr/include/sys/time.h:455: warning: `FD_SET' redefined
/usr/local/lib/gcc-lib/hppa1.1-hp-hpux/2.5.8/include/sys/types.h:227: warning: this is the location of the previous definition
/usr/include/sys/time.h:464: warning: `FD_CLR' redefined
/usr/local/lib/gcc-lib/hppa1.1-hp-hpux/2.5.8/include/sys/types.h:228: warning: this is the location of the previous definition
/usr/include/sys/time.h:468: warning: `FD_ZERO' redefined
/usr/local/lib/gcc-lib/hppa1.1-hp-hpux/2.5.8/include/sys/types.h:232: warning: this is the location of the previous definition
/usr/include/sys/time.h:492: warning: `FD_ISSET' redefined
/usr/local/lib/gcc-lib/hppa1.1-hp-hpux/2.5.8/include/sys/types.h:229: warning: this is the location of the previous definition
In file included from /usr/local/lib/gcc-lib/hppa1.1-hp-hpux/2.5.8/include/sys/param.h:30,
                 from /usr/include/limits.h:313,
                 from /usr/local/lib/gcc-lib/hppa1.1-hp-hpux/2.5.8/include/syslimits.h:9,
                 from /usr/local/lib/gcc-lib/hppa1.1-hp-hpux/2.5.8/include/limits.h:14,
                 from /usr/include/locale.h:65,
                 from perl.h:338,
                 from miniperlmain.c:11:
/usr/include/sys/time.h:337: warning: useless keyword or type name in empty declaration
/usr/include/sys/time.h:444: conflicting types for `fd_set'
/usr/local/lib/gcc-lib/hppa1.1-hp-hpux/2.5.8/include/sys/types.h:225: previous declaration of `fd_set'
In file included from /usr/local/lib/gcc-lib/hppa1.1-hp-hpux/2.5.8/include/stdlib.h:258,
                 from perl.h:367,
                 from miniperlmain.c:11:
/usr/include/pwd.h:29: parse error before `int32_t'
/usr/include/pwd.h:29: warning: no semicolon at end of struct or union
/usr/include/pwd.h:31: parse error before `}'
/usr/include/pwd.h:67: parse error before `int32_t'
/usr/include/pwd.h:67: warning: no semicolon at end of struct or union
/usr/include/pwd.h:69: parse error before `}'
/usr/include/pwd.h:80: warning: parameter names (without types) in function declaration
In file included from /usr/include/sys/stat.h:25,
                 from perl.h:531,
                 from miniperlmain.c:11:
/usr/include/sys/_stat_body.h:22: parse error before `blkcnt_t'
/usr/include/sys/_stat_body.h:22: warning: no semicolon at end of struct or union
/usr/include/sys/_stat_body.h:23: parse error before `:'
/usr/include/sys/_stat_body.h:24: parse error before `:'
/usr/include/sys/_stat_body.h:25: parse error before `:'
/usr/include/sys/_stat_body.h:52: parse error before `st_spare4'
/usr/include/sys/_stat_body.h:52: warning: data definition has no type or storage class
/usr/include/sys/_stat_body.h:53: parse error before `}'
In file included from /usr/local/lib/gcc-lib/hppa1.1-hp-hpux/2.5.8/include/signal.h:8,
                 from unixish.h:93,
                 from perl.h:1112,
                 from miniperlmain.c:11:
/usr/local/lib/gcc-lib/hppa1.1-hp-hpux/2.5.8/include/sys/signal.h:474: field `sl_ss' has incomplete type
*** Error exit code 1

Stop.


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

Date: Thu, 29 Jul 1999 22:40:04 GMT
From: Ilya <ilya@speakeasy.org>
Subject: Re: Problems compiling Perl 5.005.02 on HP-UX 10.20
Message-Id: <rq1m24$0$37nspbj$3e@corp.supernews.com>

In comp.lang.perl.misc Ilya <ilya@speakeasy.org> wrote:
> Here is the output of make command. Why is this happening and what can be done
> about it?

BTW, here is the error I get when I run sh Configure:


Checking to see how many bits your rand function produces...
In file included from /usr/include/unistd.h:11,
                 from try.c:5:
/usr/include/sys/unistd.h:374: parse error before `ualarm'
/usr/include/sys/unistd.h:374: warning: parameter names (without types) in function declaration
/usr/include/sys/unistd.h:374: warning: data definition has no type or storage class
/usr/include/sys/unistd.h:375: warning: parameter names (without types) in function declaration
In file included from /usr/local/lib/gcc-lib/hppa1.1-hp-hpux/2.5.8/include/stdlib.h:258,
                 from try.c:8:
/usr/include/pwd.h:29: parse error before `int32_t'
/usr/include/pwd.h:29: warning: no semicolon at end of struct or union
/usr/include/pwd.h:31: parse error before `}'
/usr/include/pwd.h:67: parse error before `int32_t'
/usr/include/pwd.h:67: warning: no semicolon at end of struct or union
/usr/include/pwd.h:69: parse error before `}'
/usr/include/pwd.h:80: warning: parameter names (without types) in function declaration
(I can't seem to compile the test program...)
How many bits does your rand() function produce? [?] 


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

Date: 29 Jul 1999 21:13:52 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: running Perl and Linux from a boot-cd?
Message-Id: <7nqg6g$s4$1@gellyfish.btinternet.com>

On Thu, 29 Jul 1999 13:11:32 +0200 Thomas Weholt wrote:
>> the part of what you want to do that's actually relevant to this group is
>> trivial .. ie. have perl available on a CD
> 
> I meant available like ready to run. You mean perhaps an package ready
> to install. 
> 

Yes. You have a bootable CD with an OS it, you will have installed Perl
on whatever system you made the image from.
> 
> Yes, I know it`s a little off topic. 
> 

Its entirely off-topic - youre question is : "How do I a make a bootable
CD based on a live Linux system" ask in a Linux NG.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 29 Jul 1999 21:51:08 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: two forms interact with one script?
Message-Id: <7nqicc$sm$1@gellyfish.btinternet.com>

On Thu, 29 Jul 1999 20:37:50 +0200 Niek Slatius wrote:
> This is the perl code:
> ----------------------------------------------------------------------
> #!/usr/bin/perl
> 

You really should want to use :

#!/usr/bin/perl -w

use strict;

> # insert code for parsing incoming formcode to be handled in perl
> require "formparse.pl";
> 

use CGI qw(:standard);

> elseif($FORM{'name2'})

that should be elsif

> 
> BTW... what's CGI.pm? Some debugging tool? (I'm a newbie, forgive me)
> 

It is a module that comes standard with all recent Perl distributions.

You can find out more about with:

   man CGI

or

   perldoc CGI

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 1 Jul 99)
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.misc (and this Digest), send your
article to perl-users@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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V9 Issue 302
*************************************


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