[13430] in Perl-Users-Digest
Perl-Users Digest, Issue: 840 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Sep 18 08:07:22 1999
Date: Sat, 18 Sep 1999 05:05:11 -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: <937656311-v9-i840@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sat, 18 Sep 1999 Volume: 9 Number: 840
Today's topics:
Re: $ENV{'REMOTE_USER'}; under Win32 <flavell@mail.cern.ch>
Re: An Array of Collumns <tlb@algonet.se>
Re: An Array of Collumns <tlb@algonet.se>
Re: backref problem (Eric Bohlman)
Re: Carrige Returns UNWANTED>. HELP ME (Bart Lateur)
Compiling Perl on AIX <chris@westnet.com>
Re: CONTEST: Range Searching <uri@sysarch.com>
Re: Error in "Learning Perl, 2nd Edition" or Error in P (Bart Lateur)
Re: Error in "Learning Perl, 2nd Edition" or Error in P <uri@sysarch.com>
Re: HELP ! BOOTSTRAP PROBLEM ! *** <gellyfish@gellyfish.com>
Re: Help me PLEASE <gellyfish@gellyfish.com>
Re: how to create temporary cookie and destroy it <gellyfish@gellyfish.com>
Re: List files in a dir <gellyfish@gellyfish.com>
Re: List files in a dir (Abigail)
Re: List files in a dir <gellyfish@gellyfish.com>
Re: List files in a dir <gellyfish@gellyfish.com>
Re: making 'find' follow soft links <gellyfish@gellyfish.com>
Perl Challenge makau@multimania.com
Perl Module for MS Access? jdkronicz@my-deja.com
Re: Perl Module for MS Access? (Eric Bohlman)
Re: perl prog for big/little indian conversion (Bart Lateur)
Re: perl return value to a perl script <tlb@algonet.se>
Re: Problem with XS and MakeMaker (Win98) <tlb@algonet.se>
ratings script? whatyoulookin@hotmail.com
site search script <jcarlson@leland.Stanford.EDU>
Re: Sorting on a string, by value. <uri@sysarch.com>
Re: Telnet scripting in Perl? <gellyfish@gellyfish.com>
transform / in \/ <mattiac@alinet.it>
Re: transform / in \/ <tlb@algonet.se>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 18 Sep 1999 12:14:14 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: $ENV{'REMOTE_USER'}; under Win32
Message-Id: <Pine.HPP.3.95a.990918120503.12783A-100000@hpplus03.cern.ch>
On Sat, 18 Sep 1999, Kragen Sitaker wrote:
> >I know that it may not be possible but is there any way of identifying the
> >user from their login (either from a network or from the profile they are
> >logged in under).
>
> REMOTE_USER doesn't do this under Unix, let alone under Win32.
Right. It does exactly what it's documented to do, and it does it very
well. It has nothing to do with a "login" in the normally accepted
sense of the term.
> You can try using ident.
To someone who may be unfamiliar with the usenet meaning of "try", that
answer seems a bit unfair. An ident request, if it returns anything at
all (which in my experience it usually won't, in a WWW context as I
assume is the reference frame here) returns a token, that sometimes
might be a login identifier and sometimes something else (some of the
machines that I manage return an encrypted string). In the cases where
the answer happens to look like a login identifier, there is absolutely
no way to determine whether it's accurate or not.
And so, as usual when anyone says "you can try" on usenet, it may mean
something like "feel free to waste your time messing around with it, but
it won't really work".
p.s to the original questioner: CGI FAQ.
all the best
------------------------------
Date: Sat, 18 Sep 1999 13:12:36 +0200
From: Andreas Hagelberg <tlb@algonet.se>
Subject: Re: An Array of Collumns
Message-Id: <37E373A4.67B24BAE@algonet.se>
Chuck Burgess wrote:
>
> I am having difficulty figuring out how to pass collumnar data from a file
> to an array.
>
> Example:
> FILE STREAM:
> 12345
> 12345
> 12345
> 12345
>
> All of collumn 1 is considered the same answer, all of collumn 2... etc.
> I use the following to read the data and set up the @testans array by
> collumn.
> open (dfile, "data.dat");
> for ($rows = 0; $rows <= 3; $rows++)
> for ($cols = 0; $cols <=4; $cols++)
>
> read(dfile, $string, 1, 0);
> $testans{$cols} .= $string;
> if ($rows != '3') {
> $testans{$cols} .= ',';
> }
> }
> }
> I'm concantenating the next item in the collumn to the previous but I know
> I'm not doing it right. I don't think this is actually creating an array. I
> need the outcome to be the following:
> @testans[1] = (1,1,1,1)
> @testans[2] = (2,2,2,2)
> etc.
>
> Any suggestions other than switching to a DB?
Well, first of all to add an element to an array you don't use
concatenation but the function push (or unshift) (concatenation can only
be done on strings). In this case however it might be easier to use
double subscripts (or whatever you call them) e.g. testans[$cols][$row].
Second 'testans' you're using isn't an array, but a hash-table. This is
what you should do: change "$testans{$cols} .= $string;" with
"$testans[$cols][$rows] = $string;" and then remove the if-statement at
the end.
The code you're using isn't very effective though if I may say so. This
is how I would have done it:
open (dfile, "data.dat");
while (<dbfile>) {
@row = split //;
push @testans, \@row;
}
This will work in the same way with only one difference; rows are the
first dimension and the cols the second; i.e. @testans[0] = (1, 2, 3, 4,
5). This is how it works:
o The while-statement is a special construction that will get one line
from the filehandle <dbfile> and put it into the standard-variable $_
and loop until the end of the file is encountered.
o The next line splits the standard-variable into seperate characters
and stores them in the array @row.
o A reference to @row is then appended to the end of the array @testans
(@testans must be empty when you're doing this since any old data
residing in it will be kept, to clear an array you can do this:
"@testans = ();"). This is possible since a multi-dimensional list is
simply built from an array containing references to other arrays. To
understand this better I recommend you to learn about references since
this is an important aspect of advanced Perl-programming.
If you _must_ have the subscripts in the other way around (cols first,
then rows), like you had in your code this what you can do:
open (dfile, "data.dat");
while (<dbfile>) {
@row = split //;
for $col (0..$#row) {
push @{$testans[$col]}, $row[$col];
}
}
This works by simply pushing each seperate character into a different
subarray of @testans. The problem here is that push requires an array
and not a reference to one so we need to dereference it in order to use
it. This is done with "@{$arrayref}". Other than that this example
shouldn't present any major difficulties.
The problem here (that you have in the other script and you own as well)
is that if you want to get a slice of an array (i.e. @testans[1]) you
will have to dereference it first. E.g. "print @testans[1];" will not
output the elements in the subarray (slice), but instead something like
"ARRAY(0xba5858)". To get the slice you have to use this instead "print
@{$testans[1]};" - this will give the desired output.
Have fun!
/Andreas
--
______________________________________________________________________
ANDREAS HAGELBERG - Student at "Högskolan i Karlskrona/Ronneby
- IT-consultant at Ericsson Software Technology AB
- Webmaster at AllGlobal (http://allglobal.com)
+ E-mail: tlb@algonet.se or di97aha@student.hk-r.se
+ Web: http://www.algonet.se/~tlb - Visual Systems Check
+ Address: Stenbocksvägen 6, SE-372 37 Ronneby, SWEDEN
+ ICQ UIN: 128240
+ Tel: +46-(0)457-19141 ________________________________________
------------------------------
Date: Sat, 18 Sep 1999 13:25:36 +0200
From: Andreas Hagelberg <tlb@algonet.se>
Subject: Re: An Array of Collumns
Message-Id: <37E376B0.706FFC22@algonet.se>
Andreas Hagelberg wrote:
>
> open (dfile, "data.dat");
> while (<dbfile>) {
> @row = split //;
> for $col (0..$#row) {
> push @{$testans[$col]}, $row[$col];
> }
> }
>
A few things I forgot to mention in my previous message:
the for-statement may look a bit odd, but it is euivalent with
"for ($col = 0; $col <= $#row; $col++) {", it's just more compact and
quicker to write.
The construct "$#row" simply returns the index of the last item in the
array @row. You could have used "@row - 1" instead or "scalar @row -1"
to be on the safe side, but I've had some problems with this in some
scripts so I prefer to use $#array instead.
Good luck.
/Andreas
--
______________________________________________________________________
ANDREAS HAGELBERG - Student at "Högskolan i Karlskrona/Ronneby
- IT-consultant at Ericsson Software Technology AB
- Webmaster at AllGlobal (http://allglobal.com)
+ E-mail: tlb@algonet.se or di97aha@student.hk-r.se
+ Web: http://www.algonet.se/~tlb - Visual Systems Check
+ Address: Stenbocksvägen 6, SE-372 37 Ronneby, SWEDEN
+ ICQ UIN: 128240
+ Tel: +46-(0)457-19141 ________________________________________
------------------------------
Date: 18 Sep 1999 09:48:32 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: backref problem
Message-Id: <7rvn5g$5bf@dfw-ixnews9.ix.netcom.com>
Eric Niebler (ericne@microsoft.com) wrote:
: $foo = 'foobar';
: if( $foo =~ m/((foo)|bar)+/ ) {
: print "0=$&\n";
: print "1=$1\n";
: print "2=$2\n";
: }
:
: It prints out:
: 0=foobar
: 1=bar
: 2=foo
:
: Why is $2 "foo"? Shouldn't it be empty? The last time ((foo)|bar) matches,
: it matches "bar", so the (foo) group didn't match anything. Doesn't that
: mean $2 should be empty?
Nope. Regex memory variables are *not* altered by unsuccessful matches.
------------------------------
Date: Sat, 18 Sep 1999 10:32:43 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Carrige Returns UNWANTED>. HELP ME
Message-Id: <37ea66e1.9609732@news.skynet.be>
jan smit wrote:
>im trying to write a script that can download rawdata from the internet ..
>but at the end of each string i have a carrige return (0x0d,0x0a)
>and i can use chomp to remove it .. but all i hafta remove = the 0x0d ..
>well i removed them both with chomp and tried to add just the char 0x0a ..
>but everytime i look at the file (with a hex editor) where i have put the
>0x0a i always get an 0x0d also .. and i dont want them.. who can help me???
binmode() is your friend. I bet your on a Wintel machine. When reading
from text files, "\015\012" is converted to "\012", and vice versa on
printing it. binmode() prevents this conversion.
Oh, and try this too:
tr/\015//d;
--
Bart.
------------------------------
Date: 14 Sep 1999 02:35:54 GMT
From: "Christopher X. Candreva" <chris@westnet.com>
Subject: Compiling Perl on AIX
Message-Id: <7rkcaa$3td$1@apocalypse.dmi.stevens-tech.edu>
I'm having trouble compiling Perl 5.005_03 Unix AIX 4.3.0 on an RS/6000 . I
am using the stock AIX compiler, linker, etc.
It appears to compile. However, make test fails 24 tests -- all Dynaloader
problems. ie:
lib/anydbm.........Can't load '../lib/auto/Fcntl/Fcntl.so' for module Fcntl:
readExports: bad magic at ../lib/DynaLoader.pm line 169.
Any hints on solving this would be greatly appreciated !
-Chris
--
==========================================================
Chris Candreva -- chris@westnet.com -- (914) 967-7816
WestNet Internet Services of Westchester
http://www.westnet.com/
------------------------------
Date: 17 Sep 1999 13:11:01 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: CONTEST: Range Searching
Message-Id: <x71zbxihui.fsf@home.sysarch.com>
>>>>> "DB" == Don Blaheta <dpb@cs.brown.edu> writes:
DB> True enough, but easy to fix; after the while loop put a continue block
DB> that resets the context counters. For those keeping track, that makes
DB> my patba code now
DB> while (<>) {
DB> shift @forelines if @forelines > $fore;
DB> push @forelines, $_ unless $aftleft;
DB> print and $aftleft-- if $aftleft;
DB> print splice @forelines, 0 and $aftleft = $aft if /$pat/o;
DB> } continue {
DB> @forelines = (), $aftleft = 0 if eof;
DB> }
what is the purpose of the continue block? you never do anything to
execute it like using next. you could just put that code in the loop
body.
then you could wrap the entire block in a -n loop and save the while
statement. of course, then your init stuff has to be in a BEGIN block.
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
uri@sysarch.com --------------------------- Perl, Internet, UNIX Consulting
Have Perl, Will Travel ----------------------------- http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
"F**king Windows 98", said the general in South Park before shooting Bill.
------------------------------
Date: Sat, 18 Sep 1999 10:32:44 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Error in "Learning Perl, 2nd Edition" or Error in Perl port specific to Windows or ?
Message-Id: <37eb677f.9767477@news.skynet.be>
Uri Guttman wrote:
>i would assume the user of such a sophisticated trick would know to not
>use the same char in the keys as is used to separate them from the rest
>of the printed string. a simple fix for your example would be to
>surround the key in the string with some quotes or other chars not in
>the key.
No. The problem is that you assume that space, the first caharacter in
what you add, sorts before any character that may be in the string.
%c = ('Bill' => 1, 'Billy' => 2);
push @l, "|$w| was seen $c times!\n" while ($w, $c) = each %c;
print sort @l;
-->
|Billy| was seen 2 times!
|Bill| was seen 1 times!
I'd say you method is a bug waiting to happen. It's just not worth it.
You might just as well say it's OK to use { "19$year" } to print dates,
because "all dates are in this century".
--
Bart.
------------------------------
Date: 18 Sep 1999 07:15:51 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Error in "Learning Perl, 2nd Edition" or Error in Perl port specific to Windows or ?
Message-Id: <x7r9jwa2s8.fsf@home.sysarch.com>
>>>>> "BL" == Bart Lateur <bart.lateur@skynet.be> writes:
BL> Uri Guttman wrote:
>> i would assume the user of such a sophisticated trick would know to not
>> use the same char in the keys as is used to separate them from the rest
>> of the printed string. a simple fix for your example would be to
>> surround the key in the string with some quotes or other chars not in
>> the key.
BL> No. The problem is that you assume that space, the first caharacter in
BL> what you add, sorts before any character that may be in the string.
in a known context (which this is) that is fine. i am not saying it is
good in all cases. and you are losing track of my original point of
using each before the sort. you can handle the boundary conditions any
way you wish if you know the data range. i am not making global
assumptions here. e.g. a local context is the ENV case where the keys
cannot contain = (a known restriction) so you can assume things will
sort fine.
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
uri@sysarch.com --------------------------- Perl, Internet, UNIX Consulting
Have Perl, Will Travel ----------------------------- http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
"F**king Windows 98", said the general in South Park before shooting Bill.
------------------------------
Date: 18 Sep 1999 10:55:58 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: HELP ! BOOTSTRAP PROBLEM ! ***
Message-Id: <7rvr3u$1eg$1@gellyfish.btinternet.com>
On Fri, 17 Sep 1999 23:49:32 -0300 Alexandre wrote:
> Please Programmers,
>
> I installed the DBD-ODBC in my system, and when a run a simple programm
> appear the message:
>
> " Install_driver(ODBC) failed: DBD::ODBC object version 0.21 does not match
> bootstrap parameter
> 0 at C:\Perl\5.005\lib/MSWin32-x86-object/DynaLoader.pm line 187."
>
> What should i make ?
> The package was installed by VMP in the Internet.
>
This message usually occurs when the .pm file of an XS module is of a
different version to the actual XS binary - I would uninstall DBD::ODBC
(I think you can do that with PPM) and reinstall the module. It is just
possible (although admittedly unlikely) that someone at Activestate made
a mistake when making the Package so it would be worth downloading the
package again.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 18 Sep 1999 10:52:00 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Help me PLEASE
Message-Id: <7rvqsg$1ed$1@gellyfish.btinternet.com>
On Fri, 17 Sep 1999 21:45:09 -0500 Frank Losasso wrote:
> i have done searches of my perl directory (i'm running activePerl on a
> win98 system) for make.*, but there is none... in previous posts about
> not finding make you have all said that the path must be set to it...
> but my path was set by the installation program, and everything else
> works EXCEPT for make
>
Why do you need make if you are using ActivePerl - if you need to install
a module then you can use PPM (Perl Package Manager) to install the modules
from Activestates module repository. You can read about PPM in the
documentation that comes with Activeperl.
'make' does nto come with Windows (a long long time ago I recall that some
version of MSDOS did and a linker and a debugger) you can get 'nmake' from
the Microsoft FTP site or you can get a Win32 port of GNU make if you really
must.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 18 Sep 1999 11:00:26 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: how to create temporary cookie and destroy it
Message-Id: <7rvrca$1em$1@gellyfish.btinternet.com>
On Fri, 17 Sep 1999 23:29:31 -0400 ken wrote:
> Hi:
> Can someone show me how to create a temporary cookie in perl so I can
> passing the value from page to page in my website, and how to delete the
> cookie from the user browser when they leaving my website. Thanks.
>
Perl doesnt have 'temporary cookies' - despite the fact that using Perl
to output the cookie text this question would have the same answer (except
for the uninteresting implementation details) whatever language you wrote
this in.
I would first look in the CGI FAQ:
<http://www.webthing.com/tutorials/cgi-faq.html>
and if that doesnt contain the answer then ask in :
comp.infosystems.www.authoring.cgi
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 17 Sep 1999 23:52:35 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: List files in a dir
Message-Id: <7ruk84$13r$1@gellyfish.btinternet.com>
On Fri, 17 Sep 1999 18:39:50 +0000 Pierre-Luc Soucy wrote:
> Hi,
>
> Anybody could tell me how to list the files in a dir and print the
> result in an HTML format with PERL?
>
There was at least one thread this week with several peices of code
posted that did just this ...
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 18 Sep 1999 05:18:13 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: List files in a dir
Message-Id: <slrn7u6ps2.1s4.abigail@alexandra.delanet.com>
lt lindley (ltl@rgsun40.viasystems.com) wrote on MMCCIX September
MCMXCIII in <URL:news:7rv4tt$9o5$1@rguxd.viasystems.com>:
() Abigail <abigail@delanet.com> wrote:
()
() :>#!/opt/perl/bin/perl -w
()
() :>use strict;
()
() :>print <<HTML;
() :><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
() :> "http://www.w3.org/TR/REC-html40/strict.dtd">
() :><title>Files</title>
() :><pre>@{[`ls`]}</pre>
() :>HTML
()
() :>__END__
()
() Let's see. In order to understand this (and ignoring the HTML so we
() are just talking about @{[`ls`]} in quoted context) the poor guy (or
() gal) has to know
So, what's the problem? S/he obviously had a gimme-gimme-gimme question
anyway, otherwise the question would have been narrowed down.
() 1)
() 2)
() 3)
You forgot that s/he needed to know "print", "here documents", and the
meaning of "__END__".
() I quit there. It wasn't hard to figure out exacly what it did, but
() the reasons for requiring all of it were non-obvious.
And all of them are in the manual.
() Surely you
() would not label that an "idiomatic" Perl usage. (Not that you
() claimed it was, but your usage was rather cavalier.)
Interpolation of lists in a here document? I do that all the time.
In fact, there was another posting of me, shortly before or after
the posting you replied to where I do that as well.
() If this is truly a common idiom, please point me to additional
() reading material.
Is there a requirement that everything has to be "common idiom"?
Besides, my posting was. The common idiom to list files in a directory
is "ls". I used "ls".
Abigail
--
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 18 Sep 1999 11:10:59 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: List files in a dir
Message-Id: <7rvs03$1er$1@gellyfish.btinternet.com>
On 18 Sep 1999 04:37:17 GMT lt lindley wrote:
>
<snip discussion of @{[`ls`]} expansion of expression in quoted>
> If this is truly a common idiom, please point me to additional
> reading material.
>
It *has* been very popular here in the past - I was going to suggest
searching DejaNews for it but would be a little tricky to do ...
Definitively perlfaq4:
How do I expand function calls in a string?
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 18 Sep 1999 11:19:31 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: List files in a dir
Message-Id: <7rvsg3$1ha$1@gellyfish.btinternet.com>
On Fri, 17 Sep 1999 18:39:50 +0000 Pierre-Luc Soucy wrote:
> Hi,
>
> Anybody could tell me how to list the files in a dir and print the
> result in an HTML format with PERL?
>
Just to complete the overload of alternatives:
use CGI qw(:standard);
print header,start_html, ul( li [`ls`] ),end_html;
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 18 Sep 1999 11:23:38 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: making 'find' follow soft links
Message-Id: <7rvsnq$1hl$1@gellyfish.btinternet.com>
On 17 Sep 1999 22:02:22 GMT Peter Bismuti wrote:
> Kragen Sitaker (kragen@dnaco.net) wrote:
> : In article <7rtrit$fue$1@news.fsu.edu>,
> : Peter Bismuti <bismuti@cs.fsu.edu> wrote:
> : >Hi, is it possible to make 'find' follow soft links??
> : >The danger of an infinite loop is clear, but working
> : >around this limitation does not seem easy.
> :
> : This is off-topic for a Perl newsgroup. The answers are: -follow, use
> : GNU or SCO find.
>
> I'm referring to the Perl File::Find::find function, not the unix command
> with the same name.
>
There is a possibility that Kragen knew that - because he had read the
File::Find manpage:
BUGS
There is no way to make find or finddepth follow symlinks.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Sat, 18 Sep 1999 11:38:40 GMT
From: makau@multimania.com
Subject: Perl Challenge
Message-Id: <7rvtk0$tdn$1@nnrp1.deja.com>
I challenge you to tell me what this piece of cde does :-)
$text=~s/('|")/${{"'"=>"\\'",'"'=>'\\"'}}{$1}/eg;
I doubt you'll find out easily :)
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Sat, 18 Sep 1999 10:41:37 GMT
From: jdkronicz@my-deja.com
Subject: Perl Module for MS Access?
Message-Id: <7rvq90$rec$1@nnrp1.deja.com>
Hi. I am relatively new to Perl and I am looking to use
it to develope a website with an Access Database. I know
there are Perl modules for databases like Sybase (Syperl)
and Oracle (Oraperl) but I can't find one on CPAN for
Access. Is there one? Should I use one of the more
generic database modules? How can I get more information
and / or code examples of how to create an interface to the
database using Perl?
Any help is greatly appreciated.
JD
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 18 Sep 1999 11:19:42 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Perl Module for MS Access?
Message-Id: <7rvsge$5bf@dfw-ixnews9.ix.netcom.com>
jdkronicz@my-deja.com wrote:
: Hi. I am relatively new to Perl and I am looking to use
: it to develope a website with an Access Database. I know
: there are Perl modules for databases like Sybase (Syperl)
: and Oracle (Oraperl) but I can't find one on CPAN for
: Access. Is there one? Should I use one of the more
: generic database modules? How can I get more information
: and / or code examples of how to create an interface to the
: database using Perl?
Most people connect to Access databases with ODBC, which can be done
either with Win32::ODBC or the combination of DBI and DBD::ODBC. This
assumes that the Perl code is running on a Win32 machine with Access
installed.
Many people are of the opinion that Access is not a suitable database for
a Web application involving concurrent updates.
------------------------------
Date: Sat, 18 Sep 1999 10:32:38 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: perl prog for big/little indian conversion
Message-Id: <37e35fe0.7817090@news.skynet.be>
<nwsread@cloudband.com> wrote:
> Hi i am looking for a perl program to convert some
>big indian ultra sparc gdbm files, to little indian 32bit
>gdbm files. Does someone have something in perl that does
>byte conversion?
Actually, the bytes are the same. :-) iµt's the ORDERING of the bytes
that is different.
This will change the byte ordering for any string:
$big = "\001\002\003\004";
$little = reverse $big; # or vice versa
Also, pack/unpack with 'N','n','V' and 'V' will allow you to read/write
long (32-bit) and short(16-bit) integers. That may helpo, too.
I don't know a thing about gdbm files, and I think that's for the
better. Wht you are trying is not "the proper way". I think you should
export the database file to, for example, CSV, and import that file in a
new database on the other platform. After all, who's to say that the
byte ordering is the only difference between the "gdbm" files on both
platforms?
--
Bart.
------------------------------
Date: Sat, 18 Sep 1999 13:41:57 +0200
From: Andreas Hagelberg <tlb@algonet.se>
Subject: Re: perl return value to a perl script
Message-Id: <37E37A85.73BC71FC@algonet.se>
b chung wrote:
>
> I trying to call another perl script and return some data.
>
> #perl1.pl
> $out = system("perl perl2.pl");
> print $out;
>
> #perl2.pl
> $xx ="test2";
> return $xx;
> #exit($xx);
>
> This doesn't work
Well, system only returns the exit status of the executed program which
is an integer containing exit-code and other stuff. To return strings
you will need to use pipes. Try this:
#perl1.pl
open (PERL12, "perl perl2.pl|");
$out = <PERL2>;
print $out;
#perl2.pl
$xx = "test2\n";
print $xx;
This should do the trick. You probably need to end each output from the
perl2.pl-program with a linefeed, since to perl1.pl this looks just like
any other input-stream and it will read until it finds a linefeed (or
whatever you change $/ to). If your perl2.pl program happens to output
any error-messages during execution theese will be piped to perl1.pl as
well so you better make sure that perl2.pl is free from bugs =) Of
course you could set up a special format for the passed data and then
instruct perl1.pl to read until it finds correctly formatted data...
Good luck
/Andreas
--
______________________________________________________________________
ANDREAS HAGELBERG - Student at "Högskolan i Karlskrona/Ronneby
- IT-consultant at Ericsson Software Technology AB
- Webmaster at AllGlobal (http://allglobal.com)
+ E-mail: tlb@algonet.se or di97aha@student.hk-r.se
+ Web: http://www.algonet.se/~tlb - Visual Systems Check
+ Address: Stenbocksvägen 6, SE-372 37 Ronneby, SWEDEN
+ ICQ UIN: 128240
+ Tel: +46-(0)457-19141 ________________________________________
------------------------------
Date: Sat, 18 Sep 1999 12:17:10 +0200
From: Andreas Hagelberg <tlb@algonet.se>
Subject: Re: Problem with XS and MakeMaker (Win98)
Message-Id: <37E366A5.F34F8D98@algonet.se>
Randy Kobes wrote:
>
> For ActiveState, if you're using a different make than Microsoft's
> 'nmake' and a different compiler that VC++, you probably have to
> change the corresponding lines in perl's Config.pm file - they are
> of the form 'make=...', etc. You should also check that the paths
> to the library and include directories for your C compiler are
> correct.
Stupid me, of course Perl need to know where to find everything...
Anyway, I've configured Perl to use MS Visual C++ (I've got both Borland
and MSVC installed, but I primarily use Borland, but since Perl is
intended to use MSVC I thought it best to use that one). But still
there's problems. Now I get the following message:
--
C:\temp\Mytest>nmake
Microsoft (R) Program Maintenance Utility Version 1.62.7022
Copyright (C) Microsoft Corp 1988-1997. All rights reserved.
mkdir blib
mkdir blib\lib
mkdir blib\arch
mkdir blib\arch\auto
mkdir blib\arch\auto\Mytest
mkdir blib\lib\auto
mkdir blib\lib\auto\Mytest
mkdir blib\man3
c:\program\vc5\bin\cl.exe -c -Od -MD -DNDEBUG -TP -GX -DWIN32
-D_CONSOL
E -DNO_STRICT -DHAVE_DES_FCRYPT -DPERL_OBJECT -Od -MD -DNDEBUG -TP
-GX -DVER
SION=\"0.01\" -DXS_VERSION=\"0.01\" -IC:\program\Perl\lib\CORE
Mytest.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 11.00.7022 for
80x86
Copyright (C) Microsoft Corp 1984-1997. All rights reserved.
Mytest.c
C:\program\Perl\lib\CORE\win32.h(59) : fatal error C1083: Cannot open
include fi
le: 'windows.h': No such file or directory
NMAKE : fatal error U1077: 'c:\program\vc5\bin\cl.exe' : return code
'0x2'
Stop.
--
Obviously MakeMaker can't find the MSVC's include-directory and
windows.h. I've looked in and searched Config.pm for a line that tells
MakeMaker where to find all includes, but I can't seem to find it. I've
tried to change 'incpath', 'libpth', 'locinpth', 'loclibpth' and some
others, but nothing.
Finally I hardcoded the -I parameter into the config and then it worked
(although it's not a very elegant solution), only to find out that
there's problems with the linker as well. The following is what I got:
--
Microsoft (R) Program Maintenance Utility Version 1.62.7022
Copyright (C) Microsoft Corp 1988-1997. All rights reserved.
c:\program\vc5\bin\cl.exe -Ic:\program\vc5\include -c -Od -MD
-DNDEBUG
-TP -GX -DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT -DPERL_OBJECT
-Od -MD -
DNDEBUG -TP -GX -DVERSION=\"0.01\" -DXS_VERSION=\"0.01\"
-IC:\program\Perl
\lib\CORE Mytest.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 11.00.7022 for
80x86
Copyright (C) Microsoft Corp 1984-1997. All rights reserved.
Mytest.c
"Running Mkbootstrap for Mytest ()"
C:\Program\Perl\bin\perl.exe -IC:\program\Perl\lib
-IC:\program\Perl\lib
-MExtUtils::Command -e chmod 644 Mytest.bs
C:\Program\Perl\bin\perl.exe "-IC:\program\Perl\lib"
"-IC:\program\Perl\
lib" -MExtUtils::Mksymlists -e "Mksymlists('NAME' => 'Mytest', 'DLBASE'
=> 'Myt
est', 'DL_FUNCS' => { }, 'FUNCLIST' => [], 'IMPORTS' => { }, 'DL_VARS'
=> []);
"
link -out:blib\arch\auto\Mytest\Mytest.dll -dll -nologo
-nodefaultlib -r
elease -machine:x86 Mytest.obj C:\program\Perl\lib\CORE\perlcore.lib
oldnames.
lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
advapi32.lib sh
ell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib wsock32.lib
mpr.lib winm
m.lib version.lib odbc32.lib odbccp32.lib PerlCRT.lib -def:Mytest.def
NMAKE : fatal error U1045: spawn failed : Invalid argument
Stop.
--
Which parameter is wrong?! This is starting to drive me crazy. I've been
trying to get this to work for I don't know how long, but no matter what
I do I run into problems. But I really need to get this to work... The
vexing thing is that I've tried this on a UNIX-machine and it worked
like a charm the first try...
Best regards,
/Andreas
--
______________________________________________________________________
ANDREAS HAGELBERG - Student at "Högskolan i Karlskrona/Ronneby
- IT-consultant at Ericsson Software Technology AB
- Webmaster at AllGlobal (http://allglobal.com)
+ E-mail: tlb@algonet.se or di97aha@student.hk-r.se
+ Web: http://www.algonet.se/~tlb - Visual Systems Check
+ Address: Stenbocksvägen 6, SE-372 37 Ronneby, SWEDEN
+ ICQ UIN: 128240
+ Tel: +46-(0)457-19141 ________________________________________
------------------------------
Date: Sat, 18 Sep 1999 09:34:15 GMT
From: whatyoulookin@hotmail.com
Subject: ratings script?
Message-Id: <7rvman$p8a$1@nnrp1.deja.com>
I'm going crazy trying to find a script that will let me put a list of
things on a page, and let people rate each one on a scale of, say, 1-10.
I can't find one that shows the results on the page before people vote.
It's funny, I go to all these script archives that use a script exactly
like what I'm looking for to rate the scripts they have for download,
but I can't find the damn script anywhere........ ugh.
Any help would be hugely appreciated.
Hugh Mann
http://wrybread.com
"because you knead wrybread"
whatyoulookin@hotmail.com
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Sat, 18 Sep 1999 04:55:07 -0700
From: James William Carlson <jcarlson@leland.Stanford.EDU>
Subject: site search script
Message-Id: <Pine.GSO.3.96.990918044959.27450C-100000@tree0.Stanford.EDU>
Hello,
I have a site that I would like to index and search. I've looked around a
bit, but I haven't found a script that meets my needs. That is, because a
number of my pages are database driven, an indexer that simply analyzes
the static HTML won't do me any good. I need an indexing script that
creates a real http spider, to properly invoke my pages. Has any one
seen/used such a script? I suppose that I could write one myself (a
mediocre one, that is) but time doesn't permit it, and I'd rather not
reinvent the wheel.
Any suggestions would be greately appreciated.
Thanks,
Jim
------------------------------
Date: 18 Sep 1999 07:20:41 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Sorting on a string, by value.
Message-Id: <x7ogf0a2k5.fsf@home.sysarch.com>
>>>>> "LR" == Larry Rosler <lr@hpl.hp.com> writes:
LR> [Posted and a courtesy copy sent.]
LR> In article <x7yae4ano4.fsf@home.sysarch.com> on 17 Sep 1999 23:44:43 -
LR> 0400, Uri Guttman <uri@sysarch.com> says...
LR> ...
>> it may help you understand how to sort things like this. but in the mean
>> time here is a whack at it using the ST (tested):
LR> But not *very* thoroughly.
i wasn't paid enough.
LR> cmp
eq, cmp, same thing. :-) my single test looked ok to sleepy eyes.
LR> my ...
my what? my word? my god?
>> $num1 =~ tr/_//d ; # cleanup prefix number
LR> You are taking the poster's word that this is correct, though it would
LR> sort, say, 2_3_5_1 ahead of 2_3_4_10. It really needs a left-to-right
LR> numeric sort on each of the four fields (rather like the IP addresses
LR> used in the examples in our paper).
hey i have to take something is correct. i did point out at least one or
two contradictions in his post.
LR> Oh, what the hell. Here's a go at it (tested; assumes all number fields
LR> fit within a byte):
i knew you would fall for this bait! and you make a possibly invalid
assumption too. so there!
LR> @out =
LR> map substr($_, 1 + rindex $_, "\0"),
LR> sort
LR> map {
LR> my ( $num1, $str, $num2 ) = /([\d_]+)\.([a-z]+)(\d*)/i ;
LR> pack 'C5 A* x A*' =>
LR> split(/_/ => $num1), $num2 || 0, $str, $_
LR> } @in ;
i was hoping the poster would try to do this for himself.
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
uri@sysarch.com --------------------------- Perl, Internet, UNIX Consulting
Have Perl, Will Travel ----------------------------- http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
"F**king Windows 98", said the general in South Park before shooting Bill.
------------------------------
Date: 18 Sep 1999 11:33:26 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Telnet scripting in Perl?
Message-Id: <7rvta6$1j5$1@gellyfish.btinternet.com>
On Fri, 17 Sep 1999 18:54:50 +0200 WhilBone wrote:
> A friend of mine have set up a mail router/firewall on Linux. When I asked
> him today about adding a small script to send some telnet commands to the
> mail server to get it to release my mail he said that it could probably be
> done in perl.
<snip>
It appears that everyone else has told you to use Net::Telnet - however
this may be more work than is necessary as the module Net::SMTP (which
is p[art of the libnet bundle available from CPAN) does support ETRN and
infact has a etrn method :
etrn ( DOMAIN )
Request a queue run for the DOMAIN given.
This should prove a lot simpler than hand coding the SMTP transaction
required to do an ETRN request ...
Of course it can be even easier (and this has nothing to do with Perl)
you could use Eric Raymond's program fetchmail which can do an ETRN
request - <http://www.ccil.org/~esr/fetchmail> .
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Sat, 18 Sep 1999 12:44:12 +0200
From: "Mattia" <mattiac@alinet.it>
Subject: transform / in \/
Message-Id: <37e36c57.0@212.7.64.37>
I need to have a variable (let's say $foo) that points to a directory. I
need to put this var both in string and in regular expression, so I need
another var for regular expressions. In regular expression the / char must
be preceded by the \ char. Let's say:
#main var
$foo = "/usr/bin/mattia";
#var for regexp
$regfoo="\/usr\/bin\/mattia";
I would like get the $regfoo variable out of $fo, instead of typing it.
I tried with tr///\// but it doesn't work.
Can anyone suggest a solution?
(please try it before posting)
Mattia
------------------------------
Date: Sat, 18 Sep 1999 13:17:56 +0200
From: Andreas Hagelberg <tlb@algonet.se>
Subject: Re: transform / in \/
Message-Id: <37E374E4.7AC2298D@algonet.se>
Mattia wrote:
>
> I need to have a variable (let's say $foo) that points to a directory. I
> need to put this var both in string and in regular expression, so I need
> another var for regular expressions. In regular expression the / char must
> be preceded by the \ char. Let's say:
Try the function "quotemeta EXPR". This will backslash any
non-alphanumeric character found in EXPR (or $_ if omitted).
/Andreas
--
______________________________________________________________________
ANDREAS HAGELBERG - Student at "Högskolan i Karlskrona/Ronneby
- IT-consultant at Ericsson Software Technology AB
- Webmaster at AllGlobal (http://allglobal.com)
+ E-mail: tlb@algonet.se or di97aha@student.hk-r.se
+ Web: http://www.algonet.se/~tlb - Visual Systems Check
+ Address: Stenbocksvägen 6, SE-372 37 Ronneby, SWEDEN
+ ICQ UIN: 128240
+ Tel: +46-(0)457-19141 ________________________________________
------------------------------
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 840
*************************************