[19493] in Perl-Users-Digest
Perl-Users Digest, Issue: 1688 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Sep 4 06:11:06 2001
Date: Tue, 4 Sep 2001 03:10:16 -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: <999598215-v10-i1688@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 4 Sep 2001 Volume: 10 Number: 1688
Today's topics:
oracle and perl and the "order by" clause <manuel.koerner@rexroth.de>
Re: oracle and perl and the "order by" clause <cyberjeff@sprintmail.com>
Re: oracle and perl and the "order by" clause <cyberjeff@sprintmail.com>
Re: oracle and perl and the "order by" clause <manuel.koerner@rexroth.de>
OT: Re: Recommendations for a PERL editor (Tim Hammerquist)
Re: paginate search results with DBI <goldbb2@earthlink.net>
Re: Perl and DBI (Chris Fedde)
Re: Perl and DBI (Tad McClellan)
Re: Perl for Psion - where? CPAN link broken <stumo@bigfoot.com>
Re: Perl handcoded? <dan@tuatha.sidhe.org>
Re: pl or not pl, that is the question (David Combs)
POD (HTML) and ERD . . . <dausha@visto.com>
Re: POD2Doc? <dausha@visto.com>
Re: problem when execute query from windows to Unix <bwalton@rochester.rr.com>
Re: Recommendations for a PERL editor <sabin@cornhusker.net>
Re: Recommendations for a PERL editor (Harri J Haataja)
Re: references, slices, voodoo (Damian James)
Re: references, slices, voodoo <hafner@augusta.de>
Re: Simple Question <kennylim@techie.com>
Re: Simple Question nobull@mail.com
Strange regex behavious (Ian Oversby)
Re: system call <goldbb2@earthlink.net>
test <alexdgreen@hotmail.com>
Re: This has got to be a bug (David Combs)
Using a link/submit to execute a subroutine (andy theimer)
Re: Using a link/submit to execute a subroutine nobull@mail.com
Re: Why do tabs eliminate the rest of the line? <goldbb2@earthlink.net>
win32 rmdir questions <keng@kengdom.per.sg>
Re: win32 rmdir questions <goldbb2@earthlink.net>
Re: win32 rmdir questions <andrew.savige@ir.com>
Re: win32 rmdir questions nobull@mail.com
Re: win32 rmdir questions <philippe.perrin@sxb.bsf.alcatel.fr>
Re: win32 rmdir questions <krahnj@acm.org>
Re: win32 rmdir questions <krahnj@acm.org>
Win32-Perms and the registry <nospam@nospam.nospam>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 4 Sep 2001 11:04:41 +0200
From: "Manuel Körner" <manuel.koerner@rexroth.de>
Subject: oracle and perl and the "order by" clause
Message-Id: <9n25en$3gs1@sunny.mannesmann.de>
Hi to all!
I want to use a variable "order by" clause and i don't know the
syntax.
part of the source code which didn't work:
my $orderby = "name";
my $sth = $dbh->prepare("select name, city ... order by ?");
$sth->execute($orderby);
Thanks for any help
Manuel Köner
------------------------------
Date: Tue, 04 Sep 2001 09:16:14 GMT
From: Jeff Thies <cyberjeff@sprintmail.com>
Subject: Re: oracle and perl and the "order by" clause
Message-Id: <3B949B3F.E9B042F9@sprintmail.com>
> I want to use a variable "order by" clause and i don't know the
> syntax.
>
> part of the source code which didn't work:
>
> my $orderby = "name";
>
> my $sth = $dbh->prepare("select name, city ... order by ?");
I'm not sure you can use placeholders for that. You can do this:
my $sql=qq{
select name, city ... order by $orderby
};
my $sth = $dbh->prepare($sql);
Jeff
>
> $sth->execute($orderby);
------------------------------
Date: Tue, 04 Sep 2001 09:19:59 GMT
From: Jeff Thies <cyberjeff@sprintmail.com>
Subject: Re: oracle and perl and the "order by" clause
Message-Id: <3B949C1F.3F4A6A4E@sprintmail.com>
Also, turn on some error checking in your execute. This should have
helped shake out your problem.
> > I want to use a variable "order by" clause and i don't know the
> > syntax.
> >
> > part of the source code which didn't work:
> >
> > my $orderby = "name";
> >
> > my $sth = $dbh->prepare("select name, city ... order by ?");
>
> I'm not sure you can use placeholders for that. You can do this:
>
> my $sql=qq{
> select name, city ... order by $orderby
> };
> my $sth = $dbh->prepare($sql);
>
> Jeff
> >
> > $sth->execute($orderby);
$sth->execute($orderby) || die "Cannot execute: $DBI::errstr\n";
------------------------------
Date: Tue, 4 Sep 2001 11:47:34 +0200
From: "Manuel Körner" <manuel.koerner@rexroth.de>
Subject: Re: oracle and perl and the "order by" clause
Message-Id: <9n27v3$5md5@sunny.mannesmann.de>
thanks for you help but it won't work. but i get the right idea. i use
"sprintf" and then
i get the right result.
by
Manuel Könrer
"Jeff Thies" <cyberjeff@sprintmail.com> schrieb im Newsbeitrag
news:3B949C1F.3F4A6A4E@sprintmail.com...
> Also, turn on some error checking in your execute. This should have
> helped shake out your problem.
>
> > > I want to use a variable "order by" clause and i don't know the
> > > syntax.
> > >
> > > part of the source code which didn't work:
> > >
> > > my $orderby = "name";
> > >
> > > my $sth = $dbh->prepare("select name, city ... order by ?");
> >
> > I'm not sure you can use placeholders for that. You can do this:
> >
> > my $sql=qq{
> > select name, city ... order by $orderby
> > };
> > my $sth = $dbh->prepare($sql);
> >
> > Jeff
> > >
> > > $sth->execute($orderby);
>
> $sth->execute($orderby) || die "Cannot execute: $DBI::errstr\n";
------------------------------
Date: Tue, 04 Sep 2001 03:21:38 GMT
From: tim@vegeta.ath.cx (Tim Hammerquist)
Subject: OT: Re: Recommendations for a PERL editor
Message-Id: <slrn9p8it1.3iu.tim@vegeta.ath.cx>
Me parece que sabin <sabin@cornhusker.net> dijo:
>
> > UltraEdit-32 never crashed my Win98SE system. It was possibly the most
> > stable application I installed.
> >
> > I wish I could've said the same for MS Word...
>
> I don't know. I don't normal run windows (normaly linux) but I was with out
> a computer away from home for a month and needed to do some stuff in perl.
> My uncle loned me a box with win95a on it. On this system which I'm sorry
> to say I am still using (but only a couple days more) UltraEdit seems to
> crash about every hour but seeing the good reports here makes me wonder. A
> little note: It only seems to happen when I am running internet explorer (I
> normaly use the internet when coding to look up things and keep up with
> lists like this). Any way take that for what its worth. It is possible it
> not the program it self.
I run linux 99% of the time also, but if I'm stuck doing some hardcore
editing on Windows...I download Vim. =) But seriously, my second choice
for Win32 editing is UltraEdit-32.
As far as Win32 stability, here's my observations ranked in ascending
order according to severity. (These may seem obvious to many.)
- Win32 stability is compromised proportional to the number of
programs open at any given time.
- Win32 stability is further compromised proportional to the number of
Microsoft(C) applications open at any given time.
- Win(95/98) stability is compromised proportional to the length of
time since installation of the OS (w/o good housekeeping).
- Win32 stability is compromised proportional to the number of
Microsoft Office applications _installed_ at any given time.
Microsoft Internet Explorer >= 4 crashes regularly when 2 or more of the
above conditions apply. Occasionally this crashes the entire system, as
IE is so closely linked with Windows Explorer.
Netscape Communicator >= 4.7 crashes spontaneously (though rarely)
regardless of above conditions, but has yet to bring the OS down with
it.
BTW: Linux apps I've noticed as being less than completely stable:
Netscape (but not nearly to the degree as on Win32)
Opera (sometimes unpredictable, and assorted other bugs)
...sometimes I think I have too much free time on my hands...then I look
at my agenda... ;)
--
We do what we do because of who we are.
If we did otherwise, we would not be ourselves.
-- Morpheus, The Sandman
------------------------------
Date: Tue, 04 Sep 2001 01:54:50 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: paginate search results with DBI
Message-Id: <3B946CAA.6D9522DB@earthlink.net>
Kurt Stephens wrote:
>
> "paul" <paulthomson@hotmail.com> wrote in message
> news:464e478f.0108290537.2fe6cd1a@posting.google.com...
[snip]
> > What I want to do is pull 50 results at a time and process them. Can
> > anyone give me any pointers?
[snip]
> my $query = "SELECT * FROM foo ORDER BY id "
> . "LIMIT $start, $records_per_page";
The most common reason to want to paginate is that it's going to be
viewed from a web browser. You should *not* be putting form data into a
query with interpolation... it's entirely possible that a malicious user
will send something Bad.
Use placeholders instead:
my $query = q[
SELECT * FROM foo
ORDER BY id
LIMIT ?, ?
];
my $sth = $dbi->prepare( $query );
$sth->execute( $start, $records_per_page );
This decreases the chance of something evil happening.
--
"I think not," said Descartes, and promptly disappeared.
------------------------------
Date: Tue, 04 Sep 2001 02:09:21 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: Perl and DBI
Message-Id: <lJWk7.92$Owe.171086848@news.frii.net>
In article <IoVk7.67396$f01.18381188@news3.rdc1.on.home.com>,
christian <carrazola@home.com> wrote:
>Hello,
>
>I'm looking for either a good Book or Documentation on all the mysql
>functions that perl can use.
>
If the documentation that is part of the DBI and DBD:: interfaces is not
enough then there are a couple other sources. There might be good pointers
for you at http://dbi.symbolstone.org/.
Good Luck
--
This space intentionally left blank
------------------------------
Date: Mon, 3 Sep 2001 22:01:33 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Perl and DBI
Message-Id: <slrn9p8dft.oa2.tadmc@tadmc26.august.net>
christian <carrazola@home.com> wrote:
>
>I'm looking for either a good Book or Documentation on all the mysql
>functions that perl can use.
Have you seen the free information that is probably already
on your own hard disk?
perldoc -q SQL
"How do I use an SQL database?"
Follow the link given there too.
perldoc Mysql
perldoc DBD::mysql
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 4 Sep 2001 10:52:09 +0100
From: "Stuart Moore" <stumo@bigfoot.com>
Subject: Re: Perl for Psion - where? CPAN link broken
Message-Id: <1y1l7.302$zi3.192125@news2-win.server.ntlworld.com>
Bob Walton <bwalton@rochester.rr.com> wrote in message
news:3B940A0E.7DFC03DB@rochester.rr.com...
> Stuart Moore wrote:
> >
> > Hi, looking for the port of Perl to the Psion. The link in CPAN (on the page
> > http://www.perl.com/CPAN-local/ports/) is
> > http://www.science-computing.de/o.flebbe/perl/ but this seems to be broken.
> > Anyone got another one?
>
> The link you mention above seems to work fine.
Was forbidden, someone must have fixed it since. Thanks
------------------------------
Date: Tue, 04 Sep 2001 03:38:00 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: Perl handcoded?
Message-Id: <s0Yk7.304707$v5.30766202@news1.rdc1.ct.home.com>
Dave Tweed <dtweed@acm.org> wrote:
> Dan Sugalski wrote:
>> Dave Tweed <dtweed@acm.org> wrote:
>> > Lijiv Khil wrote:
>> >> I was going through the sources of perl v 1.0. Is Perl written without
>> >> using any compiler construction tools like Lex and Yacc? I found that
>> >> all the transition tables etc were hand-coded in the sources.
>>
>> > Even perl-1.000 (found at http://www.etla.org/retroperl/perl1/) has a
>> > perl.y file, so the answer is no. You might be looking at a distribution
>> > for a platform that didn't (yet) have a yacc or bison (DOS?), and so it
>> > included the pre-processed grammar.
>>
>> All versions of perl, AFAIK, come with a preprocessed grammar. We don't
>> require a working yacc to build perl.
> Who is "we"?
"We" would be the perl 5 porters.
> The early kits at the above site don't include the preprocessed grammar
> (perl.c), but a distribution of perl-3.018 for MSDOS that I have from
> elsewhere does, and it does *not* include perl.y.
The preprocessed grammar has shipped with perl for ages, presumably
since the first time perl was targetted to build out of the box on a
system with just make and a C compiler.
It's name has changed over the years. It's perly.y now, and goes over
to perly.c. perl.c is something else entirely, though that's apparently
not always been the case.
> I assumed Lijiv asked the question because the distribution that he's
> looking at also does not include perl.y.
Guess the version he had just left it out. It's not necessary once
you get the .c, so someome probably chopped it out making the kit.
Dan
------------------------------
Date: 4 Sep 2001 07:56:12 GMT
From: dkcombs@panix.com (David Combs)
Subject: Re: pl or not pl, that is the question
Message-Id: <9n21es$8dj$3@news.panix.com>
I like to keep the extensions on.
So I can run a .sh-script like this:
ls -Aslt > ls.dn
egrep '\.mod$' ls.dn > mod.dn
egrep '\.prj$' ls.dn > prj.dn
egrep '\.man$' ls.dn > man.dn
egrep '\.1$' ls.dn > 1.dn
egrep '\.ps$' ls.dn > ps.dn
egrep '\.lib$' ls.dn > lib.dn
egrep '\.loc$|\.locDKC$|\.locS$|\.locTOOLS$' ls.dn > loc.dn
egrep '\.awk$|\.nawk$' ls.dn > awk.dn
egrep '\.hlp$' ls.dn > hlp.dn
egrep '\.txt$' ls.dn > txt.dn
egrep '\.out1$' ls.dn > out1.dn
egrep '\.out$' ls.dn > out.dn
egrep '\.nam$' ls.dn > nam.dn
egrep 'kep$' ls.dn > kep.dn
egrep '\.dat$' ls.dn > dat.dn
egrep '\.doc$' ls.dn > doc.dn
egrep '\.xrf$' ls.dn > xrf.dn
egrep '\.aux$' ls.dn > aux.dn
egrep '\.dif$' ls.dn > dif.dn
egrep '\.ex$' ls.dn > ex.dn
egrep '\.sed$' ls.dn > sed.dn
egrep '\.pl$' ls.dn > pl.dn
egrep '\.pm$' ls.dn > pm.dn
egrep '\.html$' ls.dn > html.dn
egrep '\.htm$' ls.dn > htm.dn
egrep '\.source$' ls.dn > source.dn
egrep '\.el$' ls.dn > el.dn
egrep '\.sh$' ls.dn > sh.dn
egrep '\.gz$' ls.dn > gz.dn
egrep '\.Z$' ls.dn > Z.dn
Sure helps me keep track of what I have,
and how recently I've changed it.
David
------------------------------
Date: Tue, 04 Sep 2001 03:34:58 GMT
From: "Benjamin Wilson" <dausha@visto.com>
Subject: POD (HTML) and ERD . . .
Message-Id: <CZXk7.60621$hT4.15588337@news1.rdc1.md.home.com>
Okay, as some may have read, I was in search of Pod2MSWord. I know, a failed
expedition. Next time I will attempt to build a bridge between both peaks of
Mount Kilimanjaro.
And now for something (not) so completely different:
Here's what I am trying to get at with the whole Pod2MSWord bunk. I'm trying
to convert our Oracle DBA to use POD in her SQL scripts to merge her Data
Dictionary document with same. That little bit won't be too hard to do on
the face--I'm sure she'll acquiesce to PODding for the web area. However,
there remains the dastardly ERD (Entity Relationship Diagram).
What I would like to know is how to, effectively, generate an ERD based upon
a set of PODed SQL scripts? I've thought of using GD and creating an image
layer of each table then trying to get it to magically figure out the
structure--but I think this is madness.
For your reading pleasure I enclose a 'sample' of what I am going to be
proposing to our group of developers and, specifically, to our DBA.
/*====================================================
=pod
=head1 NAME
Table_Name
=head1 PRIMARY KEY
primary_key
=head1 RELATIONSHIPS
fk_field from fk_table
=cut
====================================================*/
create table Table_Name (
field_one int,
field_two varchar(20),
primary key (field_one)
);
/*===================================================
=pod
=head1 Data Dictionary
=head2 field_one int
This is the first field . . .
=head2 field_two varchar(20)
This is the second field . . .
=cut
====================================================*/
Thanks in advance,
Ben
------------------------------
Date: Tue, 04 Sep 2001 01:47:29 GMT
From: "Benjamin Wilson" <dausha@visto.com>
Subject: Re: POD2Doc?
Message-Id: <RoWk7.60571$hT4.15469207@news1.rdc1.md.home.com>
"Rob - Rock13.com" <rob_13@excite.com> wrote in message
news:Xns91119A4A4C0D3rock13com@64.8.1.226...
> Benjamin Wilson
> <news:E5Mk7.59113$hT4.14742628@news1.rdc1.md.home.com>:
>
> > However, since there is some desire with the customer (i.e., US
> > Government) to have things in a 'universal' standard (i.e., MS
> > Word--talk about ironic).
>
> Maybe you should remind them about accessibility. If its on the web
> it is more accessible as HTML than a Word DOC I would presume. :-)
Hey! I didn't say they were savvy computer users. However, I'm working on
them. :-) Thanks for your comments.
Ben
> --
> Rob - http://rock13.com/
> Web Stuff: http://rock13.com/webhelp/
------------------------------
Date: Tue, 04 Sep 2001 04:07:41 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: problem when execute query from windows to Unix
Message-Id: <3B945384.8FE306F8@rochester.rr.com>
Valentin763 wrote:
...
> I want to execute a script from windows on a Unix Machine.It works with a
> script whithout parameters but not in the following script....
>
> require "Telnet.pm";
> $telnet = new Telnet (timeout=>10,Errmode=>'die');
> $telnet->open('55.1.4.223');
> $telnet->waitfor('/Connexion :$/i');
> $telnet->print('pgexp0');
> $telnet->waitfor('/Mot de passe de pgexp0 : $/i');
> $telnet->print('pgexp0');
> $telnet->waitfor('/\> $/i'); # > -> dernier char du prompt
>
> #@lines = $telnet->cmd("/progres/appdir/cliexp"); #work
> @lines = $telnet->cmd("/progres/appdir/cliexp -d 20010828 > jmfool");#doesn't
> work
> print @lines;
...
> Valentin
Well, if I were you, I would use the one that works :-). But I suppose
you really mean that that one doesn't work either, since you really need
to pass the parameters? Saying "work" and "doesn't work" is not being
communicative enough to actually get help with your problem. What
exactly do think doesn't work? Are there error messages generated? If
so, what *exactly* do they say? What does it do that it shouldn't do?
What doesn't it do that it should do? "Doesn't work" covers a lot of
territory and leaves those who would like to help you with insufficient
information.
Just guessing, I would say that the user you are logging in as may not
have write permission in the directory at which they end up after
logging in. But that is just a guess.
--
Bob Walton
------------------------------
Date: Mon, 3 Sep 2001 20:24:09 -0500
From: "sabin" <sabin@cornhusker.net>
Subject: Re: Recommendations for a PERL editor
Message-Id: <3b942ecc_2@Usenet.com>
> UltraEdit-32 never crashed my Win98SE system. It was possibly the most
> stable application I installed.
>
> I wish I could've said the same for MS Word...
I don't know. I don't normal run windows (normaly linux) but I was with out
a computer away from home for a month and needed to do some stuff in perl.
My uncle loned me a box with win95a on it. On this system which I'm sorry
to say I am still using (but only a couple days more) UltraEdit seems to
crash about every hour but seeing the good reports here makes me wonder. A
little note: It only seems to happen when I am running internet explorer (I
normaly use the internet when coding to look up things and keep up with
lists like this). Any way take that for what its worth. It is possible it
not the program it self.
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
------------------------------
Date: 4 Sep 2001 06:55:24 GMT
From: hhaataja@melkki.cs.Helsinki.FI (Harri J Haataja)
Subject: Re: Recommendations for a PERL editor
Message-Id: <slrn9p8ulm.4fq.hhaataja@melkki.cs.Helsinki.FI>
Kurt Stephens wrote:
>"RoJo" <rojo@mindspring.com> wrote in message
>news:3b926160.358347636@news.mindspring.com...
>>
>> I'm new to PERL. I keep getting "The page cannot be displayed" when I
>> use Windows 2000's Notepad to edit my scripts. An ISP support person
>> tells me it has syntax errors that are introduced by the editor.
>>
>> Can someone recommend to me a reliable Windows-based editor that WON'T
>> create these problems for me ???
>
>Regardless of which editor you use, you will still have problems if you try
>to transfer files from a Win32 machine to a Unix host without translating
>the line terminator from [CR/LF] to [LF].
Most frequently seen and definitely the most cryptic one I've seen is
that if the #! path doesn't include any arguments and is trailed by a
CR, you'll get "file not found" IIRC. Anyway, you can guess it after
you see it and fix it once. What makes it funny is that #!/usr/bin/perl
breaks but #!/usr/bin/perl -w doesn't =)
------------------------------
Date: 4 Sep 2001 03:25:07 GMT
From: damian@qimr.edu.au (Damian James)
Subject: Re: references, slices, voodoo
Message-Id: <slrn9p8i9e.eot.damian@puma.qimr.edu.au>
Abigail chose 3 Sep 2001 23:29:16 GMT to say this:
>...
>Note that the stupid 'unless $i == $j' no longer appears in modern
>editions of the FAQ.
>
Gack! Before anyone says 'cargo cult', it's time for a quick revision (below).
Cheers,
Damian
--
@:=grep!(m!$/|#!..$|),split//,<DATA>;@;=0..$#:;while($:=@;){$;=rand
$:--,@;[$;,$:]=@;[$:,$;]while$:;push@|,shift@;if$;[0]==@|;select$,,
$,,$,,1/80;print qq x\bxx((@;+@|)*$|++),@:[@|,@;],!@;&&$/} __END__
Just another Perl Hacker, ### rev 3.3 -- stupidectomy performed :-)
------------------------------
Date: 04 Sep 2001 08:51:33 +0200
From: Walter Hafner <hafner@augusta.de>
Subject: Re: references, slices, voodoo
Message-Id: <qdfd75730ui.fsf@www.ibexnet.de>
rgarciasuarez@free.fr (Rafael Garcia-Suarez) writes:
Thanks to all!
> This lines swaps the values of the elements $i and $j in the array.
> It's equivalent to :
>
> ($array[$i],$array[$j]) = ($array[$j],$array[$i]) unless $i == $j;
Ah! Thanks! Ok, that clarifies it. Even, if the line has errors in it.
What I don't understand:
abigail writes:
> Note that the stupid 'unless $i == $j' no longer appears in modern
> editions of the FAQ.
why "stupid"?
-Walter
------------------------------
Date: Mon, 3 Sep 2001 22:26:17 -0700
From: "Student" <kennylim@techie.com>
Subject: Re: Simple Question
Message-Id: <9n1odv$1vt$1@nntp9.atl.mindspring.net>
Hi All,
I am just a beginner and would like to drop all index
that existing on a given table name. I ran into this
error after dropping the first index. ( I have 3 index in that table)
"Can't call method "fetchrow_array" without a package or object reference"
Can anyone be kind enough to provide some quick pointers?
Snippets of my code enclosed below.
Thanks All.
Kenny-
$User_Name = "kenny";
$Table_Name = "employee";
drop_all_index();
sub drop_all_index
{
$sth = $dbh->prepare ("
select index_name
from user_ind_columns
where table_name = '$Table_Name'");
$sth->execute( );
while (@All_Old_Index = $sth->fetchrow_array( ))
{
$sth = $dbh->do ("drop index $User_Name.@All_Old_Index");
print "@All_Old_Index Index is dropped!\n";
}
}
------------------------------
Date: 04 Sep 2001 08:30:59 +0100
From: nobull@mail.com
Subject: Re: Simple Question
Message-Id: <u9elpns98m.fsf@wcl-l.bham.ac.uk>
"Student" <kennylim@techie.com> writes:
> Subject: Re: Simple Question
Please use the subject line of your post to give the subject of your
post.
> "Can't call method "fetchrow_array" without a package or object reference"
> $sth = $dbh->prepare ("
> select index_name
> from user_ind_columns
> where table_name = '$Table_Name'");
Evidently this failed. To figure out why look at the error it
returned. To find out how to find the error look in the manual.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: 4 Sep 2001 03:00:21 -0700
From: oversby@hotmail.com (Ian Oversby)
Subject: Strange regex behavious
Message-Id: <21fc098d.0109040200.6dce5115@posting.google.com>
Hi,
Can anyone explain why the resultant strings after each of these calls
are different please?
$str = 'VISHASHAL';
$str =~ s/(?<=[AEIOU])SH(?:[AEIOU])/Z/g;
print "$str\n";
$str = 'VISHASHAL';
$str =~ s/(?<=[AEIOU])SH(?:[AEIOU])/Z/;
$str =~ s/(?<=[AEIOU])SH(?:[AEIOU])/Z/;
print "$str\n";
Regards,
Ian Oversby
------------------------------
Date: Tue, 04 Sep 2001 02:20:12 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: system call
Message-Id: <3B94729C.AA7CC63D@earthlink.net>
Dale Bohl wrote:
>
> I'm developing a perl program that does a rsh to a list
> of Unix clients and returns the size of /etc/passwd.
>
> How do I get the following to work with a system call
> from Perl?
>
> $command = "ls -la /etc/passwd | awk '{print $5}'";
>
> After this I do a system ("rsh $host $command");
>
> I can't figure out how to get the | awk '{print $5}'
> part working.
Unless I'm guessing wrong, the reason you want to use awk is that you're
allowing the output of the program to print to it's copy of standardout.
If you were to capture the program's stdout, then you could parse it
yourself.
use Shell qw(rsh);
my $lsout = rsh($host, qw(ls -l /etc/passwd));
my $size = (split ' ', $lsout)[4];
print $size, "\n";
If you insist on having the ls output parsed by awk, then I would
suggest either this:
use Shell q(rsh);
my $cmd = q(ls -l /etc/passwd | awk '{print $5}');
my $size = rsh($host, $cmd);
print $size, "\n";
Or this [note that I pass a list, not just a single scalar]:
my $cmd = q[ls -l /etc/passwd | awk '{print $5}'];
system "rsh", $host", $cmd;
The reason I suggest this is that it results in the awk being executed
on the remote machine, which I think is what you want. The other
suggestion I've seen:
$command = q(ls -la /etc/passwd | awk '{print $5}');
system "rsh $host $command";
Results in:
system "rsh $host ls -la /etc/passwd | awk '{print \$5}'";
Which first runs rsh, which runs ls on the remote machine, and pipes the
output of rsh to awk *on the local machine*. This is completely
pointless, since if you're going to have the unabridged output of ls
sent to the local machine, you might as well have perl split it rather
than awk.
--
"I think not," said Descartes, and promptly disappeared.
------------------------------
Date: Thu, 30 Aug 2001 16:05:40 +0200
From: "Alex Green" <alexdgreen@hotmail.com>
Subject: test
Message-Id: <9mlh7m$2t0jn$1@ID-106172.news.dfncis.de>
test
------------------------------
Date: 4 Sep 2001 08:23:12 GMT
From: dkcombs@panix.com (David Combs)
Subject: Re: This has got to be a bug
Message-Id: <9n231g$9ev$1@news.panix.com>
In article <9m8poo$hj4$1@news.doit.wisc.edu>,
art blair <arthur@ablair.physics.wisc.edu> wrote:
>Thanx to all. \Q \E worked.
>I need to get a better perl book.
>
>Art.
The "Bible" of perl is "Programming Perl", 3rd edition,
pub= O'Reilly.
Written by Larry Wall plus one or two others.
(BTW: Larry's the guy who invented Perl, and
is still in charge of its development. You
won't find anyone anywhere who better
qualifies as an author of a perl book (actually
a reference manual -- but one *can* learn
perl *from* this book -- though it isn't easy
going, since every sentence says something new
and that you have to memorize. But you cannot
live *without* this book.
You can get it at maybe 40% off from www.bookpool.com --
they give really good deals on O'Reilly books.
David
PS: there are several others you should have,
one of which is another work of absolute
genius, Object Oriented Perl, by Damian Conway,
pub=Manning, isbn 1-884777-79-1,
(Most of the top people in the perl world
know the author, and of course have the book.)
David
------------------------------
Date: 3 Sep 2001 19:20:17 -0700
From: atheimer98@yahoo.com (andy theimer)
Subject: Using a link/submit to execute a subroutine
Message-Id: <caa8eeb3.0109031820.453c8848@posting.google.com>
I was wondering if anyone could fill me in on how to
execute a subroutine with a link, or a submit button.
Thanks
Andy
------------------------------
Date: 04 Sep 2001 08:16:54 +0100
From: nobull@mail.com
Subject: Re: Using a link/submit to execute a subroutine
Message-Id: <u9ofors9w8.fsf@wcl-l.bham.ac.uk>
atheimer98@yahoo.com (andy theimer) writes:
> I was wondering if anyone could fill me in on how to
> execute a subroutine with a link, or a submit button.
I'm going to guess you're talking abour CGI scripting in a web
environment.
You can't.
This has nothing to do with Perl.
Your CGI script must look at the parameters it is passed and decide
what to do. For example:
if (param('submit_button_name') eq 'Submit Button Value') {
some_subroutine;
}
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Tue, 04 Sep 2001 05:45:40 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Why do tabs eliminate the rest of the line?
Message-Id: <3B94A2C4.7B3B1E7D@earthlink.net>
Sara wrote:
>
> John J. Trammell wrote:
[snip]
> > I am unable to duplicate your error. Why don't you just use \t
> > to indicate a tab anyhow?
>
> \t is an option, as was just using spaces which is what i did for now.
> Trouble with \t is it's difficult to line up with other non-tabbed
> items since its not WYSIWYG.
If you want something that is WYSIWYG, consider using either perl's
builtin WYSIWYG picture printer -- format and write, or if you don't
like them, the form() sub from the Text::Autoformat module, which is
similar, but isn't a builtin, and whose documentation might be easier to
read and understand.
use Text::Autoformat qw(form);
form { numeric => 'AllPlaces' }; # set the default behavior
print form( <<'PICTURE', $jobnum, $today, $jobid, $l{LA}, $price );
*
* JOB#<<<<<<< <<<<<<<<<<<<
* <<<<<<<<<<< ITEM: <<<<<< PRICE: $>>>.<< USD
PICTURE
The '' around PICTURE prevent interpolation from occuring within the
here-document. This is needed since you don't want to have to put a
backslash character in front of the $ for dollars.
Setting numeric=>AllPlaces as part of the default behavior means that
the .<< part of printing the money will print ".10" when it otherwise
would have printed ".1 ".
--
"I think not," said Descartes, and promptly disappeared.
------------------------------
Date: Tue, 4 Sep 2001 14:40:04 +0800
From: "keng" <keng@kengdom.per.sg>
Subject: win32 rmdir questions
Message-Id: <9n1t1t$rtc$1@clematis.singnet.com.sg>
dear all
how can i remove a directory that is not empty (can have other sub-dir or
files in it) ?
pls help
thanks
btw i checked activestate documentation on rmdir and it reviewed
*****
rmdir FILENAME
rmdir
Deletes the directory specified by FILENAME if that directory is empty. If
it succeeds it returns true, otherwise it returns false and sets $! (errno).
If FILENAME is omitted, uses $_.
*****
>>so how to delete non-empty dir?
--
regards
isaac
------------------------------
Date: Tue, 04 Sep 2001 03:15:24 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: win32 rmdir questions
Message-Id: <3B947F8C.54B6141B@earthlink.net>
keng wrote:
>
> dear all
>
> how can i remove a directory that is not empty (can have other sub-dir
> or files in it) ?
Simple. First remove all the things in it, then remove the directory
itself. Be warned: this is an extremely dangerous operation, not to be
done lightly.
sub rmdir_recursive {
use File::Find;
finddepth { -d ? rmdir : unlink or die $! } @_;
}
--
"I think not," said Descartes, and promptly disappeared.
------------------------------
Date: Tue, 4 Sep 2001 17:16:57 +1000
From: "Knob" <andrew.savige@ir.com>
Subject: Re: win32 rmdir questions
Message-Id: <Kd%k7.8$hm2.1856@news0.optus.net.au>
"keng" <keng@kengdom.per.sg> wrote in message
news:9n1t1t$rtc$1@clematis.singnet.com.sg...
> dear all
>
> how can i remove a directory that is not empty (can have other sub-dir or
> files in it) ?
> pls help
> thanks
>
> btw i checked activestate documentation on rmdir and it reviewed
> *****
> rmdir FILENAME
> rmdir
> Deletes the directory specified by FILENAME if that directory is empty. If
> it succeeds it returns true, otherwise it returns false and sets $!
(errno).
> If FILENAME is omitted, uses $_.
> *****
> >>so how to delete non-empty dir?
>
> --
> regards
> isaac
You could use the File::Path::rmtree() function.
------------------------------
Date: 04 Sep 2001 08:27:21 +0100
From: nobull@mail.com
Subject: Re: win32 rmdir questions
Message-Id: <u9itezs9eu.fsf@wcl-l.bham.ac.uk>
"keng" <keng@kengdom.per.sg> writes:
> how can i remove a directory that is not empty (can have other sub-dir or
> files in it) ?
You do it the same in Perl on Win32 as you would in any language on
any OS that can't delete non-empty directries. Do a depth first
recursive delete of the directory contents.
use File::Find;
finddepth sub { (-d) ? rmdir : unlink or die $! }, $directory;
Alternative use system() to call the OS shell's recursive delete
command.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Tue, 04 Sep 2001 09:36:17 +0200
From: Philippe PERRIN <philippe.perrin@sxb.bsf.alcatel.fr>
Subject: Re: win32 rmdir questions
Message-Id: <3B948471.A4A678D5@sxb.bsf.alcatel.fr>
keng wrote:
> how can i remove a directory that is not empty (can have other sub-dir or
> files in it) ?
not really a Perl solution, but a win32-based solution :
system("rd /s /q $yourDir");
--
PhP
($r1,$r2,$r3,$r4)=("19|20","0|1","28|29","5|24");($r5,$r6)=("9|10|15|16|$r1|$r2","9|10|$r3");%h=("1|",$r6,"1=","[1-5]|2[0-4]","1/","0|19","1\\","6|25","2|","0|6|19|25|$r6","2/","1|20","2\\",$r4,"3|","$r2|6|$r1|25|$r6","3/",$r4,"4|","$r2|$r1|$r6","4=","2|3|4|11|12|13|14|21|22|23","4/",$r4,"4\\",15,"5|","$r2|9|15|$r1|20|$r3","5/",10,"6|",$r5,"7|",$r5,"7/",$r3);for($l=1;$l<8;$l++){b:for($i=0;$i<30;$i++){c:foreach(keys
%h){next c if(!(/^$l(.*)$/));$a=$1;if($i=~/^($h{$_})$/){print $a;next
b;}}print " ";}print "\n";}
------------------------------
Date: Tue, 04 Sep 2001 09:06:13 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: win32 rmdir questions
Message-Id: <3B9499F0.11A9F643@acm.org>
Benjamin Goldberg wrote:
>
> keng wrote:
> >
> > dear all
> >
> > how can i remove a directory that is not empty (can have other sub-dir
> > or files in it) ?
>
> Simple. First remove all the things in it, then remove the directory
> itself. Be warned: this is an extremely dangerous operation, not to be
> done lightly.
>
> sub rmdir_recursive {
> use File::Find;
> finddepth { -d ? rmdir : unlink or die $! } @_;
finddepth sub { -d ? rmdir : unlink or die $! }, @_;
> }
John
--
use Perl;
program
fulfillment
------------------------------
Date: Tue, 04 Sep 2001 09:09:45 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: win32 rmdir questions
Message-Id: <3B949AD0.DF32C177@acm.org>
Philippe PERRIN wrote:
>
> keng wrote:
> > how can i remove a directory that is not empty (can have other sub-dir or
> > files in it) ?
>
> not really a Perl solution, but a win32-based solution :
> system("rd /s /q $yourDir");
system "deltree /y $yourDir";
John
--
use Perl;
program
fulfillment
------------------------------
Date: Mon, 03 Sep 2001 20:57:27 -0600
From: Michael Roinestad <nospam@nospam.nospam>
Subject: Win32-Perms and the registry
Message-Id: <3B944317.283BFF33@nospam.nospam>
I have been trying to use the Win32::Perms module for creating access
permissions in a NT Registry. I am currently using PERL v5.6.0 on a
WINNT 4.0 sp 6a machine. I have had excellent results
when applying to a directory, file or share but can't seem to make the
registry respond.
== Sample code ========================================
#!/perl -v
use Win32;
use Win32::Perms;
Win32::Perms::LookupDC(0);
sub SecureKey {
my ($Key,$Recurse) = @_;
$Recurse |= 0;
my $Perms = new Win32::Perms();
print "Setting permissions for: $Key\n";
($Perms) || die "Could not obtain permissions for: $Key\n";
my %Permissions = (
'Administrators' => FULL,
'Users' => READ
);
$Perms->Remove(-1);
$Perms->Owner('Administrators');
foreach $User (keys %Permissions) {
$Perms->Allow($User, $Permissions{$User}, CONTAINER);
}
my $Result = $Perms->Set($Key, $Recurse);
return($Result);
}
my $Key = "HKEY_LOCAL_MACHINE\\SOFTWARE\\ORL";
die "Could not set permissions for $Key\n" unless(&SecureKey($Key));
exit;
Thanks in advance,
Michael Roinestad
------------------------------
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 1688
***************************************