[7085] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 710 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jul 9 00:17:24 1997

Date: Tue, 8 Jul 97 17:00:42 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 8 Jul 1997     Volume: 8 Number: 710

Today's topics:
     Re: Best idiom for defaulting, getting & untainting an  (dave)
     Re: Can an array have two subscripts (i.e., @array (i,j <rootbeer@teleport.com>
     Checking for HTTP open connection <kman@cfer.com>
     deleting a record... <serginho@alpha.hydra.com.br>
     Re: deleting a record... <rootbeer@teleport.com>
     Re: FOR QUESTION <rootbeer@teleport.com>
     Re: Function pointers in PERL (Andrew M. Langmead)
     Re: Function pointers in PERL <rootbeer@teleport.com>
     Re: hashes of hashes in perl5 (Bob Wilkinson)
     Re: How do you do a 'cut -cx-y' with Perl? (John C. Randolph)
     How to access serial ports in WIN/DOS environment? <charlie@flychina.com>
     Re: How to make the same changes to many files. <Dskramer@concentric.net>
     how to s '?' ? <ymc@umich.edu>
     Re: how to s '?' ? (brian d foy)
     Re: I just dont't get this -- opening a new filehandle (Billy Chambless)
     Re: IF Problem <rootbeer@teleport.com>
     Inheritance in Packages? (Calle ]sman)
     Re: Installing libwww-perl-5.10 on perl 5.004_01 fo NT  (Jamie O'Shaughnessy)
     libwww won't compile.... <ghartman@aurora-bbs.nl>
     Re: Memory problem with reading file <rootbeer@teleport.com>
     perl CGI on NT- can't read CGI.pm <joelaff@laffey-stl.com>
     Re: Problem with pack() and unsigneds (Charles DeRykus)
     Script to add Verilog sensitivity lists <cimenti@segsrv.hlo.dec.com>
     Re: SIGCHLD handler not being called consistently (Jeff Stampes)
     Re: Statistic functions for PERL? <rootbeer@teleport.com>
     TIMES function <qwu@xyplex.com>
     Re: Trapping system errors <rootbeer@teleport.com>
     Use of Win32::File and official perl5.004_01 on NT and  (Jamie O'Shaughnessy)
     Re: Using SFIO with perl5.004 on NT (Gurusamy Sarathy)
     Re: Why use 'use strict' ??? (Andrew M. Langmead)
     Re: Why use 'use strict' ??? (Simon Hyde (aka Jeckyll))
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Tue, 08 Jul 1997 22:00:00 GMT
From: over@the.net (dave)
Subject: Re: Best idiom for defaulting, getting & untainting an env variable.
Message-Id: <33c2b85d.2803591@news.one.net>

mike@stok.co.uk (Mike Stok) wrote:

>In article <33c168fe.4150187@news.one.net>, dave <over@the.net> wrote:
>>
>>Right now I'm doing:
>>
>>$inval = "defaultval" unless $inval = $ENV{INVAL};
>>$inval = $1 if $inval =~ /^(expression)$/;    # untaint
>>
>>Since I assume this might be required a lot, I'm looking for simpler
>>alternatives.
>
>If you care about security then you'll consider exactly what expression to
>put in the regex - ([\s\S]*) may work, but what are the implications?
>

Thanks,

The particular environment variable I am using defines a file
containing a perl fragment to be executed via a do statement.  My
expression is therefore ([\w.]+) so that the variable is only
untainted when it is a simple alphanumeric filename with/without an
extension.

I believe this is using untainting with the correct intent and method.


Dave
|
| Please visit me at http://w3.one.net/~dlripber
|
| For reply by email, use:
| dlripber@one.net
|________


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

Date: Mon, 7 Jul 1997 07:11:54 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: F J Deng <fdeng@cc.memphis.edu>
Subject: Re: Can an array have two subscripts (i.e., @array (i,j))?
Message-Id: <Pine.GSO.3.96.970707070806.9019G-100000@kelly.teleport.com>

On Sun, 6 Jul 1997, F J Deng wrote:

> Can an array have two subscripts, such as @array(i,j)? 

Yes and no. The short answer is that "Perl does not have multi-dimensional
arrays". But you can make your own data structures very easily, with
references. (Although they aren't really multi-dimensional array, you can
use them to do the same tasks.)

    $foo[7][9] = "This is row 7 column 9";

For more information about this, check out the manpages perlref, perllol,
and perldsc. Hope this helps! 

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: Mon, 07 Jul 1997 21:06:20 -0200
From: "Kevin B. Rich" <kman@cfer.com>
Subject: Checking for HTTP open connection
Message-Id: <33C1766C.7C95@cfer.com>

I am working on a PERL 5.003 script for our intranet and need to run a
continuous action on a file as long as the users browser is connected to
the server and have the script die when the user moves on or if the HTTP
times out. I have tried to use the various ENV strings such as
ENV{REMOTE_ADDR} but with no success. My current code looks like this :



open(FILE, filename);
while (1) {
        $scalar = ENV{REMOTE_ADDR}; # also tried ENV{'REMOTE_ADDR'}
        .... do file actions here .... 
        if ($scalar = 0) {  # also tried ($scalar eq "")        
                die;
                }
        $scalar = ""; #to reset the variable
        }
close(FILE);
exit;

The script works fine except when the user moves on, the script.cgi
process continues to run on the server. If anyone can steer me in the
right direction, it would sure be appreciated.

Please answer via e-mail if possible.

Kevin B. Rich
UNIX Systems Administrator
ConferTech International 
mailto:kman@cfer.com


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

Date: 7 Jul 1997 12:24:30 GMT
From: "Sergio Stateri Jr" <serginho@alpha.hydra.com.br>
Subject: deleting a record...
Message-Id: <01bc8ad1$12138b80$6875e7c8@Term104>

Hi! How can I delete a line from a Text File in Perl ? Like this :

line 1
line 2
line 3
line 4
<end of file>

I'd like to delete the line 3.

thanks for any help.


-- 
--------------------------------------------
Sergio Stateri Jr
Sco Paulo (SP) - Brazil
e-mail: serginho@usa.net
--------------------------------------------


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

Date: Mon, 7 Jul 1997 07:38:22 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Sergio Stateri Jr <serginho@alpha.hydra.com.br>
Subject: Re: deleting a record...
Message-Id: <Pine.GSO.3.96.970707073742.9019M-100000@kelly.teleport.com>

On 7 Jul 1997, Sergio Stateri Jr wrote:

> How can I delete a line from a Text File in Perl ? 

It sounds as if you want this entry from the FAQ. Hope this helps!

    http://www.perl.com/CPAN/doc/FAQs/FAQ/html/perlfaq5/
          How_do_I_change_one_line_in_a_fi.html

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: Mon, 7 Jul 1997 07:18:44 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Fan Ng <FANNGMAIL@prodigy.net>
Subject: Re: FOR QUESTION
Message-Id: <Pine.GSO.3.96.970707071212.9019H-100000@kelly.teleport.com>

On Mon, 7 Jul 1997, Fan Ng wrote:

>     Is someone know that    for ( ; <STDIN> ; )  
>                                                {print;} why stdin can't
> in the first or last???? and what kind the still to put in that three
> EXPR in FOR. 

I'm not sure about all of what you're asking, but I'll try anyway.

When you use the magical line input operator <STDIN> as the only thing in
the conditional of a while loop, Perl uses that as a shortcut for
defined($_ = <STDIN>) . The traditional for loop is actually a while loop
in disguise, so this trick also works there, in the conditional, as you
did. (Although Perl lets you omit the initialization and increment in the
for, you might as well make it a while loop in that case. It's easier to
understand.) 

If, on the other hand, you used the line input operator as the first or
last item in the for loop, it's not a shortcut for anything. That is to
say, in those cases nothing will be assigned to $_ . The magical
assignment to $_ happens only in the conditional of a while (or for) loop.

So, what you usually want is something like this.

    # Copying input to output
    while (<STDIN>) {
	print;
    }

Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: Mon, 7 Jul 1997 13:54:38 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Function pointers in PERL
Message-Id: <ECyBz3.ICq@world.std.com>

crr026@email.mot.com writes:

>Hi!

>I'm trying to speed up a long list of if-elsif-else. Is there a simple way
>to do this without going through each condition check?

>In C (my mother tongue, :-}), there's a construct called function
>pointers. I can load an array with pointers to the functions concerned,
>and instead of going through the if-else chain, work out the index and
>jump to the function right away. Is there such a beast or technique I can
>use in Perl?

In C where you have pointers of any kind, in Perl you have
references. Pointers to functions become references to
subroutines. You can make arrays of references to functions, but the
really neat perl trick is hashes of references to functions.

%do_it = ( foo => \&do_foo, bar => \&do_bar, @otherfuncs);

$sub = $do_it{foo};

&$func(@args) if $sub;

sub do_foo {
}

sub do_bar {
}
-- 
Andrew Langmead


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

Date: Mon, 7 Jul 1997 07:33:53 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: crr026@email.mot.com
Subject: Re: Function pointers in PERL
Message-Id: <Pine.GSO.3.96.970707072917.9019J-100000@kelly.teleport.com>

On Mon, 7 Jul 1997 crr026@email.mot.com wrote:

> I'm trying to speed up a long list of if-elsif-else. Is there a simple
> way to do this without going through each condition check? 
> 
> In C (my mother tongue, :-}), there's a construct called function
> pointers. I can load an array with pointers to the functions concerned,
> and instead of going through the if-else chain, work out the index and
> jump to the function right away. Is there such a beast or technique I
> can use in Perl? 

Indeed there is; it can be done with references. I'd write an example, but
there's a good one already available in Randal's eighth column for Unix
Review magazine. 

    http://www.stonehenge.com/merlyn/UnixReview/

Of course, references are also covered in the Perl docs, in perlref(1). 
Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: Mon, 07 Jul 1997 14:46:13 +0100
From: b.wilkinson@pindar.co.uk (Bob Wilkinson)
Subject: Re: hashes of hashes in perl5
Message-Id: <b.wilkinson-0707971446130001@ip57-york.pindar.co.uk>

In article <33B8E13A.41C67EA6@merkantildata.com>, Ivar Hxsteng
<ivar.hosteng@merkantildata.com> wrote:

> I am trying to access the second level hashes in a hash of hashes like
> this:
> 
> #!/usr/bin/perl -w
> 
> $$hh{"foo"}{"test1"}="some data";
> $$hh{"foo"}{"test2"}="some other data";
> $$hh{"bar"}{"tst1"}="some data2";
> $$hh{"bar"}{"tst2"}="some other data2";
> 
> 
> foreach $i (sort keys %$hh) {
>         print "Starting dataset $i:\n";
>         foreach $j (sort keys %$hh{$i}) {
>                 print "Data for $j is $$hh{$i}{$j}\n";
>         }
> }
> 
> Is there anyone that can tell me how to do this?
> 
> -- 
> Regards,
> Ivar E. Hxsteng
> email: ivar.hosteng@merkantildata.no

Hello,

       type "perldoc perllol" for starters.

Bob

-- 
 .sig file on holiday


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

Date: 7 Jul 1997 22:35:59 -0700
From: jcr@idiom.com (John C. Randolph)
Subject: Re: How do you do a 'cut -cx-y' with Perl?
Message-Id: <5psjjv$3ak@idiom.com>

Don Wallwork <wallwork@a1.flo.med.ge.com> writes:

>I am trying to separate the fields in a file that are grouped by
>spacing.  

>Here is an example of how the file is set up:

>Name                 Phone    Alt Ph. Description      City        Ctr
>----------------------------------------------------------------------
>FLINTSTONE Fred      555 1234         Caveman          Bedrock     USA
>JETSON George        555 2651         Future Guy       Sky         USA
>LE PEW Pepe          555 2922 3421    Romantic Skunk   Paris       FR
>RUBBLE Barney        555 4321         Caveman's Buddy  Bedrock     USA
>SIMPSON Homer J.     555 9101         Nuclear Tech     Springfield USA
>0123456789012345678901234567890123456789012345678901234567890123456789
>          1         2         3         4         5         6

>(Bottom 2 rows of numbers just for reference here.)

>* Notice that number of words in each group can vary.

[munch]

>Is there a Perl operator that will do the cutting?

There are several ways to do it, the fastest at runtime would be the
unpack function.

-jcr



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

Date: 8 Jul 1997 21:13:02 GMT
From: "Charlie" <charlie@flychina.com>
Subject: How to access serial ports in WIN/DOS environment?
Message-Id: <01bc8be3$db543fe0$ab63e3c7@mail.flychina.com>

Hi, there,

Having read the FAQ's, still couldn't figure out how to communicate with
the serial port on PC, say COM1, that is, read from and write to COM1.  
I'm not sure where ioctl thing is, and how to use them.  Please shed some
light on me.  Thanks a lot!

Charlie


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

Date: Tue, 8 Jul 1997 16:30:42 -0400
From: David Kramer <Dskramer@concentric.net>
Subject: Re: How to make the same changes to many files.
Message-Id: <Pine.SUN.3.96.970708162202.22875O-100000@galileo.cris.com>

On 7 Jul 1997, Patrick Baldwin wrote:

> Date: 7 Jul 1997 22:20:08 GMT
> From: Patrick Baldwin <pbaldwin@mrst.com>
> Newsgroups: comp.lang.perl.misc
> Subject: How to make the same changes to many files.
> 
> 
> A common task I have run into working in sysadmin is making the
> same set of changes to the same file on different machines.
> 
> For example, the fstab or the auto.direct need to be changed on all 
> machines when a mounted filesystem moves, goes offline, or is added.
> 
> Is there an existing Perl tool to do this sort of thing?  
> If this tool exists, where is it?

This is the guts of a little perl program I wrote to do that.  As I was
trying to get the job done and not perfect the utility, it may not be
optimal, but it worked. It can even process multiple search/replaces on
multiple files.

Note that in =~ s/search/replace/flags, the search and replace can be
variables, but not the flags, so I used g.

*Process command line to create:
	@Files array, holding files to be processed
	@Search array, holding strings to search for
	@Replace array, holding strings to replace above with

for($x=0;$Files[$x] ne "";$x++)
{
    $BackupFile="$Files[$x].before";
    `mv $Files[$x] $BackupFile`;  #test that this works
    open(IN,"$BackupFile") || die("$0: Could not open $BackupFile: $!");
    open(OUT,"> $Files[$x]") || die("$0: Could not open $Files[$x]: $!");

    while($Line=<IN>)
    {
        print("OLD: $Line\n");
        for($x=0;$Search[$x] ne "";$x++)
        {
            $ThisSearch=$Search[$x];
            $ThisReplace=$Replace[$x];
            $ThisFlags=$Flags[$x];
            print("\t/$Search[$x]/$Replace[$x]/$Flags[$x]\n");
            $Line =~ s/$ThisSearch/$ThisReplace/g;

        }
        print("NEW: $Line\n");
        print(OUT $Line);
    }
    close(IN);
    close(OUT);

}




-------------------------------------------------------------------
DDDD    David Kramer      dskramer@concentric.net   
DK KD                     http://www.concentric.net/~dskramer
DKK D   
DK KD   Friends help you move. Real friends help you move bodies
DDDD    





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

Date: Tue, 08 Jul 1997 15:18:37 -0400
From: "Yee Man, Chan" <ymc@umich.edu>
Subject: how to s '?' ?
Message-Id: <33C2928B.50E7D2A3@umich.edu>

Hi, everybody,

I tried to substitute '?' but unsuccessful. Can you tell me how to
substitute '?' and why what I did doesn't work?

$line = 'ax?yb';
$temp = 'x?y';
$_ = $temp;
tr/a-z/A-Z/;
$line =~ s/$temp/$_/;
print $line; # what I want is 'aX?Yb' but what I get is 'ax?yb'

Any clue?
Yee Man, Chan



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

Date: Tue, 08 Jul 1997 18:57:38 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: how to s '?' ?
Message-Id: <comdog-ya02408000R0807971857380001@news.walrus.com>

In article <33C2928B.50E7D2A3@umich.edu>, "Yee Man, Chan" <ymc@umich.edu> wrote:

> I tried to substitute '?' but unsuccessful. Can you tell me how to
> substitute '?' and why what I did doesn't work?
> 
> $line = 'ax?yb';
> $temp = 'x?y';
> $_ = $temp;
> tr/a-z/A-Z/;
> $line =~ s/$temp/$_/;
> print $line; # what I want is 'aX?Yb' but what I get is 'ax?yb'


recall that ? is a meta character in this context (it matches 0 or 1
instances).  when i try your code, i get:

    ax?X?Yb

the regex tried to match zero or one 'x' next to a 'y'.  it could only
match the 'y', so that is all that was replaced.

to get your intended behaviour, you need to escape the metacharacters
before you use them in the regular expression:

#!/usr/bin/perl

my $line = 'ax?yb';
my $temp = 'x?y';

      $_ = $temp;
           tr/a-z/A-Z/;

$temp    = quotemeta($temp);  #see the man pages for the details

$line    =~ s/$temp/$_/;

print $line, "\n";

__END__

aX?Yb

-- 
brian d foy                                    comdog@computerdog.com



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

Date: 7 Jul 1997 14:22:23 GMT
From: billy@cast.msstate.edu (Billy Chambless)
Subject: Re: I just dont't get this -- opening a new filehandle
Message-Id: <5pqu2v$r2k$1@NNTP.MsState.Edu>

In article <33bc37f0.341392705@news.mindspring.com>, topaz56@one.net writes:

|> I appreciate all the help several members of this group have so
|> graciously passed along...   Now, please explain to me how
|> I will use cgi.pm on a virtual server w/ only Perl 4 available.

Maybe you should have mentioned you were using an historical artifact
instead of a current Perl interpreter. Most readers of this group would
assume you were using a current Perl unless you specify otherwise. 

|> What a bunch of assholes...

Yeah, I hope they're not charging you too much for that virtual server.

Tell those assholes to install Perl5.004 and add
comp.infosystems.www.authoring.cgi to their newsfeed.

-- 
*    "We all agree on the necessity of compromise.  We just can't agree on
*     when it's necessary to compromise."
*                --Larry Wall in  <1991Nov13.194420.28091@netlabs.com>



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

Date: Mon, 7 Jul 1997 07:28:25 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: James Steven <jsteven@sirris.com>
Subject: Re: IF Problem
Message-Id: <Pine.GSO.3.96.970707071914.9019I-100000@kelly.teleport.com>

On Sun, 6 Jul 1997, James Steven wrote:

> What's wrong with this IF Statement? Every time it executes it runs the
> first IF case, I've tried everything!
> 
> if ($subdname=="my.yagoo.com")  {

Everything except -w, perhaps? :-)

As 88 other people are even now rushing to tell you, you're using a
numeric comparison on a string, and if you'd asked perl to warn you (with
the -w option) it would have told you so. You wanted the  eq  operator,
didn't you? -w is your friend.

