[18362] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 530 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Mar 19 21:11:19 2001

Date: Mon, 19 Mar 2001 18:10:15 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <985054214-v10-i530@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Mon, 19 Mar 2001     Volume: 10 Number: 530

Today's topics:
    Re: Print "tar" Success or Failure <whataman@home.com>
    Re: Print "tar" Success or Failure <whataman@home.com>
    Re: Print "tar" Success or Failure (Garry Williams)
    Re: Print "tar" Success or Failure (Garry Williams)
    Re: Problems running perl script with call to Win32::Ad <bart.lateur@skynet.be>
    Re: problems with systems calls (Joe Smith)
    Re: push, pop file handles to deal with recursive #incl (Gwyn Judd)
    Re: push, pop file handles to deal with recursive #incl <johnlin@chttl.com.tw>
        search modify and then replace? <milliwave@rfengineering.freeserve.co.uk>
    Re: search modify and then replace? <chrisw@dynamite.com.au>
    Re: search modify and then replace? (Damian James)
    Re: search modify and then replace? (Jay Tilton)
        spaces in system call under NT <thomy.heim@gmx.de>
        split fields in sub? <dp@dsoft.com>
        subject : delete a class object -- HTML::Parser <ulpanakv@netvision.net.il>
    Re: subject : delete a class object -- HTML::Parser <bart.lateur@skynet.be>
    Re: too late for -T <elijah@workspot.net>
        warnings.pm syntax error near "{^" lee_spam_this@yahoo.com
        win32: accessing file in same Drive where cgi-bin resid <kellyboy@nospanner>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Mon, 19 Mar 2001 23:11:08 GMT
From: "What A Man !" <whataman@home.com>
Subject: Re: Print "tar" Success or Failure
Message-Id: <3AB69286.DC338700@home.com>

