[18335] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 503 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Mar 16 11:05:35 2001

Date: Fri, 16 Mar 2001 08:05:09 -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: <984758708-v10-i503@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Fri, 16 Mar 2001     Volume: 10 Number: 503

Today's topics:
        [ANNOUNCE] DBD::Chart <darnold@earthlink.net>
    Re: `pwd` doesn't work on all servers? <bsugars@canoe.ca>
    Re: `pwd` doesn't work on all servers? <jazrant@zsc.nrcan.zc.ca>
    Re: ANNOUNCE: Math::MatrixReal::Ext1 <jonni@ifm.liu.se>
    Re: binary files <mjcarman@home.com>
    Re: binary files (Abigail)
    Re: Create .tar.gz with Perl? <bowman@montana.com>
    Re: Create .tar.gz with Perl? (John Joseph Trammell)
    Re: Getopt::Std swallows argument even if ":" not speci <dperham@dperham.eng.tvol.net>
    Re: Getopt::Std swallows argument even if ":" not speci (Peter Scott)
    Re: How to gret rid of Warning message? "Value of <HAND <dan@tuatha.sidhe.org>
    Re: new user <mjcarman@home.com>
    Re: new user (Tom Briles)
        Overloading in OO perl <taka@yarn.demon.co.uk>
    Re: Overloading in OO perl (Abigail)
    Re: pattern matching <mjcarman@home.com>
    Re: Perl FAQ? <mflaherty2@earthlink.net>
    Re: preserve unix path when obtaining parameters from u <idontreadthis56@hotmail.com>
    Re: Spaces in path to perl script (NT) <bowman@montana.com>
    Re: Spaces in path to perl script (NT) <Peter.Dintelmann@dresdner-bank.com>
    Re: Spaces in path to perl script (NT) <paul@indigoproductions.be>
    Re: Spaces in path to perl script (NT) (Glyndwr)
    Re: Straight array output <jonni@ifm.liu.se>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Thu, 15 Mar 2001 17:17:48 GMT
From: "Dean Arnold" <darnold@earthlink.net>
Subject: [ANNOUNCE] DBD::Chart
Message-Id: <tb47l23ghgll05@corp.supernews.com>

DBD::Chart 0.20 is now available on CPAN. This module
provides a DBI abstraction for rendering charts/graphs.
For more information, see
http://home.earthlink.net/~darnold/dbdchart/

Regards,
Dean Arnold




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

Date: Fri, 16 Mar 2001 14:57:53 GMT
From: Benjamin Sugars <bsugars@canoe.ca>
Subject: Re: `pwd` doesn't work on all servers?
Message-Id: <Pine.LNX.4.21.0103160947260.1932-100000@marmot.rim.canoe.ca>


On Thu, 15 Mar 2001, John W. Krahn wrote:

> "John A. Grant" wrote:
> > 
> > Is there a way to look up the cwd internally without capturing
> > the output of `pwd` from the system?
> 
> perldoc Cwd
> 
> SYNOPSIS
>            use Cwd;
>            $dir = cwd;

I think Cwd::cwd actually uses `pwd` internally on Unix systems.

Cheers,
-Ben

-- 
signer: can't create ~/.sig: Socket type not supported




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

Date: Fri, 16 Mar 2001 10:39:25 -0500
From: "John A. Grant" <jazrant@zsc.nrcan.zc.ca>
Subject: Re: `pwd` doesn't work on all servers?
Message-Id: <98tcas$5tm28@nrn2.NRCan.gc.ca>

"Benjamin Sugars" <bsugars@canoe.ca> wrote in message
news:Pine.LNX.4.21.0103160947260.1932-100000@marmot.rim.canoe.ca...
>
> On Thu, 15 Mar 2001, John W. Krahn wrote:
>
> > "John A. Grant" wrote:
> > >
> > > Is there a way to look up the cwd internally without capturing
> > > the output of `pwd` from the system?
> >
> > perldoc Cwd
> >
> > SYNOPSIS
> >            use Cwd;
> >            $dir = cwd;
>
> I think Cwd::cwd actually uses `pwd` internally on Unix systems.

    That appears to be the case. I substituted cwd as above
    and got this error:

    "Can't exec "pwd": No such file or directory at