> $HTML_File = "my.html";
> open (HTMLOUT, "$Data_Dir\/$HTML_File");

Why are you needlessly backwhacking the slash? And (more importantly) why
aren't you checking the return value of the open?

    open HTMLOUT, "$Data_Dir/$HTML_File"
	or die "Couldn't open '$Data_Dir/$HTML_File': $!";

> read(HTMLOUT,$FinalHTMLOut,200000);
> close (HTMLOUT);
> print $FinalHTMLOut;

Did you really want to do that with a hard limit of 200000 bytes? If
that's what you want, that's all right. But maybe you want to copy the one
to the other. That can be done in chunks, which is more efficient, since
you don't load a potentially-large file into memory. And you don't run the
risk of copying only part of the file.

> } elsif ( $subdname = "cool.yagoo.com" ) {

Here you have an assignment, but I'm sure you want a test.

Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: 08 Jul 1997 09:33:39 +0200
From: md4calle@mdstud.chalmers.se (Calle ]sman)
Subject: Inheritance in Packages?
Message-Id: <w7pradaj8vg.fsf@grosse.mdstud.chalmers.se>


I created a package that looks like:
package ParseXX;
require HTML::Parser;
use HTML::Entities ();      

@ISA=qw(HTML::Parser);

sub start_map{
    my ($self,$attr, $attrseq, $origtext) = @_;
  main::store("map","+"); #nr of maps
}
#all other methods and stuff



