[21880] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4084 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Nov 8 06:06:55 2002

Date: Fri, 8 Nov 2002 03: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)

Perl-Users Digest           Fri, 8 Nov 2002     Volume: 10 Number: 4084

Today's topics:
    Re: (undef || LIST) vs (LIST || LIST) (Bernhard Kick)
    Re: A Unix guy moving to Windows 2000 <not@gonnatell.ya>
    Re: A vision for Parrot (Walter Roberson)
    Re: A vision for Parrot <goldbb2@earthlink.net>
    Re: A vision for Parrot <slaven.rezic@berlin.de>
    Re: A vision for Parrot <goldbb2@earthlink.net>
    Re: Komodo Opinions <nospam@nospam.com>
    Re: Makefile.PL @INC PREFIX LIB [should be How do I kee <koos_pol@NO.nl.JUNK.compuware.MAIL.com>
    Re: Makefile.PL @INC PREFIX LIB <koos_pol@NO.nl.JUNK.compuware.MAIL.com>
    Re: Object in @INC returning Tie::Handles from INC meth <goldbb2@earthlink.net>
    Re: Oracle Transactions in Perl Script <rereidy@indra.com>
    Re: performance characteristics of embedded perl? <nospam-abuse@ilyaz.org>
    Re: Simple question - What is unicode? (Malcolm Dew-Jones)
        system("rm filename") <lois@hotmail.com>
    Re: system("rm filename") <benSPAMhopkins@mindSPAMspring.com>
    Re: system("rm filename") <fxn@hashref.com>
    Re: system("rm filename") <nospam@nospam.com>
        What is this: &quot;sub myFunc ($$) {&quot; <member@mainframeforum.com>
    Re: What is this: &quot;sub myFunc ($$) {&quot; <bernard.el-hagin@DODGE_THISlido-tech.net>
    Re: What is this: &quot;sub myFunc ($$) {&quot; <koos_pol@NO.nl.JUNK.compuware.MAIL.com>
    Re: What is this: &quot;sub myFunc ($$) {&quot; <fxn@hashref.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 8 Nov 2002 00:36:44 -0800
From: bernhard.kick@gmx.de (Bernhard Kick)
Subject: Re: (undef || LIST) vs (LIST || LIST)
Message-Id: <f2383213.0211080036.52c292b6@posting.google.com>

Bodo Schulze <bobesch@letras.net> wrote in message news:<87wunphi51.fsf@letras.net>...
> ...snip ...
> > 
> > (It does work for scalars. The Camel book, in the chapter
> >  about short circuit operators, has this example:
> >     $home = $ENV{HOME}||$ENV{LOGDIR}||...||die "You're homeless!";
> > )
> > 
> 
> just read on the text you cited from the Camel book. The answer to
> your question immediately follows the example you evoked.
> 
> p. 103 says:

Hm, i checked my book again, and i cannot find it there.
I have the 2nd edition where the example is on p. 89.
(Pg. 103 is about Loop Control)

> 
> "On the other hand, since the left argument is always evaluated in
> scalar context, you can't use || for selecting between two aggregates
> for assignment:
> 
> @a = @b || @c;           # This doesn't do the right thing 
> @a = sclalar (@b) || @c; # because it really means this.  
> @a = @b ? @b : @c;       # This works fine, though."
> 
> Best regards, Bodo

thank you for the quote from the book, which explains clearly what is
going on. Seems to be a later edition, and I should probably
upgrade...

Thanks and kind regards,
Bernhard.


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

Date: Fri, 08 Nov 2002 07:27:54 GMT
From: matt <not@gonnatell.ya>
Subject: Re: A Unix guy moving to Windows 2000
Message-Id: <_HJy9.36083$sP2.12548@sccrnsc02>

Helgi Briem wrote:

> On Wed, 06 Nov 2002 20:19:07 GMT, "matt"
> <matt@no.spam.please> wrote:

>>You will need to make sure your windows %PATH% env. variable
>>points to the bin directory where you installed cygwin, something
>>like c:\cygwin\usr\bin .
> 
> Yes.  But Activeperl would take care of that for you.

Activeperl would take care of adding the path to *perl* in your PATH 
variable, but that's it. He is making system calls to programs that reside 
in cygwin's /usr/bin directory. Of course he shouldn't be, because he can 
do all of that with perl, but that wasn't the question.

-- Matt




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

Date: 8 Nov 2002 07:24:18 GMT
From: roberson@ibd.nrc.ca (Walter Roberson)
Subject: Re: A vision for Parrot
Message-Id: <aqfor2$cv5$1@canopus.cc.umanitoba.ca>

In article <aqbimo$a36$1@news.ox.ac.uk>, Frodo Morris  <""> wrote:
:Perdantick bast.  :-)

Hmmm, according to OED, "bast" means "sanctuary, refuge, asylum".

:Imagine if parrot could understand all currently- and popularly- 
:implemented interpreted languages.

Such as Forth, Word Perfect Macros, Microsoft Visual Basic,
and Befunge?? (You haven't been very specific on the meaning of
'popularly'.)


Now, Parrot is intended for interpreted languages, right? And
the fundamental feature of such languages is that you should
be able to compute a string and then execute the string as
a statement. So Parrot will have to know how to execute statements
in arbitrary source languages. This means that it isn't enough
to have a (say) bash-to-parrot translator that translates
the program and hands it off to parrotd: the entire translator
is going to have to be input along with the translated source.

This indirectly raises an interesting point. If parrotd is glued into
the operating system as part of exec() as has been proposed (as opposed
to the counter proposal to just liet #!  do its standard job) then the
implication is that there is only one parrot implimentation per system.
How would one then test new versions of Parrot? With #! it's easy: you
just name the path to the alternative interpreter and the kernel
invokes it. But if parrotd is built right into exec() then in order to
support multiple versions of Parrot, you would have to build the new
versions -in- Parrot and pass them in as yet another layer of
interpreter. e.g., parrotd version 6.302 is running and it has been
passed a copy of the bash2parrot 4.19 translator in case it needs to
interpret a computed string that invokes a program that needs to layer
on the experimental parrotd 6.4.9 interpreter that has to be passed the
perl2parrot translator in case it needs to interpret a computed string
that invokes a program that needs to have -another copy- of parrotd
6.302 layered on [you can't count on parrotd 6.4.9 running parrotd
6.302 programs the same way that parrotd 6.302 would run them] that has
the <etc.> interpeter layered on to run <etc.>.

Scheme is right at home at dealing with these kinds of layering issues,
using a process called "reflection" [well developed by Brian Reid and
Jeem Desriviers]. They aren't straight-forward issues: think about
debugging, and think about re-entrancy, and think about problems in
cross-layer pollution -- you don't want a wild pointer in the fifth
layer down to affect your third layer, right?


Speaking of layers: I take it that some thought has been put into
how to do operating-system escapes? So that one can (for example)
handle graphics? Or even just sockets? Seeing as some of the most popular
interpreted languages are by no means restricted to text-only
and have networking capabilities? But of course the appropriate calls
could come within one of the computed strings, so any escape cannot
be absolute and must instead be handled via the interpretation layer
(c.f. the above in which I showed that parrotd must be built in
Parrot if you want parrotd to be handled at the exec() level...)
--
   "The human genome is powerless in the face of chocolate."
   -- Dr. Adam Drewnowski


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

Date: Fri, 08 Nov 2002 04:00:45 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: A vision for Parrot
Message-Id: <3DCB7D3D.B2EAAB0F@earthlink.net>

Walter Roberson wrote:
> 
> In article <aqbimo$a36$1@news.ox.ac.uk>, Frodo Morris  <""> wrote:
> :Perdantick bast.  :-)
> 
> Hmmm, according to OED, "bast" means "sanctuary, refuge, asylum".
> 
> :Imagine if parrot could understand all currently- and popularly-
> :implemented interpreted languages.
> 
> Such as Forth, Word Perfect Macros, Microsoft Visual Basic,
> and Befunge?? (You haven't been very specific on the meaning of
> 'popularly'.)

Is it (currently) possible to put Word Perfect macros into a file, and
run that file as a script?

And I think that it's actually highly probable that a translator from
MSVB to Parrot will be written... or rather, a translator from MSIL or
from .NET to Parrot.

> Now, Parrot is intended for interpreted languages, right? And
> the fundamental feature of such languages is that you should
> be able to compute a string and then execute the string as
> a statement. So Parrot will have to know how to execute statements
> in arbitrary source languages.

Well, not parrot *itself* ... you'll have a compiler (written in parrot)
which translates the other language to parrot bytecode.  When some piece
of code does eval $string, it calls to the translator, then runs the
resultant bytecode.

> This means that it isn't enough to have a (say) bash-to-parrot
> translator that translates the program and hands it off to parrotd:
> the entire translator is going to have to be input along with the
> translated source.

Fortuantly, parrot is able to defer loading of modules until they're
needed.  You hand off the translated source, and as soon as it runs into
an eval $string operation, it loads up the translator, then runs the
translator and continues on it's merry way.

> This indirectly raises an interesting point. If parrotd is glued into
> the operating system as part of exec() as has been proposed (as
> opposed to the counter proposal to just let #! do its standard job)
> then the implication is that there is only one parrot implimentation
> per system.

Yes, this does sound like what was being proposed.

However, nothing prevents you from having more than one parrot kernel
plugin, the selection of which would be distinguished by a version
number in the header of the bytecode file.

> How would one then test new versions of Parrot?

Well, instead of typing in "bytecodeprogram" at the commandline, you
would have to type in "parrot bytecodeprogram", where "parrot" is your
path to your newer version of parrot.

Or perhaps you would do:
   parrot_daemon --nokernel &
   parrot_send_to_daemon bytecodeprogram

(or something like that)

Obviously this won't be *quite* the same environment as the kernel's
plugged-in parrot interpreter daemon, but it will be sufficiently close
for *most* forms of testing.

> With #! it's easy: you just name the path to the alternative
> interpreter and the kernel invokes it. But if parrotd is built right
> into exec() then in order to support multiple versions of Parrot, you
> would have to build the new versions -in- Parrot and pass them in as
> yet another layer of interpreter.

I don't understand what you mean by this.

> e.g., parrotd version 6.302 is running and it has been passed a copy
> of the bash2parrot 4.19 translator

Err, no.  You would have a program which was originally written in bash,
then translated into parrot bytecode.  All places where strings need to
be translated at runtime (via the eval command) are set up to load up
the bash translator, then translate that string, then run the string.

The bash2parrot translator would not be *included* in the translated
bytecode, though -- only the name of the module, or maybe the filename
of the module.  Vaguely like how one shared object can depend on another
one, or even whole reams of other ones -- but they don't get loaded
until functions in them get called.

> in case it needs to interpret a computed string that invokes a program

Ok, at this point, stop, and take a breath.  When your translated bash
program wants to "invoke a program", *how* that program's guts work is
beyond it's concern -- it merely calls fork and exec and wait.

The fact that the exec() may send the filename and args and environment
to a different parrot daemon is irrelevant to that process.

> that needs to layer on the experimental parrotd 6.4.9 interpreter that

What do you mean 'layer on' ?

> has to be passed the perl2parrot translator in case it needs to

Again, nothing is passing around translators -- they only get loaded
when they are needed.

> interpret a computed string that invokes a program
> that needs to have -another copy- of parrotd 6.302 layered on [you
> can't count on parrotd 6.4.9 running parrotd 6.302 programs the same
> way that parrotd 6.302 would run them] that has the <etc.> interpeter
> layered on to run <etc.>.

Your confusion seems to mainly stem from three things:  You're not
paying attention to process boundaries, and you think that every
translated program in language X has the translator for X to parrot
embedded into it, and exec() doesn't invoke a sub-process, it replaces
the current process with a new process  (That's why you have to fork()
first if you want a sub-process).

Once you have a better understanding of the unix process model, the
problems you've sketched will disappear.

> Scheme is right at home at dealing with these kinds of layering
> issues, using a process called "reflection" [well developed by Brian
> Reid and Jeem Desriviers]. They aren't straight-forward issues: think
> about debugging, and think about re-entrancy, and think about problems
> in cross-layer pollution -- you don't want a wild pointer in the fifth
> layer down to affect your third layer, right?

Fortuantly for us, seperate processes have their own memory address
spaces, so this isn't a concern.

> Speaking of layers: I take it that some thought has been put into
> how to do operating-system escapes? So that one can (for example)
> handle graphics? Or even just sockets? Seeing as some of the most
> popular interpreted languages are by no means restricted to text-only
> and have networking capabilities?

Remember, the parrot interpreter is written in C... it has to be. 
Obviously, one would have parrot opcodes which result in calls to C
functions, which perform socket operations or graphics or whatever.

> But of course the appropriate calls could come within one of the
> computed strings, so any escape cannot be absolute and must instead be
> handled via the interpretation layer (c.f. the above in which I showed
> that parrotd must be built in Parrot if you want parrotd to be handled
> at the exec() level...)

You can't write parrotd in parrot -- you have to write it in something
which runs on the hardware (elf or a.out).

Writing parrotd in parrot is similar to writing a turing machine VM in
the language you use to write descriptions of turing machines, and then
having exec() detect when you're running a compiled turing machine and
handing it off to the turing machine VM ... if it doesn't get passed off
to *something* running on the actual hardware, it's going to loop
forever.

-- 
my $n = 2; print +(split //, 'e,4c3H r ktulrnsJ2tPaeh'
 ."\n1oa! er")[map $n = ($n * 24 + 30) % 31, (42) x 26]


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

Date: 08 Nov 2002 10:53:14 +0100
From: Slaven Rezic <slaven.rezic@berlin.de>
Subject: Re: A vision for Parrot
Message-Id: <878z04mlpx.fsf@vran.herceg.de>

Benjamin Goldberg <goldbb2@earthlink.net> writes:

> Walter Roberson wrote:
> > 
[...] 
> > Speaking of layers: I take it that some thought has been put into
> > how to do operating-system escapes? So that one can (for example)
> > handle graphics? Or even just sockets? Seeing as some of the most
> > popular interpreted languages are by no means restricted to text-only
> > and have networking capabilities?
> 
> Remember, the parrot interpreter is written in C... it has to be. 
> Obviously, one would have parrot opcodes which result in calls to C
> functions, which perform socket operations or graphics or whatever.
> 

I dont't think it will be opcodes, but rather a combination of loadlib
(load a DLL) and dlfunc (create a parrot-callable subroutine from a
DLL function). See core.ops.

Regards,
	Slaven

-- 
Slaven Rezic - slaven.rezic@berlin.de

Visualize Makefiles with GraphViz:
	http://user.cs.tu-berlin.de/~eserte/src/perl/GraphViz-Makefile/


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

Date: Fri, 08 Nov 2002 05:26:54 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: A vision for Parrot
Message-Id: <3DCB916E.76E55334@earthlink.net>

Slaven Rezic wrote:
> 
> Benjamin Goldberg <goldbb2@earthlink.net> writes:
> 
> > Walter Roberson wrote:
> > >
> [...]
> > > Speaking of layers: I take it that some thought has been put into
> > > how to do operating-system escapes? So that one can (for example)
> > > handle graphics? Or even just sockets? Seeing as some of the most
> > > popular interpreted languages are by no means restricted to
> > > text-only and have networking capabilities?
> >
> > Remember, the parrot interpreter is written in C... it has to be.
> > Obviously, one would have parrot opcodes which result in calls to C
> > functions, which perform socket operations or graphics or whatever.
> 
> I dont't think it will be opcodes, but rather a combination of loadlib
> (load a DLL) and dlfunc (create a parrot-callable subroutine from a
> DLL function). See core.ops.

Ok, so loadlib is one op, and dlfunc is another op :)

-- 
my $n = 2; print +(split //, 'e,4c3H r ktulrnsJ2tPaeh'
 ."\n1oa! er")[map $n = ($n * 24 + 30) % 31, (42) x 26]


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

Date: Thu, 7 Nov 2002 23:23:11 -0800
From: "Tan Nguyen" <nospam@nospam.com>
Subject: Re: Komodo Opinions
Message-Id: <3dcb65ca_4@nopics.sjc>


"TBN" <ihave@noemail.com> wrote in message
news:xKuy9.2025$uwT2.36962367@news2.randori.com...
> Does anyone have an opinion on what they like or dislike about Komodo as
far
> as using Perl with it?

I tried Komodo a while back and wasn't impressed at all. However, I've heard
that they have made significant improvements since then, so it might be
totally different these days. The version that I tried was big, sluggish and
damn slow. If you're used to Visual Studio, you probably won't find Komodo
attractive. Check out a new article on this dragon IDE by Cozens at
www.perl.com




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

Date: Fri, 08 Nov 2002 09:25:36 +0100
From: Koos Pol <koos_pol@NO.nl.JUNK.compuware.MAIL.com>
Subject: Re: Makefile.PL @INC PREFIX LIB [should be How do I keep my own module/library directory?]
Message-Id: <newscache$oq095h$sb1$1@news.emea.compuware.com>

Mothra wrote (Thursday 07 November 2002 22:20):

> $ export PERL5LIB=/home/hillr/mymodules/lib/site_perl

Ah! There it is then. I had the PERL5LIB wrong. I am using (see my previous 
post):

PERL5LIB=/some/local/dir perl Makefile.PL ...

But it should have been

PERL5LIB=/some/local/dir/site_perl/5.6.1 perl Makefile.PL ...
                         ^^^^^^^^^^^^^^^

>> Here is (again) the proof:

> The only thing this proves is that you can't read the documentation that
> was given you.

I think it proves I can't write what I read... Disability admitted...:-(
Thanks for your help. Much appreciated.

-- 
KP



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

Date: Fri, 08 Nov 2002 09:31:04 +0100
From: Koos Pol <koos_pol@NO.nl.JUNK.compuware.MAIL.com>
Subject: Re: Makefile.PL @INC PREFIX LIB
Message-Id: <newscache$sz095h$sb1$1@news.emea.compuware.com>

nobull@mail.com wrote (Thursday 07 November 2002 19:19):

> Koos Pol <koos_pol@NO.nl.JUNK.compuware.MAIL.com> wrote in message
> news:<newscache$2q975h$bx$1@news.emea.compuware.com>...
> 
>>   perl Makefile.PL  PREFIX=/usr/local/httpd/cgi-bin/upara_07/lib
>>   Warning: prerequisite HTML::Tagset failed to load: Can't locate
>>   HTML/Tagset.pm in @INC (@INC contains: /usr/lib/perl5/5.6.1/i586-linux
>>   /usr/lib/perl5/5.6.1 /usr/lib/perl5/site_perl/5.6.1/i586-linux
>>   /usr/lib/perl5/site_perl/5.6.1 /usr/lib/perl5/site_perl .) at (eval 4)
>>   line 3
>> 
>> As you see @INC keeps pointing to the default locations. How can I
>> convince Makefile.PL to scan the local directory too? Using LIB i.s.o.
>> PREFIX doesn't help.
> 
> Try setting the PERL5LIB environment variable.

From another kind soul (Mothra <mothra@nowhereatall.com>) I learned that 
that is what I need. Thanks for your pointer.

-- 
KP



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

Date: Fri, 08 Nov 2002 03:17:34 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Object in @INC returning Tie::Handles from INC method
Message-Id: <3DCB731E.D76BF311@earthlink.net>

Bryan Castillo wrote:
> 
> I've been trying to come up with a way to load perl modules out of zip
> files, by appending an object that implements an INC method, onto the
> end of @INC.

Have you considered the ex::lib::zip module from CPAN?

-- 
my $n = 2; print +(split //, 'e,4c3H r ktulrnsJ2tPaeh'
 ."\n1oa! er")[map $n = ($n * 24 + 30) % 31, (42) x 26]


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

Date: Thu, 07 Nov 2002 22:21:16 -0700
From: Ron Reidy <rereidy@indra.com>
Subject: Re: Oracle Transactions in Perl Script
Message-Id: <3DCB49CC.5366E847@indra.com>

Frank Foss wrote:
> 
> First: Please bear with me, I'm kinda new to Perl.
> 
> Second: I have a small Perl Script to generate test data in an Oracle 9i
> 
> Database.
> 
> The script roughly does this:
> 
> 1) Select a list of resources from an existing table
> 
> 2) Loop thru these, and
> 
>     3) Loop thru 1..24 (hours per day), and
> 
>         4) Loop thru 1..60 (minutes per hour), and
> 
>             5) insert a value in a table
> 
> So far, so good.
> 
> I am currently strugglin to BEGIN TRANSACTION at point 2, and commit at the
> end of that 'resource' loop.
> 
> This will insert 24*60 rown in one transaction.
> 
> THe actual code is at the end of the post.
> 
> How to program the begin transaction?
> 
> by using the database handle $dbh or the statement handle $sth.?
> 
> Actual syntax? Preparing and executing a "begin transaction" and a "commit"
> 
> Insights appreciated
> 
> Foz
Well, the problem is the code is not visible.  Here is a hint:

Read the DBD::Oracle docs, paying close attention to the sections
dealing with PL/SQL blocks and error handling (assuming you want to
implement this in PL/SQL as your post suggests).  If this does not do it
for you, get a copy of "Programming the Perl DBI" and read up on
transactions in this book.
-- 
Ron Reidy
Oracle DBA


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

Date: Fri, 8 Nov 2002 08:29:41 +0000 (UTC)
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: performance characteristics of embedded perl?
Message-Id: <aqfsll$125v$1@agate.berkeley.edu>

[A complimentary Cc of this posting was sent to
pkent 
<pkent77tea@yahoo.com.tea>], who wrote in article <pkent77tea-89D5AF.22114407112002@news-text.blueyonder.co.uk>:

> Once any perl has been compiled it runs comparably as fast as C

Only if you consider something which is potentially 200x slower being
of the "same fastness".  [Of course, if your code is doing a moral
equivalent of sleep(1), or using "do a lot" Perl opcodes, the
difference may be less.]

Ilya


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

Date: 7 Nov 2002 23:05:39 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: Simple question - What is unicode?
Message-Id: <3dcb6243@news.victoria.tc.ca>

Alan Anderson (aranders@netusa1.net) wrote:
: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones) wrote

: > As for running out of values for all languages, what do you expect when
: > the standard wastes the "unicode bandwidth" for languages such as klingon. 
: > This is simply an example of the lack of mental disipline as mentioned
: > earlier.
: > 
: > </rant>

