[28749] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 10113 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jan 3 18:06:06 2007

Date: Wed, 3 Jan 2007 15:05:14 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 3 Jan 2007     Volume: 10 Number: 10113

Today's topics:
    Re: Disable functionality thru commenting out a use <nobull67@gmail.com>
        Disabling tainted feature in Perl <raghunandan.ramakrishnan@gmail.com>
    Re: Disabling tainted feature in Perl <nobull67@gmail.com>
    Re: File::Temp and external editor <nobull67@gmail.com>
    Re: gtk2 treeview and threads : custom sort while updat <zentara@highstream.net>
    Re: how to test uninitialized value <brian.d.foy@gmail.com>
    Re: I'm not too sure if this is a perl question..... <cdalten@gmail.com>
    Re: I'm not too sure if this is a perl question..... <john@castleamber.com>
    Re: Problematic Perl code <mfarid1@yahoo.com>
    Re: Problematic Perl code <mritty@gmail.com>
    Re: Problematic Perl code <mritty@gmail.com>
    Re: regex problem <yankeeinexile@gmail.com>
    Re: regex problem <mritty@gmail.com>
    Re: regex problem <andreap@gmx.de>
    Re: regex problem <mritty@gmail.com>
    Re: regex problem <andreap@gmx.de>
    Re: regex problem <uri@stemsystems.com>
    Re: system command won't run with -T option on xhoster@gmail.com
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 3 Jan 2007 11:13:21 -0800
From: "Brian McCauley" <nobull67@gmail.com>
Subject: Re: Disable functionality thru commenting out a use
Message-Id: <1167851600.968180.129610@42g2000cwt.googlegroups.com>



On Dec 30 2006, 2:49 pm, "Robert Nicholson"
<robert.nichol...@gmail.com> wrote:
> I want to disable some functionality by making it conditional that it's
> use statement is in the script.
>
> How in general can you tell if a module is present or loaded? if
> defined(X) what should X be?

%My::Module::

(Note the trailing double colon).

Actually you don't need the defined() although if probably faster to
include it.

What this actually tells you is if the My::Module namespace contains
any symbols which is not always quite the same thing as you'd get by
cheking $INC{'My/Module.pm'} (as suggested by Mumia) which is the more
literal answer to your question as to whether the module has been
loaded.

> I want to disable some features in a big perl script by
> conditionalizing the code that relies on those modules and be able to
> disable those features by comment out the "use" line for the modules.

I hope these are your own modules. Otherwise there's always a risk that
they may get unexpected use()d by another module and suddenly your
scripts functionality will change.



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

Date: 3 Jan 2007 09:47:22 -0800
From: "rr_79" <raghunandan.ramakrishnan@gmail.com>
Subject: Disabling tainted feature in Perl
Message-Id: <1167846442.641961.188760@n51g2000cwc.googlegroups.com>

We are using perl v5.6.1 and this has tainted feature in perl enabled
by default.

Is there any way of disabling this feature?



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

Date: 3 Jan 2007 10:46:30 -0800
From: "Brian McCauley" <nobull67@gmail.com>
Subject: Re: Disabling tainted feature in Perl
Message-Id: <1167849990.338297.30530@42g2000cwt.googlegroups.com>

On Jan 3, 5:47 pm, "rr_79" <raghunandan.ramakrish...@gmail.com> wrote:

> We are using perl v5.6.1 and this has tainted feature in perl enabled
> by default.
>
> Is there any way of disabling this feature?

Tainting is not switched on by default by default in perl5.6.1 so
either you have a non-standard build of Perl or something about the way
you are calling Perl is telling it to enable tainting.

There are all sorts of reasons why you probably should not disable
tainting when Perl thinks it should be enabled but if you are really
determined you can use the Taint::Runtime module.



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

Date: 3 Jan 2007 10:58:33 -0800
From: "Brian McCauley" <nobull67@gmail.com>
Subject: Re: File::Temp and external editor
Message-Id: <1167850713.217086.27700@s34g2000cwa.googlegroups.com>



