[16438] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3850 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jul 30 18:06:10 2000

Date: Sun, 30 Jul 2000 15:05:13 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <964994713-v9-i3850@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sun, 30 Jul 2000     Volume: 9 Number: 3850

Today's topics:
    Re: Compile any module with Cygwin v 1.1 (Colin Keith)
    Re: Data Editing <gellyfish@gellyfish.com>
    Re: Database Question ()
    Re: Downloading Perl (brian d foy)
    Re: Downloading Perl (brian d foy)
    Re: Downloading Perl <leo@grx.nl>
    Re: Downloading Perl <fedya@banet.net>
        dynamic language pohanl@my-deja.com
    Re: how to query oracle database and send output to scr <gellyfish@gellyfish.com>
    Re: I Am An Idiot <dave@dave.org.uk>
    Re: I Am An Idiot <gellyfish@gellyfish.com>
    Re: I Am An Idiot <gellyfish@gellyfish.com>
    Re: Is "exit()" really necessary? <bart.lateur@skynet.be>
        Moving and renaming files (Dan Alexander)
    Re: Moving and renaming files <dietmar.staab@t-online.de>
    Re: Moving and renaming files <tina@streetmail.com>
    Re: No more typeglobs in Perl 6 (was: Advanced Perl Pro (brian d foy)
    Re: No more typeglobs in Perl 6 (was: Advanced Perl Pro (Keith Calvert Ivey)
    Re: Online RPG using SQL? <jarcher@gmx.net>
    Re: Online RPG using SQL? <jarcher@gmx.net>
    Re: Online RPG using SQL? <gellyfish@gellyfish.com>
    Re: perl reference on nt server <gellyfish@gellyfish.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Sun, 30 Jul 2000 20:23:12 GMT
From: ckeith@clara.net (Colin Keith)
Subject: Re: Compile any module with Cygwin v 1.1
Message-Id: <Q80h5.37$DT4.2033387@nnrp2.clara.net>

In article <3983EB25.BD4E22F4@gmx.net>, Benjamin Schuele <bschuele@gmx.net> wrote:
>Hello,
>
>when I want to compile a perl module with cygwin v 1.1, I always become
>the same error message after perl Makefile.PL && make :
>Makefile:246: *** missing separator.  Stop.
>Cud anyone help me?

Not really without knowing which module you're trying to install.
Check line 246 of the Makefile has a tab as the first white space 
character, not a white space. You're using gmake afterall.

I've changed the followups to go to c.l.p.misc (afaik .modules is for 
announcements/discussions of modules)

Col.


---
Colin Keith
Systems Administrator
Network Operations Team
ClaraNET (UK) Ltd. NOC


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

Date: 30 Jul 2000 23:15:16 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Data Editing
Message-Id: <8m29dk$t9c$1@orpheus.gellyfish.com>

On Sat, 29 Jul 2000 14:16:22 -0700 psycho wrote:
> i've posted something like this before i need to be able to open
> a file and edit the data thats in the file i've found some
> source code it's from cgi101.com.
> 

perlfaq5 :

       How do I change one line in a file/delete a line in a
       file/insert a line in the middle of a file/append to the
       beginning of a file?


> #!/usr/bin/perl

                 ^ -w

use strict;

> print "Content-type:text/html\n\n";
> srand(time() ^ ($$ + ($$ << 15)) );
> 

This is not necessary with a recent perl :

  perldoc -f rand
  perldoc -f srand

> open(INF,"addata.txt");

No test for the success of the open - this is being discussed in another
thread at the moment so I wont bore everyone.

> @grok = <INF>;
> close(INF);
> 
> @vads = ();

There is  little point in reading the whole file into an array if you
are simply going to iterate over it with foreach when you can simply
use 'while(<INF>)' below.

> 
> foreach $i (@grok) {
>     # added this line in case the file has a blank line in it
>     if ($i eq "") {
> 	next;			# skip to the next loop iteration
>     }
>     chomp($i);

Except that $i should always have the line terminator in it when the
comparison is done before the chomp() - put that above the 'if' or
test for equality to the line separator $/.

>     ($id,$gif,$url,$alt,$max,$count) = split(/\|/,$i);
>     if ($count < $max) {
> 	push(@vads,$i);
>     }
> }
> 
> $rid = int(rand(@vads));
> 
> if ($rid < 0) {
>     # there's been some problem.  Abort.
>     exit;
> }
> 
> $ad = $vads[$rid];
> ($id,$gif,$url,$alt,$max,$count) = split(/\|/,$ad);
> print qq(<a href="$url"><img src="$gif" alt="$alt"></a>\n);
> 
> $count = $count + 1;
> 
> open(INF,">addata.txt");
> flock(INF,2);
> seek(INF,0,0);

Oof! You have just clobbered your file before getting the lock on the file.
You should use a mode of '+<','>>' or '+>>' and truncate and seek as 
appropriate - your seek above is pointless as the file is effectively
empty anyhow.

Anyhow this is all moot, because you didnt gain an exclusive lock at the
time of you first reading from the file you are likely to overwrite the
changes made by another instance of the program.  You should open the
file once at the outset for reading and writing ('+<'), gain an exclusive
lock, read the file and do the processing then truncate, seek to the
beginning and rewrite the file then close the file.

> foreach $i (@grok) {
>     chomp($i);
>     if ($i eq $ad) {
> 	print INF "$id|$gif|$url|$alt|$max|$count\n";
>     } else {
> 	print INF "$i\n";
>     }
> }
> close(INF);
> 

Ah, I see why you saved the file in an array now, perhaps you should have
done the tests in the initial loop in the first place ?

/J\
-- 
yapc::Europe in assocation with the Institute Of Contemporary Arts
   <http://www.yapc.org/Europe/>   <http://www.ica.org.uk>


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

Date: Sun, 30 Jul 2000 19:39:35 GMT
From: sjs@yorku.ca ()
Subject: Re: Database Question
Message-Id: <slrn8o912q.1qc.sjs@john.sympatico.ca>

neil@pacifier.com <neil@pacifier.com> wrote:
>Unigni <unigni@zaynar.demon.co.uk> wrote:
>> I'm wanting a database which I can use with Perl (running on a Unix web
>> server). I only need to be able to access records using their key (no
>> complicated searching things), but want to be able to lock specific
>> records and write to them while I'm also reading/writing other records.
>> Could anybody suggest a good database to use?

