[13541] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 951 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Sep 30 11:17:09 1999

Date: Thu, 30 Sep 1999 08:10:16 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <938704216-v9-i951@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 30 Sep 1999     Volume: 9 Number: 951

Today's topics:
        Q: Syntax to open a file in PERL on an NT server (Necromancer)
    Re: Q: Syntax to open a file in PERL on an NT server <eldridgem@ihorizons.net>
    Re: Q: Syntax to open a file in PERL on an NT server <rhomberg@ife.ee.ethz.ch>
    Re: Q: Syntax to open a file in PERL on an NT server (Necromancer)
    Re: question: cgi-script on server a database on server <no_one@no_place.com>
    Re: question: cgi-script on server a database on server <rgsmith@c-gate.net>
    Re: RedHat Linux 6.0 and Perl 5.005_03 (Dan Wilga)
        return ? byoodeja@my-deja.com
    Re: return ? <rhomberg@ife.ee.ethz.ch>
    Re: return ? c_j_marshall@my-deja.com
    Re: return ? <gellyfish@gellyfish.com>
    Re: return ? <gmarzot@baynetworks.com>
        setuid script <pbyrne@ie.oracle.com>
        STDIN & @ARGV (Eisen Chao)
    Re: Thread::Signal troubles (Malcolm Beattie)
        using tr? (James Stevenson)
    Re: using tr? c_j_marshall@my-deja.com
    Re: using tr? <picaza@chsi.com>
    Re: using tr? <sariq@texas.net>
    Re: using tr? c_j_marshall@my-deja.com
    Re: Validating unsafe code? (M.J.T. Guy)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Thu, 30 Sep 1999 14:21:23 GMT
From: necr0mancer@myremarq.com (Necromancer)
Subject: Q: Syntax to open a file in PERL on an NT server
Message-Id: <38737117.81209893@news>

I've been a PERL scripter on UNIX for quite awhile, but I've never had
to create PERL for NT.  The scripts I had I'm having to port over, and
I can't even get data files to read in!  Can someone help?

My old syntax was:

open(DATA,"<../data/newratesdata.txt");

showing that I went up a directory, went into /data/ and grabbed the
file.  The sysadmin of the NT server is telling me that since the PERL
is being handled with MIMETYPE on the server, that relative paths mean
nothing and will not work.  He suggested I use an absolute path.  I
have never scripted a filehandler to use an absolute address like so:

open(DATA,"<http://www.mycompany.com/data/newratesdata.txt");

and even when I tried it nothing happened.  I think it's invalid code
anyway.  So, I'm stuck with a script which loads up, but doesn't read
any data in.  

Any suggestions?

Thanks!



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

Date: Thu, 30 Sep 1999 10:28:47 -0400
From: "M.E." <eldridgem@ihorizons.net>
Subject: Re: Q: Syntax to open a file in PERL on an NT server
Message-Id: <37F3739F.836BE448@ihorizons.net>

You wouldn't put the http address there. You would put the hard drive
address.
So if the directory is c:\home\data\newratesdata.txt, you'd put:

open(DATA,"</home/data/newratesdata.txt");


Necromancer wrote:

> I've been a PERL scripter on UNIX for quite awhile, but I've never had
> to create PERL for NT.  The scripts I had I'm having to port over, and
> I can't even get data files to read in!  Can someone help?
>
> My old syntax was:
>
> open(DATA,"<../data/newratesdata.txt");
>
> showing that I went up a directory, went into /data/ and grabbed the
> file.  The sysadmin of the NT server is telling me that since the PERL
> is being handled with MIMETYPE on the server, that relative paths mean
> nothing and will not work.  He suggested I use an absolute path.  I
> have never scripted a filehandler to use an absolute address like so:
>
> open(DATA,"<http://www.mycompany.com/data/newratesdata.txt");
>
> and even when I tried it nothing happened.  I think it's invalid code
> anyway.  So, I'm stuck with a script which loads up, but doesn't read
> any data in.
>
> Any suggestions?
>
> Thanks!



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

