[8646] in Perl-Users-Digest
Perl-Users Digest, Issue: 2263 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Apr 7 02:07:22 1998
Date: Mon, 6 Apr 98 23:00:21 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 6 Apr 1998 Volume: 8 Number: 2263
Today's topics:
Re: -comparing the values of 2 arrays- <rjk@coos.dartmouth.edu>
Re: Any ideas, expert opinions?? about.. <rjk@coos.dartmouth.edu>
Re: Buggy textarea using IE <rjk@coos.dartmouth.edu>
CGI and perl <banman@wwdg.com>
Do I really have to wait for a lengthy script to finish dr.schueller@forum-medizin.com
Help: problems building perl 5.004-4 <marco@techie.com>
Re: How to call a function every 15 seconds or so ? <rjk@coos.dartmouth.edu>
Re: How to call a function every 15 seconds or so ? <rjk@coos.dartmouth.edu>
Re: How to call a function every 15 seconds or so ? <rjk@coos.dartmouth.edu>
Pattern searching... (Mark Tong)
Re: Pattern searching... <rjk@coos.dartmouth.edu>
Re: perl linux database program? (Paul Wilson)
Porting HTML into CGI Perl routine with variables. <RainCloudStudios@worldnet.att.net>
Re: Porting HTML into CGI Perl routine with variables. <eugene@vertical.net>
Q: Dynamic namespace change? (V. Ilyushchenko)
Re: reading file permissions (Colin Kuskie)
Re: using modules (Ali Mehdizadeh)
Re: Win32 ODBC error - object not found (Jim Dolan)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 06 Apr 1998 23:26:32 -0400
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
Subject: Re: -comparing the values of 2 arrays-
Message-Id: <35299CEB.A5F901CA@coos.dartmouth.edu>
[posted but not mailed - munged addresses are annoying]
James wrote:
>
> I am trying to compare the values of two arrays, and combining them in
> another array, ensure that no duplicates are entered.
>
> For example:
>
> @array1 = ("12 ","13 ","14 ","15 ");
> @array2 = ("14 ","15 ","16 ","17 ");
>
> The end result should look like this:
>
> @newarray = ("12 ","13 ","14 ","15 ","16 ","17 ");
# sort is optional
@_{@array1, @array2} = 0;
@newarray = keys sort %_;
# possibly faster than above, but assumes arrays are sorted
$i = $j = 0;
while (1) {
last if $i > $#array1
or $j > $#array2;
if ($array1[$i] lt $array2[$j]) {
push @newarray, $array1[$i++];
} elsif ($array1[$i] gt $array2[$j]) {
push @newarray, $array2[$j++];
} else {
push @newarray, $array1[$i++];
$j++;
}
}
push @newarray, @array1[$i..$#array1], @array2[$j..$#array2];
--
_ / ' _ / - aka - rjk@coos.dartmouth.edu
( /)//)//)(//)/( Ronald J. Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Mon, 06 Apr 1998 23:32:26 -0400
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
Subject: Re: Any ideas, expert opinions?? about..
Message-Id: <35299E4D.64038E9D@coos.dartmouth.edu>
Lalit Jairath wrote:
>
> Original text:
> ~~~~~~~~~~~~~
>
> <input type="radio" name="-e" value="april1998" checked> April 1998<br>
> <table>
> <tr valign top>
> <td>
> <input type="radio" name="-e" value="march1998" > March 1998<br>
> <input type="radio" name="-e" value="february1998" > February 1998<br>
>
> Updated text:
> ~~~~~~~~~~~~~
>
> <input type="radio" name="-e" value="may1998" checked> May 1998<br>
> <table>
> <tr valign top>
> <td>
> <input type="radio" name="-e" value="april1998" > April 1998<br>
> <input type="radio" name="-e" value="march1998" > March 1998<br>
> <input type="radio" name="-e" value="february1998" > February 1998<br>
Why is the first month outside the table?
Read in a line at a time, searching searching for the previous month.
When you find it, output the line for the current month.
(Including the text " checked".)
Remove the text " checked" from the previous month's line.
Read in and output lines until you get to the line for two months ago.
Output the line for the previous month.
Output the line for two months ago.
Read in the rest of the file and print it back out unchanged.
Ta da.
--
_ / ' _ / - aka - rjk@coos.dartmouth.edu
( /)//)//)(//)/( Ronald J. Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Mon, 06 Apr 1998 23:06:11 -0400
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
Subject: Re: Buggy textarea using IE
Message-Id: <35299825.EE0A96A8@coos.dartmouth.edu>
Robert Prashad wrote:
>
> If you can't answer the question, then instead of giving a
> smart ass response leave it for someone else who can. The scirpt that
> saves the form is Perl, why do you think I'm posting to this
> newsgroup. Does anyone else know a Perl solution to this problem?
There is no Perl solution to the problem as you have written it. You wanted
to know how to stop Internet Explorer from inserting control-M characters in a
text field. By the time your Perl script receives the input, IE has already
inserted the \cM characters. Thus, there is no way for Perl to prevent the
\cM's from being inserted.
If you're unsatisfied with the answer you received, you should have phrased
the question better.
> On Sun, 05 Apr 1998 21:45:24 -0500, Eugene Sotirescu
> <eugene@vertical.net> wrote:
>
> > I can't answer your question, I only do Perl. Maybe post it on a MS
> >Newsgroup?
> >
> >(Does anyone know how to prevent posts like these from getting
> >inserted into a Perl Newsgroup?
> >
> > Your help is much appreciated.)
> >
> >
> >Robert Prashad wrote:
> >
> >> I have a script that saves forms to a file. It works great
> >> with Navigator. However, Internet Explorer inserts ^M~nl~ into every
> >> textarea regardless of the user typing in text or not. The ^M shows up
> >> as just a box.
> >> Does anyone know how I can prevent these from getting
> >> inserted?
--
_ / ' _ / - aka - rjk@coos.dartmouth.edu
( /)//)//)(//)/( Ronald J. Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Tue, 07 Apr 1998 03:54:25 GMT
From: John Compe <banman@wwdg.com>
Subject: CGI and perl
Message-Id: <3529A104.72EB@wwdg.com>
I'm just starting out with perl, bought some books, been looking at
source code, writing some simple CGI applications, but I would like to
know where I can get some full documentation on some CGI applications,
such as using mdb to create a working database and compile stats and
numbers to figure percentages and those sort of calculations.
-compethius
------------------------------
Date: Mon, 06 Apr 1998 22:56:31 -0600
From: dr.schueller@forum-medizin.com
Subject: Do I really have to wait for a lengthy script to finish
Message-Id: <6gc85f$50b$1@nnrp1.dejanews.com>
Hello out there,
I want to run cgi scripts from my browser (or having anyone else to do that)
without having to wait for the lengthy script to finish. It would be nice, if
the script could report something to the user and close the connection while
still doing the rest of the job. This task has been asked before (it was about
a mailing list, where someone posting an article had to wait for a lot of
emails to be sent), but the answers given there (chron jobs doing the rest)
are not suitable for me because of lack of sufficient chron job possibilities
(my ISP restricts me here).
Every idea will be welcome, please copy your answer directly to me.
Walter
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: 06 Apr 1998 21:11:14 -0700
From: Marco Melgazzi <marco@techie.com>
Subject: Help: problems building perl 5.004-4
Message-Id: <xviuomw9st.fsf@mdmgaia.intergate.bc.ca>
Hi
here it is the problem
lib/io_xs.........perl: can't resolve symbol 'fgetpos'
FAILED at test 0
lib/ndbm..........ok
lib/odbm..........perl: can't resolve symbol 'creat'
FAILED at test 0
lib/opcode........ok
lib/open2.........ok
lib/open3.........ok
lib/ops...........ok
lib/parsewords....ok
lib/posix.........perl: can't resolve symbol 'sigaddset'
FAILED at test 6
lib/safe1.........ok
lib/safe2.........ok
lib/sdbm..........ok
lib/searchdict....ok
lib/selectsaver...ok
lib/socket........ok
lib/soundex.......ok
lib/symbol........ok
lib/texttabs......ok
lib/textwrap......ok
lib/timelocal.....ok
lib/trig..........ok
Failed 3 test scripts out of 153, 98.04% okay.
### Since not all tests were successful, you may want to run some
### of them individually and examine any diagnostic messages they
### produce. See the INSTALL document's section on "make test".
###
### Since most tests were successful, you have a good chance to
### get information with better granularity by running
### ./perl harness
### in directory ./t.
u=0.42 s=0.32 cu=21.77 cs=6.95 scripts=151 tests=4835
make: *** [test] Error 1
63 -mdmgaia:/home/marco/foo/perl5.004_04>./myconfig
Summary of my perl5 (5.0 patchlevel 4 subversion 4) configuration:
Platform:
osname=linux, osvers=2.0.29, archname=i586-linux
uname='linux mdmgaia.intergate.bc.ca 2.0.29 #9 sat nov 29 09:59:43 met 1997 i586 '
hint=recommended, useposix=true, d_sigaction=define
bincompat3=y useperlio=undef d_sfio=undef
Compiler:
cc='cc', optimize='-O3 -mpentium', gccversion=pgcc-2.90.27 980315 (egcs-1.0.2 release)
cppflags='-Dbool=char -DHAS_BOOL -I/usr/local/include'
ccflags ='-Dbool=char -DHAS_BOOL -I/usr/local/include'
stdchar='char', d_stdstdio=define, usevfork=false
voidflags=15, castflags=0, d_casti32=define, d_castneg=define
intsize=4, alignbytes=4, usemymalloc=n, prototype=define
Linker and Libraries:
ld='cc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /shlib /lib /usr/lib
libs=-lndbm -lgdbm -ldbm -ldb -ldl -lm -lc -lcrypt
libc=/lib/libc.so, so=so
useshrplib=false, libperl=libperl.a
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'
65 -mdmgaia:/home/marco/foo/perl5.004_04/t>./perl lib/io_xs.t
1..4
ok 1
ok 2
./perl: can't resolve symbol 'fgetpos'
66 -mdmgaia:/home/marco/foo/perl5.004_04/t>./perl lib/odbm.t
1..18
./perl: can't resolve symbol 'creat'
67 -mdmgaia:/home/marco/foo/perl5.004_04/t>./perl lib/posix.t
1..17
ok 1
ok 2
ok 3
ok 4
ok 5
./perl: can't resolve symbol 'sigaddset'
As you can see for some mysterious reason ( seemingly not dependent
from the libc I use ( tried with 5.4.44 and 5.4.33 ) or the compiler
(tried egcs and gcc with different optimizations ) perl is not able to
resolve those symbols. Anybody has a clue on what I could do to fix this
strange problem ?
Thanks a lot
Marco
P.S. Could you please CC: the reply by mail ?
------------------------------
Date: Mon, 06 Apr 1998 23:42:15 -0400
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
To: Michael Shavel <mshavel@erols.com>
Subject: Re: How to call a function every 15 seconds or so ?
Message-Id: <3529A09A.5237D412@coos.dartmouth.edu>
[posted and mailed]
Michael Shavel wrote:
>
> I have a perlscript that is used to call a dozen or so individual queries
> on an Sybase database running on a UNIX box. The script is run through a
> GUI made by perl/tk. I use the PID number of each process to determine if
> the query is complete.
>
> I am trying to create a sub routine in perl that will run a ps -ef |grep
> $pidnum on the pidnum I get from running the process. I would like to
> run the subroutine every 15 seconds or so to check and see if that
> particular query is finished. I can write the subroutine fine but am at a
> standstill when I try to figure out how I can call it every 15 seconds (or
> any arbitrary time) to check and see if the process has ended. I don't
> want to put the function call in a loop because I don't want to rest of
> the program to lock up while I am waiting for this one process to end (I
> have other queries I can run)
Good thinking - a loop would prevent your program from doing anything else!
Tk does indeed provide two timer-related functions: after and repeat. I
believe repeat will do what you want.
Not having used Tk myself, I can't tell you more. Check the Perl/Tk
documentation, or Chapter 14 of Advanced Perl Programming, by Sriram
Srinivasan, which is how I learned about these functions.
--
_ / ' _ / - aka - rjk@coos.dartmouth.edu
( /)//)//)(//)/( Ronald J. Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Mon, 06 Apr 1998 23:46:48 -0400
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
To: Michael Shavel <mshavel@erols.com>
Subject: Re: How to call a function every 15 seconds or so ?
Message-Id: <3529A1AC.BDB2BDC8@coos.dartmouth.edu>
[posted and mailed]
Michael Shavel wrote:
>
> I have a perlscript that is used to call a dozen or so individual queries
> on an Sybase database running on a UNIX box. The script is run through a
> GUI made by perl/tk. I use the PID number of each process to determine if
> the query is complete.
>
> I am trying to create a sub routine in perl that will run a ps -ef |grep
> $pidnum on the pidnum I get from running the process. I would like to
> run the subroutine every 15 seconds or so to check and see if that
> particular query is finished. I can write the subroutine fine but am at a
> standstill when I try to figure out how I can call it every 15 seconds (or
> any arbitrary time) to check and see if the process has ended. I don't
> want to put the function call in a loop because I don't want to rest of
> the program to lock up while I am waiting for this one process to end (I
> have other queries I can run)
Good thinking - a loop would prevent your program from doing anything else!
Tk does indeed provide two timer-related functions: after and repeat. I
believe repeat will do what you want.
Not having used Tk myself, I can't tell you more. Check the Perl/Tk
documentation, or Chapter 14 of Advanced Perl Programming, by Sriram
Srinivasan, which is how I learned about these functions.
--
_ / ' _ / - aka - rjk@coos.dartmouth.edu
( /)//)//)(//)/( Ronald J. Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Tue, 07 Apr 1998 00:15:47 -0400
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
Subject: Re: How to call a function every 15 seconds or so ?
Message-Id: <3529A879.69B4060A@coos.dartmouth.edu>
Martien Verbruggen wrote:
>
> In article <mshavel-0604981912110001@130.9.16.207>,
> mshavel@erols.com (Michael Shavel) writes:
>
> > So my question is, am I missing something basic (some timer function or
>
> perldoc -f sleep
In a GUI application? Not a good idea. Did you actually read Michael's
entire message, Martien? He considered sleep in a loop, but realized that the
program would not be able to do anything else.
--
_ / ' _ / - aka - rjk@coos.dartmouth.edu
( /)//)//)(//)/( Ronald J. Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: 7 Apr 1998 03:36:59 GMT
From: marktng@condor.sccs.swarthmore.edu (Mark Tong)
Subject: Pattern searching...
Message-Id: <6gc70r$cl8@larch.cc.swarthmore.edu>
Perl gurus,
I know this is damn easy but I just can't seem to figure this
out. I have a corrupted text file that (I think) can be recovered
using some smart perl scripting. Basically all new lines \n are being
replaced by a sequence of ctrl-A, two random characters and then ctrl-E
- therefore lines of the whole text file are now concatenated together
with those characters. For example,
Before corruption
-----------------
This is a lousy cat.
This is a dog.
This is a big mouse.
After corruption
----------------
This is a lousy cat.^AeB^EThis is a dog.^A2k^EThis is a big mouse.
Any help appreciated. Please reply to marktng@sccs.swarthmore.edu .
TIA!
-Mark Tong
*---------------------------------------------------------------------*
* Mark Tong (marktng@sccs.swarthmore.edu) * finger for PGP Key / URL *
* 500 College Ave., Swarthmore, PA 19081-1397 * (610).690.3967(H) *
*---------------------------------------------------------------------*
------------------------------
Date: Tue, 07 Apr 1998 00:17:49 -0400
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
To: Mark Tong <marktng@condor.sccs.swarthmore.edu>
Subject: Re: Pattern searching...
Message-Id: <3529A8F3.65DA8C97@coos.dartmouth.edu>
[posted and mailed]
Mark Tong wrote:
>
> I have a corrupted text file that (I think) can be recovered
> using some smart perl scripting. Basically all new lines \n are being
> replaced by a sequence of ctrl-A, two random characters and then ctrl-E
So do the same replacement in the other direction.
perl -pi -e 's/\cA..\cE/\n/g'
--
_ / ' _ / - aka - rjk@coos.dartmouth.edu
( /)//)//)(//)/( Ronald J. Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Tue, 07 Apr 1998 05:09:40 GMT
From: prw@vanitydomain.net (Paul Wilson)
Subject: Re: perl linux database program?
Message-Id: <3529b4c0.49637707@news.bestweb.net>
On Sat, 4 Apr 1998 07:34:47 -0500, "Greg Waters" <gwaters@dorsai.org>
wrote:
>Does anybody know resource information and help files on how to create perl
>databases for linux? Did someone write a program?
>
Creating a perl database would be a pain. Why not just use mSQL
(http://www.hughes.com.au) , get a copy of MSQL.pm, and you're all
set.
Paul
------------------------------
Date: Tue, 7 Apr 1998 00:26:45 -0400
From: "Charles R. Thompson" <RainCloudStudios@worldnet.att.net>
Subject: Porting HTML into CGI Perl routine with variables.
Message-Id: <6gca2v$2b7@bgtnsc02.worldnet.att.net>
This is a long shot... hoping a guru is out there with a really good fix.
I am currently working with a Perl based database search script. The script
works beautifully, but I want to customize the script and am having
problems. Here is the layout, and the pitch.. let's see if anyone can help
me solve the problem...
our files in question..
search.cgi
search.setup
search cgi basically parses the URL input and loads the setup file which
contains all the field info and page output routines for our database driven
site. From there the setup file uses HTML tags between a
print qq~ \n;
line to build our page. Again.. the printing routines with the HTML are in
the setup file.
Within the print statement are references to variables _within_ the setup
file. Basically things like hidden input and whatnot. What I would like to
do is use Perl's open routine and pull the HTML from an external file. This
would make it much easier to customize HTML output.. not to mention the
capability to produce many different views of data.
My problem is this... I have accomplished everything except the ability to
grab the variables and use them in the open - print loop. Example...
sub load_search_form
{
($searchtype) = @_;
if (($searchtype) eq "sim")
{
open(<HTML_ARCHIVE>, "./html_archives/simple_search.html_archive");
While (<HTML_ARCHIVE>)
{
print;
}
}
}
This effectively pulls in every line of an HTML file and renders it to the
screen. However... within the source I see things like this...
<form METHOD="post" ACTION="$this_script_url">
<input type="hidden" name="setup_file" value="$form_data{'setup_file'}">
<input type="hidden" name="view" value="world">
<input type="hidden" name="session_file" value="$session_file">
<input type="hidden" name="sort_by" value="$index_of_field_to_be_sorted_by">
The values of the fields do not get set in this loop I have created.
1) Can someone explain why?
I believe that it has something to do with the scope of the variables.
In my original setup file code the html markup was printed in the
following manner...
print qq~
<HTML>
etc
\n~;
2) Does using the print command without the qq~ option somehow mess up the
variables from being recognized?
Anyone with some leads?
answers duplicated in email for archiving would be greatly appreciated.
Charles R. Thompson
RainCloud Studios
------------------------------
Date: Tue, 07 Apr 1998 00:00:54 -0500
From: Eugene Sotirescu <eugene@vertical.net>
Subject: Re: Porting HTML into CGI Perl routine with variables.
Message-Id: <3529B304.402C7C03@vertical.net>
Although I don't completely understand the mechanics of files/scripts involved,
here is what I noticed:
- what is /html_archives/simple_search.html_archive? an HTML file? it looks
like you're reading a raw, unexecuted Perl CGI script that sets up a form, not
an HTML file. . . is this HTML file supposed to be a form? where do those
hidden fields come from? hard to make all this out. . .
(also, I take it you didn't paste in the code below: as you have it here it
can't work, there no While in Perl or file handles opened with <>).
Sorry can't help more, looks like you really need a guru ;-----------------)
Eugene
Charles R. Thompson wrote:
> sub load_search_form
> {
> ($searchtype) = @_;
>
> if (($searchtype) eq "sim")
> {
> open(<HTML_ARCHIVE>, "./html_archives/simple_search.html_archive");
> While (<HTML_ARCHIVE>)
> {
> print;
> }
> }
> }
>
> This effectively pulls in every line of an HTML file and renders it to the
> screen. However... within the source I see things like this...
>
> <form METHOD="post" ACTION="$this_script_url">
> <input type="hidden" name="setup_file" value="$form_data{'setup_file'}">
> <input type="hidden" name="view" value="world">
> <input type="hidden" name="session_file" value="$session_file">
> <input type="hidden" name="sort_by" value="$index_of_field_to_be_sorted_by">
>
> The values of the fields do not get set in this loop I have created.
>
> 1) Can someone explain why?
> I believe that it has something to do with the scope of the variables.
>
> In my original setup file code the html markup was printed in the
> following manner...
>
> print qq~
> <HTML>
> etc
> \n~;
>
> 2) Does using the print command without the qq~ option somehow mess up the
> variables from being recognized?
>
> Anyone with some leads?
>
> answers duplicated in email for archiving would be greatly appreciated.
>
> Charles R. Thompson
> RainCloud Studios
------------------------------
Date: Mon, 06 Apr 1998 20:46:07 +0400
From: "Simon (V. Ilyushchenko)" <simonf@rrg.msk.su>
Subject: Q: Dynamic namespace change?
Message-Id: <352906CF.62E21B4@rrg.msk.su>
Hello,
Here a goes a Tough Question. Suppose I need a module (call it A) that
would be called from module B with a code string as a parameter. Then
module A will want to 'eval' that string using variable namespace of
module B. How is this possible?
I know that all the namespaces are accessible via a global hash, but I
am looking for an elegant way. I tried passing the package name as a
function parameter and then issuing "package $package", but compiler
barked on me.
Thanks in advance,
Simon
--
_________ Simon (Vsevolod ILyushchenko)
| x |
| y = e | simonf@rrg.msk.su Life is file...
|_________|
Disclaimer: This is not me. This is just my mailer talking to your
mailer...
------------------------------
Date: 6 Apr 1998 11:09:43 -0700
From: colink@latticesemi.com (Colin Kuskie)
Subject: Re: reading file permissions
Message-Id: <6gb5p7$hkd@sarek.latticesemi.com>
In article <352626AB.72E7@mediaone.net>,
Sneaker's Nest <sneaker@mediaone.net> wrote:
>[Mailed & Posted...]
>
>David Shirley wrote:
>>
>> Newbie question here:
>> How does one go about reading the existing permissions on a file?
>
>A possible answer:
A different solution that doesn't require ls, spawning an external
process, uses perl built-in functions and can be found in the following
places:
the perlfunc man page
(No offense intended, Sneaker, but this is a job for perl, not the
shell and it was a dead give away. Instead of posting to the
newsgroup it's 15 minute job from start to finish.)
Here's the whole thing:
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
$blksize,$blocks) = stat($filename);
More than everything that you want to know about the file. To
simplify this (since you only wanted to know the permissions) you can
do this:
($mode) = (stat($filename))[2];
Now, $mode is a strange thing. You would expect that it would
only contain an octal number that represents the file permissions
but it actually has more info. After digging through a few man
pages and a quick trial script I find that you can use $mode, with
no changes, as an argument to chmod, et. al.
For more info on stat, check out the stat manpage but be prepared
to hit at least one or two more to find out about mode.
Hope this helps,
Colin Kuskie
------------------------------
Date: 7 Apr 1998 05:26:33 GMT
From: amehdiza@joule.ee.calpoly.edu (Ali Mehdizadeh)
Subject: Re: using modules
Message-Id: <6gcde9$4i5$1@isnews.csc.calpoly.edu>
Andrew M. Langmead (aml@world.std.com) wrote:
: amehdiza@joule.ee.calpoly.edu (Ali Mehdizadeh) writes:
: >I am using perl under NT. What am I doing wrong?
: Its a couple of different things going on at the same time. Once you
: fix these, either of the two lines should work.
: 1. You also need a "use POSIX;" line to import the POSIX module.
: 2. Perl identifiers are case sensitive, you have to refer to the POSIX
: module as "POSIX", not "posix".
: 3. Windows NT is not an POSIX complient system (except for a
: perversely comical POSIX mode that has no access to the any Win32
: functions. Including all of the graphics functions.) so it does not
: have a POSIX module.
: --
: Andrew Langmead
point 3 above leads me to believe that 1 and 2 do not apply to me:)
So, what are my options? implementing my own ceil() function?
Probably... I can probably use the code for the ceil() function
in the POSIX module and just put it in my program.
Thanks,
-Ali M.
------------------------------
Date: Tue, 07 Apr 1998 05:56:12 GMT
From: dolanjd@iname.com (Jim Dolan)
Subject: Re: Win32 ODBC error - object not found
Message-Id: <3529bfc8.124271062@nntp.alaska.net>
Try installing this one, found at your closest CPAN mirror.
perl5.00402-bindist04-bc.zip
Later,
Jim Dolan
***********************************************************************************
>From the README.
Welcome to the binary distribution of Perl for the Win32 platform.
This distribution has been compiled using the Borland C++ compiler
(version 5.02). It is built around the latest production release of
Perl, version 5.004_02, which comes with Win32 support.
Please note that this distribution is not to be confused with
the pre-5.004 Perl port by the Activeware folks, or the binaries
they distribute (which are mostly referred to by "build" numbers).
This bundle contains almost everything you will need for using Perl
on Win32 platforms. It also contains everything needed to build,
test and install additional perl modules from CPAN that you may not
find in here, provided they use the standard MakeMaker extension
build tools. Since MakeMaker needs a `make' utility, a Win32 binary
of Dennis Vadura's `dmake' tool is supplied (see below for more on
`dmake'). For using this distribution to build extensions that need
a C compiler, you will also need either Borland C++ 5.02, or Visual
C++ (version 2.0 and later).
WHY WOULD YOU WANT THIS?
------------------------
+ You want to use perl on WindowsNT or Windows95, but you have
no C compiler (or at least not one that will build perl).
+ You seem to have the compiler stuff, but not the patience or
knowledge to deal with compiling perl and the various extensions.
And you are happy to continue using the binary distributions that
you know people are going to keep putting out once every half
moon. [May not be exactly every half moon, but you'll keep the
faith. Remember to give away that compiler you don't use :)]
+ You have one of the supported compilers that will build Perl,
but you want to jump-start your XSsively hardcore perl module
development by taking this shortcut. [But see the notes below
on `USING IT WITH YOUR C COMPILER' for some caveats about doing
this.]
+ You want a perl that is capable of doing sockets on Windows95,
and you just have Visual C++. [The Visual C++ libraries known to
date have a problem with sockets on Windows95, which might cause
you trouble. The Borland libraries, which this distribution was
built with, do not have the problem.]
PLATFORMS
---------
This binary distribution has been extensively tested only on
WindowsNT.
Based on reports from others, I believe it also works on Windows95,
but I personally did not test it on that platform. Note the supplied
binaries are for the x86 architecture.
WHAT IT CONTAINS
----------------
It includes the following packages:
perl5.004_02
dmake-4.1
Alias-2.3
Bit-Vector-4.2
Curses-1.01 [*]
Data-Dumper-2.07
DateCalc-3.2
DateManip-5.10
DBD-ODBC-0.16
DBI-0.89
Devel-Peek-0.83
Devel-Symdump-2.00
DProf-19970614 [*]
GD-1.14 [*]
libnet-1.0505 [*]
libwin32-0.08
libwww-perl-5.11
MD5-1.7
MIME-Base64-2.03
MLDBM-1.23
Storable-0.5 [*]
String-Approx-2.1
Tk402.002
NOTES:
[*] These packages needed porting or other fixes to compile and
run properly. All changes are included in the form of patches
(the kind that can be applied using the GNU patch utility) in
the `patches' subdirectory. The full sources of all of
these packages (with the exception of dmake, see below for that)
can be found on the Comprehensive Perl Archive Network (CPAN).
Point your web browser at "http://www.perl.com/CPAN" to find the
CPAN site nearest you.
The package subdirectories under `distfiles' also contain other
documentation and testsuites that came with the package. These are
not installed, so you may want to save them for later reference.
Please note that the patches are for information purposes only.
You don't have to apply them (or even know what a patch is) to use
this distribution.
In case you find yourself needing to build things from source, there
is a win32 port of GNU patch-2.1 at:
http://www-personal.umich.edu/~gsar/patch2_1-win32.tar.gz
that can be used to apply the included patches.
The modules in the distribution doubtless reflect my own personal
pattern of use. In some cases, I made a conscious decision not to
include modules that don't contain C or XS source, since it should be
possible to obtain, build and install such modules from CPAN without
too much trouble (or a C compiler), using perl and `dmake'.
Nevertheless, I shall add specific modules to the distribution if
there is demand.
Enjoy!
Gurusamy Sarathy (Just Another Perl Porter)
gsar@umich.edu
08-AUG-1997
santon@nu.com wrote:
>
>
>
>
>I've installed this version of Perl for Win32;
>
> Win32 port Copyright (c) 1995-1996 Microsoft Corporation.
> All rights reserved.
> Developed by ActiveWare Internet Corp., http://www.ActiveWare.com
>
>Perl for Win32 Build 316 - Built 09:44:44 Mar 13 1998
>
>This is perl, version 5.003_07
>
>Copyright 1987-1996, Larry Wall
>
> + suidperl security patch
>Perl may be copied only under the terms of either the Artistic License or the
>GNU General Public License, which may be found in the Perl 5.0 source kit.
>
>I've done this (had to create the lib\site\auto\Win32\ODBC\ directories).
>
> - Rename the binary file according and copy it to the correct directory
> as shown in the following table:
>
> File Name Rename to then Copy into directory:
> -------------------- --------- -------------------------
> 970208-3xx.pll ODBC.pll lib\auto\win32\odbc\
> 970208-core.dll ODBC.dll lib\site\auto\Win32\ODBC\
>
>
>
>I'm using this script:
>
>use Win32::ODBC;
>$DSN = "component_stuff";
>print "Connecting to ".$DSN."\n";
>if (!($db = new Win32::OBDC($DSN))) {
> print "Error connecting to $DSN\n";
> print "Error: " . Win32::ODBC::Error()."\n";
> exit;
>}
>exit;
>
>
>And I get this error:
>
>Can't locate object method "new" via package "Win32::ODBC" at test.pl line 4.
>
>I've setup the DSN etc. I temporarily renamed ODBC.PM to ensure it is the
>module being used, and it is. What am I missing?
>
>
>Thanks,
>ns
>
>-----== Posted via Deja News, The Leader in Internet Discussion ==-----
>http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.misc (and this Digest), send your
article to perl-users@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.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 2263
**************************************