[19889] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2084 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Nov 7 14:10:43 2001

Date: Wed, 7 Nov 2001 11:10:17 -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: <1005160217-v10-i2084@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 7 Nov 2001     Volume: 10 Number: 2084

Today's topics:
        Mounting a drive with Perl <jessica.bull@broadwing.com>
    Re: moving files (Tad McClellan)
        NDSm <Carsten.Schaefer@G-TAC.de>
        Opening/creating files <g.vox@verizon.net>
    Re: Opening/creating files <Laocoon@eudoramail.com>
    Re: Opening/creating files (Tad McClellan)
        Reading series of files on Client's computer with loop (Etal)
    Re: regular expressions news@roaima.freeserve.co.uk
        Return from subroutine behaving unexpectedly <andrew_harton@agilent.com>
    Re: SelfLoader and 'open(FH, "-|")' <mcnuttj@dnps-linux1.telecom.missouri.edu>
    Re: some regex magic (Eric Bohlman)
    Re: some regex magic <anordae@pisem.net>
    Re: some regex magic (Tad McClellan)
    Re: sorry ! <robsjobs@hotmail.com>
        split into words, find in table (Pokerface)
    Re: split into words, find in table <Laocoon@eudoramail.com>
    Re: split into words, find in table <jeff@vpservices.com>
        SQLPLUS via Perl (John Menke)
    Re: SQLPLUS via Perl <rereidy@indra.com>
        Temporarily disabling the print command <pr1@club-internet.fr>
    Re: Temporarily disabling the print command <josef.moellers@fujitsu-siemens.com>
    Re: Temporarily disabling the print command <wuerz@yahoo.com>
    Re: too late for -T? <nickmarkham@mailandnews.com>
    Re: too late for -T? <nickmarkham@mailandnews.com>
    Re: too late for -T? <echang@netstorm.net>
        URGENT!  Please help me with this! <msisto@chat.carleton.ca>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 07 Nov 2001 18:12:09 GMT
From: "Jessica Bull" <jessica.bull@broadwing.com>
Subject: Mounting a drive with Perl
Message-Id: <YPeG7.92386$tb2.7228071@bin2.nnrp.aus1.giganews.com>

All,
I do all of my programming on a Windows platform.  I have been tasked to
write  short script for a Linux platform which copies files to a share.  I
think (open for suggestions on this) that I have to mount a drive for the
share.  Is this correct and how can I do this?  I appreciate your help with
a simple problem.

Jess




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

Date: Wed, 07 Nov 2001 13:37:41 GMT
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: moving files
Message-Id: <slrn9uibe9.ec1.tadmc@tadmc26.august.net>

John W. Krahn <krahnj@acm.org> wrote:
>Joe Smith wrote:
>> In article <jsKF7.77812$ez.10056973@news1.rdc1.nj.home.com>,
>> bubba  <pmi@iname.com> wrote:
>> >I need to write this in perl (part of a larger program)
>> >
>> >in Bash shell:    mv `ls | head -50` ../dir
>> >
>> >"Move the first 50 files from this directory to another directory
>> 
>> http://www.inwap.com/mybin/?hourly.pl has sample code to do that.
>> It runs on Unix and on Win9x.
>
>
>#!/usr/local/bin/perl5
># Name: backyard/hourly.pl              Author: Joe.Smith@inwap.com


>  opendir(DIR,$dir); @imgs = grep(/jpg$|gif$/i,readdir(DIR));

>What happens when opendir() fails?


Also, what happens when DIR contains 'generate_gif'  ?


>  @imgs = grep(!/capture/,@imgs);       # Skip capture_t.jpg
>
>If you want to skip capture_t.jpg then why not
>grep(!/^capture_t\.jpg$/,@imgs);?


Yuck! Why disguise an "eq" as a regex? We're not working on a JAPH here :-)

   grep( $_ ne 'capture_t.jpg', @imgs)


You could filter them out in the first place too:

   grep( /\.(jpg|gif)$/i && $_ ne 'capture_t.jpg', readdir(DIR));


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Wed, 7 Nov 2001 16:25:57 +0100
From: "Carsten Schäfer" <Carsten.Schaefer@G-TAC.de>
Subject: NDSm
Message-Id: <9sbjok$7nu$1@news.online.de>