Date: Thu, 30 Sep 1999 16:45:12 +0200
From: Alex Rhomberg <rhomberg@ife.ee.ethz.ch>
Subject: Re: Q: Syntax to open a file in PERL on an NT server
Message-Id: <37F37778.78E63C2D@ife.ee.ethz.ch>

Necromancer wrote:
> 
> I've been a PERL scripter on UNIX for quite awhile, but I've never had
> to create PERL for NT.  The scripts I had I'm having to port over, and
> I can't even get data files to read in!  Can someone help?
> 
> My old syntax was:
> 
> open(DATA,"<../data/newratesdata.txt");

As any regular on this ng could tell you, this is wrong. It should read

open(DATA, $file) or die "Don't wan't to live anymore because of $!";

> showing that I went up a directory, went into data/ and grabbed the
> file.  The sysadmin of the NT server is telling me that since the PERL
> is being handled with MIMETYPE on the server, that relative paths mean
> nothing and will not work.  He suggested I use an absolute path.  I
> have never scripted a filehandler to use an absolute address like so:
> 
> open(DATA,"<http://www.mycompany.com/data/newratesdata.txt");

You assume that perl open can directly fetch a file from the web?
an absolute path looks like
'/usr/local/httpd/data/subdir/here'
or on MS products, it should be something like
C:\Micros~1\window~1\webser~1\datadi~1

to find the absolute path, go into the correct directory and run the NT
equivalent of 'pwd'

and don't forget to check the result of your open

- Alex


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

Date: Thu, 30 Sep 1999 14:55:39 GMT
From: necr0mancer@myremarq.com (Necromancer)
Subject: Re: Q: Syntax to open a file in PERL on an NT server
Message-Id: <38747931.83283605@news>

On Thu, 30 Sep 1999 14:21:23 GMT, necr0mancer@myremarq.com
(Necromancer) wrote:

>I've been a PERL scripter on UNIX for quite awhile, but I've never had
>to create PERL for NT.  The scripts I had I'm having to port over, and
>I can't even get data files to read in!  Can someone help?
>
>My old syntax was:
>
>open(DATA,"<../data/newratesdata.txt");
>
>showing that I went up a directory, went into /data/ and grabbed the
>file.  The sysadmin of the NT server is telling me that since the PERL
>is being handled with MIMETYPE on the server, that relative paths mean
>nothing and will not work.  He suggested I use an absolute path.  I
>have never scripted a filehandler to use an absolute address like so:
>
>open(DATA,"<http://www.mycompany.com/data/newratesdata.txt");
>
>and even when I tried it nothing happened.  I think it's invalid code
>anyway.  So, I'm stuck with a script which loads up, but doesn't read
>any data in.  
>
>Any suggestions?
>
>Thanks!

An update to this question... the server is using ActiveState 5.18!

Thanks


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

Date: Thu, 30 Sep 1999 08:12:45 -0500
From: "Roger G. Smith" <no_one@no_place.com>
Subject: Re: question: cgi-script on server a database on server b
Message-Id: <7svnr6$6ia@enews2.newsguy.com>

>
|<quoth Abigail>
|. Some of the most well known protocols are NFS and UUCP.

You overlooked FTD.

[Advantages:  FTD can deliver to 99.8% of the U.S. population. as well as
international locations, unlike NFS and UUCP, which can at best deliver to
connected servers.. FTD stands behind a 100% satisfaction guarantee on all
orders sent through FTD for delivery within the U.S. and Canada. Other
protocols offer no such guarantee.  Disadvantage:  FTD is not, to my
knowledge, licensed under the GPL or other open-source license.  Per packet
charges apply. see www.ftd.com]

-Roger

--
I'm out of coffee.  I'm posting to Usenet
There's some precedence or other logic error here...
--





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

Date: Thu, 30 Sep 1999 08:31:27 -0500
From: "Roger" <rgsmith@c-gate.net>
Subject: Re: question: cgi-script on server a database on server b
Message-Id: <7svosp$72r@enews2.newsguy.com>

