[23453] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5668 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Oct 16 09:07:26 2003

Date: Thu, 16 Oct 2003 06:05:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 16 Oct 2003     Volume: 10 Number: 5668

Today's topics:
    Re: 5.8.0 h2xs seems broken wrt. library arguments <tassilo.parseval@rwth-aachen.de>
    Re: cleanup speed (named vs anonymous (and my?)) <ewilhelm@somethinglike.sbcglobalDOTnet>
    Re: cleanup speed (named vs anonymous (and my?)) <nobull@mail.com>
        Emacs syntax highlight of Perl comments (Alythh)
    Re: Emacs syntax highlight of Perl comments <bernard.el-haginDODGE_THIS@lido-tech.net>
    Re: Emacs syntax highlight of Perl comments (Anno Siegel)
    Re: Emacs syntax highlight of Perl comments <REMOVEsdnCAPS@comcast.net>
    Re: Emacs syntax highlight of Perl comments <abigail@abigail.nl>
        help chdir UNC path ( newbie ) <dfraisse@free.fr>
    Re: help chdir UNC path ( newbie ) <bernard.el-haginDODGE_THIS@lido-tech.net>
    Re: help chdir UNC path ( newbie ) <dfraisse@free.fr>
    Re: help chdir UNC path ( newbie ) <bernard.el-haginDODGE_THIS@lido-tech.net>
    Re: help chdir UNC path ( newbie ) <REMOVEsdnCAPS@comcast.net>
    Re: help chdir UNC path ( newbie ) <nobull@mail.com>
    Re: help chdir UNC path ( newbie ) <elhber1@lido-tech.net>
    Re: help chdir UNC path ( newbie ) <daniel.rawson.take!this!out!@asml.nl>
    Re: help chdir UNC path ( newbie ) <daniel.rawson.take!this!out!@asml.nl>
    Re: help chdir UNC path ( newbie ) <nobull@mail.com>
    Re: help chdir UNC path ( newbie ) <nobull@mail.com>
    Re: help chdir UNC path ( newbie ) <daniel.rawson.take!this!out!@asml.nl>
    Re: help chdir UNC path ( newbie ) <nobull@mail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 16 Oct 2003 06:57:09 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: 5.8.0 h2xs seems broken wrt. library arguments
Message-Id: <bmlfg5$8cn$1@nets3.rz.RWTH-Aachen.DE>

Also sprach Clint Olsen:

> The docpage for h2xs states that any extra library arguments required
> (libraries and such) should follow any headerfile arguments.  However, when
> I do this h2xs complains that -L and -l arguments are "unknown".

A while back I complained about the same thing and provided a patch to
sync h2xs' behaviour with the docs. So this is now fixed for 5.8.1's
h2xs.

It was not a very serious bug though. Just leave off any -l/-L arguments
and instead stuff them into Makefile.PL as the value for LIBS. This is
what h2xs is doing right now, too.

Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval


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

Date: Thu, 16 Oct 2003 11:12:13 GMT
From: Eric Wilhelm <ewilhelm@somethinglike.sbcglobalDOTnet>
Subject: Re: cleanup speed (named vs anonymous (and my?))
Message-Id: <pan.2003.10.16.06.12.12.802639.13509@somethinglike.sbcglobalDOTnet>

On Wed, 15 Oct 2003 12:30:02 -0500, nobull wrote:

> Eric Wilhelm <ewilhelm@somethinglike.sbcglobalDOTnet> wrote

<snip>
$self->{g} = $CAD::Drawing::geometry_data{$self}; 
<snip>

> I think the point is not that they are cleaned up faster but that the
> package variables are simply not cleaned up at process end.
> 
> If you are happy for your class to leak memory the above trick will work
> fine.
> 
<snip>

> As I undersand it, package variables just continue to exist and the
> memory will be freed when the process terminates.

With such a speed difference on large drawings, what is my other option?