: Your rant is misplaced.  

based on the below, the last bit of the rant does appears to be misplaced. 

: Klingon was rejected for inclusion in
: Unicode.  

I'm glad to hear that.  Not that I have anything against klingon, or
people playing with these ideas.

: Mental discipline *was* applied, and the prevailing thought
: was that Klingon script was inappropriate.  Not because it's a script
: for a constructed language, but because its potential users generally
: don't use the script.  

I guess the potential users are star trek fans, who communicate in
various human languages other than klingon.


: (I think that's a chicken-and-egg situation,
: myself, but nobody on the Unicode committees asked my opinion.)

: Of course, there's still the Private Use Area, and Klingon does have a
: consistent place there according to the ConScript Unicode Registry. 
: But the PUA was *intended* for such special purposes outside the
: Unicode standard.

A PUA is certainly suitable for this.  

I still stand by my underlying issues.  Unicode originated as an extremely
simple idea.  By simply increasing the size of the elementry unit of data,
almost all textual language/character data transmision issues are dealt
with while still retaining extremenly simple and obvious data handling
techniques.  It wasn't perfact but nothing is.

The fact that it is not perfect, in this age of seemingly potential
perfection, has allowed the simplicity to be subsumed to the desire to
accomodate everything, and in the process, nothing much has been
accomplished.