>Mysql might be what you are looking for. Take a look at www.mysql.com

I don't think MySQL does record-level locking.  From the manual:

"MySQL uses table locking (instead of row locking or column locking) 
to achieve a very high lock speed."

Steve


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

Date: Sun, 30 Jul 2000 14:14:16 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: Downloading Perl
Message-Id: <brian-ya02408000R3007001414160001@news.panix.com>

In article <39845985.4A7839A0@banet.net>, fedya@banet.net posted:

> Is there anywhere other than Activestate where one can do this?  They've
> been down since Friday night

they're using a crappy webserver.  perhaps it's a dogfood thing, but it's
also a pain in the ass.

however, you can ftp to ftp.activestate.com and follow the directories.

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Mongers <URL:http://www.perl.org/>


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

Date: Sun, 30 Jul 2000 14:16:55 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: Downloading Perl
Message-Id: <brian-ya02408000R3007001416550001@news.panix.com>

In article <39845E49.54B77D43@rochester.rr.com>, Bob Walton <bwalton@rochester.rr.com> posted:

> Ted wrote:

> > Is there anywhere other than Activestate where one can do this?  They've
> > been down since Friday night.

> There must be something else wrong, because I accessed ActiveState a
> bunch yesterday.  What exactly is it you think is down?

several of their links to the latest builds just don't work (i.e. lead
to 404s).  i was unable to download the latest build through the web.
parts of the rest of the site work, though.

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Mongers <URL:http://www.perl.org/>


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

Date: Sun, 30 Jul 2000 20:16:43 +0200
From: "leo grapendaal" <leo@grx.nl>
Subject: Re: Downloading Perl
Message-Id: <8m1reb$55p$1@news1.xs4all.nl>