I'm assuming that by "leaking memory" you are referring to the fact that
the package variable continues to exist when the object goes out of
scope.  For most uses of this package, that is at process end anyway
(though I realize that is a poor assumption to make.)

What are my other options?

Is the slowness of the hash cleanup typical? Why?

What about a DESTROY function?

I guess I'll have to try a few things, but I'd really like to find a
reason for the slowdown.

Thanks,
Eric


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

Date: 16 Oct 2003 12:59:57 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: cleanup speed (named vs anonymous (and my?))
Message-Id: <u9zng1s88y.fsf@wcl-l.bham.ac.uk>

Eric Wilhelm <ewilhelm@somethinglike.sbcglobalDOTnet> writes:

> On Wed, 15 Oct 2003 12:30:02 -0500, nobull wrote:
> 
> > Eric Wilhelm <ewilhelm@somethinglike.sbcglobalDOTnet> wrote
> 
> <snip>
> $self->{g} = $CAD::Drawing::geometry_data{$self}; 
> <snip>
> 
> > I think the point is not that they are cleaned up faster but that the
> > package variables are simply not cleaned up at process end.
> > 
> > If you are happy for your class to leak memory the above trick will work
> > fine.
> > 
> <snip>
> 
> > As I undersand it, package variables just continue to exist and the
> > memory will be freed when the process terminates.
> 
> With such a speed difference on large drawings, what is my other option?

The only other way would be to use some alternative approach to
storage like a packed string. This, of course, is dependant on how
regular your data structure is.

See also the various Tie:: modules on CPAN, perhaps one of those could
help.

> I'm assuming that by "leaking memory" you are referring to the fact that
> the package variable continues to exist when the object goes out of
> scope.

Yes.

>  For most uses of this package, that is at process end anyway
> (though I realize that is a poor assumption to make.)
> 
> What are my other options?

I cannot immediately see any simple third option.  You either make the
assumption or you don't.  (Or, of course, allow the caller to tell you
if you should make the assumption).

> Is the slowness of the hash cleanup typical? 

I think so.

>Why?

Because it recursively traverses a large structure returning each
element to the free pool.
 
> What about a DESTROY function?

All that does is allow you some control over the cleanup.  I don't see
how it could make the cleanup faster.  You could use a DESTROY
function so that CAD::Drawings usually cleaned up after itself but so
that the user could set a flag to tell CAD::Drawing that the program is
about to end and that it can forget cleaning up hereafter.

> I guess I'll have to try a few things, but I'd really like to find a
> reason for the slowdown.

You have found the reason.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: 16 Oct 2003 01:58:52 -0700
From: alythh@netscape.net (Alythh)
Subject: Emacs syntax highlight of Perl comments
Message-Id: <6a25ba72.0310160058.46979f3d@posting.google.com>

While using Emacs to write Perl programs, I notice that it colorizes
my one-line comments starting with # without problems.
Instead, multiline comments in style:
=begin
blah

blah

=end
=cut

are not recognized nor colorized

(BTW, there isnt a more elegant way to write it? 2 lines should
suffice for most languages, 1 for begin, 1 for end)

Any info on how to pathc this?


Thanks so much!

Alessandro Magni


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

Date: Thu, 16 Oct 2003 09:11:35 +0000 (UTC)
From: "Bernard El-Hagin" <bernard.el-haginDODGE_THIS@lido-tech.net>
Subject: Re: Emacs syntax highlight of Perl comments
Message-Id: <Xns941671ACBB1A7elhber1lidotechnet@62.89.127.66>

alythh@netscape.net (Alythh) wrote:

> While using Emacs to write Perl programs, I notice that it colorizes
> my one-line comments starting with # without problems.


You have mistaken this group for one which discusses the Emacs editor.


> Instead, multiline comments in style:
> =begin
> blah
> 
> blah
> 
> =end
> =cut