On Jan 2, 9:07 pm, Binand Sethumadhavan <bin...@gmx.net> wrote:
> Hi All,
>
> I am writing a program which:
>
> - creates a temporary file using File::Temp
> - opens the file in an external editor
> - processes the data the user enters in the file
>
> (sort of like "cvs commit" - it opens a /bin/vi buffer where you can
> enter the commit log).
>
> I cannot figure out how to get the text typed in the buffer, back in my
> perl code. Here is what I'm doing at the moment:
>
> $prefix = "/tmp";
> $cmd = "/bin/vi";
> use File::Temp qw/tempfile/;
> ($fh, $filename) = tempfile(DIR => $prefix, UNLINK => 1);
> print $fh <<EOF;
> [some pre-filled information here]
> EOF
> $mtime1 = (stat($filename))[9];
> system ("$cmd $filename");
> $mtime2 = (stat($filename))[9];
> if ($mtime2 - $mtime1 > 0) {
>      # Process the contents of $filename here
>
> }

> What I am doing at the moment is @cmdbuf = `cat $filename`; so that I
> can continue with the rest of my code, but I'd like to know how to do it
> better.

I think you are looking for

seek($fh,0,0);
@cmdbuf = <$fh>;



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

Date: Wed, 03 Jan 2007 11:45:50 -0500
From: zentara <zentara@highstream.net>
Subject: Re: gtk2 treeview and threads : custom sort while updating rows
Message-Id: <j1nnp212cuq938plq5to4vscgph0figamo@4ax.com>

On 2 Jan 2007 09:04:28 -0800, erwan.barrier@gmail.com wrote:

>I have a timeout each 5 second who create a thread to update data to my
>treeview.
>it looks like
>
>while (@data)
>{
>Gtk2::Gdk::Threads->enter;
>push @{$tree->{data}}, \@data;
>Gtk2::Gdk::Threads->leave;
>}
>
>i have 5 column automatically sorted and a column where i want custom
>sorting.
>it look like:
>my $id=0;
>map { $_->set_sort_column_id($id++)} $tree->get_columns;
>$tree->get_model->set_sort_func(6, \&sort_variation);
>
>with sort_variation who returns an integer equal to negative, 0, or
>positive.
>
>custom sort works if update is done without threads.
>automatic sort works with or without threads.
>custom sort DOESN'T work if update is done with threads.
>the error message before is:
>"Usage: set(list_store, iter, col1, val1, ...)"
>any help needed
>Thanks in advance

Please post a complete working snippet which demonstrates
the problem. Perl/Gtk2 tries to be thread-safe, but it is tricky
to use, and we cannot test it without working code.

It may be as simple as

use Gtk2 qw/-init -threads-init /;
  die "Glib::Object thread safetly failed"
        unless Glib::Object->set_threadsafe (TRUE);  

The enter-leave mechanism is tricky to use, and it is usually
best to use the standard thread-gui precautions....

1. create your threads before any gui code
2. don't try to access the gui from the threads

Now Perl/Gtk2's thread-safe mechanism tries to let you
avoid those precautions, but it must be done right.
So show complete snippets.

zentara




-- 
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html


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

Date: Wed, 03 Jan 2007 12:16:29 -0600
From: brian d  foy <brian.d.foy@gmail.com>
Subject: Re: how to test uninitialized value
Message-Id: <030120071216297340%brian.d.foy@gmail.com>

In article <459b038b$0$5281$4c368faf@roadrunner.com>, Oxnard
<oxnard@carolina.rr.com> wrote:

> How do I test to see if a variable is initialized or not?

defined() usually does the trick.

Good luck :)

-- 
Posted via a free Usenet account from http://www.teranews.com



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

Date: 3 Jan 2007 06:16:48 -0800
From: "grocery_stocker" <cdalten@gmail.com>
Subject: Re: I'm not too sure if this is a perl question.....
Message-Id: <1167833808.213421.292600@n51g2000cwc.googlegroups.com>

John Bokma wrote:
> "grocery_stocker" <cdalten@gmail.com> wrote:
>
> > Let's see if I can break this down.
> > 1)I really don't see when a backslash can be quoted as a backslash
> > (presum. in URL)
> > 2)I see even less when there can be a close-paren with backslash.
> >
> > Maybe if I understood this, I could maybe understand why it has to be
> > converted to hex.
>
> If you read the rest of jwz's comments you should have learned fast enough
> that MORK is the biggest POS file format you'll probably every encounter
> in your life.
>
> Let's hope it will be dropped with Firefox 3.0 (If it hasn't been already)
>