>
|<quoth Abigail>
|. Some of the most well known protocols are NFS and UUCP.

You overlooked FTD.

[Advantages:  FTD can deliver to 99.8% of the U.S. population. as well as
international locations, unlike NFS and UUCP, which can at best deliver to
connected servers.. FTD stands behind a 100% satisfaction guarantee on all
orders sent through FTD for delivery within the U.S. and Canada. Other
protocols offer no such guarantee.  Disadvantage:  FTD is not, to my
knowledge, licensed under the GPL or other open-source license.  Per packet
charges apply. see www.ftd.com]
--
I'm out of coffee.  I'm posting to Usenet
There's some precedence or other logic error here...
--







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

Date: Thu, 30 Sep 1999 09:34:10 -0400
From: dwilgaREMOVE@mtholyoke.edu (Dan Wilga)
Subject: Re: RedHat Linux 6.0 and Perl 5.005_03
Message-Id: <dwilgaREMOVE-3009990934110001@wilga.mtholyoke.edu>

In article <slrn7v5l1l.9j.efflandt@efflandt.xnet.com>, efflandt@xnet.com wrote:

> >Also, trying to execute a chmod command from within a CGI script does not
> >seem to do anything, but when run from a shell it executes correctly.
> 
> The webserver runs as 'nobody' (unless configured for suexec) so CGI can
> only do what 'nobody' (others) can do.

That's not necessarily true; it's often a configuration option. The Apache
documentation, for instance, strongly recommends AGAINST running it as
nobody, since that user will often own unrelated files on the system.

Dan Wilga          dwilgaREMOVE@mtholyoke.edu
** Remove the REMOVE in my address address to reply reply  **


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

Date: Thu, 30 Sep 1999 13:47:40 GMT
From: byoodeja@my-deja.com
Subject: return ?
Message-Id: <7svpln$vrp$1@nnrp1.deja.com>

Perl gurus out there,


What does this return ?

$year = ($birthdate =~ /^(dddd)-(dd)s*$/);

$year is empty when I ran on my WinNT machine. I thought it should
return "true".

Thanks in advance.


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Thu, 30 Sep 1999 16:16:11 +0200
From: Alex Rhomberg <rhomberg@ife.ee.ethz.ch>
Subject: Re: return ?
Message-Id: <37F370AB.F8BD1B27@ife.ee.ethz.ch>

byoodeja@my-deja.com wrote:
> 
> Perl gurus out there,
> 
> What does this return ?
> 
> $year = ($birthdate =~ /^(dddd)-(dd)s*$/);

it returns true (in $year) if $birthdate is "dddd-dd", with any number
of 's' at the end of the string. 

You might want to look for \d in perldoc perlre and decide that adding
some backslashes could help

- Alex


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

Date: Thu, 30 Sep 1999 14:20:40 GMT
From: c_j_marshall@my-deja.com
Subject: Re: return ?
Message-Id: <7svrj9$1cb$1@nnrp1.deja.com>

In article <7svpln$vrp$1@nnrp1.deja.com>,
  byoodeja@my-deja.com wrote:
> Perl gurus out there,
>
> What does this return ?
>
> $year = ($birthdate =~ /^(dddd)-(dd)s*$/);
>
> $year is empty when I ran on my WinNT machine. I thought it should
> return "true".
>

What is in $birthdate ?


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 30 Sep 1999 15:44:45 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: return ?
Message-Id: <37f3775d_2@newsread3.dircon.co.uk>

byoodeja@my-deja.com wrote:
> Perl gurus out there,
> 
> 
> What does this return ?
> 
> $year = ($birthdate =~ /^(dddd)-(dd)s*$/);
> 
> $year is empty when I ran on my WinNT machine. I thought it should
> return "true".
> 

depends on what you've got in $birthdate  - what you have there will
match four 'd's followed by a dash followed by 2'd's followed by zero or
more 's' and thats it - it doesnt look like much of a date to me -
read the perlre manpage :

  perldoc perlre