There are no multiline comments in Perl. That is POD documentation which is 
sometimes used to simulate multiline comments.

 
> are not recognized nor colorized
> 
> (BTW, there isnt a more elegant way to write it? 2 lines should
> suffice for most languages, 1 for begin, 1 for end)


perldoc perlpod

 
> Any info on how to pathc this?


Try a group which deals with editors.


Cheers,
Bernard


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

Date: 16 Oct 2003 09:27:17 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Emacs syntax highlight of Perl comments
Message-Id: <bmlo9l$nvg$1@mamenchi.zrz.TU-Berlin.DE>

Alythh <alythh@netscape.net> wrote in comp.lang.perl.misc:
> While using Emacs to write Perl programs, I notice that it colorizes
> my one-line comments starting with # without problems.
> Instead, multiline comments in style:
> =begin
> blah
> 
> blah
> 
> =end
> =cut
> 
> are not recognized nor colorized

All syntax hilighters have glitches like that, some more, some less.
If you look closer at your specific one, you'll probably find others.

The saying is "Only perl can parse Perl", which means you need a full
Perl interpreter just to analyze the syntax.  Since typical editors
don't have a Perl interpreter, all they can do is guesswork.

> (BTW, there isnt a more elegant way to write it? 2 lines should
> suffice for most languages, 1 for begin, 1 for end)

It is part of a larger system (pod) that allows you to embed documentation
in your programs.  It supports far more than block comments.  See "perldoc
perlpod".

> Any info on how to pathc this?

Don't sweat it.  Use syntax hilighting as far as it goes, but don't
try fixing marginal glitches.  You'll never see the end of it.

Anno


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

Date: Thu, 16 Oct 2003 06:27:02 -0500
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Re: Emacs syntax highlight of Perl comments
Message-Id: <Xns94164B9E81AFFsdn.comcast@216.196.97.136>

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1

alythh@netscape.net (Alythh) wrote in 
news:6a25ba72.0310160058.46979f3d@posting.google.com:

> While using Emacs to write Perl programs, I notice that it colorizes
> my one-line comments starting with # without problems.
> Instead, multiline comments in style:
> =begin
> blah
> 
> blah
> 
> =end
> =cut
> 
> are not recognized nor colorized

Are you using perl-mode or cperl-mode?  cperl-mode is far better than 
perl-mode.  Also, be sure to use the latest version.  cperl-mode 5.0 is 
quite excellent -- I don't think I've come across a situation yet where 
it highlights incorrectly.

Are you sure you're formatting your POD directives correctly?  There must 
have one completely blank line before and after each one.  Which is not 
how you have written them above....


> (BTW, there isnt a more elegant way to write it? 2 lines should
> suffice for most languages, 1 for begin, 1 for end)

I would write "=begin comment" rather than simply "=begin".  It makes 
your intention clearer, and may be meaningful to certain source-
processing tools.

- -- 
Eric
$_ = reverse sort $ /. r , qw p ekca lre uJ reh
ts p , map $ _. $ " , qw e p h tona e and print

-----BEGIN xxx SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBP46AR2PeouIeTNHoEQI4/ACfUGdzVBLR0TZDYT9zfkNHT2vSxw8AoJCz
FZUYpv2h2BGkeA7/FJapIHnI
=5vcb
-----END PGP SIGNATURE-----


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

Date: 16 Oct 2003 12:52:50 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: Emacs syntax highlight of Perl comments
Message-Id: <slrnbot552.5ip.abigail@alexandra.abigail.nl>

Alythh (alythh@netscape.net) wrote on MMMDCXCVIII September MCMXCIII in
<URL:news:6a25ba72.0310160058.46979f3d@posting.google.com>:
))  While using Emacs to write Perl programs, I notice that it colorizes
))  my one-line comments starting with # without problems.
))  Instead, multiline comments in style:
)) =begin
))  blah
))  
))  blah
))  
)) =end
)) =cut
))  
))  are not recognized nor colorized
))  
))  (BTW, there isnt a more elegant way to write it? 2 lines should
))  suffice for most languages, 1 for begin, 1 for end)