For whatever reasons, I thought I was somehow missing some strange and
funky CS concept.  After following and reading the URLs in the source
code, I realized that those lines were meant to deal with MORK itself.

Chad



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

Date: 3 Jan 2007 20:00:29 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: I'm not too sure if this is a perl question.....
Message-Id: <Xns98AD8E7F4E19Dcastleamber@130.133.1.4>

"grocery_stocker" <cdalten@gmail.com> wrote:

> John Bokma wrote:
>> "grocery_stocker" <cdalten@gmail.com> wrote:
>>
>> > Let's see if I can break this down.
>> > 1)I really don't see when a backslash can be quoted as a backslash
>> > (presum. in URL)
>> > 2)I see even less when there can be a close-paren with backslash.
>> >
>> > Maybe if I understood this, I could maybe understand why it has to
>> > be converted to hex.
>>
>> If you read the rest of jwz's comments you should have learned fast
>> enough that MORK is the biggest POS file format you'll probably every
>> encounter in your life.
>>
>> Let's hope it will be dropped with Firefox 3.0 (If it hasn't been
>> already) 
>>
> 
> For whatever reasons, I thought I was somehow missing some strange and
> funky CS concept.  After following and reading the URLs in the source
> code, I realized that those lines were meant to deal with MORK itself.

Yup, kudos to jwz for his script. I once tried to decode the format 
myself, and while looking for a specification I found the script.

-- 
John                Experienced Perl programmer: http://castleamber.com/

          Perl help, tutorials, and examples: http://johnbokma.com/perl/


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

Date: 3 Jan 2007 06:54:16 -0800
From: "PerlNovice" <mfarid1@yahoo.com>
Subject: Re: Problematic Perl code
Message-Id: <1167836056.336771.54510@k21g2000cwa.googlegroups.com>

-------------------------------------------------
#!/usr/bin/perl
use Net::FTP;
$ftp = Net::FTP->new("some.host.name", Debug => 1)
    or die "Cannot connect to some.host.name: $@";
$ftp->login("anonymous",'-anonymous@')
    or die "Cannot login ", $ftp->message;
$ftp->cwd("/myfolder")
    or die "Cannot change working directory ", $ftp->message;
$ftp->binary;
for( <*.zip> ){
  $ftp->get($_,"tmp.$$") or die $!;
  $ftp->rename("tmp.$$",$_) or die $!;
  $ftp->size($_) == -s $_ or die "$_ sizes don't match";
}
$ftp->quit;
-----------------------------------------------

Thank you for your responses. Ian, this code does NOT work. It runs,
does not produce any error, but doesn't bring the file from Windows to
UNIX. I don't understand the For loop. For every .zip file, it puts it
in the variable $_. What is:

get($_,"tmp.$$")
Does that mean that every .tmp file is put in $_? Why do we use tmp.$$?

size($_) == -s $_ : What does this do?



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

Date: 3 Jan 2007 07:20:08 -0800
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: Problematic Perl code
Message-Id: <1167837608.294513.162870@k21g2000cwa.googlegroups.com>

PerlNovice wrote:
> -------------------------------------------------
> #!/usr/bin/perl
> use Net::FTP;
> $ftp = Net::FTP->new("some.host.name", Debug => 1)
>     or die "Cannot connect to some.host.name: $@";
> $ftp->login("anonymous",'-anonymous@')
>     or die "Cannot login ", $ftp->message;
> $ftp->cwd("/myfolder")
>     or die "Cannot change working directory ", $ftp->message;
> $ftp->binary;
> for( <*.zip> ){
>   $ftp->get($_,"tmp.$$") or die $!;

This code makes no sense of any kind.  You are iterating through every
 .zip file *on the local machine*, and attempting to retrieve a file of
the same name *on the remote machine*, saving that file back to the
local machine as the name "tmp.$$" ($$ is the process id of the current
process).

>   $ftp->rename("tmp.$$",$_) or die $!;

And this makes even less sense.  Now you're trying to access a file
named $tmp.$$ *on the remote machine*, and change it's name to the file
you just tried to retrieve.  $tmp.$$ never existed on the remote
machine.  Even if it did, you'd then be overwriting the file whose
contents you just copied.

>   $ftp->size($_) == -s $_ or die "$_ sizes don't match";
> }
> $ftp->quit;
> -----------------------------------------------
>
> Thank you for your responses. Ian, this code does NOT work. It runs,
> does not produce any error, but doesn't bring the file from Windows to
> UNIX. I don't understand the For loop. For every .zip file, it puts it
> in the variable $_. What is:
>
> get($_,"tmp.$$")
> Does that mean that every .tmp file is put in $_? Why do we use tmp.$$?
>
> size($_) == -s $_ : What does this do?