/J\
-- 
"I don't have access to the intelligence" - Michael Howard


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

Date: 30 Sep 1999 10:58:16 -0400
From: Joe Marzot <gmarzot@baynetworks.com>
Subject: Re: return ?
Message-Id: <pd3dvw1m5z.fsf@baynetworks.com>

byoodeja@my-deja.com writes:

> Perl gurus out there,
> 
> 
> What does this return ?
> 
> $year = ($birthdate =~ /^(dddd)-(dd)s*$/);

hmmm... did you forget the backslash? 

> 
> $year is empty when I ran on my WinNT machine. I thought it should
> return "true".
> 
> Thanks in advance.
> 
> 
> Sent via Deja.com http://www.deja.com/
> Before you buy.

-- 
G.S. Marzot                        email: gmarzot@nortelnetworks.com
Nortel Networks                    voice: (978)916-3990
600 Tech Park  M/S BL60-101        pager: (800)409-6080 (4096080@skytel.com)
Billerica, MA  01821                 fax: (978)670-8145


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

Date: Thu, 30 Sep 1999 15:22:29 +0100
From: Pascal Byrne <pbyrne@ie.oracle.com>
Subject: setuid script
Message-Id: <37F37225.3BF737E@ie.oracle.com>

Hi,

I am trying to run a UNIX setuid script with an include path and get the
following:
  No -I while running setuid.
If I remove the -I then the following error is given:
  Insecure $ENV{PATH} while running setuid

I read the docs and tried using the -U switch but that hasn't helped.
Any ideas?

Perl: 5.005_02
OS: Solaris 2.5.1

Thanks,
pascal



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

Date: Thu, 30 Sep 1999 14:43:48 GMT
From: echao@interaccess.com (Eisen Chao)
Subject: STDIN & @ARGV
Message-Id: <rv6tp4ou3i542@corp.supernews.com>

Howdy All:

My Question:

   How do I write a Perl script (to be compiled)
   that can do all of the following:

   1) cat SOMEDATA | compiledpl

             or
  
   2) compiledpl -d -s anotherfile morefiles.*

             as well as

   3) cat SOMEDATA | compiledpl -d evenmorefiles.*


   If I set up my begining something like:

      @ARGV = <STDIN> unless @ARGV
   
   It won't work for my 3rd case of piped input + command line
   options and parms, it shortcircuit and ignores the streamed data.

   If the script expects <STDIN> as well as @ARGV all the time, then
   if I run it like:

      compiledpl -h

   for example to run 'help', the script will hang. I'd like
   to be able to acommodate all 3) scenarios for my compiled
   script. I know that if I run it something like:

      perl -MagicPerlOption nameofscript -d -f somefilename

   this will work, but since I'd like to compile the script
   into an MS-DOS .EXE file.

   Is this asking too or is it indeed possible (as well as 
   easy to implement) ?

   
   Thanks in Advance,

   Eisen
   Chicago


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

Date: 30 Sep 1999 12:17:47 GMT
From: mbeattie@sable.ox.ac.uk (Malcolm Beattie)
Subject: Re: Thread::Signal troubles
Message-Id: <7svkdb$a25$1@news.ox.ac.uk>