By now every single computer should be using unicode as the in-built
default for everything.  This is one of the few things that the original
NT architecture got completely right.  Just as every single personal
computer and almost all non-IBM-main-frame-compatible copmputers were
using ascii by the early 80's, so should all computers be using unicode
today.  How many PC's do you know that have VGA video pages that map 16
bit values to bitmaps in VGA'ish style text modes?  Absolutly none, but
there is no reason why not.  



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

Date: Fri, 08 Nov 2002 06:49:18 GMT
From: "Lois" <lois@hotmail.com>
Subject: system("rm filename")
Message-Id: <N7Jy9.58027$Lu1.49630@sccrnsc01>

Hi all,

    If  I need to delete a file and prompt message for failure to do so.

if (-e "filename")
{
       system("rm filename")   || die "error\n";
}

but this code always end with a die. I tried to capture the value for
system("rm filename") and I got a 0 for success and 256 for non-success. can
i just negate the command to obtain the correct answer?


thanks,
lois




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

Date: Fri, 08 Nov 2002 07:13:58 GMT
From: Ben Hopkins <benSPAMhopkins@mindSPAMspring.com>
Subject: Re: system("rm filename")
Message-Id: <7unfqa.jg1.ln@www.mindspring.com>

Lois wrote:

>     If  I need to delete a file and prompt message
>     for failure to do so.
> 
> if (-e "filename")
> {
>        system("rm filename")   || die "error\n";
> }
> 
> but this code always end with a die. I tried to
> capture the value for system("rm filename") and I got
> a 0 for success and 256 for non-success. can i just
> negate the command to obtain the correct answer?

