[25431] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 7676 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jan 20 06:05:40 2005

Date: Thu, 20 Jan 2005 03:05:11 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 20 Jan 2005     Volume: 10 Number: 7676

Today's topics:
        [perl-python] 20050120 find functions in modules <xah@xahlee.org>
    Re: checking existance of a directory <1usa@llenroc.ude.invalid>
    Re: checking existance of a directory <news@chaos-net.de>
    Re: checking existance of a directory <1usa@llenroc.ude.invalid>
    Re: checking existance of a directory <tassilo.von.parseval@rwth-aachen.de>
    Re: Directory listing <groleau+news@freeshell.org>
    Re: How do I force a specific compiler in Configure/mak <spamntrapf@yahoo.com>
    Re: How do I force a specific compiler in Configure/mak <spamtrap@dot-app.org>
        How to replace the multi-line string <sonet.all@msa.hinet.net>
    Re: How to replace the multi-line string <do-not-use@invalid.net>
    Re: locale problem <do-not-use@invalid.net>
    Re: Low level data manipulation in Perl <do-not-use@invalid.net>
        regular expressions <jmccloughlin@[remove this]hotmail.com>
    Re: regular expressions <tony_curtis32@yahoo.com>
    Re: regular expressions <noreply@gunnar.cc>
    Re: regular expressions <peroli@gmail.com>
    Re: regular expressions <1usa@llenroc.ude.invalid>
    Re: regular expressions <sbryce@scottbryce.com>
    Re: regular expressions <toreau@gmail.com>
    Re: regular expressions <peroli@gmail.com>
        Sbox <EuBenHadd@hotmail.com>
    Re: Sbox <spamtrap@dot-app.org>
    Re: system command on Win98 <ebohlman@omsdev.com>
    Re: The world's shortest 'Hello World!' program: a prop <groleau+news@freeshell.org>
    Re: The world's shortest 'Hello World!' program: a prop <1usa@llenroc.ude.invalid>
    Re: The world's shortest 'Hello World!' program: a prop <do-not-use@invalid.net>
    Re: Whats the variable holding the dir seperator? <perl@lennychallis.co.uk>
    Re: Whats the variable holding the dir seperator? <matternc@comcast.net>
    Re: Whats the variable holding the dir seperator? <1usa@llenroc.ude.invalid>
    Re: Whats the variable holding the dir seperator? <ThomasKratz@REMOVEwebCAPS.de>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 19 Jan 2005 23:50:12 -0800
From: "Xah Lee" <xah@xahlee.org>
Subject: [perl-python] 20050120 find functions in modules
Message-Id: <1106207412.251279.279670@f14g2000cwb.googlegroups.com>

=A9 # -*- coding: utf-8 -*-
=A9 # Python
=A9
=A9 # once a module is loaded
=A9 # import mymodule
=A9 # one can find all the names it
=A9 # export with dir()
=A9
=A9 import sys
=A9 print dir(sys)
=A9
=A9 # without argument it gives the names
=A9 # you've defined
=A9 print dir()
=A9
=A9 # to find a list of built-in names
=A9 # import the module __builtin__
=A9 # and use dir on it.
=A9 import __builtin__
=A9 print dir(__builtin__)
=A9
=A9 # see
=A9 # http://python.org/doc/2.3.4/tut/node8.html
=A9
=A9 ----------------
=A9 # in Perl, Perl experts can achieve
=A9 # similar functionality by, for example:
=A9
=A9 use Data::Dumper ('Dumper');
=A9 print Dumper \%Data::Dumper::;
=A9
=A9 # it has to do with understanding the inner
=A9 # mechanisms of Perl's module system.
=A9
=A9 ---------------
=A9
=A9 Note: this post is from the Perl-Python
=A9 a-day mailing list at
=A9 http://groups.yahoo.com/group/perl-python/
=A9 to subscribe, send an email to
=A9 perl-python-subscribe @ yahoogroups.com if
=A9 you are reading it on a web page,
=A9 program examples may not run because
=A9 html conversion often breaks the code.
=A9
=A9  Xah
=A9  xah@xahlee.org
=A9  http://xahlee.org/PageTwo_dir/more.html



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

Date: 20 Jan 2005 02:10:07 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: checking existance of a directory
Message-Id: <Xns95E3D75D0AE07asu1cornelledu@132.236.56.8>

"Leonard Challis" <perl@lennychallis.co.uk> wrote in
news:csn3cm$sqs$1@news8.svr.pol.co.uk: 