Hi,

is anyone working with NDSm?
I'd like to do so, but I can not install the NDSm-modules. The author is
talking about Perl 5.0xx and his already compiled module. But I'am working
with ActiveState's Perl 5.6.1

Can anyone help me?

Carsten Schaefer





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

Date: Wed, 07 Nov 2001 16:25:22 GMT
From: "G Harper" <g.vox@verizon.net>
Subject: Opening/creating files
Message-Id: <SfdG7.171$JA3.180790@paloalto-snr2.gtei.net>

How can I open a file to read from, without truncating it, and creating it
if necessary?






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

Date: Wed, 7 Nov 2001 18:00:49 +0100
From: Laocoon <Laocoon@eudoramail.com>
Subject: Re: Opening/creating files
Message-Id: <Xns9152B73F69A7ALaocooneudoramailcom@62.153.159.134>

perldoc perlopentut


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

Date: Wed, 07 Nov 2001 18:10:39 GMT
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Opening/creating files
Message-Id: <slrn9uirlj.fmp.tadmc@tadmc26.august.net>

G Harper <g.vox@verizon.net> wrote:

>How can I open a file to read from, without truncating it, and creating it
>if necessary?


What would be the point of creating an empty file to read from?

You're not going to read much from an empty file.

Anyway (untested):

   unless ( -e $file ) {  # doesn't exist, need to create it...
      open FILE, ">$file" or die "could not create '$file' $!";
   }
   open FILE, $file or die "could not open '$file' for reading  $!";


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: 7 Nov 2001 06:28:59 -0800
From: colorful_98@yahoo.com (Etal)
Subject: Reading series of files on Client's computer with loop
Message-Id: <370bfd7.0111070628.ceb0e7d@posting.google.com>

I want to be able to upload a series of small icons from the client's
computer. Each file is named icon1.gif, icon2.gif...

A multipart form asks the user to locate the file "icon" on their
drive (without extension), then a loop ads the "1.gif, 2.gif..." to
the file.

By Perl does not accept the file name as a valid file on the client's
drive. Any idea of how to do that?

Here is the script I use:

use CGI qw/:standard/;
use CGI::Carp qw/fatalsToBrowser/;
my $file = param('file');
my $fn = $file;
$fn =~ s,^.*(\\|/)(.+)$,$2,; # Extract filename from client path.
if($fn ne "icon") { die "'$fn' is NOT the file I need here.";}

# Assign name to files on Client machine
for ($a = 1; $a < 13; $a++) {
	$file_up = "$file$a.gif";
	$fn_up = "$fn$a.gif";

	if (ref $file_up) {
             # read file	
  	} else {
	     # error reading file  	
        }
}

I get error reading file...


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

Date: 7 Nov 2001 14:23:15 GMT
From: news@roaima.freeserve.co.uk
Subject: Re: regular expressions
Message-Id: <3be943d3@news.netserv.net>

Rafael Garcia-Suarez <rgarciasuarez@free.fr> wrote:
> There's a module on CPAN to extract email addresses from a text :
> Email::Find. You should use it.

It states categorically that it only attempts to match a *subset* of
RFC822 addresses. Only the OP can decide whether this subset is sufficient
for their needs.

Chris


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

Date: Wed, 7 Nov 2001 17:04:19 -0000
From: "Andrew Harton" <andrew_harton@agilent.com>
Subject: Return from subroutine behaving unexpectedly
Message-Id: <1005152668.176148@cswreg.cos.agilent.com>

Hi,

I'm hoping someone can shed some light on this..

By way of background, I'm trying to write a generic console based file
selector to be used as a frontend for a number of scripts I have.  It would
be called by supplying a start directory, the file extension for the
filetype to be chosen and a message indicating what the user is to do, and
it will return the filename that the user selects using the mouse.  At the
moment, I'm just trying to get it working by itself, and I've run into a
problem whereby something weird happens to the return value of the main
subroutine.

Here's what I feel is the relevant code;

  use strict;
  use Win32::Console;
  use File::Spec;

  my $val = DialogBox("c:\\cpi",".txt","Select Text File : ");
  printf "Selection : %s \n", $val;

  sub DialogBox
  {
      my ($dir,$extn,$message) = @_;

      ....Stuff....

      printf "Returning %s \n", $selection;
      return $selection;
}