perldoc -f unlink


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

Date: Fri, 8 Nov 2002 07:18:19 +0000 (UTC)
From: "F. Xavier Noria" <fxn@hashref.com>
Subject: Re: system("rm filename")
Message-Id: <aqfofr$b88$1@news.ya.com>

In article <N7Jy9.58027$Lu1.49630@sccrnsc01>, Lois wrote:

>     If  I need to delete a file and prompt message for failure to do so.
> 
> if (-e "filename")
> {
>        system("rm filename")   || die "error\n";
> }
> 
> but this code always end with a die. I tried to capture the value for
> system("rm filename") and I got a 0 for success and 256 for non-success. can
> i just negate the command to obtain the correct answer?

Yes, that is shell semantics. For instance, this is a common idiom:

   if (system "cmd arg0") {
      # cmd arg0 failed
   }

Nevertheless, in the case of "rm" Perl has unlink() already. Have a glance
at perldoc -f unlink.

Unless you want fine grained error control there is no need to check before
whether the file exists, since its removal will fail if not.

-- fxn


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

Date: Thu, 7 Nov 2002 23:16:35 -0800
From: "Tan Nguyen" <nospam@nospam.com>
Subject: Re: system("rm filename")
Message-Id: <3dcb65c9$1_4@nopics.sjc>