Wait a minute.  Your original post said "I have this code".  That is
generally meant to mean "I've written this code".  Now it's pretty
clear that you didn't write it.  Well, frankly, good for you, because
it's crap.  But more importantly, why aren't you asking the person who
did write it to fix it, rather than asking us to explain it to you?

Throw that mess away, read the docs from Net::FTP, and start your own
script.  When you encounter problems with YOUR OWN code, let us know,
and we can probably help you.

Paul Lalli



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

Date: 3 Jan 2007 07:24:31 -0800
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: Problematic Perl code
Message-Id: <1167837871.680935.76830@h40g2000cwb.googlegroups.com>

PerlNovice wrote:
> I have the following Perl code:
>
> -------------------------------------------------
> #!/usr/bin/perl
> use Net::FTP;
> $ftp = Net::FTP->new("some.host.name", Debug => 1)
>     or die "Cannot connect to some.host.name: $@";
> $ftp->login("anonymous",'-anonymous@')
>     or die "Cannot login ", $ftp->message;
> $ftp->cwd("/myfolder")
>     or die "Cannot change working directory ", $ftp->message;
> $ftp->binary;
> for( <*.zip> ){
>   $ftp->get($_,"tmp.$$") or die $!;
>   $ftp->rename("tmp.$$",$_) or die $!;
>   $ftp->size($_) == -s $_ or die "$_ sizes don't match";
> }
> $ftp->quit;
> -----------------------------------------------
>
> I need to do the following:
>
> 1)I need to copy .zip files from Windows to my Unix folder

I have the distinct feeling that your central problem here is using
get() instead of put().  On what machine is this program running - the
Windows or the Unix?  If it's running on Unix and you're trying to
"get" the files from the Windows machine, you have several different
logic problems - see my other response in this thread.  If it's running
on Windows, you should be using "put", not get.  get() retrieves a file
from the remote machine and stores it on the local machine.  put()
takes a file from the local machine and stores it on the remote
machine.

> and name the
> .zip files as something else, let's say, .txt. I then need
> to rename it back to .zip only when the entire file has been copied.

Huh?  Why do you think you need to name it as something else
temporarily?

> This is because I'll be unzipping the files later.

That does not explain why you need to give it a temporary name...

> There could be multiple .zip files in the Windows folder.

 ... and neither does that.

> 2)Once the file(s) are copied completely, a size comparison needs to be
> made between the Windows and Unix sides.
>
> 3)If the sizes are the same, then I need to rename the .txt file back
> to the .zip file.

And if they're not?

Regardless, your program logic does not meet your description.  You do
the renaming *first* and then check the size.

Paul Lalli



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

Date: 03 Jan 2007 08:05:39 -0600
From: Lawrence Statton XE2/N1GAK <yankeeinexile@gmail.com>
Subject: Re: regex problem
Message-Id: <87lkkkdx3g.fsf@gmail.com>

"Andrea Petersen" <andreap@gmx.de> writes:
> Hello,
> 
> i'm new to using regex and working on the following problem for 6 hours now.
> (damn)
> 

And thus you know why everyone says, "Never use regexps to parse HTML"

I would reccomend one of the HTML::* modules (e.g. HTML::Parser
HTML::TreeBuilder)

-- 
	Lawrence Statton - lawrenabae@abaluon.abaom s/aba/c/g
Computer  software  consists of  only  two  components: ones  and
zeros, in roughly equal proportions.   All that is required is to
sort them into the correct order.


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

Date: 3 Jan 2007 06:22:25 -0800
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: regex problem
Message-Id: <1167834145.506596.249160@k21g2000cwa.googlegroups.com>