If I run this, the printf inside the subroutine indicates that it is
returning the correct thing (a filename), but the program never seems to get
to the printf in the main body of the program.

If I change the start of the program to this;

  if((my $val = DialogBox("c:\\cpi",".txt","Select Text File : ")) ne "")
  {
      printf "Selection : %s \n", $val;
  }

then the if() statement evaluates to true, the printf is executed, and the
filename stored in $val is the same as what the subroutine says it's
returning.

Why is this happening?  Any pointers would be appreciated.

Thanks,

Andrew




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

Date: 7 Nov 2001 02:21:16 GMT
From: <mcnuttj@dnps-linux1.telecom.missouri.edu>
Subject: Re: SelfLoader and 'open(FH, "-|")'
Message-Id: <9sa5qs$5ds$1@dipsy.missouri.edu>

This solved the problem.  My script now gets along with fork().  Thanks!

Now I just need to re-arrange my source modules and my Makefile to install
with *and* without SelfLoader...

--J

In comp.lang.perl.modules Andrew Gierth <andrew@erlenstar.demon.co.uk> wrote:

> (didn't see this before, I only read the perl groups intermittently)

> I think your problem is that the child processes are messing up each
> other's reading of the DATA filehandle. Without looking at how DATA is
> implemented internally I can't be certain, but my guess is that it
> actually leaves the original source FH open at that point. All the
> child processes will end up sharing that FH, which means that only one
> of them will be able to read it successfully.

> The fix is actually very simple; force the data to be read immediately
> (but not compiled, it's the compilation that takes the time) rather
> than waiting for the first function call:

> package jscanmacfind;

> use (some packages);
> use SelfLoader;

> BEGIN { .... }

> SelfLoader->load_stubs();

> END { }

> 1;

> __DATA__

> sub macfind($$$) {
> 	...code...
> }

> By calling load_stubs, you make SelfLoader read from DATA and locate
> the subroutines in it (and declare them for you, saving you the bother
> of doing it for yourself).

> -- 
> Andrew.


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

Date: 7 Nov 2001 11:41:26 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: some regex magic
Message-Id: <9sb6l6$1pu$1@bob.news.rcn.net>

Balance Keeper <anordae@pisem.net> wrote:
> There is a string in HTML file:
> <b><i>this</i> and <i>that</i> are important.</b> Oh, <b><i>me
> too!</i></b>

> and we want to extract _all_ words, that are bold and italic
> simultaneously.
> It is an example from Perl Cookbook, but the regex in it doesn't work
> properly.
> Maybe somebody can help me with this.

Use a parser, not a regex:

#!perl -w
use strict;
use HTML::TokeParser;
my ($bold,$italic);
my $p=HTML::TokeParser->new(\*DATA);
while (my $t=$p->get_token()) {
  if ($t->[0] eq 'S') {
    ++$bold if lc($t->[1]) eq 'b';
    ++$italic if lc($t->[1]) eq 'i';
  }
  elsif ($t->[0] eq 'E') {
    --$bold if lc($t->[1]) eq 'b';
    --$italic if lc($t->[1]) eq 'i';
  }
  elsif ($t->[0] eq 'T') {
    print "$t->[1]\n" if $bold and $italic;
  }
}
__END__
<b><i>this</i> and <i>that</i> are important.</b> Oh, <b><i>me
too!</i></b>



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

Date: Wed, 07 Nov 2001 19:19:05 +0300
From: Balance Keeper <anordae@pisem.net>
Subject: Re: some regex magic
Message-Id: <3BE95EF9.6FDC4987@pisem.net>



Eric Bohlman wrote:

> Balance Keeper <anordae@pisem.net> wrote:
> > There is a string in HTML file:
> > <b><i>this</i> and <i>that</i> are important.</b> Oh, <b><i>me
> > too!</i></b>
>
> > and we want to extract _all_ words, that are bold and italic
> > simultaneously.
> > It is an example from Perl Cookbook, but the regex in it doesn't work
> > properly.
> > Maybe somebody can help me with this.
>
> Use a parser, not a regex:
>
> #!perl -w
> use strict;
> use HTML::TokeParser;
> my ($bold,$italic);
> my $p=HTML::TokeParser->new(\*DATA);
> while (my $t=$p->get_token()) {
>   if ($t->[0] eq 'S') {
>     ++$bold if lc($t->[1]) eq 'b';
>     ++$italic if lc($t->[1]) eq 'i';
>   }
>   elsif ($t->[0] eq 'E') {
>     --$bold if lc($t->[1]) eq 'b';
>     --$italic if lc($t->[1]) eq 'i';
>   }
>   elsif ($t->[0] eq 'T') {
>     print "$t->[1]\n" if $bold and $italic;
>   }
> }
> __END__
> <b><i>this</i> and <i>that</i> are important.</b> Oh, <b><i>me
> too!</i></b>

That works, I know, but I want a regex, just one _simple_ regex :)
and still I cannot find the sollution :(

--
  Temel Nosce




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

Date: Wed, 07 Nov 2001 18:10:37 GMT
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: some regex magic
Message-Id: <slrn9uirai.fmp.tadmc@tadmc26.august.net>

Balance Keeper <anordae@pisem.net> wrote:
>Eric Bohlman wrote:
>> Balance Keeper <anordae@pisem.net> wrote:
>> > There is a string in HTML file:
>> > <b><i>this</i> and <i>that</i> are important.</b> Oh, <b><i>me
>> > too!</i></b>
>>
>> > and we want to extract _all_ words, that are bold and italic
>> > simultaneously.

>> Use a parser, not a regex:

>That works, I know, but I want a regex, just one _simple_ regex :)
                         ^^^^^^
>and still I cannot find the sollution :(
             ^^^^^^^^^^^^^^^^^^^^^^^^^


That is because there *is no* solution! (certainly not a simple one)

"I want" my car to get 65 mpg and accelerate from 0-60 in 3 seconds.

Ain't gonna happen in my lifetime.

It's like that guy with the large mouth says:

   "You can't always get what you want."


When you think you have a regex solution, post it here and we
will give you some legal HTML that breaks it. Then patch it up
for that case, and post it again. We will break it for you again.

Lather. Rinse. Repeat.

It will feel really good when you stop banging your head against the wall.

:-)


There are several examples of tricky HTML in a FAQ answer:

   perldoc -q HTML

-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Wed, 07 Nov 2001 15:36:48 GMT
From: "Rob" <robsjobs@hotmail.com>
Subject: Re: sorry !
Message-Id: <kycG7.5541$Yb.1700794@typhoon.tampabay.rr.com>


"hugh1" <weiwe1@yeah.net> wrote in message
news:7dcf30ba.0111051633.7c473fd6@posting.google.com...
>  i want to know in perl programing how should call one cgi program which
> maybe complied with C or some other languages.
>  how can i trans argv to it!!


You should not attempt to run a CGI specific program from another CGI
program.  BUT,  if the compiled C program is a regular program, you can pass
the arguments with the system command.  CGI programs expect values to exist
in the Environment variables and setting all of the needed variables is
beyond the scope of what you should do with a CGI program.  Use the system
command to execute the second program if it is a regular program and you
only need to pass arguments to it...

system('command','arg1','arg2','argx') or die "couldn't execute \'command\':
$!\n";


Rob




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

Date: Wed, 07 Nov 2001 12:20:58 GMT
From: paul@xpand.nl (Pokerface)
Subject: split into words, find in table
Message-Id: <3bea255f.774427147@news.zwoll1.ov.nl.home.com>

Hi,

I'm tryng to find / make a script that does the following, but can't
figure out what to do....

I'd like to compare words in a string (from a DB record) to another
table (word, description). If a word from the first record equals a
word in the second table, it has to retrun the description.

The sencentences from the first string have to splitted into words.

First table:
Content
-----------
Content_Id
Content_text


Second tabel:
WordsDescription
--------------------
WD_Id
WD_Word
WD_Desc.

Anyone who can help me with this ?

Thank you very much !

P.




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

Date: Wed, 7 Nov 2001 16:16:08 +0100
From: Laocoon <Laocoon@eudoramail.com>
Subject: Re: split into words, find in table
Message-Id: <Xns9152A57EFB75ELaocooneudoramailcom@62.153.159.134>

paul@xpand.nl (Pokerface) wrote in news:3bea255f.774427147
@news.zwoll1.ov.nl.home.com:

> Hi,
> 
> I'm tryng to find / make a script that does the following, but can't
> figure out what to do....
> 
> I'd like to compare words in a string (from a DB record) to another
> table (word, description). If a word from the first record equals a
> word in the second table, it has to retrun the description.
> 

Is the description exactly one line as in your example? And is the word the 
only thing in a line?

$table2 =~ /$word\n(.+)\n/

This called in proper context (i.e. a grep) will return the description ( if 
it is in the next line)

Please post more input.. 


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

Date: Wed, 07 Nov 2001 09:10:00 -0800
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: split into words, find in table
Message-Id: <3BE96AE8.14876664@vpservices.com>

Pokerface wrote:
> 
> Hi,
> 
> I'm tryng to find / make a script that does the following, but can't
> figure out what to do....
> 
> I'd like to compare words in a string (from a DB record) to another
> table (word, description). If a word from the first record equals a
> word in the second table, it has to retrun the description.
> 
> The sencentences from the first string have to splitted into words.
> 
> First table:
> Content
> -----------
> Content_Id
> Content_text
> 
> Second tabel:
> WordsDescription
> --------------------
> WD_Id
> WD_Word
> WD_Desc.
> 

use DBI;
#... connect to the db
my $sth = $dbh->prepare(qq~
    SELECT Content_text, WD_Desc
      FROM Content, WordsDescription
     WHERE Content.Content_text = WordsDescription.WD_Desc
~);

-- 
Jeff



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

Date: 7 Nov 2001 09:14:43 -0800
From: jmenke@scsnet.csc.com (John Menke)
Subject: SQLPLUS via Perl
Message-Id: <3a2d73ac.0111070914.5ead7074@posting.google.com>

I need to execute a script designed for SQLPLUS in Perl and return the
output of the script back into the perl environment (meaning I want to
examine the output from perl)

I have searched the archives and the best advice I could come up with
is:

------------------------------------------
my ($sqlinput)  = "c:\\aaa\\fragment1.sql";
my ($sqloutput) = "c:\\aaa\\test.lst";
open (SQLPLUS, "|sqlplus -S username/password \@$sqlinput |")
  or die "cannot open sqlplus";
open (RESULTS, ">$sqloutput")
  or die "cannot open output file";
while( $line = <SQLPLUS>) {
   print RESULTS $line;
}

close RESULTS;
close SQLPLUS;
--------------------------------------------

this will run fine and will create test.lst, but it is always empty! 
I verify the script is running by using spool inside the SQL file and
it produces output.  Problem is I want the output to stay inside Perl
(probably not phrasing this correctly) - I want to get the output into
a variable...


Can anyone show me how to do this?

john


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

Date: Wed, 07 Nov 2001 10:37:19 -0700
From: Ron Reidy <rereidy@indra.com>
Subject: Re: SQLPLUS via Perl
Message-Id: <3BE9714F.E10E40D0@indra.com>

John Menke wrote:
> 
> I need to execute a script designed for SQLPLUS in Perl and return the
> output of the script back into the perl environment (meaning I want to
> examine the output from perl)
> 
> I have searched the archives and the best advice I could come up with
> is:
> 
> ------------------------------------------
> my ($sqlinput)  = "c:\\aaa\\fragment1.sql";
> my ($sqloutput) = "c:\\aaa\\test.lst";
> open (SQLPLUS, "|sqlplus -S username/password \@$sqlinput |")
>   or die "cannot open sqlplus";
> open (RESULTS, ">$sqloutput")
>   or die "cannot open output file";
> while( $line = <SQLPLUS>) {
>    print RESULTS $line;
> }
> 
> close RESULTS;
> close SQLPLUS;
> --------------------------------------------
> 
> this will run fine and will create test.lst, but it is always empty!
> I verify the script is running by using spool inside the SQL file and
> it produces output.  Problem is I want the output to stay inside Perl
> (probably not phrasing this correctly) - I want to get the output into
> a variable...
> 
> Can anyone show me how to do this?
> 
> john
The problem is in the use of the '|' pipes at the begining and end of
your open() call.  See perldoc perlipc for an explanation of this issue.

To do what I think you might want, try...

my $script = "c:\\aaa\\fragment1.sql";

open(SQLPLUS, "sqlplus -s uid/pwd \@$script |") || die $!;
while (<SQLPLUS>) {
	# work with the data
}
close(SQLPLUS);
-- 
Ron Reidy
Oracle DBA
Reidy Consulting, L.L.C.


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

Date: 07 Nov 2001 14:11:38 GMT
From: Philippe de Rochambeau <pr1@club-internet.fr>
Subject: Temporarily disabling the print command
Message-Id: <2001117-151138-351080@foorum.com>


Hello,

is there a way to temporarily disable print commands, apart from commenting all 
the lines in your code containing that command? For instance, I would like all 
the following print commands not to print to the debug.txt file:



open(FH, ">debug.txt" )...
 ..
print FH "The var variable contains ...
print FH "Hell world...

close(FH)

How can I do that?

Many thanks.

Philippe de Rochambeau

-- 
User of http://www.foorum.com/. The best tools for usenet searching.


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

Date: Wed, 07 Nov 2001 15:34:39 +0100
From: Josef =?iso-8859-1?Q?M=F6llers?= <josef.moellers@fujitsu-siemens.com>
Subject: Re: Temporarily disabling the print command
Message-Id: <3BE9467F.1DAF55B8@fujitsu-siemens.com>

Philippe de Rochambeau wrote:
> =

> Hello,
> =

> is there a way to temporarily disable print commands, apart from commen=
ting all
> the lines in your code containing that command? For instance, I would l=
ike all
> the following print commands not to print to the debug.txt file:
> =

> open(FH, ">debug.txt" )...
> ..
> print FH "The var variable contains ...
> print FH "Hell world...
> =

> close(FH)
> =

> How can I do that?

open /dev/null, instead?

-- =

Josef M=F6llers (Pinguinpfleger bei FSC)
	If failure had no penalty success would not be a prize
						-- T.  Pratchett


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

Date: 07 Nov 2001 09:38:05 -0500
From: Mona Wuerz <wuerz@yahoo.com>
Subject: Re: Temporarily disabling the print command
Message-Id: <m3g07qk5o2.fsf@DCCMBX01.njitdm.campus.njit.edu>

Philippe de Rochambeau <pr1@club-internet.fr> writes:

> is there a way to temporarily disable print commands, apart from commenting all 
> the lines in your code containing that command? 

not with a Perl builtin, as far as I know

>                                                 For instance, I would like all 
> the following print commands not to print to the debug.txt file:

You could declare a 'debug' flag, and make all offending print
statements dependend on that:

#!/usr/bin/perl -w
use strict;
use constant DEBUG => 1;

# ...

DEBUG and print "Hello world\n";        # will be printed if DEBUG
DEBUG and print FH "Here goes\n";       # is set to a true value
print "I'm alive\n";                    # will always be printed
__END__

-- 
$_="\n,rekcah egnufeB rehtona tsuJ";#v1<?>g\:pv-<5<
s s\S+(?:B)sunpack'u',q q$;')E4qsee;#>60#^<(v!<)g6<
print scalar reverse,$@ unless m,[+;#]55,;m:_,:#^1<


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

Date: Wed, 7 Nov 2001 10:41:15 -0500
From: "Nicholas R. Markham" <nickmarkham@mailandnews.com>
Subject: Re: too late for -T?
Message-Id: <9sbkbf$m3m$1@newsfeeds.rpi.edu>

No, the scripts run on a Linux machine.

"Cameron Dorey" <camerond@mail.uca.edu> wrote in message
news:3BE813A9.E07876B@mail.uca.edu...
> "Nicholas R. Markham" wrote:
> >
> > I have a Perl CGI (several, in fact) that I want to make more secure
using
> > taint mode.  The shebang line looks like
> >
> > #! /usr/bin/perl -T
> >
> > But when I try to run it, perl says 'Too late for "-T" option at
script.cgi
> > line 1.'
> > How can the first line of the script be too late?
>
> Sounds like you're working on Window$, yes? (at least your message came
> from a Window$ machine) You have to call Perl with the -T option enabled
> in your file association. As you know, Perl is called from your file
> association, instead of the script (except when you're using Apache, I
> don't know) in Window$, so you have already started perl.exe when you
> start reading the script. Thus it's too late.




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

Date: Wed, 7 Nov 2001 10:46:05 -0500
From: "Nicholas R. Markham" <nickmarkham@mailandnews.com>
Subject: Re: too late for -T?
Message-Id: <9sbkkg$kc2$1@newsfeeds.rpi.edu>

I've got it working now.  Thanks for all the help.

"Nicholas R. Markham" <nickmarkham@mailandnews.com> wrote in message
news:9s8uun$uik$1@newsfeeds.rpi.edu...
> I have a Perl CGI (several, in fact) that I want to make more secure using
> taint mode.  The shebang line looks like
>
> #! /usr/bin/perl -T
>
> But when I try to run it, perl says 'Too late for "-T" option at
script.cgi
> line 1.'
> How can the first line of the script be too late?




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

Date: Wed, 07 Nov 2001 16:45:26 GMT
From: "E.Chang" <echang@netstorm.net>
Subject: Re: too late for -T?
Message-Id: <Xns9152789BFF0BFechangnetstormnet@207.106.93.86>

"Nicholas R. Markham" <nickmarkham@mailandnews.com> wrote in
news:9sbkbf$m3m$1@newsfeeds.rpi.edu: 

> No, the scripts run on a Linux machine.

On linux, you will get this response if you invoke perl and give it the 
script as an argument - for example

$ perl toolate

If you invoke the script directly

$ ./toolate

it will not have the problem.

 
> "Cameron Dorey" <camerond@mail.uca.edu> wrote in message
> news:3BE813A9.E07876B@mail.uca.edu...
>> "Nicholas R. Markham" wrote:
>> >
>> > I have a Perl CGI (several, in fact) that I want to make more
>> > secure using taint mode.  The shebang line looks like
>> >
>> > #! /usr/bin/perl -T
>> >
>> > But when I try to run it, perl says 'Too late for "-T" option at
>> > script.cgi line 1.'
>> > How can the first line of the script be too late?
[snip]


-- 
EBC


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

Date: 7 Nov 2001 18:15:37 GMT
From: "Marianne Sisto" <msisto@chat.carleton.ca>
Subject: URGENT!  Please help me with this!
Message-Id: <9sbto9$7h1$1@bertrand.ccs.carleton.ca>

Hi, I have to get this working because it is for an assignment which is due
on Fri! I have written code to store cookies. This appears to be working.
Then I have some code to read the cookies.  I have used print statements to
test this and it seems to be reading the cookies.  But, I am trying to
compare a variable called $STU_NUM with the name of the cookies, and it just
will NOT find them equal, even when they are.  This is what I have done:

    $cookieName=$STU_NUM;
    $cookieData;
    foreach $course(@validCourses){
         $cookieData=$cookieData.$course."/t";
    }
    print "Set-Cookie:$cookieName=$cookieData;expires=Tue 11-12-2001
00:00:00 GMT\n";

This is supposed to take the data out of the validCourses array, bit by bit
and concatenate it to the string cookieData, and it seems to work.  The data
is separated by tabs.

Then, later on I read the cookies:

if($ENV{'HTTP_COOKIE'}){

          @cookies=split(/;/,$ENV{'HTTP_COOKIE'});
           foreach $cookie(@cookies){
                ($name,$value)=split(/=/,$cookie);
                $crumbs{$name}=$value;
          }

        foreach $key(keys%crumbs)
        {
              print "key is $key";
              print "stu_num is $STU_NUM";   #testing

              if($key eq $STU_NUM){
                  print "FOUND IT!";
              }
              else  #testing
              {
                  print "THIS IS NOT IT";
              }
        }

        if(exists $crumbs{$STU_NUM}){
           print "found";
        }
        else{
           print "not found";
        }
}

It prints out the keys and the student numbers, and I can see that they are
equal, but it NEVER finds it - what am I doing wrong?  It always prints out
this is not it and not found!
Help!
Thank you in advance.
Marianne.








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

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


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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

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

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


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


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