Now I want to inherit all the methods from that one, and if I want to change
a single method it shall be override by this new package, so I tried something
like this:

package ParseNew;
require "parsern.pm";
@ISA = qw(ParseXX);

sub start_map{
       print "\n##################################################MECK20000000000000000000000000\n";
}


package main;
  my $form = new ParseNew;
  $form->netscape_buggy_comment(1); #to accept buggy netscapecomments
  $form->parse($doc);    
 
#other stuff




but somehow it still uses the old version of start_map?

anyone have an idea why?

/Calle


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

Date: Tue, 08 Jul 1997 08:36:02 GMT
From: joshaugh@uk.oracle.com (Jamie O'Shaughnessy)
Subject: Re: Installing libwww-perl-5.10 on perl 5.004_01 fo NT - problems
Message-Id: <33c1fa3f.1093657796@newshost.us.oracle.com>

On 07 Jul 1997 19:48:00 +0200, Gisle Aas <aas@bergen.sn.no> wrote:

>Patches that make the LWP test suite work on Win32 will be accepted.
>-- 
>Gisle Aas <aas@sn.no>

I'm trying to sort the problem out and am part way to understanding this.

When I run the tests as they stand I just get:

D:\perl\latest.src\libwww-perl-5.10>nmake test

Microsoft (R) Program Maintenance Utility   Version 1.61.6038
Copyright (C) Microsoft Corp 1988-1996. All rights reserved.

        rem
        ..\perl t/TEST 0
base/afm............The name specified is not recognized as an
internal or external command, operable program or batch file.
dubious
        Test returned status 0 (wstat 1)
base/common-req.....The name specified is not recognized as an
internal or external command, operable program or batch file.
dubious
        Test returned status 0 (wstat 1)

etc....

It seems to be a problems with the libwww-perl-5.10\t\TEST script. The tests
themselves run fine (when run as perl t\base\common-req.t). If I edit the
makefile to not call TEST, but instead to run a test directly, e.g.

#  $(FULLPERL) t/TEST $(TEST_VERBOSE)
   $(FULLPERL) -e "use Test::Harness qw(&runtests $$verbose);
$$verbose=$(TEST_VERBOSE); runtests @ARGV;" t\html\entities.t

Then this will run the html\entities.t test fine within the harness. So this is
why I think the TEST script is the problem. For sure I think the:

    foreach (@INC) {
	$_ = "../$_" unless m,^/,;
    }

bit of TEST is no good on Win32 as all entries in @INC are of the form
D:\perl\latest.src\lib and not the expected unix style /perl/latest.src/lib.
But this isn't the problem.

I'm working on it, but if anyone has any ideas...

Thanks,
Jamie

___________________________________________________________________________ 
Jamie O'Shaughnessy                        Work: joshaugh@uk.oracle.com 
Oracle Designer/2000 Forms Generator Team  Home: jamie@thanatar.demon.co.uk 
______________________________________________________  __  __ _  __ .   __ 
Opinions expressed here are my own and not those of... (__)|-</-\(__ |__ -_ 


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

Date: Tue, 08 Jul 1997 00:10:39 +0200
From: Guido Hartmann <ghartman@aurora-bbs.nl>
Subject: libwww won't compile....
Message-Id: <33C1695F.7F94737@aurora-bbs.nl>

Hy,

When trying to install libwww, i get (make test)

robot/ua............HTTP Server terminated
FAILED tests 1-3, 5, 7
        Failed 5/7 tests, 28.57% okay
local/autoload......ok
local/get...........ok
local/http..........HTTP Server terminated
Can't call method "is_redirect" without a package or object reference at

local/h
ttp.t line 173, <DAEMON> chunk 1.
dubious
        Test returned status 9 (wstat 2304)
DIED. FAILED tests 1-18
        Failed 18/18 tests, 0.00% okay
local/protosub......ok
Failed Test  Status Wstat Total Fail  Failed  List of failed
------------------------------------------------------------------------------

local/http.t      9  2304    18   18 100.00%  1-18
robot/ua.t                    7    5  71.43%  1-3, 5, 7
Failed 2/25 test scripts, 92.00% okay. 23/376 subtests failed, 93.88%
okay.
make: *** [test] Error 29

What do i do now? All I want is Perl support in my Apache HTTP deamon
(1.2.0, linux 2.0.28)

Who can help me?

Please email me at ghartman@aurora-bbs.nl

Many thanx in advance,
Guido Hartmann




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

Date: Mon, 7 Jul 1997 07:01:24 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Megan Webb <mwebb@mail.usyd.edu.au>
Subject: Re: Memory problem with reading file
Message-Id: <Pine.GSO.3.96.970707065750.9019E-100000@kelly.teleport.com>

On 7 Jul 1997, Megan Webb wrote:

>  I have a data file that is 27.5 Meg of ascii data,

>  Even this peaks at 200 Meg

>          @row=<TASK>;

>  What is happening?

You're reading your entire dataset into memory, and it takes up a lot of
space. If you can process it one record at a time, you'll have much less
memory load.

Another way to deal with this sort of thing is by using a tied variable to
access the data from disk. Although this sounds slow, if you're already
using virtual memory and swapping, it's probably not so bad! 

Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: Mon, 7 Jul 1997 13:59:18 -0500
From: Joe Laffey <joelaff@laffey-stl.com>
Subject: perl CGI on NT- can't read CGI.pm
Message-Id: <Pine.NEB.3.95.970707135637.29338B-100000@maat.fastrans.net>

I am trying to move my website from a UNIX server to an NT server at my
ISP.

I am having trouble getting the server to execute scripts containing
CGI.pm (latest vers.).

I get the following message:

Can't call method "import" in empty package "cgi" at
D:\pages\myhome\cgi\cgi-bin\random_img.pl line 20.
BEGIN failed--compilation aborted at
D:\pages\myhome\cgi\cgi-bin\random_img.pl line 20.

CGI.pm has a subroutine called import, but not a method... Anyone know
what is going on here or how to rectify it?

BTW, I DID set the $OS variable in CGI.pm to Windows.

Thanks,

Joe Laffey
LAFFEY Computer Imaging
St. Louis, MO
joe@laffey-stl.com
http://www.laffey-stl.com/imaging/



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

Date: Tue, 8 Jul 1997 18:41:05 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: Problem with pack() and unsigneds
Message-Id: <ED0JwI.2q8@bcstec.ca.boeing.com>

In article <33C13ADC.E040AC1B@dwx.com>, DWX  <support@dwx.com> wrote:
 > I'm attempting to create my own animated GIFs using perl; I run into a
 > problem when trying to create my own GIF Control blocks, with a line
 > like:
 > 
 > $controlblock = pack("CCCCSCC",0x21,0xF9,0x04,0x00,0,0x00,0x00);
 > 
 > The official GIF89a spec calls for:
 > 
 > byte       type         field              comments/value
 > 1          byte         extension intro    0x21
 > 2          byte         graphic ctl label  0xF9
 > 1          byte         block size         # bytes between delimit
 > 2          packed flds
 >    3 bits - reserved
 >    3 bits - disposal method (values 0-3)
 >    1 bit  - user input flag
 >    1 bit  - transparent color flag
 > 3-4        unsigned     delay time         x/100 s time to delay
 > 5          byte         transparency color idx
 > 1          block terminator                0x00
 > 
 > My problem? The values I pass as the delay time (the S in the
 > pack() template) aren't coming out right - when I pass 0, I get
 > a delay of 0. Otherwise, I get multiples of 256/100 seconds:
 > 
 > pass value of           get delay of
 > 0                       0
 > 1                       256/100 s
 > 2                       512/100 s
 > 3                       3 * 256/100 s
 > 
 > What am I doing wrong? Is the "S" a bad choice, for some reason?
 > 

Could indian-ness be the problem?  You might try:

   $controlblock = pack("CCCCnCC", ...);


HTH,
--
Charles DeRykus
ced@carios2.ca.boeing.com


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

Date: Tue, 08 Jul 1997 19:31:13 -0400
From: Claudia Cimenti <cimenti@segsrv.hlo.dec.com>
Subject: Script to add Verilog sensitivity lists
Message-Id: <33C2CDC1.15FB@segsrv.hlo.dec.com>

All,

I apologize in case this is not a good newsgroup to post this in... 
but it seems that the following is something that someone might have
used Perl to automate (I use Perl nearly daily and would surely use it
to implement this project).

I am looking for a tool that parses Verilog (a hardware description
language) code and adds the sensitivity lists (activation lists) to
always statements.

Our development group has so far not included these, since our 
in-house cycle-based simulator did not require them; Synopsys
has no need for them either and we used an event driven Verilog
simulator only with the synthesized netlist. 

Now we are evaluating some third-party tools that (of course) require
sesitivity lists. Because of the huge number of files that we have to 
change, we urgently need an automated way of adding these lists.

I would appreciate any help or pointer to such a tool (if it exists).

Thanks a lot in advance.

	-- Claudia

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
			Claudia Cimenti
     claudia.cimenti@mts.hlo.dec.com, cimenti@segsrv.hlo.dec.com
Bridges Product Line				Tel: (508) 568-6687
Digital Semiconductor				Fax: (508) 568-4367
77 Reed Road HLO2-1/J12				DTN:       225-6687
Hudson, MA 01749

    " When a human is motivated by excellence, success follows "
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


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

Date: 8 Jul 1997 22:41:12 GMT
From: stampes@xilinx.com (Jeff Stampes)
Subject: Re: SIGCHLD handler not being called consistently
Message-Id: <5pufm8$jsh$1@neocad.com>

Jonathan Rozes (jrozes@gumbo.tcs.tufts.edu) wrote:
: When I run this, my signal handler only gets called once, sometime twice.

>From perlipc:


     But that will be problematic for the more complicated
     handlers that need to reinstall themselves.  Because Perl's
     signal mechanism is currently based on the signal(3)
     function from the C library, you may sometimes be so
     misfortunate as to run on systems where that function is
     "broken", that is, it behaves in the old unreliable SysV way
     rather than the newer, more reasonable BSD and POSIX
     fashion.  So you'll see defensive people writing signal
     handlers like this:

         sub REAPER {
             $waitedpid = wait;
             # loathe sysV: it makes us not only reinstate
             # the handler, but place it after the wait
             $SIG{CHLD} = \&REAPER;
         }
         $SIG{CHLD} = \&REAPER;
         # now do something that forks...

     or even the more elaborate:

         use POSIX ":sys_wait_h";
         sub REAPER {
             my $child;
             while ($child = waitpid(-1,WNOHANG)) {
                 $Kid_Status{$child} = $?;
             }
             $SIG{CHLD} = \&REAPER;  # still loathe sysV
         }
         $SIG{CHLD} = \&REAPER;
         # do something that forks...

HTH...

--
Jeff Stampes -- Xilinx, Inc. -- Boulder, CO -- jeff.stampes@xilinx.com


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

Date: Mon, 7 Jul 1997 06:46:48 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Christian Gau <Christian.Gau@asterix.majestix.rhein-main.de>
Subject: Re: Statistic functions for PERL?
Message-Id: <Pine.GSO.3.96.970707064456.9019C-100000@kelly.teleport.com>

On Sun, 6 Jul 1997, Christian Gau wrote:

> I am looking for implementations of statistic functions for PERL. What I
> need is calculation of Standard deviations, variance, covariance,
> correlations and some additional mathemtic functions like Matrix
> multiplication, inversion etc. 

If CPAN has it, it should be on the Modules List. If not, you're welcome
to make a module of your own and submit it! :-)  Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: Mon, 07 Jul 1997 09:58:30 -0400
From: Qing Wu <qwu@xyplex.com>
To: comp.lang.perl.misc
Subject: TIMES function
Message-Id: <33C0F606.3E23@xyplex.com>

I have a test tool written in Perl that is running on UNIX workstation.
I am trying to port it to Windows95, but Perl-for-Win32 doesn't support
this function called TIMES. Times function returns four-element array
which contains the user and system CPU time for this process and the
child of this process.  Does anyone know how I can work around this???

Thanks in advance!

Qing
qwu@xyplex.com


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

Date: Mon, 7 Jul 1997 07:06:29 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Joao Cabral <joao@ultranet.com>
Subject: Re: Trapping system errors
Message-Id: <Pine.GSO.3.96.970707070342.9019F-100000@kelly.teleport.com>

On Sun, 6 Jul 1997, Joao Cabral wrote:

> $found = `rsh $machine <run a command here>`;
> 
> Is there a way to trap the "Permission denied" error so it does not show
> up during the execution of the script? 

It sounds as if you want to capture the standard error output of the
command run in the backticks. This entry from the FAQ, entitled "How can I
capture STDERR from an external command?" looks to be just what you need.
Hope this helps!

    http://www.perl.com/CPAN/doc/FAQs/FAQ/html/perlfaq8/
          How_can_I_capture_STDER_from_an.html

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: Mon, 07 Jul 1997 14:21:30 GMT
From: joshaugh@uk.oracle.com (Jamie O'Shaughnessy)
Subject: Use of Win32::File and official perl5.004_01 on NT and other problems on NT
Message-Id: <33c2fb67.1028417437@newshost.us.oracle.com>


I'm having problems using Win32::File::SetAttributes and the official release
of perl 5.004_01 on Win32/NT. I've built and installed everything from the perl
release OK, along with the Win32 module set from CPAN (and the patch it
requires). Everything else seems to work fine, but when I do something like:

use Win32::File;

# sets all files RW
my($attrib);
foreach(@ARGV) {
   Win32::File::GetAttributes($_, $attrib) || 
         die "ERROR: Couldn't get attributes for $_:\n$!\n";
   Win32::File::SetAttributes($_, ($attrib & ~READONLY));
}

if just gives me:

Can't locate auto/Win32/File/READONLY.al in @INC (@INC contains:
t:\tools\perl5.004\lib t:\tools\perl5.004\lib t:\tools\perl5.004\lib\site
t:\tools\perl5.004\lib\site .) at fptest.pl line 8

It seems like it doesn't like the "READONLY", which is defined in
Win32\File.pm.

Any ideas?

BTW, perl5.004_01 can cause NT to give you a blue screen of death. I've not
completely tied down the problem but it seems that if your perl script is
accessing a file on a NFS connected network drive, and you CTRL-C to abort it,
it will blue screen you. This happens with both Beam & Whiteside's and
Hummingbird's NFS for NT on both NT 3.51 and 4 (all service packs).

I actually think it's a NFS driver problem and not actually perl's fault. That
said, perl is the only thing that can case these problems to result in a blue
screen. This is a particular problem with perl5.004_01 but I have actually seen
it happen with Hip's NT port of 5.003.

Thanks,
Jamie

___________________________________________________________________________ 
Jamie O'Shaughnessy                        Work: joshaugh@uk.oracle.com 
Oracle Designer/2000 Forms Generator Team  Home: jamie@thanatar.demon.co.uk 
______________________________________________________  __  __ _  __ .   __ 
Opinions expressed here are my own and not those of... (__)|-</-\(__ |__ -_ 


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

Date: 8 Jul 1997 22:02:47 GMT
From: gsar@engin.umich.edu (Gurusamy Sarathy)
Subject: Re: Using SFIO with perl5.004 on NT
Message-Id: <5pude7$fod@srvr1.engin.umich.edu>
Keywords: SFIO NT

 [ mailed and posted ]

In article <5prj9s$5ag$1@hal.brainiac.com>,
Ronald E. Fortin <ref@mesasys.com> wrote:
>I'm having a problem building perl5.004 with SFIO.  I have
>succesfully build perl5.004 by itself (without SFIO) and have
>built the sfio libraries (which needed some minor fixes).

Could you send the fixes needed to build sfio to
<perl5-porters@perl.org>?  Thanks.

>INCLUDES = -Id:\dev\sfio97\include -I.\include -I. -I..
>DEFINES = -DWIN32 -DCONSOLE -DPERLDLL -DUSE_PERLIO -DUSE_SFIO
>LIBFILES = ..... libsfio.a libstdio.a
[...]
>Has anyone tried to build perl with sfio97 on NT?

I'm afraid you're on uncharted waters.  Using sfio on Win32 is
one of the goals (to avoid vendor RTL incompatibilities), so let
us know how it pans out.  Good luck.

 - Sarathy.
   gsar@umich.edu





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

Date: Tue, 8 Jul 1997 18:59:51 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Why use 'use strict' ???
Message-Id: <ED0Krr.n0D@world.std.com>

"mashfiel" <ashfield.matthew@miti.nb.ca> writes:

>Hi, sorry for the semi-repost, but did not get any responses from the last.
>I have since been reading documentation, ie the FAQ and manpage, but am
>still unsure of myself. I have seen numerous times recommendations to use
>the
>'use strict'
>command. From my understanding (albeit limited), this will force all my
>variable declarations to be prefixed with 
>my
>correct? 

You might wan to re-read the "strict" pragma's man page. Using the
"strict" pragma requires you to do one of the following:

1. Lexically scope the variable with the "my" operator.

2. Refer to the variable with its fully qualified name
(eg $package::package:var)

3. Explicitly declare that you are going to use the variable globally
with the "vars" pragma. (eg "use vars qw($global @global %global)")

Since the first choice is the best one in the majority of cases,
people often forget about numbers two and three.

-- 
Andrew Langmead


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

Date: Tue, 08 Jul 1997 23:16:35 GMT
From: shyde@poboxes.com (Simon Hyde (aka Jeckyll))
Subject: Re: Why use 'use strict' ???
Message-Id: <33c3c630.55111373@news.uni-stuttgart.de>

On 8 Jul 1997 17:32:15 GMT, "mashfiel" <ashfield.matthew@miti.nb.ca> wrote:

>Hi, sorry for the semi-repost, but did not get any responses from the last.
>I have since been reading documentation, ie the FAQ and manpage, but am
>still unsure of myself. I have seen numerous times recommendations to use
>the
>'use strict'
>command. From my understanding (albeit limited), this will force all my
>variable declarations to be prefixed with 
>my
>correct? So my question is this: Won't this make it impossible to use
>Global variables? (I hope this doesn't lead to the discussion on the pros
>and cons of Globals, hahaha). 
Well....sort of, firstly, it doesn't quite stop you, take a look at
http://www.perl.com/perl/nmanual/lib/strict.html or `perldoc strict` for more info on how
strict works.

Also, you can actually declare a global variable:

use vars qw($scalar %hash @array $etc);

>So if I can't use globals, then my new question is this, how do I go about 
>passing all my variables back and forth to different subroutines? I know
>you can pass-by value and pass-by reference, but am unsure of the purpose
>and use of each, even after reading the manpage (I really have to get that
>Camel book).
> From my limited understanding, pass-by-value will allow me to get a copy
>of the value of the parameter, but will not allow my subroutine to modify
>it. And pass-by-reference will allow me to modify it. Is this correct? 
>
>Sorry for all the questions, I guess I need to re-read the docs again, but
>hopefully someone out there will be able to let me konw if I'm on the right
>track or not.
>
Right well....try running the following to find out, ever heard of testing something out
for yourself it would probably be a lot quicker than posting to the newsgroup :-).

$var = 'hi there';
print "Before passed to function as scalar:\t\t", $var, "\n";
&my_sub($var);
print "After passed to function as scalar:\t\t", $var, "\n\n";

$var = 'hi there again';
print "Before passed to function as reference:\t\t", $var, "\n";
&their_sub (\$var);
print "After passed to function as reference:\t\t", $var, "\n";

sub my_sub{
 my($local_var) = @_;
 print "Inside scalar function, before alteration:\t",$local_var, "\n";
 $local_var = 'hi';
 print "Inside scalar function, after alteration:\t",$local_var, "\n";
}

sub their_sub{
 my($local_var) = @_;
 print "Inside reference function, before alteration:\t",$$local_var, "\n";
 $$local_var = 'hi';
 print "Inside reference function, after alteration:\t",$$local_var, "\n";
}


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

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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 V8 Issue 710
*************************************

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