Andrea Petersen wrote:
> i'm new to using regex and working on the following problem for 6 hours now.
> (damn)
>
>
> <body>
>
> <div>MATCH
> <b>ONE</b></div>
>
> <p> foobar </p>
>
> <div>MATCH <b>TWO</b></div>
>
> </body>
>
>
> I want to extract the two strings between <div> and </div>. The new line in
> the first div-tag drives me crazy.
>
> Can somebody help me out with this? I'm searching for the regular expression
> to match this tags.

Since you don't show what you're doing, it's impossible for us to show
you what you're doing wrong.  Please post a short-but-complete script
that demonstrates the error.  Have you read the Posting Guidelines that
are posted here twice a week?

I'll take a stab in the dark and guess that you are processing the file
line-by-line, but that you're trying to use a pattern match to find a
pattern that spans more than one line.  That obviously won't work.

You need to either: 1) Read the entire file into one big scalar, or 2)
(preferably) use a module that was actually designed for HTML parsing,
rather than rolling your own.

1) Several options: (a) read the file into an array and join() it
together with the empty string; (b) set $/ to undef before reading, and
do one read to a scalar; or (c) use the File::Slurp module
2) Several options, including HTML::Parser and HTML::TokeParser.  I
recommend the latter.  Here's an example using that module:

#!/opt2/perl/bin/perl
use strict;
use warnings;
use HTML::TokeParser;
use Data::Dumper;

my $p = HTML::TokeParser->new(\*DATA);
while (my $token = $p->get_tag("div")){
    my $val;
    while (my $token = $p->get_token()){
        last if $token->[-1] eq '</div>';
        if ($token->[0] =~ /^[SECD]$/) {
            $val .= $token->[-1];
        } elsif ($token->[0] eq 'T') {
            $val .= $token->[1];
        }
    }
    print "Found: '$val'\n";
}

__DATA__
<body>
<div>MATCH
<b>ONE</b></div>
<p> foobar </p>
<div>MATCH <b>TWO</b></div>
</body>


This outputs:
Found: 'MATCH
<b>ONE</b>'
Found: 'MATCH <b>TWO</b>'

Hope this helps,
Paul Lalli



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

Date: Wed, 3 Jan 2007 15:32:37 +0100
From: "Andrea Petersen" <andreap@gmx.de>
Subject: Re: regex problem
Message-Id: <engeqb$ivc$01$1@news.t-online.com>

My problem:

<div>[a-z0-9\,\<\>\/ ]*</div>

does not match the first div-tag. (but matches the second)

-----

<div>[\n a-z0-9\,\<\>\/]*</div>

matches everything between the first <div> and the very last </div>

---

my somach hurts. regexs are very unhealthy.




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

Date: 3 Jan 2007 06:43:59 -0800
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: regex problem
Message-Id: <1167835439.582014.94670@v33g2000cwv.googlegroups.com>

Andrea Petersen wrote:
> My problem:
>
> <div>[a-z0-9\,\<\>\/ ]*</div>

Why are you limiting it to only those characters.  Why are you assuming
people can't type any punctuation between the div tags?

Further, why are you back-slashing the comma, less-than, greater-than,
and front slash in the character class?  None of them need to be
escaped.  (The slash might, if you are using slashes as your regexp
delimiter, but if that were the case, you'd need to escape the one in
the </div> part too)

> does not match the first div-tag. (but matches the second)

Of course not.  You didn't tell it to match newlines.

> <div>[\n a-z0-9\,\<\>\/]*</div>
>
> matches everything between the first <div> and the very last </div>

Right.  You told it to match as much of that stuff as possible.  If you
want quantifiers (like the *) to be non-greedy, add a ? after them.

> my somach hurts. regexs are very unhealthy.

No, regexps are perfectly healthy.  It's your usage of them that's
causing your stomachache.  As I and someone else have both now told
you, Regexps are not meant to parse HTML.  Even when you make the
change above, just because it "works" for your given case is no
guarantee that it will work for any other data.

Paul Lalli



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

Date: Wed, 3 Jan 2007 15:51:01 +0100
From: "Andrea Petersen" <andreap@gmx.de>
Subject: Re: regex problem
Message-Id: <engfss$l2n$01$1@news.t-online.com>