> > Is there anywhere other than Activestate where one can do this?  They've
> > been down since Friday night.  I'm looking for the ready-to go version,
not
> > the source code that you have to compile yourself (which I was able to
find
> > on perl.com).  I've tried at least half a dozen times, and keep getting
the
> > same error message.  (BTW: If it makes a difference, I'm simply
following
> > the links from the www.activestate.com webpage)

> There must be something else wrong, because I accessed ActiveState a
> bunch yesterday.  What exactly is it you think is down?
> --
> Bob Walton

Bob,  Ted is right: ActiveStates downloadserver is very, very down. No
downloads
possible at all.
They're probably running IIS for this ;-)

Their webpages are still accessible though. (Apache?)

Ted, you could try www.dynamicstate.com (how original), they also have a
Windoze perl port.
(IndigoPerl) (if that is what you're after).  Can't say I used that one
though.


Leo Grapendaal

Amsterdam Perl Mongers <URL:http://amsterdam.pm.org/>







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

Date: Sun, 30 Jul 2000 16:52:33 -0400
From: Ted <fedya@banet.net>
Subject: Re: Downloading Perl
Message-Id: <39849591.F915271C@banet.net>



leo grapendaal wrote:

> > > Is there anywhere other than Activestate where one can do this?  They've
> > > been down since Friday night.  I'm looking for the ready-to go version,
> > > not the source code that you have to compile yourself (which I was able
> > > to find on perl.com).  I've tried at least half a dozen times, and keep
> > > getting the same error message.  (BTW: If it makes a difference, I'm
> > > simply following the links from the www.activestate.com webpage)
>
> > There must be something else wrong, because I accessed ActiveState a
> > bunch yesterday.  What exactly is it you think is down?
> > --
> > Bob Walton
>
> Bob,  Ted is right: ActiveStates downloadserver is very, very down. No
> downloads possible at all.
> They're probably running IIS for this ;-)
>
> Their webpages are still accessible though. (Apache?)

Thank you -- you stated the problem much better than I did.  :-)  I was indeed
able to get on to the ActiveStates pages, but when I clicked on the download
links, I got an error message (created from the ActiveStates site) telling me to
go to activestates.com or press the back button for more help.

> Ted, you could try www.dynamicstate.com (how original), they also have a
> Windoze perl port.
> (IndigoPerl) (if that is what you're after).  Can't say I used that one
> though.

This is going to bring up a silly question, but -- what's the difference between
Active Perl and Indigo Perl?  If it helps, what I want to use Perl for is
basically spreadsheet management.  I run a small web-site that has info on a
bunch of players on the (Sanex) Women's Tennis Association Tour, and would like
to set up a bunch of the web-pages to extract data from the spreadsheet (the
spreadsheet changes slightly from week to week, but the location of the data I'd
need to extract would always be the same).  Eventually, I'd like to be able to
use Perl to do some more advanced things, such as sort the players by ranking
and print out a rankings table, although right now that's a bit beyond my Perl
programming capabilities.  [OK, I admit it -- "a bit" is an understatement.
:-)]  Would it make a difference which version I'm using?

> Amsterdam Perl Mongers <URL:http://amsterdam.pm.org/>

--Ted                 I have always challenged the "psychoses." Why don't
fedya@banet.net       you have a right to say you are Jesus? And why isn't
                      the proper response to that congratulations?"
                      Thomas Szasz, "Reason" Magazine, July 2000




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

Date: Sun, 30 Jul 2000 21:54:49 GMT
From: pohanl@my-deja.com
Subject: dynamic language
Message-Id: <8m2878$l58$1@nnrp1.deja.com>

The future of languages.

As you all know, the history of languages started with instruction
codes for a machine.  These were very basic operations like the
following...

Load 001 R1   <- put 1 in storage 1(register 1)
Load 002 R2   <- put 2 in storage 2 (register 2)
Add R1 R2     <- add storage 2 to storage 1 and put results in storage 1


Of course, this is assembly.  Which is translated to
machine language..

005 001 001
005 002 002
006 001 002

(assuming 005 = Load, 006 = Add).

Since machine language are just bytes, you can convert them to
binary...

00000101 00000001 00000001
00000101 00000010 00000010
00000110 00000001 00000010