/usr/local/lib/perl5/5.6.0/Cwd.pm
    line 85 (#1) (W exec) An system(), exec(), or piped open call
    could not execute the named program for the indicated reason.
    Typical reasons include: the permissions were wrong on the file,
    the file wasn't found in $ENV{PATH}, the executable in question
    was compiled for another architecture, or the #! line in a script
    points to an interpreter that can't be run for similar reasons. (Or
    maybe your system doesn't support #! at all.)

    Use of uninitialized value in scalar chop at
/usr/local/lib/perl5/5.6.0/Cwd.pm
    line 85 (#1) (W uninitialized) An undefined value was used
    as if it were already defined. It was interpreted as a "" or a 0,
    but maybe it was a mistake. To suppress this warning assign
    a defined value to your variables"

    I've asked the sysadmin to look into this.

    Here's the permissions/facl on pwd:
        % cd /usr/bin
        % pwd
        /usr/bin
        % ls -l pwd
        r-xr-xr-x   1 root     bin         4360 Jan  5  2000 pwd

        % getfacl pwd
        # file: pwd
        # owner: root
        # group: bin
        user::r-x
        group::r-x              #effective:r-x
        mask:r-x
        other:r-x

    It's SunOS 5.8 I think.

--
John A. Grant  * I speak only for myself *  (remove 'z' to reply)
Radiation Geophysics, Geological Survey of Canada, Ottawa
If you followup, please do NOT e-mail me a copy: I will read it here






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

Date: Fri, 16 Mar 2001 16:25:17 +0100
From: "Jonas Nilsson" <jonni@ifm.liu.se>
Subject: Re: ANNOUNCE: Math::MatrixReal::Ext1
Message-Id: <98tb55$q6$1@newsy.ifm.liu.se>

>   $ident3x3 =
Math::MatrixReal::Ext1->new_from_cols([1,0,0],[0,1,0],[0,0,1]);
>   $upper_tri =
Math::MatrixReal::Ext1->new_from_rows([1,1,1],[0,1,1],[0,0,1]);

Suggestion: new_from_cols and new_from_rows should also be able to take a
reference to an array of references to arrays like this:

@row1=(1,2,3);
@row2=(3,2,3);
@row3=(2,2,5);
$rows=[\@row1,\@row2,\@row4];
$mymatrix=Math::MatrixReal::Ext1->new_from_cols($rows);

or

$mymatrix=Math::MatrixReal::Ext1->new_from_cols( [ [ 23,21,2 ] [ 32,23,2 ]
[ 32,23,3 ] ] );

This way less data need to be shuffled onto the heap when "matrixcreators"
are within a sub.
/jN






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

Date: Fri, 16 Mar 2001 07:53:54 -0600
From: Michael Carman <mjcarman@home.com>
Subject: Re: binary files
Message-Id: <3AB21AF2.C9AE7B16@home.com>

Todd Smith wrote:
> 
> I just want to be able to translate a file into a file containing 1's and
> 0's (Binary). Then I'll take that file in perl and play with it later.
> uuencode seems to do a good job but how do i get only the 1's and 0's of
> real binary data?

Egads I was right! Bleach! *Why* do you want to do this? "Binary" files
do not look like '0110100101100' when you open them up in a text editor.
(Well, I suppose they could, but they don't in general.) When you open a
file in a text editor you get a textual representation of the data. Each
character on your screen represents a byte -- eight bits -- of that data
(assuming an ASCII character set). The *characters* 0 and 1 actually
have values of 30 and 31 (hex), or 00110000 and 00110001 binary. Do you
see now why I said that "translating" the file in this fashion would
cause your file size to blow up? It would be eight times as large! And
for what? Perl can quite happily process your file as is without any
shenanigans such as this.

Whatever it is that you're trying to do -- trust me, there's a better
way.

-mjc


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

Date: 16 Mar 2001 14:45:43 GMT
From: abigail@foad.org (Abigail)
Subject: Re: binary files
Message-Id: <slrn9b49on.863.abigail@tsathoggua.rlyeh.net>

Michael Carman (mjcarman@home.com) wrote on MMDCCLIV September MCMXCIII
in <URL:news:3AB21AF2.C9AE7B16@home.com>:
|| 
|| Egads I was right! Bleach! *Why* do you want to do this? "Binary" files
|| do not look like '0110100101100' when you open them up in a text editor.
|| (Well, I suppose they could, but they don't in general.) When you open a
|| file in a text editor you get a textual representation of the data. Each
|| character on your screen represents a byte -- eight bits -- of that data
|| (assuming an ASCII character set). The *characters* 0 and 1 actually
|| have values of 30 and 31 (hex), or 00110000 and 00110001 binary. Do you
|| see now why I said that "translating" the file in this fashion would
|| cause your file size to blow up? It would be eight times as large! And
|| for what? Perl can quite happily process your file as is without any
|| shenanigans such as this.


Well, if you use just 0's and 1's, the file compresses a lot better.



Abigail
-- 
@_=map{[$!++,$_^$/]}split$²,"\@\x7Fy~*kde~box*Zoxf*Bkiaox";$\="\r";
$|=++$*;do{($#,$=)=(rand@_,rand@_);@_[$#,$=]=@_[$=,$#]}for($*..@_);
for$:($|..@_-$|){for($|..@_-$:){@_[$_-$|,$_]=@_[$_=>$_-$*]if$_[$_][
$¼]<$_[$_-$*][$®];print+map{$_->[$|]}@_;select$·,$°,$½,0.1}}print$/


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

Date: Fri, 16 Mar 2001 06:15:28 -0700
From: "bowman" <bowman@montana.com>
Subject: Re: Create .tar.gz with Perl?
Message-Id: <7sps6.101$pl.87@newsfeed.slurp.net>


Christian Meisl <meisl@amvt.tu-graz.ac.at> wrote in message
news:m366harv8j.fsf@famvtpc59.tu-graz.ac.at...
>
> Can anyone give me some hints on creating .tar.gz archives with Perl?
> Can this be done without backticks or system calls?

fwiw, if you have the current gnu tar and gzip,

tar -czf foo.tgz  *

will tar and compress with one call. conversely,  tar -xzf foo.tgz  expands
and untars. this can be a quick and dirty solution if you don't want to
install the modules.





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

Date: Fri, 16 Mar 2001 14:44:10 GMT
From: trammell@bayazid.hypersloth.net (John Joseph Trammell)
Subject: Re: Create .tar.gz with Perl?
Message-Id: <slrn9b47c1.ir7.trammell@bayazid.hypersloth.net>

On Fri, 16 Mar 2001 06:15:28 -0700, bowman <bowman@montana.com> wrote:
> tar -czf foo.tgz  *

s/-//



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

Date: 16 Mar 2001 09:46:44 -0500
From: Doug Perham <dperham@dperham.eng.tvol.net>
Subject: Re: Getopt::Std swallows argument even if ":" not specified?
Message-Id: <81hf0t93fv.fsf@wgate.com>

"Antoine Beaupre (LMC)" <lmcabea@lmc.ericsson.se> writes:

> Hi.
> 
> <angry-tired-programmer-rant>
> 
> I expected the following code:
> 
>   my (%opts) = ();
>   message "ARGV is @ARGV now";
>   getopt('qvf:', \%opts);

I think you want the "getopts" function instead of "getopt"
I'm pretty sure that will fix your problem. 

perldoc Getopt::Std 

will describe the difference.  


>   message "ARGV is @ARGV now";
> 
> To output something like:
> 
> ====> ARGV is -v -q -v P1 OU/ADMINDATA now
> ====> ARGV is P1 OU/ADMINDATA now
> 
> but instead I had:
> 
> ====> ARGV is -v -q -v P1 OU/ADMINDATA now
> ====> ARGV is OU/ADMINDATA now
> 
> Don't give me that "it's-not-a-bug-it's-a-feature" crap. :) I believe
> that the parser should leave the argument in @ARGV if it doesn't need
> it!
> 
> It's always possible to recuperate the "P1" arg if it was the latest
> arg, but I think this behavior is bad.
> 
> It should be $opt{'b'} = <int> where 'b' is a boolean flag and <int> is
> incremented at each encounter of -b. 
> 
> No?
> 
> </angry-tired-programmer-rant>
> 
> This is perl, version 5.005_03 built for sun4-solaris by the way. :)
> 
> Thanks
> 
> A.
> 
> --
> La sémantique est la gravité de l'abstraction.

-- 
Doug Perham                                          o{..}o     
dperham@wgate.com                                moo! (oo)___   
WorldGate Communications, Inc.                        (______)\ 
                                                      / \  / \  


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

Date: Fri, 16 Mar 2001 15:37:59 GMT
From: peter@PSDT.com (Peter Scott)
Subject: Re: Getopt::Std swallows argument even if ":" not specified?
Message-Id: <rrqs6.32343$V6.128626@news1.gvcl1.bc.home.com>

In article <3AB12E26.CBCC9876@lmc.ericsson.se>,
 "Antoine Beaupre (LMC)" <lmcabea@lmc.ericsson.se> writes:
>Hi.
>
><angry-tired-programmer-rant>
>
>I expected the following code:
>
>  my (%opts) = ();
>  message "ARGV is @ARGV now";
>  getopt('qvf:', \%opts);
>  message "ARGV is @ARGV now";
>
>To output something like:
>
>====> ARGV is -v -q -v P1 OU/ADMINDATA now
>====> ARGV is P1 OU/ADMINDATA now
>
>but instead I had:
>
>====> ARGV is -v -q -v P1 OU/ADMINDATA now
>====> ARGV is OU/ADMINDATA now
>
>Don't give me that "it's-not-a-bug-it's-a-feature" crap. :) I believe
>that the parser should leave the argument in @ARGV if it doesn't need
>it!

It's not a bug, it's a feature.

The parser needs the argument because you told it to.

Take a look at the hash and you'll see that key 'v' has value 'P1'.
Before this assignment, it had the value '-q'.

Now take a look at the documentation for Getopt::Std and the
difference between the 'getopt' and 'getopts' calls.  :-)

-- 
Peter Scott


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

Date: Fri, 16 Mar 2001 14:48:15 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: How to gret rid of Warning message? "Value of <HANDLE>"
Message-Id: <PIps6.37477$Ok4.3569804@news1.rdc1.ct.home.com>

Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> According to Csaba Raduly <real.email@signature.this.is.invalid>:
>> >Thanh Q Lam (thanh.q.lam@alcatel.com) wrote:

> [...]

>> >: ./listChg.pl line 65535.

> [...]

>> Ain't that a bug (in Perl) ?

> Yes, a well known and loved one.  I'd miss it.

I think you can manage. :) It's been gone since 5.004_05...

					Dan


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

Date: Fri, 16 Mar 2001 08:14:45 -0600
From: Michael Carman <mjcarman@home.com>
Subject: Re: new user
Message-Id: <3AB21FD5.7BE7E260@home.com>

Anders Goeransson wrote:
> 
> Graham Wood <graham.wood@iona.com> wrote:
> 
>> If you can find "use strict;" in the script try commenting it out 
>> (#use strict;) and see if this gets rid of all the error messages.
> 
> Thanks a million!
> It works now. (There were some other fishy things to get rid of
> too....)

But of course, you really should be trying to make this script work
*with* 'use strict'

-mjc


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

Date: Fri, 16 Mar 2001 15:59:04 GMT
From: sariq@texas.net (Tom Briles)
Subject: Re: new user
Message-Id: <3ab2388b.65334976@news.texas.net>

On Fri, 16 Mar 2001 12:31:09 GMT, Anders Goeransson
<anders.goransson@chello.se> wrote:

>On Fri, 16 Mar 2001 11:28:08 -0000, "Graham Wood"
><graham.wood@iona.com> wrote:
>
>><snipped>
>>> Global symbol "$in" requires explicit package name at
>>> C:\Perl\eg\example.pl line
>>>  20.
>>> Execution of C:\Perl\eg\example.pl aborted due to compilation errors.

>>If you can find "use
>>strict;" in the script try commenting it out (#use strict;) and see if this
>>gets rid of all the error messages.
>>
>>Hope this helps

Quite unlikely to "help".

>Thanks a million!
>It works now. (There were some other fishy things to get rid of
>too....)

And the furniture burns on...

- Tom


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

Date: 16 Mar 2001 14:24:18 +0000
From: Paul the Nomad <taka@yarn.demon.co.uk>
Subject: Overloading in OO perl
Message-Id: <m3bsr1hjvx.fsf@yarn.demon.co.uk>



I've been through the docs (haven't got that Perl OO book though) and
I can't see any recommendations for overloading constructors in OO
Perl.  Just so where you know I'm coming from, I have a bit of a Java
background.  In Java overloading constructors is an easy thing to do.

Basically, I want my constructor to behave differently if I pass it
nothing, an int or an array ref.

Are if...else statements the best way to do this? So it would end up
looking something like this:

sub new {

$class = shift;
$anArg = shift;
$self = {};
bless ($self, $class);

if (ref $anArg eq ARRAY) {
	do something
}

elsif ($anArg =~ /^\d+$/ ) {

	do something else
}

else {

	do something entirely different
}

}



-- 

Paul 
   http://www.seditiousdiaries.com/Donald15.html



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

Date: 16 Mar 2001 15:24:03 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Overloading in OO perl
Message-Id: <slrn9b4c0j.863.abigail@tsathoggua.rlyeh.net>

Paul the Nomad (taka@yarn.demon.co.uk) wrote on MMDCCLIV September
MCMXCIII in <URL:news:m3bsr1hjvx.fsf@yarn.demon.co.uk>:
\\ 
\\ 
\\ I've been through the docs (haven't got that Perl OO book though) and
\\ I can't see any recommendations for overloading constructors in OO
\\ Perl.  Just so where you know I'm coming from, I have a bit of a Java
\\ background.  In Java overloading constructors is an easy thing to do.
\\ 
\\ Basically, I want my constructor to behave differently if I pass it
\\ nothing, an int or an array ref.
\\ 
\\ Are if...else statements the best way to do this? So it would end up
\\ looking something like this:
\\ 
\\ sub new {
\\ 
\\ $class = shift;
\\ $anArg = shift;
\\ $self = {};
\\ bless ($self, $class);
\\ 
\\ if (ref $anArg eq ARRAY) {
\\ 	do something
\\ }
\\ 
\\ elsif ($anArg =~ /^\d+$/ ) {
\\ 
\\ 	do something else
\\ }
\\ 
\\ else {
\\ 
\\ 	do something entirely different
\\ }
\\ 
\\ }


That's the way of doing it in Perl. 


Abigail
-- 
perl -MTime::JulianDay -lwe'@r=reverse(M=>(0)x99=>CM=>(0)x399=>D=>(0)x99=>CD=>(
0)x299=>C=>(0)x9=>XC=>(0)x39=>L=>(0)x9=>XL=>(0)x29=>X=>IX=>0=>0=>0=>V=>IV=>0=>0
=>I=>$==-2449231+gm_julian_day+time);do{until($=<$#r){$_.=$r[$#r];$=-=$#r}for(;
!$r[--$#r];){}}while$=;$,="\x20";print+$_=>September=>MCMXCIII=>=>=>=>=>=>=>=>'


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

Date: Fri, 16 Mar 2001 09:27:51 -0600
From: Michael Carman <mjcarman@home.com>
Subject: Re: pattern matching
Message-Id: <3AB230F7.8D4D8FB4@home.com>

Milliwave wrote:
> 
> Hello I'm new to perl and have a couple of questions, based on code 
> which I have written recently.
> 
> question1) Initilisation
> question2) pattern matching
> question 3) While loops