> > <div>[\n a-z0-9\,\<\>\/]*</div>
> >
> > matches everything between the first <div> and the very last </div>
>
> Right.  You told it to match as much of that stuff as possible.  If you
> want quantifiers (like the *) to be non-greedy, add a ? after them.

<div>[\n\r a-z0-9\,\<\>\/]*?</div>   [added the ?]

does the job perfectly. Thank you *very* much.

Andrea




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

Date: Wed, 03 Jan 2007 12:28:26 -0500
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: regex problem
Message-Id: <x77iw4ggud.fsf@mail.sysarch.com>

>>>>> "AP" == Andrea Petersen <andreap@gmx.de> writes:

  >> > <div>[\n a-z0-9\,\<\>\/]*</div>
  >> >
  >> > matches everything between the first <div> and the very last </div>
  >> 
  >> Right.  You told it to match as much of that stuff as possible.  If you
  >> want quantifiers (like the *) to be non-greedy, add a ? after them.

  AP> <div>[\n\r a-z0-9\,\<\>\/]*?</div>   [added the ?]

  AP> does the job perfectly. Thank you *very* much.

no, it is FAR from perfect. you would be better for it if you realized
this. delusions of regex perfection will make more than your stomach
hurt. wait until the div crosses lines or has other chars in it. there
are too many ways to count to break that regex.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


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

Date: 03 Jan 2007 20:44:10 GMT
From: xhoster@gmail.com
Subject: Re: system command won't run with -T option on
Message-Id: <20070103154446.325$PL@newsreader.com>

"Paul Lalli" <mritty@gmail.com> wrote:
> rallabs@adelphia.net wrote:
> > Paul Lalli wrote:
> > > You do not need to print $ENV{PATH} anywhere, but if you wanted to,
> > > you would print it the same way you print anything else.  Regardless,
> > > you need to *set* $ENV{PATH}.  You need to set the path to be a
> > > sequence of directories from which you want to allow commands to be
> > > run.  So if your executable that you're calling via system calls the
> > > program "mycmd.exe", which directories should be searched for
> > > mycmd.exe?
>
> > Thanks for the advice.  I printed out $ENV{PATH} and it said
> > '/usr/local/bin:/usr/bin:/bin'
> > which doesn't have anything in it about any of my variables,
>
> Correct.  The "taintedness" of the PATH has nothing to do with
> variables.  It has to do with the fact that the PATH, by default, comes
> from the environment - that is, it comes from outside your script.  It
> is tainted because it is theoretically possible for someone in the
> environment to set a "bad" PATH before launching your script.  And if
> they do that, you're screwed.

Well, most likely *they* are screwed, not you.

> If your program calls 'mycmd.exe', and
> the malicious user has set PATH to be "/my/really/nasty/viruses/" and
> puts a very bad program named mycmd.exe in that PATH, you're in
> trouble.  By defining the PATH within the script itself, you eliminate
> that possibility.

What are the ways for another party to change *my* PATH environment,
without already having the system completely under their control anyway?
I'm not really worried about someone else tricking Perl code (that I wrote,
but which they, not I, am running) into running some nasty code within
their own account, when they could have run the code in their own account
directly anyway.

The only one I can think of is setuid.  In perhaps the most common
situation in which -T is used, CGI, I think mistrusting PATH might be
excessive, as anyone who can hack apache to change the PATH under which
your script executes probably is already in the driver seat.  Am I wrong on
that?  Is there a way to run "taint-light" in which only things coming from
the http client is tainted, instead of everything coming from outside the
script being tainted?


> > but i then tried:
> >
> > $ENV{PATH}='/usr/local/bin:/usr/bin:/bin';
> >
> > in the script and it seems to have done the job, because it runs now.
> > After 4 hrs. messing around with it I still don't understand why it
> > happened but I guess it's another of the very many Perl mysteries I'll
> > never get
>
> It's really not mysterious.  The -T flag simply insures that nothing
> created or assigned outside of your program can influence your
> program's execution.  The PATH is defined by the environment, unless
> you specifically define it within your script.
>
> Please let us know if you still don't understand.

Indeed, when I first ran into the problem I found it irritating, but
hardly mysterious.  I thought the error was self-explanatory.

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB


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

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


Administrivia:

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

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

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

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

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


------------------------------
End of Perl-Users Digest V10 Issue 10113
****************************************


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