"Lois" <lois@hotmail.com> wrote in message
news:N7Jy9.58027$Lu1.49630@sccrnsc01...
> Hi all,
>
>     If  I need to delete a file and prompt message for failure to do so.
>
> if (-e "filename")
> {
>        system("rm filename")   || die "error\n";
> }
>
> but this code always end with a die. I tried to capture the value for
> system("rm filename") and I got a 0 for success and 256 for non-success.
can
> i just negate the command to obtain the correct answer?

system returns the exit value of the command that is run. Conventionally,
programs return 0 for success, and rm simply follows this. Negation of the
return value of system might not report the right exit status as in the case
of system failing to run the command (for example, it returns undef). The
safe way is checking the exit status as you know how it's supposed to be.
system("rm $filename") == 0 or die "cannot remove $filename: $!\n";

You can also use Perl's built-in function unlink to remove file
unlink $filename or die "failed to unlink $filename: $!\n";







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

Date: 8 Nov 2002 05:29:58 -0500
From: yisraelharris <member@mainframeforum.com>
Subject: What is this: &quot;sub myFunc ($$) {&quot;
Message-Id: <3dcb9226$1_6@news.onlynews.com>

I have seen functions declared like this:

sub myFunc ($$) { .... }

What exactly does the "$$" mean? (Note: I tend not to understand things
unless they are explained very clearly :)

Even better: I spent quite a while trying to find the answer on the
Internet and did not succeed.

If anyone knows of either a website where I could easily find the
answers to questions like this or a method of finding websites to answer
questions like this, I'd be grateful.



--
www.MainFrameForum.com - USENET Gateway


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

Date: Fri, 8 Nov 2002 10:43:10 +0000 (UTC)
From: Bernard El-Hagin <bernard.el-hagin@DODGE_THISlido-tech.net>
Subject: Re: What is this: &quot;sub myFunc ($$) {&quot;
Message-Id: <slrnasn1kg.53f.bernard.el-hagin@gdndev25.lido-tech>

In article <3dcb9226$1_6@news.onlynews.com>, yisraelharris wrote:
> I have seen functions declared like this:
> 
> sub myFunc ($$) { .... }
> 
> What exactly does the "$$" mean? (Note: I tend not to understand things
> unless they are explained very clearly :)
> 
> Even better: I spent quite a while trying to find the answer on the
> Internet and did not succeed.


You don't need the Internet. Just check out the documentation you get
with Perl. You can find the answer to your question by reading
perlsub.pod. To do that run:


perldoc perlsub


> If anyone knows of either a website where I could easily find the
> answers to questions like this or a method of finding websites to answer
> questions like this, I'd be grateful.


Again, the Perl documentation is as good a source of information as
you can get.


perldoc perl


Cheers,
Bernard
--
echo 42|perl -pe '$#="Just another Perl hacker,"'


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

Date: Fri, 08 Nov 2002 11:47:21 +0100
From: Koos Pol <koos_pol@NO.nl.JUNK.compuware.MAIL.com>
Subject: Re: What is this: &quot;sub myFunc ($$) {&quot;
Message-Id: <newscache$xa795h$uc1$1@news.emea.compuware.com>

yisraelharris wrote (Friday 08 November 2002 11:29):

> I have seen functions declared like this:
> 
> sub myFunc ($$) { .... }
> 
> What exactly does the "$$" mean? (Note: I tend not to understand things
> unless they are explained very clearly :)
> 
> Even better: I spent quite a while trying to find the answer on the
> Internet and did not succeed.
> 
> If anyone knows of either a website where I could easily find the
> answers to questions like this or a method of finding websites to answer
> questions like this, I'd be grateful.
> 
> 
> 
> --
> www.MainFrameForum.com - USENET Gateway

Those are subroutine prototypes. That is, they have the name "prototype", 
but I have read comments (Iliya Zhakarevich?) that the name is arguably 
wrong and that they are of limited purpose. See "perldoc perlsub" for 
technical details.

-- 
KP



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

Date: Fri, 8 Nov 2002 11:02:54 +0000 (UTC)
From: "F. Xavier Noria" <fxn@hashref.com>
Subject: Re: What is this: &quot;sub myFunc ($$) {&quot;
Message-Id: <aqg5ku$qm3$1@news.ya.com>

In article <3dcb9226$1_6@news.onlynews.com>, yisraelharris wrote:

> I have seen functions declared like this:
> 
> sub myFunc ($$) { .... }
> 
> What exactly does the "$$" mean? (Note: I tend not to understand things
> unless they are explained very clearly :)

perldoc perlsub
/Prototypes

-- fxn


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

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


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