Multiple questions deserve multiple posts, okay?
 
> Question 1
> ---------------
> I have written the code below, and would like to know why the perl
> interpreter complains about an uninitilized variable.

Because you're trying to use something which you haven't assigned a 
value to yet.

> I would also apprecite if you could inform me how to declare variables
> locally and globally?

You want to read up on my(), local(), our(), and 'use vars'. A few
quick examples:

use vars qw($GLOBAL_VAR); # global variable, visible everywhere

BLOCK1 {
	# lexical local variable, only visible inside BLOCK1
	my $var;
}

BLOCK2 {
	# dynamic localized use of a global variable, only affects
	# value inside BLOCK2
	local $/;
}

That's far from complete, though. Go read the docs!
 
> The Code for question 1
> ---------------------------------
> $flagds2 = 0;
> while (<FILE>)
> 
> {
>    chomp;
>    if ($_ =~ m/^DS\s(\d*)\s(\d*)\s(\d*);/)
> 
>        $comp =$1;
>        $flagds2 =1;
>        if ($table[$comp]==$comp) # Warning indicates to this line

That means that either $comp is uninitialized, or that $table[$comp] is.
Since you set $comp a couple lines up, it must be $table[$comp] that 
hasn't been given a value.

> Question 2
> --------------
> 
> I am trying to match the following pattern in a big file! (The 
> numbers of P are randomn) I need to detect each one of the "P" and 
> capture the digits (both + and -ve numbers)
> Example:
> 
> P  1234  4567  23 244  445 1236 1234 7890
>      1234  555    6     666  -450 -900 670 -30;
> P  1234  456   -700  -800  -76000  -600 -900 -785
>      1234  455;
> P  1234  4567  23  244 445 1236 1234 7890
>      1234  555   6    666 -450 -900 670 -30
>       45    44     3     -20;
> 
> Code I have Written
> ---------------------------
[snip]

Hmm. Are you sure that each line of the file is a different polygon? 
The format of the data implies that a polygon is everything between a 
'P' and a ';' but that's not what your code does.

> IS there anyway to shrink the $_ =~ pattern to something more smaller 
> much more efficient than the looooong one I have written.

Your fields are all separated by the same things (whitespace), so you 
should be using split() instead of a big regex.

I'm going to make a big assumption in the code below: I'm assuming that 
a polygon is supposed to be everything between a 'P' and a ';' in your 
file. I'm doing that because otherwise a line with two numbers would 
only be a point, and that doesn't make much sense if you're trying to 
define shapes. (It's a minor change if this assumption isn't valid.) 
Also, there wasn't enough context in your code for me to tell what 
$flagds2, $tcell_type_flag, or $Pflag were being used for, so I left 
them out.

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

{
    local $/ = ";\n";
    while (<DATA>) {
        chomp;
        s/P\s+//;
        my @points = split;
    
        my (@polyvarx, @polyvary);
        print "POLY: @points\n";

        while (scalar @points) {
            push(@polyvarx, shift(@points));
            push(@polyvary, shift(@points));
        }

        # Presumably do something with @polyvarx and @polyvary ...
    }
}

__DATA__
P  1234  4567  23 244  445 1236 1234 7890
     1234  555    6     666  -450 -900 670 -30;
P  1234  456   -700  -800  -76000  -600 -900 -785
     1234  455;
P  1234  4567  23  244 445 1236 1234 7890
     1234  555   6    666 -450 -900 670 -30
      45    44     3     -20;

> question 3
> ---------------
> If I have two spearate while loops does while loop no execute first,
> and then while loop2?
> 
> while(loop1)
> {
> 
> }
> 
> while(loop2)
> {
> 
> }

If they're written like that, of course they do. But if they're written
like this;

while (<condition1>) {
    while (<condition2>) {
        # Do something
    }
}

Then the inner loop is run for each pass of the outer loop.

-mjc


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

Date: Fri, 16 Mar 2001 15:13:57 GMT
From: "Mike Flaherty" <mflaherty2@earthlink.net>
Subject: Re: Perl FAQ?
Message-Id: <V4qs6.1253$Im6.203800@newsread1.prod.itd.earthlink.net>

I'm not sure if this is redundant but I have found www.perlfaq.com to be
helpful.

As an aside, I find it disappointing that anyone would discourage any
questions within this forum.  This is a Perl forum for "miscellaneous"
questions right?  If someone can't ask a "stupid" question here, then what
else is it here for.  It is axiomatic that "newbies" will not know where to
find the answers they need - as the Perl FAQ can be overwhelming if you
don't know the concepts behind the answers.

I find the abrasive dialogue to be very undermining.  While Perl does enjoy
a strong following, how do folks expect to sustain its popularity by
berating people who ask simple questions.  If it really bothers you, then
spend your time in a moderated newsgroup.  Call it something like
"comp.lang.perl.grumpy.programmers".

Despite all of the flames against Kellyboy his question did lead me to a new
resource - www.perldoc.com.  I like how it is arranged.

Remember.  There is no such thing as a dumb question.

Peace,
Mike Flaherty





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

Date: Fri, 16 Mar 2001 09:24:53 -0600
From: Keep it to Usenet please <idontreadthis56@hotmail.com>
Subject: Re: preserve unix path when obtaining parameters from upload field
Message-Id: <idontreadthis56-F5AEC8.09245216032001@newsrump.sjc.telocity.net>

In article <98k6v7$1n7$1@slb7.atl.mindspring.net>,
 "Kurt Stephens" <kstep@pepsdesign.com> wrote:

> "Different browsers will return slightly different things for the 
> name. Some browsers return the filename only. Others return the 
> full path to the file, using the path conventions of the user's 
> machine.

Impiracle observations:
   Netscape and IE for WinX:  Full DOS path
   everything else:           filename only

I haven't tried Opera on WinX, so I don't know if it does it 
"incorrectly" like IE and Netscape.

-- 
Help!  I'm being held in a .sig factory.


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

Date: Fri, 16 Mar 2001 06:11:32 -0700
From: "bowman" <bowman@montana.com>
Subject: Re: Spaces in path to perl script (NT)
Message-Id: <tops6.100$pl.1498@newsfeed.slurp.net>


Paul Goris <paul@indigoproductions.be> wrote in message
news:B6D7D415.ABDF%paul@indigoproductions.be...
> We have to run a Perl script from within a directory that contains spaces
in
> the path to it. Everytime we try to acces the script, an error occurs
saying
> the script can't be found.

Yeah, thanks, Bill. things like 'My Stupid Proposal.doc' are also a problem
for some apps. I've found two approaches, though they don't seem to be
universally applicable.

1.  quote the string  .i.e :   C:\"My Documents"\foo.txt
2. escape the spaces  i.e. :     c:/My\ Documents/foo.txt.

The latter works with used-to-be-*nix apps that are happier with forward
slashes.





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

Date: Fri, 16 Mar 2001 14:49:39 +0100
From: "Dr. Peter Dintelmann" <Peter.Dintelmann@dresdner-bank.com>
Subject: Re: Spaces in path to perl script (NT)
Message-Id: <98t583$lud3@news-1.bank.dresdner.net>

    Hi,

"Paul Goris" <paul@indigoproductions.be> wrote in message
news:B6D7D415.ABDF%paul@indigoproductions.be...

    [snip]

> We run MIIS 4.0 on an NT machine.

> D:\Web\Directory with Spaces\Folder\thescript.cgi
> The error produced is:

    try quotes "D:\Web\Directory with Spaces\Folder\thescript.cgi".

    HTH,

        Peter Dintelmann






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

Date: Fri, 16 Mar 2001 14:51:33 GMT
From: Paul Goris <paul@indigoproductions.be>
Subject: Re: Spaces in path to perl script (NT)
Message-Id: <B6D7E706.AD11%paul@indigoproductions.be>

in article tops6.100$pl.1498@newsfeed.slurp.net, bowman at
bowman@montana.com wrote on 16/3/01 14:11:

>> We have to run a Perl script from within a directory that contains spaces
> in
>> the path to it. Everytime we try to acces the script, an error occurs
> saying
>> the script can't be found.
> 
> Yeah, thanks, Bill. things like 'My Stupid Proposal.doc' are also a problem
> for some apps. I've found two approaches, though they don't seem to be
> universally applicable.
> 
> 1.  quote the string  .i.e :   C:\"My Documents"\foo.txt
> 2. escape the spaces  i.e. :     c:/My\ Documents/foo.txt.
> 
> The latter works with used-to-be-*nix apps that are happier with forward
> slashes.

Mmm... thanks for the tips, but I guess I should have been more precise when
explaining the exact problem.
The point is: the error occurs when you call the script from a web browser.
(As I said we use IIS 4 on an NT server).

So when pointing to the url:

http://www.domain.com/thescript.cgi

 ... when the physical path to "thescript.cgi" on the server would be:

D:\Web\Directory with Spaces\Folder\thescript.cgi

 ... we'll get the error:

"Can't open perl script "D:\Web\Directory": No such file or directory"

And to be absolutely clear: "D:\Web\Directory with Spaces\Folder" would in
that case be the root directory for www.domain.com.

Well, maybe I'm missing the very obvious here... Thanks for any ideas about
what's going on here, that would really help us out!

Paul Goris



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

Date: Fri, 16 Mar 2001 15:57:49 GMT
From: glynFOOdwr@FSCKdeleteEmeD.co.uk (Glyndwr)
Subject: Re: Spaces in path to perl script (NT)
Message-Id: <slrn9b4e0e.170.glynFOOdwr@glyndwr.dyndns.org>

On Fri, 16 Mar 2001 14:51:33 GMT, Paul Goris scribbled:
>Well, maybe I'm missing the very obvious here... Thanks for any ideas about
>what's going on here, that would really help us out!

This is webserver issue; IIS is choking on the spaces, not Perl. My only
experience of IIS resulting in a half-day of premature hair-loss
followed by and install of Apache for NT, so I can't help you, I'm
afraid.

-- 
                                          -=G=-
Web: http://www.fscked.co.uk                           ICQ: 66545073


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

Date: Fri, 16 Mar 2001 16:50:21 +0100
From: "Jonas Nilsson" <jonni@ifm.liu.se>
Subject: Re: Straight array output
Message-Id: <98tck6$17d$1@newsy.ifm.liu.se>

> How might one print to screen twenty arrays in straight, vertical columns?
> Each column is the contents of one of them.

Like this:

my @col1=('a','b','cwef','d','e');
my @col2=(1,2,3);
my @col3=('x','egergery');    #Just some testdata

my @arrays=( \@col1, \@col2, \@col3); #This is the arrays to print
my @colwidths=(4,3,-8);   #negative for left justified, positive for right.

my $maxindex;
for (@arrays) {$maxindex=$#{$_} if $maxindex<$#{$_}};
for my $ind (0..$maxindex) {
 for (0..$#arrays) {printf "%".$colwidths[$_]."s|",${arrays[$_]}[$ind]};
 print "\n";
}

/jN




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

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


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