These are fed to the processor of the CPU (Central Processing Unit)
which understand instruction of Load, Add, etc.  and follows
what the instructions tell it to do.  Those individual bits trigger
events in the transistors.  So you are actually talking to transistors
if you think low enough.


Well.  If you notice the above language follows a particular syntax,
namely Operator Operand Operand.  A B B
If you construct a grammar tree for this... it looks like so...

Program=>Statements
Statements=>Statement Statements
Statement=>Operator Operand Operand
Operator=>Load | Add | Sub | Jump | etc
Operand=>R1 | R2 | A1 | etc

Of course, you can create the language of Basic using a different
grammar set.  C has its own, every language has one.

But have you noticed something?  All the languages in the world
has a fixed grammar.  The only one that comes close to being dynamic
is Lisp.  But even in lisp you must follow the recursive syntax,
and you are bound to it for creating new functions.

Well, I happen to have created a new language with a dynamic
grammar tree.  You can prune add grammar anywhere in it.
The most scrary and interesting thing about it is that it
has the potential to be alive "living".  All it needs is a source
for replacing any piece in the LHS (left side of the grammar tree),
and a source for food (something to parse its grammar on, in
computer language it is called the program).  It can obtain both
either manually (you feed it), or it can grab it from a source
(like the internet webpages)

It can live on the internet following webpages.  It can understand
html format (and its links).  And it can understand text.  So
for example, it follows a link to a regular text (which has sentences
with periods, etc), and it will eventually hit upon a http link
and it can go there if it wants.  It has rudimentary english
grammar capability etc.

But back to the dynamic nature of its grammar tree.  Because it is
dynamic, it can be pruned and spliced internally, new grammar trees
can be created.  It can understand C, C++, pascal, etc if you feed
it that grammar.

The only things that come up is endless recursion.  A bonus is
that when it has a choice of following two paths, it can use
random path.  If it gets it nowwhere (not settling down to a matching
tree node) in a certain iteration, that prune of the tree is considered
bad (a bad mutation), so it is removed (it dies).  It can keep track
of good paths for keeps.  Eventually based on percentages, the random
paths narrow down to useful grammars.

Actions.  Well what can it do?  It can interpret languages and
execute if it has a way to hook into the CPU and tell it to
do stuff.  From there it needs a starting point.  You can feed
it a program for it to interpret (like a perl language or a
C program, or a html link), and off it goes following its intstructions.
now and then it encounters a part it doesn't understand from
its food.  From then it has a choice of either incorporating the
new tree token or discard it.  (you can set the mutation rate).
Note that it can be set to retain a lot.

This thing can crawl to your machine and live there if it has
hooks to your machine.  For example... this is a path it would
take if it wants to reproduce children...