> "A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote

>> 2. There is no guarantee that a directory or file will not spring to
>> existence between the check for its existence and your attempt to
>> create. Therefore, you are better off with just attempting to create
>> it straight away.
> 
> That's interesting. I would have thought that it would be less than a
> split second to check AND create the file. Is there really a
> possibility? 

There is a good discussion about this in "Programming Perl", 3rd ed p. 
571. I remember seeing the same discussion quite a few times in other 
contexts but I only got it after reading Larry Wall et al.'s 
description.

> Do you have any examples? Thanks for the tip I'll bear
> that one in mind. 

It creates a race condition. While I cannot concoct a demonstration, 
when a race condition is theoretically possible, you can be sure it will 
bite you at some point.

> Are you saying something such as the following would be more "correct"
> in your views?
> 
>| if  (mkdir "dirname") { # created successfully }
>| else { #not made }

Exactly.

Sinan.


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

Date: 20 Jan 2005 02:23:27 GMT
From: Martin Kissner <news@chaos-net.de>
Subject: Re: checking existance of a directory
Message-Id: <slrncuu5gv.sso.news@maki.homeunix.net>

A. Sinan Unur wrote :
> "Leonard Challis" <perl@lennychallis.co.uk> wrote in
 
>>| if  (mkdir "dirname") { # created successfully }
>>| else { #not made }
>
> Exactly.

Isn't the above somehow different from this:

	mkdir("c:/temp", 0777) unless (-d "c:/temp");

Besides the problem of the race condition this will not give you any
feedback if there exist a regular file "c:/temp" so I guess even

	mkdir("c:/temp", 0777) unless (-e "c:/temp");

would be "better".

-- 
Epur Si Muove (Gallileo Gallilei)


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

Date: 20 Jan 2005 03:14:59 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: checking existance of a directory
Message-Id: <Xns95E3E256131CBasu1cornelledu@132.236.56.8>

Martin Kissner <news@chaos-net.de> wrote in 
news:slrncuu5gv.sso.news@maki.homeunix.net:

> A. Sinan Unur wrote :
>> "Leonard Challis" <perl@lennychallis.co.uk> wrote in
>  
>>>| if  (mkdir "dirname") { # created successfully }
>>>| else { #not made }
>>
>> Exactly.
> 
> Isn't the above somehow different from this:
> 
>      mkdir("c:/temp", 0777) unless (-d "c:/temp");

It _is_ different and that is why it is preferable.
 
> Besides the problem of the race condition this will not give you any
> feedback if there exist a regular file "c:/temp" so I guess even
> 
>      mkdir("c:/temp", 0777) unless (-e "c:/temp");
> 
> would be "better".

No. You do bring up an important point, the race condition still exists in 
this case and therefore it should not be used.

Sinan.


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

Date: Thu, 20 Jan 2005 08:01:51 +0100
From: "Tassilo v. Parseval" <tassilo.von.parseval@rwth-aachen.de>
Subject: Re: checking existance of a directory
Message-Id: <slrncuulqv.qn.tassilo.von.parseval@localhost.localdomain>

Also sprach Martin Kissner:

> A. Sinan Unur wrote :
>> "Leonard Challis" <perl@lennychallis.co.uk> wrote in
>  
>>>| if  (mkdir "dirname") { # created successfully }
>>>| else { #not made }
>>
>> Exactly.
>
> Isn't the above somehow different from this:
>
> 	mkdir("c:/temp", 0777) unless (-d "c:/temp");
>
> Besides the problem of the race condition this will not give you any
> feedback if there exist a regular file "c:/temp" so I guess even
>
> 	mkdir("c:/temp", 0777) unless (-e "c:/temp");
>
> would be "better".

Still not good enough. 'mkdir' is one of the rare circumstances in which
you probably have to check the value of $! if the call fails:

    use Errno qw/EEXIST/;
    
    mkdir "c:/temp" or do {
        if ($!{EEXIST}) {
            die  "Path is a file\n" if -f "c:/temp";
            warn "No need to create existing directory\n" 
        } else {
            die "Some other error: $!";
        }
    };

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: Wed, 19 Jan 2005 23:43:22 -0500
From: Wes Groleau <groleau+news@freeshell.org>
Subject: Re: Directory listing
Message-Id: <GoidnT-t06F7q3LcRVn-gA@gbronline.com>

Richard Gration wrote:
> rather than trying to decide what context you are in and whether you can
> afford to be sloppy, both in expression and interpretation. That's why the
> objection to casing. It's about respecting the input filters (and
> therefore *time*) of the people whose help you are asking for.

Someone who doesn't know that it's Perl, not PERL
(or Ada, not ADA) is not very likely to know anything
about the "input filters" of the people who get upset
about it.


-- 
Wes Groleau

  Guidelines for judging others:

  1. Don't attribute to malice that which
     can be adequately explained by stupidity.

  2. Don't attribute to stupidity that which
     can be adequately explained by ignorance.

  3. Don't attribute to ignorance that which
     can be adequately explained by misunderstanding.


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

Date: 19 Jan 2005 18:51:59 -0800
From: "Jacob" <spamntrapf@yahoo.com>
Subject: Re: How do I force a specific compiler in Configure/make
Message-Id: <1106189519.691416.218830@z14g2000cwz.googlegroups.com>

Sherm Pendley wrote:
> Jacob wrote:
>
> > did, but xlc_r was not in the list.  However, among the
> > aliases was this tidbit:
> > cc=/usr/bin/cc
> >
> > Anything in that?  Nah, the make is not invoking cc, it's
> > invoking cc_r.
>
> It might be relevant, or it might not. Is /usr/bin/cc a link
> (either kind) to cc_r? If so, it might be worth trying a
> different alias.
>
> sherm--

Well Sherm,

/usr/bin/cc is a link all right. But not to any exotic compilers
$ ls -l /usr/bin/cc
lrwxrwxrwx 1 root system 15 Dec 02 2003 /usr/bin/cc -> /usr/vac/bin/cc

Hence, relevence still lacking.

Hey, we're running out of blind alleys here!  A correct path has
gotta show up already!  For now I'm considering giving up on the
64-bit compilation by omitting the -Duse64bitall from the Configure
command line.  I wonder what penalty I'll pay. Performance? Hey,
I'm not writing apps, this is for DBA scripting.

Other ideas? I'm wide open. (just don't shoot! :-)
Jacob JSalomon at bn.com



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

Date: Thu, 20 Jan 2005 03:21:15 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: How do I force a specific compiler in Configure/make
Message-Id: <s4qdnWxzgZ5h9HLcRVn-tA@adelphia.com>

Jacob wrote:

> /usr/bin/cc is a link all right. But not to any exotic compilers
> $ ls -l /usr/bin/cc
> lrwxrwxrwx 1 root system 15 Dec 02 2003 /usr/bin/cc -> /usr/vac/bin/cc
> 
> Hence, relevence still lacking.

Not at all! The aix.sh hints file has some special handling for the case
where the first compiler it finds is a link, and the target of that link
has the string "vac" in its path - I think that might be biting you.

Try this: Create a bin/ subdirectory in your home directory, and prepend
that to your PATH. Then, create a 'cc' symlink in that directory, with the
target being whatever compiler you want to use. Also, get rid of the 'cc=
usr/bin/cc' alias, and any 'CC' or 'cc' environment variables.

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


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

Date: Thu, 20 Jan 2005 17:39:19 +0800
From: "sonet" <sonet.all@msa.hinet.net>
Subject: How to replace the multi-line string
Message-Id: <csnu99$quk$1@netnews.hinet.net>


X-Status:  333 test1
                       test2
                       last

TEST


How to replace the string to TEST??


I Can not do this job with  ~s/X-Status:.*last\n//g;




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

Date: 20 Jan 2005 11:08:02 +0100
From: Arndt Jonasson <do-not-use@invalid.net>
Subject: Re: How to replace the multi-line string
Message-Id: <yzdekggh0ql.fsf@invalid.net>


"sonet" <sonet.all@msa.hinet.net> writes:
> X-Status:  333 test1
>                        test2
>                        last
> 
> TEST
> 
> 
> How to replace the string to TEST??
> 
> 
> I Can not do this job with  ~s/X-Status:.*last\n//g;

It's not clear to me exactly what you want to do, but using the 's'
modifier for s/// may solve your problem:

        s/X-Status:.*last\n//gs;

See
        perldoc perlop
        perldoc perlre

Besides, "~s" looks strange. Maybe you are interpreting "$x =~ s/a/b/"
as "$x = ~s/a/b/", but "=~" is one single operator, not related to
"=".


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

Date: 20 Jan 2005 09:35:43 +0100
From: Arndt Jonasson <do-not-use@invalid.net>
Subject: Re: locale problem
Message-Id: <yzdpt00h50g.fsf@invalid.net>


osmo wrote :
> I have problems with using my locale in perl. I have all my locale 
> environment variables set to "fi_FI.UTF-8" (finnish).
> [...]

Exactly which are "all my locale environment variables"? Maybe you and
those who do get the wanted results do not have the same ones set?


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

Date: 20 Jan 2005 09:29:55 +0100
From: Arndt Jonasson <do-not-use@invalid.net>
Subject: Re: Low level data manipulation in Perl
Message-Id: <yzdu0pch5a4.fsf@invalid.net>


"Alfred Z. Newmane" <a.newmane.remove@eastcoastcz.com> writes:
> Arndt Jonasson wrote:
> > "Leonard Challis" <perl@lennychallis.co.uk> writes:
> >> I am referring to most people in this group who aren't newbies. If
> >> you do plenty of searching first and then ask a question you will
> >> still get flamed. People seem to enjoy flaming each other in this
> >> group. It's quite sad really. I fully agree with people just posting
> >> "I cant do it how do i do it!" questions, but when people show what
> >> they have searched already and why they are still struggling do they
> >> deserve being flamed still?
> >
> > The text you quote (*) mostly mentions attributions, and their absence
> > in your article. You wrote "You don't seem to get me straight", with
> > no indication on who or what you mean.
> 
> I don't know about you but it seemed plainly obvious to me that he was 
> referring to the name attributed /below/ that line:
> 
> (An excerpt.)
> 
> You don'tseem to get me straight...
> 
> > "Leonard Challis" <perl@lennychallis.co.uk> wrote:
> >> What I am saying is this: Is there any way of opening a file, and 
> >> instead
> >> of getting the text in side it, you actually see the 1s and0s or the
> >> hexnumbers?
> 
> (End of excerpt.)

Yes, but that's his _own_ name. But I think most points have been made
by now, and maybe taken too. Let's get back to Perl.


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

Date: Thu, 20 Jan 2005 03:36:23 -0000
From: "Sokar" <jmccloughlin@[remove this]hotmail.com>
Subject: regular expressions
Message-Id: <358n9nF4jap49U1@individual.net>

hi,

I have the string

$variable = ",1,2,3,4,5";

I was wondering if anyone knew a regular expression that would remove the
first "," so that I would have

$variable = "1,2,3,4,5"

Thanks and regards




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

Date: Wed, 19 Jan 2005 21:39:07 -0600
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: regular expressions
Message-Id: <87y8eoeplw.fsf@limey.hpcc.uh.edu>

>> On Thu, 20 Jan 2005 03:36:23 -0000,
>> "Sokar" <jmccloughlin@[remove this]hotmail.com> said:

> hi, I have the string

> $variable = ",1,2,3,4,5";

> I was wondering if anyone knew a regular expression that
> would remove the first "," so that I would have

> $variable = "1,2,3,4,5"

s/,//;

or is there a more interesting issue lurking unseen here?


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

Date: Thu, 20 Jan 2005 04:45:08 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: regular expressions
Message-Id: <358nr6F4j34q0U1@individual.net>

Sokar wrote:
> I have the string
> 
> $variable = ",1,2,3,4,5";
> 
> I was wondering if anyone knew a regular expression that would remove the
> first "," so that I would have
> 
> $variable = "1,2,3,4,5"

You would have known, if you had studied e.g.

     perldoc perlrequick

But if all you want to do is removing the first character, the substr() 
function is sufficient.

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


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

Date: 19 Jan 2005 21:10:42 -0800
From: "Peroli" <peroli@gmail.com>
Subject: Re: regular expressions
Message-Id: <1106197842.567215.197040@c13g2000cwb.googlegroups.com>

hi tony,
with regard to your code:
s/,//;

That will remove all the commas, leaving you with string "12345"

$variable = ",1,2,3,4,5";
$varaible =~ s/^,+//g;
will remove any number of leading commas.

Peroli Sivaprakasam



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

Date: 20 Jan 2005 05:18:36 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: regular expressions
Message-Id: <Xns95E432D7E9F8asu1cornelledu@132.236.56.8>

"Peroli" <peroli@gmail.com> wrote in news:1106197842.567215.197040
@c13g2000cwb.googlegroups.com:

> hi tony,
> with regard to your code:
> s/,//;
> 
> That will remove all the commas, leaving you with string "12345"
> 
> $variable = ",1,2,3,4,5";
> $varaible =~ s/^,+//g;
> will remove any number of leading commas.

Hmmmm ...

C:\Home\asu1\UseNet\clpmisc> type crap.pl
use strict;
use warnings;

my $variable = ",1,2,3,4,5";
$varaible =~ s/^,+//g;

print $variable;

C:\Home\asu1\UseNet\clpmisc> crap.pl
Global symbol "$varaible" requires explicit package name at C:\Home\asu1
\UseNet\clpmisc\crap.pl line 5.
Execution of C:\Home\asu1\UseNet\clpmisc\crap.pl aborted due to 
compilation errors.

Please make sure your code is valid before you post. The easiest way to 
catch this mistake would have been to make sure you had 

use strict;

in your script as the posting guidelines recommend.

Second point: You are only removing a leading sequence of commas. By 
definition, there can only be one leading sequence of commas. Why do you 
think you need the g option above?

use strict;
use warnings;

my $v = ",,,,,,,,,,,,,,,,,,,1,2,3,4,5";
$v =~ s/^,+//;

print $v;

__END__

C:\Home\asu1\UseNet\clpmisc> crap.pl
1,2,3,4,5

Sinan


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

Date: Wed, 19 Jan 2005 23:09:07 -0700
From: Scott Bryce <sbryce@scottbryce.com>
Subject: Re: regular expressions
Message-Id: <G8adnUcDjNxt13LcRVn-pQ@comcast.com>

Peroli wrote:

> hi tony,
> with regard to your code:
> s/,//;
> 
> That will remove all the commas, leaving you with string "12345"

Are you sure?

s/,//g;

will remove all of the commas.

s/,//;

will remove the first comma found, even if it isn't the first character.



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

Date: Thu, 20 Jan 2005 07:59:48 +0100
From: Tore Aursand <toreau@gmail.com>
Subject: Re: regular expressions
Message-Id: <DFIHd.5211$IW4.107016@news2.e.nsc.no>

Peroli wrote:
> with regard to your code:
> s/,//;
> 
> That will remove all the commas, leaving you with string "12345"

No. s/,// will remove the _first_ comma in the variable. I really don't 
think the OP want to do that; I think the OP just want to remove the 
comma if it appears as the first character in the variable;

   s/^,//;

The expression s/,//g; will remove _all_ the commas in the variable, by 
the way.


-- 
Tore Aursand <tore@aursand.no>
"Then there was the man who drowned crossing a stream with an average
  depth of six inches." (W.I.E. Gates)


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

Date: 20 Jan 2005 01:01:40 -0800
From: "Peroli" <peroli@gmail.com>
Subject: Re: regular expressions
Message-Id: <1106211700.256418.107260@c13g2000cwb.googlegroups.com>

> hi tony,
> with regard to your code:
> s/,//;

> That will remove all the commas, leaving you with string "12345"

> $variable = ",1,2,3,4,5";
> $varaible =~ s/^,+//g;
> will remove any number of leading commas.

My apologies for not testing the script before posting.

s/,//;
will remove only one comma. I was mislead by overconfidence.  And
finally

> $varaible =~ s/^,+//g;
"g" option is not needed too.

Peroli Sivaprakasam



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

Date: Thu, 20 Jan 2005 08:05:15 GMT
From: "Tabasco1" <EuBenHadd@hotmail.com>
Subject: Sbox
Message-Id: <%CJHd.64986$nP1.8404@twister.socal.rr.com>

I am struggling with being hosted on a server running sbox. I know my 
application runs just fine on other servers not using sbox.

The problem I'm running into is my program is having trouble finding files. 
I have checked the paths and my files are exactly where they should be. Here 
is the error. " Can't locate ./languages/default/main.language at 
/home/content/s/p/i/xxxxxxxxx/html/cgi/apf4/amazon_products_feed.cgi line 
144. "

I have been searching all over the internet for tutorials etc on writing for 
systems with sbox and have found note at least yet. I would great full if 
any one could direct me to a tutorial or give me some suggestions based on 
their experience
-- 
Charles
Torrance, California
http://www.tcpslashipdomains.com Now  accepting PayPal
http://www.tcpslaship.com under construction 




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

Date: Thu, 20 Jan 2005 03:28:42 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: Sbox
Message-Id: <s4qdnW9zgZ4n9nLcRVn-tA@adelphia.com>

Tabasco1 wrote:

> The problem I'm running into is my program is having trouble finding
> files. I have checked the paths and my files are exactly where they should
> be. Here is the error. " Can't locate ./languages/default/main.language

Notice that the path being looked for here is relative - "." is the current
working directory. Quite often, for CGI scripts, that's the directory your
script is in - but it doesn't have to be.

Try using absolute paths.

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


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

Date: 20 Jan 2005 05:14:30 GMT
From: Eric Bohlman <ebohlman@omsdev.com>
Subject: Re: system command on Win98
Message-Id: <Xns95E3ED9D5BEA8ebohlmanomsdevcom@130.133.1.4>

Mike Flannigan <mikeflan@earthlink.net> wrote in news:41EE90AC.2AF65675
@earthlink.net:

> I suspect there is a Perl way to send the keystrokes too.
> In fact I suspect Win32::CtrlGUI::Window would do
> everything I need.  I need to learn that module and
> throw away that commercial scripting language package.

Win32::GuiTest provides a SendKeys() function that should do what you want.


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

Date: Wed, 19 Jan 2005 23:38:26 -0500
From: Wes Groleau <groleau+news@freeshell.org>
Subject: Re: The world's shortest 'Hello World!' program: a proposal
Message-Id: <AMOdnbjrP5kjqHLcRVn-iA@gbronline.com>

Hue-Bond wrote:
>>Note that the empty program _is_ a valid program, and it's also the
>>simples trie, in that it _does_ print itself, i.e. nothing.
> 
> Hmm? How could an empty program *print* something? Even if that something is
> the empty string.

Nothing in, nothing out.  Basic computer science.

-- 
Wes Groleau

A pessimist says the glass is half empty.

An optimist says the glass is half full.

An engineer says somebody made the glass
        twice as big as it needed to be.


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

Date: 20 Jan 2005 04:41:47 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: The world's shortest 'Hello World!' program: a proposal
Message-Id: <Xns95E3F11388BB4asu1cornelledu@132.236.56.8>

Wes Groleau <groleau+news@freeshell.org> wrote in
news:AMOdnbjrP5kjqHLcRVn-iA@gbronline.com: 

> Hue-Bond wrote:
>>>Note that the empty program _is_ a valid program, and it's also the
>>>simples trie, in that it _does_ print itself, i.e. nothing.
>> 
>> Hmm? How could an empty program *print* something? Even if that
>> something is the empty string.
> 
> Nothing in, nothing out.  Basic computer science.

Actually, that is "Garbage in, garbage out".

C:\Home\asu1\UseNet\clpmisc> perl -e
No code specified for -e.

Nothing in, something out.

Sinan.


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

Date: 20 Jan 2005 09:43:45 +0100
From: Arndt Jonasson <do-not-use@invalid.net>
Subject: Re: The world's shortest 'Hello World!' program: a proposal
Message-Id: <yzdllaoh4n2.fsf@invalid.net>


"A. Sinan Unur" <1usa@llenroc.ude.invalid> writes:
> Wes Groleau <groleau+news@freeshell.org> wrote in
> news:AMOdnbjrP5kjqHLcRVn-iA@gbronline.com: 
> 
> > Hue-Bond wrote:
> >>>Note that the empty program _is_ a valid program, and it's also the
> >>>simples trie, in that it _does_ print itself, i.e. nothing.
> >> 
> >> Hmm? How could an empty program *print* something? Even if that
> >> something is the empty string.
> > 
> > Nothing in, nothing out.  Basic computer science.
> 
> Actually, that is "Garbage in, garbage out".
> 
> C:\Home\asu1\UseNet\clpmisc> perl -e
> No code specified for -e.
> 
> Nothing in, something out.

arndt ~/perl 4011> perl -e ''
arndt ~/perl 4012> 

Empty in, empty out. (No, I didn't say "nothing".)


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

Date: Thu, 20 Jan 2005 02:24:24 -0000
From: "Leonard Challis" <perl@lennychallis.co.uk>
Subject: Re: Whats the variable holding the dir seperator?
Message-Id: <csn4op$14r$1@newsg4.svr.pol.co.uk>

"A. Sinan Unur wrote

> On the other hand, if $dir1, $dir2 and $file are variables, you end up
> with:
>
> my $path = $dir1.$*.$dir2.$*.$file.'.ext';

I agree it is a little bit unpretty.

> I am hoping that I am not the only one who thinks
>
> use File::Spec::Functions 'catfile';
>
> my $path = catfile $dir1, $dir2, "$file.ext";
>
> is vastly clearer.
>

Clearer to a certain extent. For the Perl newbie, playing with modules is a 
little daunting although I do agree with you.
Another thing to note it speed. How much time would you save having the 
variable built in insted of using a module?

> File::Spec provides a lot in the way of platform neutral file name and
> path handling -- more than just a simple variable holding the directory
> separator character.

Of course, however sometimes you don't need all that stuff, so why open it 
_all_ up when not using any of it? Does using modules in perl take up alot 
more resources and/or time?

> Additionally, one is usually more interested in using the correct
> character(s) for the OS than the actual character(s) themselves.

Thats also true, however it is a slight contradiction when many people feel 
that portability must be strongly considered when writing "good" code.

Thanks for your comments Sinan,
Lenny 




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

Date: Wed, 19 Jan 2005 21:49:47 -0500
From: Chris Mattern <matternc@comcast.net>
Subject: Re: Whats the variable holding the dir seperator?
Message-Id: <R-6dnTmM85LWgXLcRVn-pg@comcast.com>

Leonard Challis wrote:

> "Big and Blue" <No_4@dsl.pipex.com> wrote
> 
>>    In what way would it make your life easier?
> 
> Well, instead of using something like the File::Spec module for
> platform-independent path handling, we could simply do something like:
> 
> my $file = "dir1$*dir2$*file.ext";
> #where $* is the seperator
> 
Apparently your definition of "platform-independent" is "It works in
Windows/DOS, and it works in Unix/Unix-like clones.  Isn't that the
entire universe?"  (And I might point out that "/" works just fine
on ALL such platforms, outside of the Windows/DOS command interpreter)

-- 
             Christopher Mattern

"Which one you figure tracked us?"
"The ugly one, sir."
"...Could you be more specific?"


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

Date: 20 Jan 2005 03:12:07 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Whats the variable holding the dir seperator?
Message-Id: <Xns95E3E1D9F39Easu1cornelledu@132.236.56.8>

"Leonard Challis" <perl@lennychallis.co.uk> wrote in
news:csn4op$14r$1@newsg4.svr.pol.co.uk: 

> "A. Sinan Unur wrote
> 
 
>> Additionally, one is usually more interested in using the correct
>> character(s) for the OS than the actual character(s) themselves.
> 
> Thats also true, however it is a slight contradiction when many people
> feel that portability must be strongly considered when writing "good"
> code. 


There is no contradiction. When I write:

use File::Spec::Functions 'catfile';

my $path = catfile $install_dir, $conf_dir, $conf_file;

I know that no matter which my script is executed on, the correct 
character(s) will be used, but I still cannot remember what those would be 
on a VMS system.

Sinan


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

Date: Thu, 20 Jan 2005 10:48:10 +0100
From: Thomas Kratz <ThomasKratz@REMOVEwebCAPS.de>
Subject: Re: Whats the variable holding the dir seperator?
Message-Id: <41ef7e5c$0$776$bb690d87@news.main-rheiner.de>

A. Sinan Unur wrote:

> There is no contradiction. When I write:
> 
> use File::Spec::Functions 'catfile';
> 
> my $path = catfile $install_dir, $conf_dir, $conf_file;
> 
> I know that no matter which my script is executed on, the correct 
> character(s) will be used, but I still cannot remember what those would be 
> on a VMS system.

A VMS Path would look like this:

    USER:[DIR1.DIR2.DIR3]file.ext

The File::Spec function 'splitpath' will correctly split this into the 
volume, directory and file part. Handling volumes correctly is another 
important issue when trying to write portable code dealing with directory 
structures.

Thomas


-- 
$/=$,,$_=<DATA>,s,(.*),$1,see;__END__
s,^(.*\043),,mg,@_=map{[split'']}split;{#>J~.>_an~>>e~......>r~
$_=$_[$%][$"];y,<~>^,-++-,?{$/=--$|?'"':#..u.t.^.o.P.r.>ha~.e..
'%',s,(.),\$$/$1=1,,$;=$_}:/\w/?{y,_, ,,#..>s^~ht<._..._..c....
print}:y,.,,||last,,,,,,$_=$;;eval,redo}#.....>.e.r^.>l^..>k^.-


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

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


Administrivia:

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

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

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

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

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


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


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