Two lines will work fine in Perl too:

    #!/usr/bin/perl

    use strict;
    use warnings;

    =cut Comment comment comment
    =cut

    print "Hello, world\n";
    __END__
    Hello, world


Abigail
-- 
srand 123456;$-=rand$_--=>@[[$-,$_]=@[[$_,$-]for(reverse+1..(@[=split
//=>"IGrACVGQ\x02GJCWVhP\x02PL\x02jNMP"));print+(map{$_^q^"^}@[),"\n"


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

Date: Thu, 16 Oct 2003 10:08:39 +0200
From: "Didier FRAISSE" <dfraisse@free.fr>
Subject: help chdir UNC path ( newbie )
Message-Id: <3f8e5192$0$20169$626a54ce@news.free.fr>

i'm trying to convert this small ruby script into perl script

Reporting.rb
========
    Dir.chdir('\\\Bureautique\Reporting France')
    system( 'C:\Program Files\Microsoft Office\Office\Excel.exe "Reporting
France.xls"')
    Dir.chdir('\\\Bureautique\Reporting Export')
    system( 'C:\Program Files\Microsoft Office\Office\Excel.exe "Reporting
Export.xls"')

Reporting.pl
========
    chdir('\\\Bureautique\Reporting France')
    system( 'C:\Program Files\Microsoft Office\Office\Excel.exe "Reporting
France.xls"')
    chdir('\\\Bureautique\Reporting Export')
    system( 'C:\Program Files\Microsoft Office\Office\Excel.exe "Reporting
Export.xls"')

but it seems that UNC path are not welcome !!!
how can i do the same in perl

thanks
Didier





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

Date: Thu, 16 Oct 2003 08:16:15 +0000 (UTC)
From: "Bernard El-Hagin" <bernard.el-haginDODGE_THIS@lido-tech.net>
Subject: Re: help chdir UNC path ( newbie )
Message-Id: <Xns9416684B61051elhber1lidotechnet@62.89.127.66>

"Didier FRAISSE" <dfraisse@free.fr> wrote:

[...]

> Reporting.pl
> ========
>     chdir('\\\Bureautique\Reporting France')
>     system( 'C:\Program Files\Microsoft Office\Office\Excel.exe
>     "Reporting 
> France.xls"')
>     chdir('\\\Bureautique\Reporting Export')
>     system( 'C:\Program Files\Microsoft Office\Office\Excel.exe
>     "Reporting 
> Export.xls"')
> 
> but it seems that UNC path are not welcome !!!
> how can i do the same in perl


Read about the quote operators in


  perldoc perlop


What you probably want is, for example:

  system( 'C:\\Program Files\\Microsoft Office   and so on,


although forward slashes would work as well so you could:


  system( 'C:/Program Files/Microsoft Office   and so on.



Cheers,
Bernard


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

Date: Thu, 16 Oct 2003 10:37:16 +0200
From: "Didier FRAISSE" <dfraisse@free.fr>
Subject: Re: help chdir UNC path ( newbie )
Message-Id: <3f8e5847$0$20184$626a54ce@news.free.fr>

Thanks for your answer

my first problem is with chdir it seems that it doesn't support UNC path

>use strict;
>use warnings;

>chdir('\\\Bureautique\Reporting France');
>system( 'dir');

the result is soething like

CMD.EXE was started up, with '\\Bureautique\Reporting France' as a way of
catalog accesses in course.  The accesses ways UNC are not taken charge of.
Usage of the catalog Windows by default.




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

Date: Thu, 16 Oct 2003 08:42:02 +0000 (UTC)
From: "Bernard El-Hagin" <bernard.el-haginDODGE_THIS@lido-tech.net>
Subject: Re: help chdir UNC path ( newbie )
Message-Id: <Xns94166CAA877BCelhber1lidotechnet@62.89.127.66>

"Didier FRAISSE" <dfraisse@free.fr> wrote: 

> Thanks for your answer
> 
> my first problem is with chdir it seems that it doesn't support UNC
> path 
> 
>>use strict;
>>use warnings;
> 
>>chdir('\\\Bureautique\Reporting France');
>>system( 'dir');
> 
> the result is soething like
> 
> CMD.EXE was started up, with '\\Bureautique\Reporting France' as a way
> of catalog accesses in course.  The accesses ways UNC are not taken
> charge of. Usage of the catalog Windows by default.


Sorry, I don't know what UNC paths are. I just know that you can access
Windows directories in the way I showed you in the previous post. If you're 
looking for a path with two \s (like the first example above) then you can 
try:


  '\\\\Bureautique\\Reporting France'


but I really don't know if that's what you mean. You'll either have to wait
until someone who knows what you're talking about chimes in, or explain in 
more detail what you need.


Cheers,
Bernard


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

Date: Thu, 16 Oct 2003 06:22:01 -0500
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Re: help chdir UNC path ( newbie )
Message-Id: <Xns94164AC53F8A8sdn.comcast@216.196.97.136>

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1

"Bernard El-Hagin" <bernard.el-haginDODGE_THIS@lido-tech.net> wrote in 
news:Xns9416684B61051elhber1lidotechnet@62.89.127.66:

> "Didier FRAISSE" <dfraisse@free.fr> wrote:
> 
> [...]
> 
>> Reporting.pl
>> ========
>>     chdir('\\\Bureautique\Reporting France')
>>     system( 'C:\Program Files\Microsoft Office\Office\Excel.exe
>>     "Reporting 
>> France.xls"')
>>     chdir('\\\Bureautique\Reporting Export')
>>     system( 'C:\Program Files\Microsoft Office\Office\Excel.exe
>>     "Reporting 
>> Export.xls"')
>> 
>> but it seems that UNC path are not welcome !!!
>> how can i do the same in perl

 ...

> Read about the quote operators in
> 
> 
>   perldoc perlop
> 
> 
> What you probably want is, for example:
> 
>   system( 'C:\\Program Files\\Microsoft Office   and so on,

Bernard, there's nothing wrong with the OP's quoting or backslashing.

His problem is apparently with the \\foo\bar style of network directory 
naming.  Or rather, that the chdir function apparently does not recognize 
it.
Alas, I can't help, since I am barely familiar with that style of naming 
(which the OP is calling "UNC"), and I have no idea whether chdir (or 
perl in general) supports it in any way.

- -- 
Eric
$_ = reverse sort $ /. r , qw p ekca lre uJ reh
ts p , map $ _. $ " , qw e p h tona e and print

-----BEGIN xxx SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBP45/EWPeouIeTNHoEQK/FgCfVmZREOXRdRChswOtW6rP0zk0PDcAoJCV
kpUWOsgLP/mz62ROg5vfBChK
=a/2k
-----END PGP SIGNATURE-----


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

Date: 16 Oct 2003 12:32:31 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: help chdir UNC path ( newbie )
Message-Id: <u98ynlto34.fsf@wcl-l.bham.ac.uk>

"Didier FRAISSE" <dfraisse@free.fr> writes:

> i'm trying to convert this small ruby script into perl script
> 
> Reporting.rb
> ========
>     Dir.chdir('\\\Bureautique\Reporting France')
>     system( 'C:\Program Files\Microsoft Office\Office\Excel.exe "Reporting
> France.xls"')
>     Dir.chdir('\\\Bureautique\Reporting Export')
>     system( 'C:\Program Files\Microsoft Office\Office\Excel.exe "Reporting
> Export.xls"')
> 
> Reporting.pl
> ========
>     chdir('\\\Bureautique\Reporting France')
>     system( 'C:\Program Files\Microsoft Office\Office\Excel.exe "Reporting
> France.xls"')
>     chdir('\\\Bureautique\Reporting Export')
>     system( 'C:\Program Files\Microsoft Office\Office\Excel.exe "Reporting
> Export.xls"')
> 
> but it seems that UNC path are not welcome !!!

You are using system(STRING).

The string contains shell meta characters.

It is therfore passed to the Win32 shell (CMD.EXE) to be parsed.

The Win32 shell does not support UNC paths for the CWD. (This, of
course, is a feature of CMD.EXE and has nothing to do with Perl).

Also CMD.EXE will interpret your command as a request to run a program
called 'C:\Program Files\Microsoft' with arguments
'Office\Office\Excel.exe' and 'Reporting Export.xls'.  (This of course
has nothing to do with Perl - it would be exactly the same at the
command line.).

If you used system(LIST) you would not use CMD.EXE.

     system( 'C:\Program Files\Microsoft Office\Office\Excel.exe', 
             'Reporting Export.xls');

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Thu, 16 Oct 2003 11:59:44 +0000 (UTC)
From: Bernard El-Hagin <elhber1@lido-tech.net>
Subject: Re: help chdir UNC path ( newbie )
Message-Id: <slrnbot1vd.j3.elhber1@gdndev25.lido-tech>

In article <Xns94164AC53F8A8sdn.comcast@216.196.97.136>, Eric J. Roode wrote:

[...]

>>>     chdir('\\\Bureautique\Reporting France')
>>>     chdir('\\\Bureautique\Reporting Export')

[...]

> Bernard, there's nothing wrong with the OP's quoting or backslashing.


Even the triple \s above? Surely that can't be right?


> His problem is apparently with the \\foo\bar style of network directory 
> naming.  Or rather, that the chdir function apparently does not recognize 
> it.
> Alas, I can't help, since I am barely familiar with that style of naming 
> (which the OP is calling "UNC"), and I have no idea whether chdir (or 
> perl in general) supports it in any way.


Yeah, I don't really know either.


Cheers,
Bernard


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

Date: Thu, 16 Oct 2003 08:01:26 -0400
From: Dan Rawson <daniel.rawson.take!this!out!@asml.nl>
Subject: Re: help chdir UNC path ( newbie )
Message-Id: <bmm1at$o1mfu$1@ID-122008.news.uni-berlin.de>

Brian McCauley wrote:
> "Didier FRAISSE" <dfraisse@free.fr> writes:
> 
> 
>>i'm trying to convert this small ruby script into perl script
>>
>>Reporting.rb
>>========
>>    Dir.chdir('\\\Bureautique\Reporting France')
>>    system( 'C:\Program Files\Microsoft Office\Office\Excel.exe "Reporting
>>France.xls"')
>>    Dir.chdir('\\\Bureautique\Reporting Export')
>>    system( 'C:\Program Files\Microsoft Office\Office\Excel.exe "Reporting
>>Export.xls"')
>>
>>Reporting.pl
>>========
>>    chdir('\\\Bureautique\Reporting France')
>>    system( 'C:\Program Files\Microsoft Office\Office\Excel.exe "Reporting
>>France.xls"')
>>    chdir('\\\Bureautique\Reporting Export')
>>    system( 'C:\Program Files\Microsoft Office\Office\Excel.exe "Reporting
>>Export.xls"')
>>
>>but it seems that UNC path are not welcome !!!
> 
> 
> You are using system(STRING).
> 
> The string contains shell meta characters.
> 
> It is therfore passed to the Win32 shell (CMD.EXE) to be parsed.
> 
> The Win32 shell does not support UNC paths for the CWD. (This, of
> course, is a feature of CMD.EXE and has nothing to do with Perl).
> 
> Also CMD.EXE will interpret your command as a request to run a program
> called 'C:\Program Files\Microsoft' with arguments
> 'Office\Office\Excel.exe' and 'Reporting Export.xls'.  (This of course
> has nothing to do with Perl - it would be exactly the same at the
> command line.).
> 
> If you used system(LIST) you would not use CMD.EXE.
> 
>      system( 'C:\Program Files\Microsoft Office\Office\Excel.exe', 
>              'Reporting Export.xls');
> 
Didier -

Actually, this does work (at least on my NT system).

You just need the right number of slashes in your chdir command or you need to use "forward" slashes which chdir will 
understand:

chdir('\\\\server\\dir\\dir');

or

chdir('//server/dir/dir');

both of which work here just fine with 5.6.1.  Since chdir is internal, the string doesn't get passed to the system command.

You WILL need to use either double-slashes '\\' or forward slashes '/' in the system commands.

Dan



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

Date: Thu, 16 Oct 2003 08:08:10 -0400
From: Dan Rawson <daniel.rawson.take!this!out!@asml.nl>
Subject: Re: help chdir UNC path ( newbie )
Message-Id: <bmm1na$o31en$1@ID-122008.news.uni-berlin.de>

Dan Rawson wrote:
> Brian McCauley wrote:
> 
>> "Didier FRAISSE" <dfraisse@free.fr> writes:
>>
>>
>>> i'm trying to convert this small ruby script into perl script
>>>
>>> Reporting.rb
>>> ========
>>>    Dir.chdir('\\\Bureautique\Reporting France')
>>>    system( 'C:\Program Files\Microsoft Office\Office\Excel.exe 
>>> "Reporting
>>> France.xls"')
>>>    Dir.chdir('\\\Bureautique\Reporting Export')
>>>    system( 'C:\Program Files\Microsoft Office\Office\Excel.exe 
>>> "Reporting
>>> Export.xls"')
>>>
>>> Reporting.pl
>>> ========
>>>    chdir('\\\Bureautique\Reporting France')
>>>    system( 'C:\Program Files\Microsoft Office\Office\Excel.exe 
>>> "Reporting
>>> France.xls"')
>>>    chdir('\\\Bureautique\Reporting Export')
>>>    system( 'C:\Program Files\Microsoft Office\Office\Excel.exe 
>>> "Reporting
>>> Export.xls"')
>>>
>>> but it seems that UNC path are not welcome !!!
>>
>>
>>
>> You are using system(STRING).
>>
>> The string contains shell meta characters.
>>
>> It is therfore passed to the Win32 shell (CMD.EXE) to be parsed.
>>
>> The Win32 shell does not support UNC paths for the CWD. (This, of
>> course, is a feature of CMD.EXE and has nothing to do with Perl).
>>
>> Also CMD.EXE will interpret your command as a request to run a program
>> called 'C:\Program Files\Microsoft' with arguments
>> 'Office\Office\Excel.exe' and 'Reporting Export.xls'.  (This of course
>> has nothing to do with Perl - it would be exactly the same at the
>> command line.).
>>
>> If you used system(LIST) you would not use CMD.EXE.
>>
>>      system( 'C:\Program Files\Microsoft Office\Office\Excel.exe', 
>>              'Reporting Export.xls');
>>
> Didier -
> 
> Actually, this does work (at least on my NT system).
> 
> You just need the right number of slashes in your chdir command or you 
> need to use "forward" slashes which chdir will understand:
> 
> chdir('\\\\server\\dir\\dir');
> 
> or
> 
> chdir('//server/dir/dir');
> 
> both of which work here just fine with 5.6.1.  Since chdir is internal, 
> the string doesn't get passed to the system command.
> 
> You WILL need to use either double-slashes '\\' or forward slashes '/' 
> in the system commands.
> 
> Dan
> 
Should have put this in my original message . . .

A 'UNC' path has the form \\server-name\directory\directory...  UNC is short for "Universal Naming Convention"; a 
misnomer if there ever was one.

Dan



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

Date: 16 Oct 2003 13:16:22 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: help chdir UNC path ( newbie )
Message-Id: <u9vfqps7hl.fsf@wcl-l.bham.ac.uk>

Dan Rawson <daniel.rawson.take!this!out!@asml.nl> writes a response to
Didier as follow-up to me, Brian McCauley, even though what he wrote
is purely in response to what the OP said and had nothing to do with
what I said:

[ untrimmed quote of my post the only relevant bit of which is... ]

> > "Didier FRAISSE" <dfraisse@free.fr> writes:
> >
> >>    chdir('\\\Bureautique\Reporting France')
> >

[ snip a lot of stuff that can be summarised by one line ]

> You WILL need to use either double-slashes '\\' or forward slashes
> '/' in the system commands.

I think Dan actually meant to say chdir not system.  Anyhow it doesn't
matter.  What Dan said would be true if Didier was using double
quotes.  But Didier was using _single_ quotes.

That said, I concur that...

  chdir('\\\\Bureautique\\Reporting France');

 ...looks better than...

  chdir('\\\Bureautique\Reporting France');

 ...even though both work.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: 16 Oct 2003 13:18:49 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: help chdir UNC path ( newbie )
Message-Id: <u9r81ds7di.fsf@wcl-l.bham.ac.uk>

Bernard El-Hagin <elhber1@lido-tech.net> writes:

> In article <Xns94164AC53F8A8sdn.comcast@216.196.97.136>, Eric J. Roode wrote:
> 
> [...]
> 
> >>>     chdir('\\\Bureautique\Reporting France')
> >>>     chdir('\\\Bureautique\Reporting Export')
> 
> [...]
> 
> > Bernard, there's nothing wrong with the OP's quoting or backslashing.
> 
> 
> Even the triple \s above? Surely that can't be right?

From an aesthetic point of view I agree.  But it's perfectly valid
Perl.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Thu, 16 Oct 2003 08:39:06 -0400
From: Dan Rawson <daniel.rawson.take!this!out!@asml.nl>
Subject: Re: help chdir UNC path ( newbie )
Message-Id: <bmm3hc$ociq6$1@ID-122008.news.uni-berlin.de>

Brian McCauley wrote:

> 
> That said, I concur that...
> 
>   chdir('\\\\Bureautique\\Reporting France');
> 
> ...looks better than...
> 
>   chdir('\\\Bureautique\Reporting France');
> 
> ...even though both work.
> 
OK, NOW I'm confused . . . <g>  The chdir('\\\....') works, but chdir('\\...') doesn't.  If there's no interpolation 
inside the single-quote, why do you need the extra slash??  Or is this a problem with the underlying Win32 API call??

Dan



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

Date: 16 Oct 2003 13:51:02 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: help chdir UNC path ( newbie )
Message-Id: <u9n0c1s5vt.fsf@wcl-l.bham.ac.uk>

Dan Rawson <daniel.rawson.take!this!out!@asml.nl> writes:

> Brian McCauley wrote:
> 
> > That said, I concur that...
> >   chdir('\\\\Bureautique\\Reporting France');
> > ...looks better than...
> >   chdir('\\\Bureautique\Reporting France');
> > ...even though both work.
> >
> OK, NOW I'm confused . . . <g>  The chdir('\\\....') works, but
> chdir('\\...') doesn't.  If there's no interpolation inside the
> single-quote, why do you need the extra slash?? 

To quote the what the reference manual (perlop) has to say on single
quoted strings:

         A backslash represents a backslash unless followed by
         the delimiter or another backslash, in which case the
         delimiter or backslash is interpolated.

I know it can be tempting once a thread has built up a momemtum to ask
subsiduary questions without thinking but please do try to pause and
think: Hey, could I trivially look this up in the reference manual?

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

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


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