In article <FIuGzL.2G4@news.boeing.com>,
Charles DeRykus <ced@bcstec.ca.boeing.com> wrote:
>In article <37f11d30.159060214@news.infinet.net>,
>Jeff Magnusson <jeff@riverstyx.net> wrote:
>>Hey, I'm having difficulty making an existing script that uses signals
>>to work with the Thread::Signals system:
>>
>>Here's the REAPER function to clean up after a child exits:
>>(with lots of debug code).  I'm consistently gettinga -1 from waitpid,
>>which used to work perfectly.
>>
>>
>>sub REAPER {
>>   my ($pid,$exit_value,$signal_num,$core_dumped);
>>   &log("DEBUG (REAPER): Starting...");
>>    ...
>
>I haven't seen Thread::Signals so the following may have
>nothing to due with your problem. (I seem to recall seeing
>some discouraging reports about signals in threaded  
>programs though). 
>
>However, some of the calls below could exacerabate the problems 
>you're seeing. Perl signals in general aren't particularly 
>robust as you probably know.  Moreover, the underlying signal 
>mechanisms are vulnerable to calls that may generate a malloc.  
>In other words, don't allocate those lexicals inside the handler; 
>don't do any debugging I/O. 

On the contrary, the Thread::Signal module exists precisely in order to
make signal handlers free to do pretty much anything they want. The
catch is that your signal handlers run in a different thread and so
some of the games you might like to play, with SIGCHLD signals for
example, don't have quite the affect you might otherwise expect.

--Malcolm

-- 
Malcolm Beattie <mbeattie@sable.ox.ac.uk>
Oxford University Computing Services
"I permitted that as a demonstration of futility" --Grey Roger


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

Date: Thu, 30 Sep 1999 12:40:24 +0000
From: James@linux.home (James Stevenson)
Subject: using tr?
Message-Id: <slrn7v6mho.et6.James@linux.home>

Hi

could somebody please send me an example of useing
tr in perl

thanks
	James

-- 
---------------------------------------------
Check Out: http://www.users.zetnet.co.uk/james/
E-Mail: mistral@stevenson.zetnet.co.uk
 12:30pm  up 20:25,  5 users,  load average: 1.18, 1.23, 1.25


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

Date: Thu, 30 Sep 1999 12:58:54 GMT
From: c_j_marshall@my-deja.com
Subject: Re: using tr?
Message-Id: <7svmq8$tke$1@nnrp1.deja.com>

In article <slrn7v6mho.et6.James@linux.home>,
  mistral@stevenson.zetnet.co.uk wrote:
> Hi
>
> could somebody please send me an example of useing
> tr in perl


Why ?
Has someone removed all the examples of tr// from your faq and
documentation ?

Oh well - guess you'll have to go out and buy Programming Perl like the
rest of us.

Getting stuck and asking for help is OK.
Not even trying is less so.


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Thu, 30 Sep 1999 09:22:24 -0400
From: "Peter Icaza" <picaza@chsi.com>
Subject: Re: using tr?
Message-Id: <7svo5l$22o2$1@pike.uhc.com>


you're gunna get a lot of flames for this...




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

Date: Thu, 30 Sep 1999 09:41:31 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: using tr?
Message-Id: <37F3769B.5A0638C7@texas.net>

James Stevenson wrote:
> 
> Hi
> 
> could somebody please send me an example of useing
> tr in perl

#!/usr/bin/perl -w

use strict;

print 'tr';      

If you look closely, you'll see that I managed to use 'tr' more than
once!

> thanks

You're welcome.

HTH.  HAND.

- Tom


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

Date: Thu, 30 Sep 1999 14:43:07 GMT
From: c_j_marshall@my-deja.com
Subject: Re: using tr?
Message-Id: <7svstm$2ff$1@nnrp1.deja.com>


> Getting stuck and asking for help is OK.
> Not even trying is less so.


actually perhaps that should read:

 Getting stuck on Perl problems and asking for help is OK.
 Not even trying is less so.
 And asking for help on CGI problems deserves death by beating.

Not that you were though, but its still something to bear in mind.


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 30 Sep 1999 12:51:51 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Validating unsafe code?
Message-Id: <7svmd7$flb$1@pegasus.csx.cam.ac.uk>

David Coppit  <newspost@coppit.orgDIESPAM> wrote:
>
>Well, I want to rule out something like
>  unlink('../.profile');
>  unlink('../../.profile');
>  unlink('../../../.profile');
>  unlink('../../../../.profile')
>which wouldn't be caught by taint.

There are lots of other problems with restricting which files someone
can act on.    Consider the possibilities of symbolic links.    In
general, restricting someone's access to *part* of a filesystem can't
be done at the Perl level.   You'll need to use chroot() instead.


Mike Guy


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

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


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