[aka BuckNaked1, I'm on PC, so I can quote properly.}

> >> Garry Williams wrote:
> 
> >> > BUCK NAKED1 wrote:
> >> > I've tried...
> >> > if (system("tar -zxf $tmpfile -C $tmpdir 2>&1")==0) {
> >> > print "SUCCESS";
> >> > }
> >> > else {print "FAILURE";
> >> > };
> >> > ..and this doesn't work. Why?
> >
> >> Probably because this tar doesn't return  a proper exit value.
> >
> > Hmmm... I thought I learned from the other thread where I asked about
> > this that "tar" returned a value of "0" upon success, so why is an 
> > exit value of "0" wrong?
> 
> Run the command from the command line and examine the exit code.
> 
I've been thru this with another poster. Tar returns nothing on success,
which would be false or 0. Is an exit value different than a return
value?


> > mkdir $tmpdir, 0705;
> > `tar -zxf $tmpfile -C $tmpdir 2>&1, Tarfile has been Extracted\n`==0 ||
> 
> This make no sense.  qx// will return the *output* of the command, not
> the exit code. 
So, I don't need the ==0. OK.
>

> I doubt that will ever be the number zero (at least
> from the tar commands that I know).
Again I get child status 1 or 3 on failure, and nothing(0) on tar
success. What do you think I should get for return values?

> If you were running with warnings
> enabled, perl would squawk about the numeric comparison.
> 
Yes, I'm running with -w. Forget the code above and its syntax errors. I
changed it to your if/else suggested way in another response. 
> 
Regards,
--Dennis


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

Date: Mon, 19 Mar 2001 23:37:29 GMT
From: "What A Man !" <whataman@home.com>
Subject: Re: Print "tar" Success or Failure
Message-Id: <3AB698B3.61F5121@home.com>

Tad McClellan wrote:
> 
> BUCK NAKED1 <dennis100@webtv.net> wrote:
> 
> >By "zombies"... I meant a blank page.
> 
> There is a source of confusion. "zombie" means something else. 
>    http://www.tuxedo.org/~esr/jargon/html/entry/zombie.html
> 
Thanks Tad. To me, a zombie was similar to the word ghost, which I
incorrectly assumed to be a blank page. Also, I obviously didn't know
the correct meaning of the word "zombie".

> >What was the "__END_" you suggested for?
> 
>    perldoc perldata
> 
> >I left it off
> >because I have an END block at the end of this script, and I thought it
> >might mess that up.
>        ^^^^^^^^^^^^
> 
> Not if the END block is before the __END__ token.

Good info. Thank You. No, in this case, the __END__ token would have
been before my END{} block.
> 
> mkdir $tmpdir, 0705 or die "Coudn't make $tmpdir: $!";
> if ($rc = `tar -zxf $tmpfile -C $tmpdir 2>&1`) { 
      ^^       
> 
> What you are putting in that variable is NOT a "return code". Is that
> what "rc" stands for?
> 
> "$tar_output" would be a better name.
> 
> Since you do not use $rc, there isn't much point in saving something
> in there anyway...
> 
Some more good points. I will remove $rc since I don't want the return
message printed. This also reminded me that I I shouldn't use $rc for a
variable since I'm using the HTTP and LWP modules, and some of the HTTP
modules use $rc for return codes, so that may cause confusion.

Now, the below does what I want; but how would you write it without
using if/else?

mkdir $tmpdir, 0705 or die "Coudn't make $tmpdir: $!";
if (`tar -zxf $tmpfile -C $tmpdir 2>&1`) { 
    rmdir $tmpdir; 
    unlink $tmpfile; 
    print "un-tar failed\n";
    }
else { print $done; 
} ;


Thanks,
--Dennis


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

Date: Tue, 20 Mar 2001 01:36:51 GMT
From: garry@ifr.zvolve.net (Garry Williams)
Subject: Re: Print "tar" Success or Failure
Message-Id: <slrn9bdd1j.dni.garry@zfw.zvolve.net>

On Mon, 19 Mar 2001 00:15:04 -0600 (CST), BUCK NAKED1
<dennis100@webtv.net> wrote:

[snip]

> Also... is there a way to do the below without using if/else? (I already
> have too many if/else's in the script already)
> 
> mkdir $tmpdir, 0705 or die "Coudn't make $tmpdir: $!";
> if ($rc = `tar -zxf $tmpfile -C $tmpdir 2>&1`) { 
>     rmdir $tmpdir; 
>     unlink $tmpfile; 
>     print "un-tar failed\n";
>     }
> else { print $done; 
> } ;
> 
> So much to learn. }-:

The backtick operator returns the _output_ of the command (its
STDOUT).  Please read the qx// section of the manual page perlop.  I
pointed that out in this thread already.  The code above is wrong.  It
does *not* check the success of the tar command.  You want to use
system() or examine the $? variable to know what tar returns.  

What's wrong with if/else?  

-- 
Garry Williams


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

Date: Tue, 20 Mar 2001 01:50:35 GMT
From: garry@ifr.zvolve.net (Garry Williams)
Subject: Re: Print "tar" Success or Failure
Message-Id: <slrn9bddrb.dni.garry@zfw.zvolve.net>

On Mon, 19 Mar 2001 23:37:29 GMT, What A Man ! <whataman@home.com> wrote:
> Tad McClellan wrote:
>> BUCK NAKED1 <dennis100@webtv.net> wrote:
>> 
>> mkdir $tmpdir, 0705 or die "Coudn't make $tmpdir: $!";
>> if ($rc = `tar -zxf $tmpfile -C $tmpdir 2>&1`) { 
>> 
>> What you are putting in that variable is NOT a "return code". Is that
>> what "rc" stands for?
>> 
>> "$tar_output" would be a better name.
>> 
>> Since you do not use $rc, there isn't much point in saving something
>> in there anyway...
>> 
> Some more good points. I will remove $rc since I don't want the return
> message printed. This also reminded me that I I shouldn't use $rc for a
> variable since I'm using the HTTP and LWP modules, and some of the HTTP
> modules use $rc for return codes, so that may cause confusion.


No, it is not confusing.  A module that happens to mention a variable
by the same name as a variable that you declare is talking about a
different variable.  It's in a different name space, so there's no
confusion.  Just because you use a module, it doesn't mean that you
need to know what variable names it happens to use.  


> Now, the below does what I want; but how would you write it without
> using if/else?
> 
> mkdir $tmpdir, 0705 or die "Coudn't make $tmpdir: $!";
> if (`tar -zxf $tmpfile -C $tmpdir 2>&1`) { 
>     rmdir $tmpdir; 
>     unlink $tmpfile; 
>     print "un-tar failed\n";
>     }
> else { print $done; 
> } ;


The code above does _not_ do what you intended.  

It will report an error any time the tar command writes anything to
its STDERR _or_ its STDOUT.  Use system() to check on the exit code
from an external command.  Use the backticks operator to *capture* the
output of a command and check its return code by examining $?.  

PLEASE read the system() section of the perlfunc manual page and the
qx// section of the perlop manual page.  

-- 
Garry Williams


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

Date: Tue, 20 Mar 2001 01:00:17 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Problems running perl script with call to Win32::AdminMisc
Message-Id: <207dbt8um2pn8l87d5b2egospf47qao6ud@4ax.com>

"Wilburn, Bryan" wrote:

>I installed ActiveState Active Perl and obtained the Roth Consulting
>Win32::AdminMisc package.  I've followed the directions provided in the
>package and copied the AdminMisc.PM & DLL files to the required folders.
>However each time I attempt to run the script, I get the message below.

>I'm running on a Windows 2000 Professional platform.  Any idea what I'm
>doing wrong?

You "copied" the modules and DLL4s their right location? I would only do
that with modules that don't make use of DLL's. I'd use PPM to install
it. Otherwise, make damn sure that your DLL and other similar files get
into their proper subtree
location under "auto", most likely under "site/lib".

>The Version of ActivePerl:
>
>D:\PScript\bin>perl -v
>
>This is perl, v5.6.1 built for MSWin32-x86-multi-thread
>(with 2 registered patches, see perl -V for more detail)

Oops. That is still an experimental version, I think.

Are you sure you have the proper compatible binary version of the
module? For 5.6.0; it's under
<http://www.activestate.com/PPMpackages/5.6/>, but for 5.6.1, I'm not
sure. I'd expect to find it under
<http://www.activestate.com/PPMpackages/5.6plus/>, but this module isn't
there. And I'm not sure that I'm even right about this.

Try going back to the real current version of ActivePerl (5.6.0 build
623). And get the correct version of the archive (under
<http://www.activestate.com/PPMpackages/5.6/MSWin32-x86-multi-thread/>).

-- 
	Bart.


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

Date: Mon, 19 Mar 2001 20:26:45 +0000 (UTC)
From: inwap@best.com (Joe Smith)
Subject: Re: problems with systems calls
Message-Id: <995q25$dq$1@nntp1.ba.best.com>

In article <3AB1BEA8.91904259@viator.com>,
Duncan Hall  <duncan@viator.com> wrote:
>Can anyone tell me why when run from a browser this script does not
>finish displaying the page until the download of the jre.zip file is
>complete?

Because you have not given the browser sufficient information to
display even one line of text, that's why.  ("\n" is irrelevent in HTML.)

>I'm running apache-suexec to make the system call.
>
>Thanks
>
>Dunc
>
>#!/usr/bin/perl
>
>print "Content-type: text/html\n\n";
>print "just downloading jre.zip first - its 15 meg in size\n";

 $|=1; print "<br>\n"; # Give browser permission to display previous line.

>`wget http://192.168.100.5/jre.zip -O /var/www/html/downloads/jre.zip`;

	-Joe
--
See http://www.inwap.com/ for PDP-10 and "ReBoot" pages.


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

Date: Mon, 19 Mar 2001 21:31:02 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: push, pop file handles to deal with recursive #include
Message-Id: <slrn9bcukk.3v3.tjla@thislove.dyndns.org>

I was shocked! How could Anno Siegel <anno4000@lublin.zrz.tu-berlin.de>
say such a terrible thing:
>According to John Lin <johnlin@chttl.com.tw>:
>> Dear all,
>> 
>> I wrote a program to deal with recursive #include
>> by using a @stack to store file handles.
>> 
>> my @stack;
>> my $f;
>> open $f,'a.txt' or die $!;
>> do {
>>     while(<$f>) {
>>         if(/#include <(.*)>/) {
>>             push @stack,$f;
>>             open $f,$1 or die $!;
>
>You're stacking away the filehandle but keeping it in $f anyhow,
>so open() does its usual implicit close.  When you pop it back from
>the stack it's still closed.  Insert "my $f" between "push" and
>"open" (untested).

Not quite. The my localises $f to the enclosing block, which in this
case is the body of the if statement. When we drop out of the if, $f
goes out of scope, causing us to also drop out of the body of the while.
We then pick up the old value of $f from the outer do...while and
continue (I am not sure if this is exactly what happens, but it explains
the behaviour we get with your solution). A solution that works seems to
be to replace your 'my $f' with 'undef $f'.

-- 
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)

"Han will have those pants down.  We've got to give him more time!" --Lando

"Return Of The Jedi (tm)", "Pants" Style


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

Date: Tue, 20 Mar 2001 08:47:46 +0800
From: "John Lin" <johnlin@chttl.com.tw>
Subject: Re: push, pop file handles to deal with recursive #include
Message-Id: <99698t$6ab@netnews.hinet.net>

"Randal L. Schwartz" wrote
> >>>>> "John" == John Lin writes:
>
> John> I wrote a program to deal with recursive #include
> John> by using a @stack to store file handles.
>
> See <http://www.stonehenge.com/merlyn/UnixReview/col19.html>.

Thank you.  It's great.

But indeed I am not asking "how to hack it out".
Just that pushing a file handle and then popping it out is problematic.
(Now I know the problem is "implicit close".)

Thank you again.

John Lin





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

Date: Mon, 19 Mar 2001 22:28:10 -0000
From: "Milliwave" <milliwave@rfengineering.freeserve.co.uk>
Subject: search modify and then replace?
Message-Id: <996132$ean$1@news5.svr.pol.co.uk>

I need a tip on a problem I am unable to solve as I am a novice to perl.

Question
------------
open(DATA, "+<data.txt")
while (<DATA>)
{

#I have the following search pattern

if ( $_ = /^\s*(\S*)s*(\S*)s*(\S*)s*(\S*)s*(\S*)/)
{
    $digits1 =$1;
    $digits2 =$2;
    $digits3 =$3;
    $digits4 =$4;
    $digits5 =$5;

# after some processing on the $digits say :

 $temp1 = ($digits1) /2;
 $temp2 = ($digits2) /2;
 $temp3 = ($digits3) /2;
 $temp4 = ($digits4) /5;
 $temp5 = ($digits5) /7;

# I would now like to replace the $digits1 to $digits5 with $temp1 to $temp5
in the original pattern which #was detected above. I would ALSO like to
write back the pattern with the modified data to its original
#location in the <DATA> file.
}

}

close DATA;

WhaT IS the magical way around the problem.
Thanking u
Kev





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

Date: Tue, 20 Mar 2001 10:10:49 +1100
From: "Chris W" <chrisw@dynamite.com.au>
Subject: Re: search modify and then replace?
Message-Id: <ynwt6.5$Ap2.346171@news.interact.net.au>

"Milliwave" <milliwave@rfengineering.freeserve.co.uk> wrote in message
news:996132$ean$1@news5.svr.pol.co.uk...
> #I have the following search pattern
>
> if ( $_ = /^\s*(\S*)s*(\S*)s*(\S*)s*(\S*)s*(\S*)/)

I think there may be a typo or two in this.   Perhaps you meant:
$_ =~ /^\s*(\S*)\s*(\S*)\s*(\S*)\s*(\S*)\s*(\S*)/
and you probably want 1 or more non-space character in each of $1..$5 i.e.
(\S+).

In any case, you may better be served by using the split function to break
your data into an array.   Process the array and then use join to put it
back together.



Hope this helps.




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

Date: 19 Mar 2001 23:27:01 GMT
From: damian@qimr.edu.au (Damian James)
Subject: Re: search modify and then replace?
Message-Id: <slrn9bd5di.aki.damian@puma.qimr.edu.au>

Milliwave chose Mon, 19 Mar 2001 22:28:10 -0000 to say this:
>...
>#I have the following search pattern
>
>if ( $_ = /^\s*(\S*)s*(\S*)s*(\S*)s*(\S*)s*(\S*)/)
>{
>    $digits1 =$1;
>	 ...
># after some processing on the $digits say :
>
> $temp1 = ($digits1) /2;
> ...
>
># I would now like to replace the $digits1 to $digits5 with $temp1 to $temp5
>in the original pattern which #was detected above. I would ALSO like to
>write back the pattern with the modified data to its original
>#location in the <DATA> file.
>...
>WhaT IS the magical way around the problem.

There is no magic here, I'm afraid. First, you have a problem with your
pattern match above -- you''l be matching on quite a lot more than you
probably want to. See below, and the perlre man pages for details.

Second, you can't write to/over a specific portion of a file. You can only
overwrite the whole file, or append to it. See below, but if the file is
too large to keep in RAM, you might want to write to another, temporary
file then rename to the original.

Here is a quick version I worked up of your program to get you going:

#!/usr/local/bin/perl -w
use strict;

my @divisors = qw(2 2 2 5 7);
my @output = ();

# open your filehandle (for reading only) here
# then replace DATA below

while (<DATA>) {
    last if /^__END__$/;
    my $index = 0;

    my @digits = /^\s*(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)/;

    #my @digits = split; # depending on your data, does the same thing

    my $line = $_;

    # your processing in here

    my @processed = map {$_ / $divisors[$index++] } @digits;
    $line =~ s/$digits[$_]/$processed[$_]/ for 0..$#digits;
    print $line;
    push @output, $line;
};

#close the filehandle here

open OUTPUT, '>outfile' or die "Can't open outfile: $!";
print OUTPUT for @output;
close OUTPUT;

__DATA__
1234 1234 1234 1234 1234
5678 5678 5678 5678 5678
4321 4321 4321 4321 4321
8765 8765 8765 8765 8765
__END__

HTH

Cheers,
Damian
-- 
@;=0..23;@;{@;}=split//,<DATA>;while(@;){for($;=@;;--$;;){next if($:=rand($;
+1))==0+$;;@;[$;,$:]=@;[$:,$;]}print map{$;{$_}}(@| ,@;);push@|,shift@;if$;[
0]==@|;$|=1;select$&,$&,$&,1/80;print"\b"x(@;+@|)}print"\n"__END__
Just another Perl Hacker


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

Date: Tue, 20 Mar 2001 01:58:48 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: search modify and then replace?
Message-Id: <3ab6b893.100599921@news.erols.com>

On Mon, 19 Mar 2001 22:28:10 -0000, "Milliwave"
<milliwave@rfengineering.freeserve.co.uk> wrote:

>if ( $_ = /^\s*(\S*)s*(\S*)s*(\S*)s*(\S*)s*(\S*)/)

I refuse to believe that line exists in any code you tested.
Surely you meant

 if ( $_ =~ /^\s*(\S*)\s*(\S*)\s*(\S*)\s*(\S*)\s*(\S*)/)
 #        ^           ^       ^       ^       ^
 # omitted^           ^       ^       ^       ^
  
Always cut and paste code when composing a message to be posted.

># I would now like to replace the $digits1 to $digits5 with $temp1 to $temp5
>in the original pattern which #was detected above.

Useful tools that come to mind are the substr and sprintf functions,
the /e regex modifier, or the match-offset lists (@- and @+ , whatever
they're really called).  For example, 

if ( $_ =~ /^(\s*\S*)(\s*\S*)(\s*\S*)(\s*\S*)(\s*\S*)/ )
#Changed the regex to capture whitespace as well as the numbers.
#Mathematical operations still work.
{
   my $digits1 =$1;
   my $digits2 =$2;
   my $digits3 =$3;
   my $digits4 =$4;
   my $digits5 =$5;

   my $temp1 = ($digits1) /2;
   my $temp2 = ($digits2) /2;
   my $temp3 = ($digits3) /2;
   my $temp4 = ($digits4) /5;
   my $temp5 = ($digits5) /7;

   my @replace = (undef, $temp1, $temp2, $temp3, $temp4, $temp5);
   my $newstring = '';
   for my $i (1..5) {
      $newstring .= sprintf '%' . ($+[$i] - $-[$i]) . 'd',
                    $replace[$i];
   }
   $_ = $newstring;
}

That's one idea.  It could do odd things if the whitespace matched
by \s is anything but a real space, and the $temp scalars get
decimal-truncated into integers in the output.  Change the code as
necessary to fit the exact parameters of your problem.

>I would ALSO like to
>write back the pattern with the modified data to its original
>#location in the <DATA> file.

Sounds like you want an inplace edit.
  perldoc -q "how do i change one line in a file"


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

Date: Mon, 19 Mar 2001 17:49:35 +0100
From: "Thomas Heim" <thomy.heim@gmx.de>
Subject: spaces in system call under NT
Message-Id: <3ab63807@hpb10302.boi.hp.com>

Hi all,

i have a problem with a system call, the operating system is Windows NT 4.0
the Perl Version is ActiveState 5.6.0.

When i try to call a command which has a space in the path all works fine
until i use a parameter which has also a space, then the perl script fails
with the following error: "The name specified is not recognized as an
internal or external command, operable program or batch file."

Here is the code of the script:
$TESTEXE = $ENV{'TESTEXE'};
my $opcmsg = $TESTEXE.'\\opcmsg.exe';
$return = system ( "\"$opcmsg\" a=a o=o msg_t=\"test text\"" );

The value of the env-variable TESTEXE is set to c:\program files, in that
directory is the file opcmsg.exe located. The strings a, o and msg_t are
parameters.

Thanks,

Thomas




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

Date: Mon, 19 Mar 2001 23:22:43 GMT
From: Daniel <dp@dsoft.com>
Subject: split fields in sub?
Message-Id: <B6DBD4C1.5A7%dp@dsoft.com>

just wondering if there is a way to
have the split in a sub so I can call from other subs?
So far I have not been able to get this to work.
I would appreciate any ideas.  Thanks.


local(@database_rows);
@database_rows = &load_productdb;
my($max) = $pos + $numtolist;
if ($max > $SIZE2) {
$max = $SIZE2;
}
for ($i=$pos;$i<$max;$i++) {
@database_rows = &split_db($database_rows[$i]);
print "$sku, $name, $partnum, $descrip, $cpu, $stock, $list, $price";

}

sub split_db {
    ($sku, $name, $partnum, $descrip, $cpu, $stock, $list, $price) =
split(/\|/,$_);
    return ($_);

}



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

Date: Mon, 19 Mar 2001 12:31:49 +0200
From: Hadar Lek <ulpanakv@netvision.net.il>
Subject: subject : delete a class object -- HTML::Parser
Message-Id: <3AB5E015.1EB0FD34@netvision.net.il>

subject : delete a class object -- HTML::Parser



can I delete a class object in the following example using a "delete"
method ? THE LAST LINE in the following buggy code



BEGIN {
  package P2;


 @P2::ISA = qw(HTML::Parser) ;


sub start
{

    my $self = shift;
    my ($tag, $attr) = @_;
    my $link;
    $link = $attr->{href} if $tag eq "a";
    $link = $attr->{src} if $tag eq "img";

}


}

 .....................


my $p2 = P2->new;

 ....................

delete $p2



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

Date: Mon, 19 Mar 2001 19:46:03 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: subject : delete a class object -- HTML::Parser
Message-Id: <hdocbtckd5cdqjtu92vrfdm1a6vpo5tbsn@4ax.com>

Hadar Lek wrote:

>subject : delete a class object -- HTML::Parser

>can I delete a class object in the following example using a "delete"
>method ? THE LAST LINE in the following buggy code

>my $p2 = P2->new;
>....................
>delete $p2

The common way is simply

	undef $p2;

Or, limit the scope of the variable $p2 to some block, and simply exit
the block. Perl will do the rest.

Only for a few modules, you have to manually destroy the object. That is
because they contain circular references, which you have to break. I
think HTML::TreeBuilder builds such a tree, but HTML::Parser doesn't.

-- 
	Bart.


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

Date: 19 Mar 2001 19:12:45 GMT
From: Eli the Bearded <elijah@workspot.net>
Subject: Re: too late for -T
Message-Id: <eli$0103191405@qz.little-neck.ny.us>

In comp.lang.perl.misc, Géry <ducateg@info.bt.co.uk> wrote:
> I have tried to run a Perl script on Ms IIS server v4. I want to run with
> the tainted security option -T. IIS complains about it and returns the
> message "Too late for -T ...".
> 
> Does anyone know why?

I don't know exactly what IIS is doing, but I have a theory.

If you write a perl script that asks for taint checking on the
#! line, then you must also use taint checking on the command
line if you pass the script to perl.

Example:

	#!/usr/bin/perl -Tw
	use strict;

	my $input_t = <STDIN>;	# tainted
	my $input;

	if ($input_t =~ /(\w+\s+\w+[.!]?)/) {
	   $input = $1;	# untainted
	   print "Got: $input\n";
	} else {
	   print "Could not untaint input.\n";
	}
	__END__

	$ perl example-taint 
	Too late for "-T" option at example-taint line 1.
	$ perl -T example-taint
	Hello world!
	Got: Hello world!
	$

So I think that IIS is trying to just run your script with a
command line like "perl iis-script", and that is causing the
problem.

I can't suggest a way to fix this, however.

Elijah
------
has never used IIS



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

Date: 19 Mar 2001 19:26:02 GMT
From: lee_spam_this@yahoo.com
Subject: warnings.pm syntax error near "{^"
Message-Id: <995mga24su@news1.newsguy.com>


Here is the error stream:
Use of reserved word "our" is deprecated at /id/sw/Perl/lib/perl5/5.6.0/PA-RISC2.0/Socket.pm line 3.
syntax error at /id/sw/Perl/lib/perl5/5.6.0/warnings.pm line 246, near "{^"
BEGIN failed--compilation aborted at /id/sw/Perl/lib/perl5/5.6.0/PA-RISC2.0/Socket.pm line 163.
BEGIN failed--compilation aborted at /id/sw/genesis/sys/scripts/perl/Genesis.pl line 18.
BEGIN failed--compilation aborted at /id/sw/genesis/sys/scripts/build_tcoupon.pl line 104.

I've looked at the line in question in warnings.pm.  It does not 
look like a problem.  In fact I do not experience this problem with 5.6.0 on Solaris.  I searched groups.google.com, but that
archive only goes back to August, 2000, and it didn't turn up
anything useful.  

1) Help with the specific problem welcomed.
2) Help identifying other places I could have searched welcomed. 
Specifically, is the bug list searchable?  I couldn't find a
link to it from www.perl.com, but perhaps I did not try hard
enough.

-- 
Lee.Lindley@bigfoot.com


==================================
Posted via http://nodevice.com
Linux Programmer's Site


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

Date: Mon, 19 Mar 2001 19:20:00 -0600
From: "kellyboy" <kellyboy@nospanner>
Subject: win32: accessing file in same Drive where cgi-bin reside return different result
Message-Id: <tbdbsvgd1npnc9@corp.supernews.com>

See code below which I got from some perl tutorial website.

This perl , thru browser, list files and directory in the path with $path
set .

If is set $path to "C:", it list the file/directory in that directory . If I
set "M:"(network map), it list file/directory in that directory as well.
Even If I set $path to "D:\\somedir", still successful.

But if I set $path to "D:" It only list file/directory in
"D:\perl\cgi-bin\". I wanted the script to print from "D:" not
"D:\perl\cgi-bin"

On my personal web server on win98, the /cgi-bin/ for perl is set to
"D:\perl\cgi-bin".
The perl script reside in that directory. So script recognize "D:\" as
"D:\perl\cgi-bin" instead of "D:" How do I get script to recognize "D:" as
"D:" ?.

What give??

here s the script:
#!/usr/bin/perl

print "Content-type: text/html\n\n";

print "<html><head>\n";
print "<title>Hello, world!</title></head>\n";
print "<body bgcolor=\"#FFFFFF\" text=\"#000000\" link=\"#FF0000\"
vlink=\"#800000\">\n";
print "<BR>";
    $path = "c:\\My Documents";
    $path = "." unless $path;

    opendir( DIR, $path ) or die "Can't open $path: $!";

    while ( $entry = readdir( DIR ) )
    {
      $type = ( -d "$path\\$entry" ) ? "dir" : "file"; # $path is crucial!

      print "$type\t$entry\n<BR>";
    }

    closedir( DIR );

print "</body></html>\n";
--

kellyboy




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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 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.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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 530
**************************************


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