On my windows machine it is running on an Intel cpu (it understands
this language).  To migrate to another machine, it would need
access to your machine's CPU.  Most computers talk http and tcp/ip.
Well, if the food is html pages, it has instant access to all the
computers on the internet that has a webservers and from there
it can find ftp servers (using ftp:// tokens).  From its base machine
it can ftp itself to public ftp servers as pure executables of
itself for intel cpus.  From there it has a chance to live again
if someone downloads it and runs it.

it just happens that it understand ftp commands

start=>statements
statements=>statement statements
statement=>operator file
operator=>put | get | etc
file=>[a-z.]*

There is the grammar for execution...

response=>error | ok | etc
error=>"cannot find"
ok=>"file transferred.."
etc.

a new grammar is simply an extention of things it found but
has no node to parse from in its internal grammar tree.
Because it is a living grammar, it can utilize useful languages it
parsed and incorporate that into its own grammar tree.

a=b | newgrammar
newgrammar=>(obtained from parsing food)

eventually if this part of the tree is successful elsewhere it is
retained (based on percentage, etc)

If it cannot have children, then it can just live on one machine and
basically grow and mutate itself.  It can understand everthing
eventually.  Even wave files (sound files) have a strict structure
with a header, begin wave sound and end file.  html has <html> for
beginning and </html> for ending.  C executables have Data Segment,
Address Segment, where to load it into memory, etc. C source
have main(argc, argcv) etc.  So it can be in a growing mode, or
execution mode.  It can execute code (any language, if you feed it
the grammar, or it finds out on its own) or run native cpu code, or
it can just grow, understand the grammar for some new food it got
and create grammar trees from it to extend itself.

Here is an interesting website: http://www.edepot.com
There is a non-living version of the grammar there
(It was useful as a glossary, so I made it live on disucssion
forum board pages, but it is non-living, so you must manually
give it new grammar by inputing into the input box.).
You can try it out on the discussion forums.  A more
direct link is http://www.edepot.com/phl.html

The living mode still working on.  (I'm using it
as a backend as a dynamic webpage language).



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


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

Date: 30 Jul 2000 23:48:28 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: how to query oracle database and send output to screen
Message-Id: <8m2bbs$3v0$1@orpheus.gellyfish.com>

In comp.lang.perl.misc Galen Boyer <galenboyer@yahoo.com> wrote:
> 
> ,----
> | Hi,
> |   I need to query my oracle database 8.1.6 on solaris 7 and send the
> | results to the screen.  I might also need to send the output to a
> | file.  I've looked into DBD and DBI but there are some modifications
> | that need to be done to some java oracle binaries to get it to work.
> | I'd rather not modify these files on my production server.  I've done
> | this with informix:
> | 
> | #!/usr/local/bin/perl
> | $ENV{INFORMIXSERVER} = "n_shm";
> | open DBACCESS, "| /u/informix/bin/dbaccess";
> | print DBACCESS qq{
> |    database mydatabase\@n_shm;
> |    UNLOAD TO '/u/myfile'
> |    SELECT *
> |    FROM a_table;
> | };
> | close DBACCESS;
> `----
> #!/bin/sh
> #THIS WILL SEND TO SCREEN
> sqlplus login/password@instance << EOF
> select ....
> ;
> EOF
> 
> #!/bin/sh
> #THIS WILL SEND TO file
> sqlplus login/password@instance << EOF > file
> select ....
> ;
> EOF
> 
> This is unix specific, not Oracle.  Substitute dbaccess and this
> will work as well.
> 
> I think Perl has this.  I would be surprised if it didn't.

Well, yes of course it does, although you have to go that extra length if
you want to do that shell redirect :)

You can use the 'backtick here document' like so :

$output =<<`EIEIO`;
sqlplus login/password@instance << EOFOO
select blah from foo;
EOFOO
EIEIO

where the output will go the variable $output, but I am sure we will all
agree this is weird and a little confusing - most people would prefer
to use IPC::Open2 to do this (and I couch this in Informix terms as
that is all I have to test with right now) :


#!/usr/bin/perl -w

use strict;

use IO::Handle;
use IPC::Open2;


my $dbaccess = '/usr/local/informix/bin/dbaccess tdcusers - ';


my $readhandle = IO::Handle->new;
my $writehandle = IO::Handle->new;



open2($readhandle,$writehandle,$dbaccess);

$| = 1;


print $writehandle <<EOFOO;
select * from codes
EOFOO

close $writehandle;

print while (<$readhandle>);


The same thing can be done with sqlplus ...

/J\
-- 
yapc::Europe in assocation with the Institute Of Contemporary Arts
   <http://www.yapc.org/Europe/>   <http://www.ica.org.uk>


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

Date: Sun, 30 Jul 2000 20:17:02 +0100
From: Dave Cross <dave@dave.org.uk>
Subject: Re: I Am An Idiot
Message-Id: <mnv8osctad07mbf3fe4kdgsno01n5j2u6b@4ax.com>

On Sun, 30 Jul 2000 16:24:25 GMT, "Ben Kennedy" <bkennedy99@home.com>
wrote:

>> This statement is in direct contradiction of your
>> previous statement, paraphrased,  "... _always_ use die."
>> However, your statement shows a bit more wisdom through
>> implication use of die may not always be the best choice.
>
>You are most likely misinterpreting what he said originally - he probably
>meant to say _always_ pay attention to the return value of open().

Actually, what I said was:

"You should _always_ check the return value from a call to open."

Which seems pretty clear to me :)

Dave...

-- 
<http://www.dave.org.uk>  SMS: sms@dave.org.uk
yapc::Europe - London, 22 - 24 Sep <http://www.yapc.org/Europe/>

"There ain't half been some clever bastards" - Ian Dury [RIP]


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

Date: 30 Jul 2000 15:01:57 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: I Am An Idiot
Message-Id: <8m1cgl$uem$1@orpheus.gellyfish.com>

On Sat, 29 Jul 2000 17:45:03 GMT Andrew Johnson wrote:
> In article <jq26os8ljbfcf1cgehpdasgleak6dlbpq5@4ax.com>,
>  Dave Cross <dave@dave.org.uk> wrote:
> 
> ! Ah well, my cover is broken. I shall have to retire from the Perl
> ! community and go back to my first love - Visual Basic.
> 
> I wonder if there's still time to register for Euro-yavbc.
> :-)
> 

Plenty of time I should imagine as we have yet to set a date - the venue
is the shed at chez Gellyfish so numbers are kinda limited but we'll let
you know in advance dont you worry - we could'nt miss the opportunity of
having a speaker like yourself.  If we get more than three attendees we'll
have a live telecast down to the large screen at the King's Head.

/J\
-- 
yapc::Europe in assocation with the Institute Of Contemporary Arts
   <http://www.yapc.org/Europe/>   <http://www.ica.org.uk>


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

Date: 30 Jul 2000 18:59:21 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: I Am An Idiot
Message-Id: <8m1qdp$c8a$1@orpheus.gellyfish.com>

On Sat, 29 Jul 2000 22:25:45 +0100 Dave Cross wrote:
> 
> 
> 1/ Always check the return from the open and _always_ die.
> You won't find that anyone has actually advocated this option,
> although the fact that both Jonathan Stowe and me both used die in our
> examples could be misconstrued as us advocating this action. I know
> that I don't and I'm pretty sure that Jonathan doesn't either.
> 

Yep.  I don't see any point in taking any more elaborate action in a program
who's sole purpose revolves round the opening and reading from a file.

Just because 'die' is used in the examples doesn't mean that it is used
everywhere - hell, I might use 'croak' sometimes :)

> 2/ Always check the return value and take _appropriate_ action. This
> may involve dying or it may involve logging an error and simply moving
> on. This is the option that Larry Rosler suggested. It's also what I
> would advocate and (reading his mind) I'm sure that Jonathan would
> agree with us.
> 

Doris^H^H^H^H^HDave is right.  The opening of a file might be optional,
for example a configuration file, some might consider that it might be
simpler to try and open a file and skip any section that might use it than
use a file test operator.  Although it is not so much an issue in a Perl
program one might want to keep track of the resources allocated in a program
so they can be released when the program exits.

> 3/ _Sometimes_ it's ok to not even check the return value from open.
> Reading her example code, this seems to be what Kira advocates, but
> she has yet to explain under what circumstances she believes this is a
> valid course of action.
> 
> 4/ _Never_ check the return value from open. 
> This is clearly very silly and I don't believe that any of us are
> advocating this option.
> 

It is always an error to read from or write to an unopened filehandle, 
indeed I could see that maybe that an unsuccesful open() should be fatal
if in a void context - there are plenty examples of languages where this
is the case (well fatal unless otherwise handled).  

There are probably quite a few people here who have worked in environments
where using an unopened filehandle is not only fatal to the program but to
the system itself under certain circumstances - of course most modern
general purpose OS arent like this, but they exist and there are often
very good reasons for putting the repsonsibility on the programmer.

/J\
-- 
yapc::Europe in assocation with the Institute Of Contemporary Arts
   <http://www.yapc.org/Europe/>   <http://www.ica.org.uk>


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

Date: Sun, 30 Jul 2000 21:20:45 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Is "exit()" really necessary?
Message-Id: <qq69os8jvqfkh3tlbf3e7ltu5p1f7k98k1@4ax.com>

Abigail wrote:

>.. I try to avoid exit() as much as possible. If I ever need it inside a
>.. sub, I tend to consider this a defeat. So I'll try to get rid of it.
>
>To me, that falls in the same category as not using return, goto, regexes,
>addition, or semicolons.

"goto", maybe. the others: bogus.

The problem with exit() is that it is untrappable. You can no longer
reuse your code.

	$code = 'exit';
	eval $code;
	print "I'm alive!\n";

Sorry; it won't be alaive any more.

Just because you're finished with your code in this version of the
program, that doesn't mean it should break of the script if you want to
call the actions of this script as a subroutine. It does. No way around
it.

-- 
	Bart.


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

Date: Sun, 30 Jul 2000 12:38:54 -0700
From: dalex@pnl.gov (Dan Alexander)
Subject: Moving and renaming files
Message-Id: <7CD3E724ABFCD31198C700508B959770016E3F10@PNLMSE0>

Perl newbie question:

I'm running Perl on NT 4.0.
  
I'd like to find some example scripts that show how to rename files and then 
move the files to another directory.

I'd appreciate it immensely if someone could point me in the right direction.

Thanks,
Dan Alexander
dalex@pnl.gov



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

Date: Sun, 30 Jul 2000 22:40:39 -0500
From: "Dietmar Staab" <dietmar.staab@t-online.de>
Subject: Re: Moving and renaming files
Message-Id: <8m23qq$vs4$12$1@news.t-online.com>

In article <7CD3E724ABFCD31198C700508B959770016E3F10@PNLMSE0>,
dalex@pnl.gov (Dan Alexander) wrote:

> Perl newbie question:
> 
> I'm running Perl on NT 4.0.
>   
> I'd like to find some example scripts that show how to rename files and
> then move the files to another directory.
> 
> I'd appreciate it immensely if someone could point me in the right
> direction.
> 
> Thanks, Dan Alexander dalex@pnl.gov

Have a look at the module File::Copy (Copy files or filehandles) for
moving files. For rename there exists a perl function rename() or you can
call system commands with system(). If you want to apply these functions
to some or all files in a directory theres a File::Glob module which puts
all selected files in an list. Then step through this list an move or
rename your files as you need.

Greetings, Dietmar


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

Date: 30 Jul 2000 21:12:40 GMT
From: Tina Mueller <tina@streetmail.com>
Subject: Re: Moving and renaming files
Message-Id: <8m25o8$5g216$9@ID-24002.news.cis.dfn.de>

hi,
Dan Alexander <dalex@pnl.gov> wrote:
>   
> I'd like to find some example scripts that show how to rename files and then 
> move the files to another directory.

you can use rename for both: renaming and
moving. let's say you have a "file1" and a
directory "dir". typing
rename ("file1","dir/file2")
would move file1 into the directory dir
with the new name file2.

HTH,
tina

-- 
http://tinita.de    \  enter__| |__the___ _ _ ___
tina's moviedatabase \     / _` / _ \/ _ \ '_(_-< of
search & add comments \    \ _,_\ __/\ __/_| /__/ perception
"The Software required Win98 or better, so I installed Linux."


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

Date: Sun, 30 Jul 2000 14:11:31 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: No more typeglobs in Perl 6 (was: Advanced Perl Programming -- Dated?)
Message-Id: <brian-ya02408000R3007001411310001@news.panix.com>

In article <uya2jfrer.fsf@demog.berkeley.edu>, aperrin@demog.berkeley.edu (Andrew J. Perrin) posted:

> Steffen Beyer <sb@muccpu1.muc.sdm.de> writes:
> 
> > >> And just think about it: Without typeglobs, no aliases for [1] subroutines
> > >> or [2] variables anymore, [3] no import of symbols in "use Module qw(...)" 
> > >> anymore,
> > >> no "use English;" anymore, etc.!
> > 
> > > Huh? How does one follow from the other? Just because typeglobs doesn't
> > > exist doesn't mean any of the other things don't exist. Heck, you can do
> > > all that stuff now without using typeglobs.
> > 
> > How?
> 
> [1] sub foo {...}
>        $Rfoo = \&foo;

references are not aliases.  with typeglobs

   *a = *b;

   a();
   b();  # same thing

but with references:

   $a = \&b;

   $a->(); # different syntax
   &b;      

> [2] $foo = 'foo';
>        $Rfoo = \$foo;

references are not aliases. again.

> [3] package Foo;
>     @ISA = qw/Exporter/;
>     @EXPORT_OK = qw/$scalar, @array, subroutine/;
> 
>     use Foo qw($scalar, @array, subroutine);

see the Exporter source code to see the typeglobs.

> [4] use English;

> I don't see how any of these require typeglobs.

see the Exporter source, again.

don't confuse a module's API with its internals.

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Mongers <URL:http://www.perl.org/>


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

Date: Sun, 30 Jul 2000 19:25:22 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: No more typeglobs in Perl 6 (was: Advanced Perl Programming -- Dated?)
Message-Id: <39847ffb.1801849@news.newsguy.com>

aperrin@demog.berkeley.edu (Andrew J. Perrin) wrote:

>[1] sub foo {...}
>       $Rfoo = \&foo;
>
>[2] $foo = 'foo';
>       $Rfoo = \$foo;
>
>[3] package Foo;
>    @ISA = qw/Exporter/;
>    @EXPORT_OK = qw/$scalar, @array, subroutine/;
>
>    use Foo qw($scalar, @array, subroutine);
>
>[4] use English;
>
>I don't see how any of these require typeglobs.

Your [1] and [2] are not aliases, which is what the question was
about.  How do you make a subroutine bar() that's a synonym for
foo(), or a scalar $bar that's a synonym for $foo?

As for [3] and [4], how do you think Exporter.pm and English.pm
work?  If you don't know, look inside them.  They use typeglobs.

That said, there's no reason Perl 6 couldn't have a new syntax
for creating aliases that didn't require typeglobs.

-- 
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC


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

Date: Sun, 30 Jul 2000 12:35:48 -0400
From: James Archer <jarcher@gmx.net>
Subject: Re: Online RPG using SQL?
Message-Id: <39845964.D5188228@gmx.net>


> Well, I don't know SQL at all, But I do like RPGs, so I think it'd be a
> good idea, go for it. ;)
> SQL or not, in perl When you do this type of stuff, I'd use some perl
> OOP methods, etc... for example:

I was thinking of something along those lines, but wasn't sure how to
implement it.  Thanks for the tips! :o)

James


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

Date: Sun, 30 Jul 2000 12:36:24 -0400
From: James Archer <jarcher@gmx.net>
Subject: Re: Online RPG using SQL?
Message-Id: <39845988.74788163@gmx.net>


> Check out the DBI modules at cpan and decide what kind of SQL database you
> would want to use.  Some popular SQL databases are mSQL and mySQL.  The DBI
> module provides an interface between the database and Perl so you can easily
> manipulate your tables in the database.  If you don't know SQL those web
> sites have some language specifications on the language.

Thanks.  The SQL stuff has been confusing me, and those sites helped a
lot!

James


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

Date: 30 Jul 2000 14:10:59 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Online RPG using SQL?
Message-Id: <8m19h3$kma$1@orpheus.gellyfish.com>

On Sat, 29 Jul 2000 18:36:52 -0400 James Archer wrote:
> I've been in the process of deveoping plans for an web-based
> role-playing game, 

Shows my age I thought it meant Report Programmer Generator.

/J\
-- 
yapc::Europe in assocation with the Institute Of Contemporary Arts
   <http://www.yapc.org/Europe/>   <http://www.ica.org.uk>


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

Date: 30 Jul 2000 19:05:28 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: perl reference on nt server
Message-Id: <8m1qp8$def$1@orpheus.gellyfish.com>

On Sat, 29 Jul 2000 14:29:33 -0400 Tom McLean wrote:
> I am trying to execute a script on an nt webserver that has the interpreter
> installed in the ntreskit directory. 
> 

Stop right there.  The Perl that comes with the NT 4 resource kit is
based on 5.001m and is almost certainly buggy and insecure, it also
does not come with any of the standard modules or documentation.
Uninstall it right now and get the latest release from Activestate
<http://www.activestate.com/> .


/J\
-- 
yapc::Europe in assocation with the Institute Of Contemporary Arts
   <http://www.yapc.org/Europe/>   <http://www.ica.org.uk>


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

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


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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

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

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


------------------------------
End of Perl-Users Digest V9 Issue 3850
**************************************


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