[7243] in Perl-Users-Digest
Perl-Users Digest, Issue: 868 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Aug 14 18:37:18 1997
Date: Thu, 14 Aug 97 15:00:30 -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 Thu, 14 Aug 1997 Volume: 8 Number: 868
Today's topics:
Re: about -e and getting filenames (Jeff Stampes)
Re: about -e and getting filenames <bfawcett@myriad.com>
Av_CharPtrPtr.(h|c) ???? <jatucker@austin.dsccc.com>
Back quotes don't seem to work well in Win32 <broomer2@primenet.com>
boulder.pm - I need examples of BoulderIO at work <neiled@enteract.com>
Re: Can You Title Case A String ?. (Jeff Stampes)
convert a Perl AV* (containing strings) to a C char** <jatucker@austin.dsccc.com>
Converting an Array to a Hash <baker@hpspk7jp.spk.hp.com>
Re: Converting an Array to a Hash (Mike Stok)
Re: emacs? No thank you <KenVogt@rkymtnhi.com>
Re: File read rate (Ilya Zakharevich)
hash of hashes of arrays <kerr_tung@sdt.com>
Re: Help with 'if'. <rmcguigan@ramresearch.com>
Re: HELP WITH INSTALLING PERL5 ON WINDOWS 95 <broomer2@primenet.com>
Re: How to treat "\n" as "\n" ? (Ilya Zakharevich)
mssql to perl question (Edward Yeh)
Re: Net::FTP documentation and examples (Parillo)
Newbie <emiliano@dsp.sps.mot.com>
Re: Newbie (Mike Stok)
Re: Perl 5 permanently loaded <tw36027@glaxowellcome.com>
Re: Perl and HTML (Tad McClellan)
perl and oracle stored procedures <dpapathanas@banmail.ml.com>
perl compiler error with CTlib <ahobesh@ucop.edu>
Re: perl question (Brian "AGENT GORDON COLE" Atkins)
Re: perl question <rstarling@btg.com>
Re: perl question (Mark Canup)
Re: perl question (Tad McClellan)
Perlscript on Active Server Pages <eric@jriver.com>
pipes and Open2 <ken.keith@marcgroup.com>
Re: Problem With Join() (Aaron Sherman)
Problems with http file upload using cgi.pm and cgi-lib <eric@migvan.co.il>
Problems with http file upload using cgi.pm and cgi-lib <eric@migvan.co.il>
Re: Puting pattern in a variable (Tad McClellan)
Re: Simple question on s/// operator in expressions <rootbeer@teleport.com>
Re: sorting... (Andrew M. Langmead)
Trouble compiling perl on Solaris 2.5 (William Reardon)
Re: Uninitialized Value? Really? (Tad McClellan)
Re: Why doesn't sort take a reference any more? (Ilya Zakharevich)
XS (converting perl array to char**..) <jatucker@austin.dsccc.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 14 Aug 1997 20:47:52 GMT
From: stampes@xilinx.com (Jeff Stampes)
Subject: Re: about -e and getting filenames
Message-Id: <5svqto$ls9$1@neocad.com>
Kenneth Kin Lum (kin@wco.com) wrote:
: Is there a way to do
: if (-e "*.txt") { ... }
: ? That is, must "-e" take an exact filename but can't take
: a wildcard?
: Also, is there a way not to fork a process but just do in PERL to do
: foreach $file (`ls *.txt`) { ... }
opendir, readdir, closedir (and rewinddir if needed) are your friends.
opendir TMP, '/tmp/test';
print "Found Text files!\n" if (grep /\.txt$/, readdir TMP)
closedir TMP;
TMTOWDTI....and if you're finding yourself forking or globbing, there's
probably plenty of other ways.
HTH,
Jeff
--
Jeff Stampes -- Xilinx, Inc. -- Boulder, CO -- jeff.stampes@xilinx.com
------------------------------
Date: Thu, 14 Aug 1997 15:51:20 -0600
From: Bob Fawcett <bfawcett@myriad.com>
Subject: Re: about -e and getting filenames
Message-Id: <33F37DD8.ABCA942E@myriad.com>
Kenneth Kin Lum wrote:
> Is there a way to do
> if (-e "*.txt") { ... }
> ? That is, must "-e" take an exact filename but can't take
> a wildcard?
>
> Also, is there a way not to fork a process but just do in PERL to do
> foreach $file (`ls *.txt`) { ... }
>
> This is because forking a process on my ISP's server is
> really slow.
>
> Could you please also CC to me when respond. Thanks.
Take a look at this little bit of code that reads files from the
current directory and deletes the ones that start with "LQ-", end with
".syb" and are older than 1 day:
opendir THISDIR, ".";
@allfiles= readdir THISDIR;
closedir THIDIR;
foreach $allfiles(@allfiles){
if (($allfiles=~/^(LQ-).*(.syb)/) && (-M $allfiles > 1)){
unlink $allfiles;
}
}
Hope it helps,
Bob Fawcett
bob@myriad.com
Myriad Genetics, Inc.
------------------------------
Date: Thu, 14 Aug 1997 15:56:16 -0500
From: John Tucker <jatucker@austin.dsccc.com>
Subject: Av_CharPtrPtr.(h|c) ????
Message-Id: <33F370F0.B3A@austin.dsccc.com>
Hello,
Does anyone know where the latest version of the followings
C files may be obtained??
Av_CharPtrPtr.h
Av_CharPtrPtr.c
Thanks,
John
------------------------------
Date: 14 Aug 1997 12:41:00 -0700
From: Rodney Broom <broomer2@primenet.com>
Subject: Back quotes don't seem to work well in Win32
Message-Id: <5svn0c$o7s@nntp02.primenet.com>
Hello All,
Ok, Ok, before anyone sais anything, I know that Perl is native to UNIX
and that some things just don't ever opperate correctly in Win32.
That said, I have used statements like:
print (`cls`);
print (`dir`);
You know, the simple ones. I have tried them on 5.003 in Win95 and NT
4.0 along with 4.036 ported to DOS. Believe it or not, I get more
consistant results in DOS. The results I get in Win32 are mixed. In NT
the whole back quote idea seems to fall apart and in 95 I get some
commands to work and not others.
I thought for a moment that I would be extra shrood and just wright the
commands to a batch file and execute it. Oh, wait, I still can't use
Perl to write the command to execute the batch. :-)
It's mostly a point of interest to me, but, if any one has any thoughs,
you can re-news or e-mail me.
Rodney
broomer2@primenet,com <--- change the comma to a period.
--
To all:
Please, visit my home page at
http://www.primenet.com/~broomer2/index.html
And, please, feel free to send me your
comments and/or critiques.
------------------------------
Date: 14 Aug 1997 19:05:02 GMT
From: "Neil Edmondson" <neiled@enteract.com>
Subject: boulder.pm - I need examples of BoulderIO at work
Message-Id: <01bca8e4$eb697c60$a094e5cf@nedmondson>
boulder.pm looks as though it could do a great job for me in conjunction
with CGI.pm (which I can't recommend highly enough for web hackers).
I've installed it, and plugged it into my environment, and written a very
simple test script (below) to see that I'm on the right track.
MY QUESTIONS:
1. What is your experience with boulder.pm?
2. More importantly, do you know where I can find some examples of its
(Stone, Cursor, Stream and Store) use? Unfortunately, the documentation
provided with the distribution doesn't quite do it for me.
TIA
Neil Edmondson (email to neiled@enteract.com if convenient)
---------------------------------------------
#!/usr/local/bin/perl -Tw
use lib "./Boulder-1.02";
use lib "./Boulder-1.02/Boulder";
use Boulder::Stream;
use Stone::Cursor;
use Boulder::Store;
use DB_File;
$filein = "./OrdersPending/keepfile.1376";
#$stream = Boulder::Stream::new($filein);
$stream = new Boulder::Stream;
open (FILEIN,$filein) || print "Can't open $filein, $!", die;
while ($stone = $stream->read_record('FILEIN')) {
print $stone;
}
exit(0);
------------------------------
Date: 14 Aug 1997 20:51:50 GMT
From: stampes@xilinx.com (Jeff Stampes)
Subject: Re: Can You Title Case A String ?.
Message-Id: <5svr56$ls9$2@neocad.com>
Andy Marr (andy@pindar.com) wrote:
: I have a string "THIS IS A STRING" and I want to
: format it to "This Is A String". (Cap at the start of each word).
: Is there a command in Perl to do this ? , or do I have to split the
: string again and change to lower case and upper case the first letter ?
: It just seems the long way round , any suggestions ?.
Map is fun...
$string = "THIS IS A STRING";
$new_string = join ' ',map {ucfirst lc} split / /,$string;
--
Jeff Stampes -- Xilinx, Inc. -- Boulder, CO -- jeff.stampes@xilinx.com
------------------------------
Date: Thu, 14 Aug 1997 15:16:31 -0500
From: John Tucker <jatucker@austin.dsccc.com>
Subject: convert a Perl AV* (containing strings) to a C char**
Message-Id: <33F3679F.7FE8@austin.dsccc.com>
I have many C functions which I am using with perlxs to
create an extension package for my perl scripts.
All of the C functions have at least one argument which
requires a non-empty "char**" parameter and I would like
to allow perl scripts which use my package to call the
routine with a perl array variable as the arguement
which I can then have converted into the expected
C char** target data type.
Is there some generic utility library out there which
is full of common conversion routines which I can use,
and if not, then how do you do it.
Thanks,
jatucker@austin.dsccc.com
John
------------------------------
Date: 14 Aug 1997 11:10:17 -0700
From: Bill Baker <baker@hpspk7jp.spk.hp.com>
Subject: Converting an Array to a Hash
Message-Id: <xacu3gsvdo6.fsf@hpspk7jp.spk.hp.com>
I have been trying to find an elegant (read that as 'terse') way to
take an array and save it as a hash where the even numbered entries in the
array are the keys for the (entry offset + 1) entries. The array is
guaranteed to contain an even number of entries. It seems like such a
utilitarian function that I am surprised that I haven't found the answer
after searching through Programming Perl 2nd Edition, Perl Man Pages and
usenet. I am sure this will end up being a {hitting forehead with palm}
"Why didn't I think of that!" kind of answer.
Bill
--
Email: baker@spk.hp.com | Hewlett Packard Co
Voice: 1-509-921-3515 | 24001 E Mission Ave
Fax: 1-509-921-3333 | Liberty Lake, WA USA 99019-9599
------------------------------
Date: 14 Aug 1997 19:48:49 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Converting an Array to a Hash
Message-Id: <5svnf1$gol@news-central.tiac.net>
In article <xacu3gsvdo6.fsf@hpspk7jp.spk.hp.com>,
Bill Baker <baker@hpspk7jp.spk.hp.com> wrote:
>I have been trying to find an elegant (read that as 'terse') way to
>take an array and save it as a hash where the even numbered entries in the
>array are the keys for the (entry offset + 1) entries. The array is
>guaranteed to contain an even number of entries. It seems like such a
>utilitarian function that I am surprised that I haven't found the answer
>after searching through Programming Perl 2nd Edition, Perl Man Pages and
>usenet. I am sure this will end up being a {hitting forehead with palm}
>"Why didn't I think of that!" kind of answer.
%hash = @list;
Maybe?
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com | Pencom Systems Administration (work)
------------------------------
Date: Thu, 14 Aug 1997 15:18:48 -0600
From: Kenneth Vogt <KenVogt@rkymtnhi.com>
Subject: Re: emacs? No thank you
Message-Id: <33F37637.68D6@rkymtnhi.com>
Gabor wrote:
>
> Kenneth Vogt (KenVogt@rkymtnhi.com) wrote:
>
> : Thanks to everyone that suggested emacs for Windows. However, it is one
> : of the UGLIEST things I have ever seen! (I'm not trying to start an
>
> There are things in life that should be pretty. An editor is not one
> of them. I expect an editor to be functional, don't you?
>
> --
> And don't tell me there isn't one bit of difference between null and space,
> because that's exactly how much difference there is. :-)
> --Larry Wall in <10209@jpl-devvax.JPL.NASA.GOV>
When I use the word ugly, I mean it is difficult to use. I did not mean
that it is aesthetically unpleasant (although it is that too ;).
Functionality and easy of use are not mutually exclusive. (In fact,
they just might be the same thing!)
--
O O O O
O O O O Kenneth Vogt
O O O O
O O O O KenVogt@rkymtnhi.com
O O O
------------------------------
Date: 14 Aug 1997 19:20:36 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: File read rate
Message-Id: <5svlq4$47d@agate.berkeley.edu>
In article <Pine.GSO.3.96.970813142443.18496I-100000@julie.teleport.com>,
Tom Phoenix <rootbeer@teleport.com> wrote:
> On 13 Aug 1997, Krishnan Jayakrishnan wrote:
>
> > was wondering if it really matters to search a file line by
> > line instead of globbing the entire contents
>
> Yes, especially if the match is likely to be found near the beginning of
> the file. Of course, if the search text isn't in the file, you still have
> to read the whole file, so it doesn't make much difference in that case.
I would not buy it (unless the match is likely to be found near the
beginning). There are many factors affecting the difference. Disk
access vs CPU may work on your side. However, if RE is complicated,
it may take a lot of time if it fails. It is better to fail one time
(or not fail at all), than fail once per line.
The disk access time will be not relevant if FS is good enough, like
cylinder-cached, and files are less than a cylinder-long and not
fragmented.
Ilya
------------------------------
Date: Thu, 14 Aug 1997 15:46:45 -0500
From: Kerr Tung <kerr_tung@sdt.com>
Subject: hash of hashes of arrays
Message-Id: <33F36EB5.550D@sdt.com>
Hi all,
I have a need to store the following data items:
view, user, file (files owned by user)
There are several views and each view has several users and each user
has several files. I want to be able to store and process what view has
what users and what user has what files.
Is some sort of hash of hashes of arrys is the best structure to allow
me to store and process this kind of data?
I am thinking of some pseudo perl code like %table{$view}{$user},
actually the $user should be a pointer to @file, because a user owns
more than one file. My mind is kind of cloudy now and can't get this
work right. How should I build this structure and print out each data
item? Can someone there help?
Thanks,
Kerr
------------------------------
Date: 14 Aug 1997 21:00:22 GMT
From: "Ryan" <rmcguigan@ramresearch.com>
Subject: Re: Help with 'if'.
Message-Id: <01bca8f6$510207c0$6e6fa1cd@www>
print "Email: $FORM{'Email'}\n";
if ($FORM{'SubjectEnquiry'} eq "") {
goto A; ----------------------------------------------do not use this
rewrite as show below
exit;
}
print "Specific Subject of Enquiry: $FORM{'SubjectEnquiry'}\n";
A
print "Detail of Enquiry: $FORM{'DetailEnquiry'}\n";
print "Email: $FORM{'Email'}\n";
if ($FORM{'SubjectEnquiry'} eq "") {
print "Detail of Enquiry: $FORM{'DetailEnquiry'}\n";
exit;
}
else {
print "Specific Subject of Enquiry: $FORM{'SubjectEnquiry'}\n";
}
------------------------------
Date: 14 Aug 1997 12:28:00 -0700
From: Rodney Broom <broomer2@primenet.com>
Subject: Re: HELP WITH INSTALLING PERL5 ON WINDOWS 95
Message-Id: <33F34E6D.6296@primenet.com>
Hi Ed,
Here's what you do.
First, go to
ftp://ftp.epix.net/pub/languages/perl/ports/win32/Perl5/Release/Pw32i306.exe
In Internet Explorer or Netscape, this will begin a download. Save the
file in any directory you like, I advise root, ie; the C: drive.
Run the self expanding zip file (Pw32i306.exe).
It will contain a a file called "install.bat", run this. It will want to
install into a directory that it will creat called \Perl5.
When this is finished, reboot your machine.
Now open a DOS shell in some directory, preferably a directory with a
Perl script in it. At he prompt type:
C:\MY_DIRECTORY>perl myscript.pl
You will see that you can run your scripts from most any where because
"perl.exe" is in the new path statement. A tip, don't put anything with
the name "perl.*" in a directory that occures sooner in your path
statement than Perl does. If you have some other file with the name
"perl*" it will be found first. For instance, in my root directory, I
have a file named perl.bat. This would usually be a problem, but, I set
up a *.pif that sets a new path when I run this batch file.
I hope this all makes sense, if not, feel free to E-mail me at
broomer2@primenet,com <--- note, that needs to be a period, not a comma.
Good luck,
Rodney
--
To all:
Please, visit my home page at
http://www.primenet.com/~broomer2/index.html
And, please, feel free to send me your
comments and/or critiques.
------------------------------
Date: 14 Aug 1997 19:06:00 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: How to treat "\n" as "\n" ?
Message-Id: <5svkuo$40h@agate.berkeley.edu>
In article <Pine.GSO.3.96.970812071822.15021D-100000@julie.teleport.com>,
Tom Phoenix <rootbeer@teleport.com> wrote:
> On Tue, 12 Aug 1997, Kriang Lerdsuwanakij wrote:
>
> > To replace $foo to its value, you will have to use eval
>
> No, you don't _have_ to. That's just one way to do it, and maybe not the
> best one.
>
> s/\$foo/$foo/g; # Replace $foo with its value
>
> s/(\$\w+)/$1/gee; # Replace simple scalars with their values
>
> s/\$(\w+)/${$1}/g; # Another way to do it, if no strict refs
>
> But those are not necessarily the best ways, either. :-) Hope this helps!
And not necessarily correct ;-). I would try
s/\$foo\b/$foo/g;
Hope this helps,
Ilya
------------------------------
Date: 14 Aug 1997 19:24:28 GMT
From: Eyeh@cris.com (Edward Yeh)
Subject: mssql to perl question
Message-Id: <5svm1c$edi@examiner.concentric.net>
where can I get the perl extensions to access
a MS SQL server?
thanks
ed
--
======================================================================
Ed Yeh
email: eyeh@cris.com - edyeh@usa.net
web: http://www.cris.com/~eyeh
======================================================================
------------------------------
Date: 14 Aug 1997 18:54:28 GMT
From: lparillo@newshost.li.net (Parillo)
Subject: Re: Net::FTP documentation and examples
Message-Id: <5svk94$irq$1@news01.li.net>
On the Activeware port of Perl, I could not find perldoc.
Is it part of the standard distribution, or is the source
available elswhere and does it run on Windoze?
lparillo at suffolk dot lib dot ny dot us
Zenin (zenin@best.com) wrote:
: For docs, try perldoc Net::FTP. Look for "Debug" in it. If that's
: not enough, see my statement above.
: --
: -Zenin
: zenin@best.com
------------------------------
Date: Thu, 14 Aug 1997 13:43:29 -0500
From: Emiliano Lozano <emiliano@dsp.sps.mot.com>
Subject: Newbie
Message-Id: <33F351D0.36997472@dsp.sps.mot.com>
I am just learning how to use Perl and am going through the examples
in Learning Perl and I get an error on the first program that uses the
chomp command. The error reads:
"chomp" may clash with future reserved word at hello line 4.
syntax error in file hello at line 4, next 2 tokens "chomp ("
This is the program
#!/usr/bin/perl -w
print "What is your name? ";
$name = <STDIN>;
chomp ($name);
print "Hello, $name!\n";
I would appreciate any help on this simple matter.
------------------------------
Date: 14 Aug 1997 19:52:16 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Newbie
Message-Id: <5svnlg$gsn@news-central.tiac.net>
In article <33F351D0.36997472@dsp.sps.mot.com>,
Emiliano Lozano <emiliano@dsp.sps.mot.com> wrote:
>I am just learning how to use Perl and am going through the examples
>in Learning Perl and I get an error on the first program that uses the
>chomp command. The error reads:
>
>"chomp" may clash with future reserved word at hello line 4.
>syntax error in file hello at line 4, next 2 tokens "chomp ("
Can you check which version of perl you're using
perl -v
at the prompt should tell you. chomp was introduced in perl5.xxx so you
may be using a (now considered obsolete by many posters) perl 4.xxx
interpreter.
If you can upgrade the system (or have it upgraded) you'll be able to get
a lot more help here and from the modules available on CPAN.
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com | Pencom Systems Administration (work)
------------------------------
Date: Thu, 14 Aug 1997 14:43:47 -0400
From: Thad Welch <tw36027@glaxowellcome.com>
To: pegit.swedmap@mbox300.swipnet.se
Subject: Re: Perl 5 permanently loaded
Message-Id: <33F351E3.3C1B26A8@glaxowellcome.com>
I remember reading in the IIS docs that you can setup IIS to dynamically
link
in your custom DLLs into it server engine. There is a Perl300.dll. It
can't be that
easy. I haven't done this, and don't know what performance improvements
you could realize. You could put your perl installation on a (3 Meg)
ram drive :)
Pinne wrote:
> Hi Perlgurus,
>
> I've read that some NT web-servers can keep Perl 5
> in memory permanently.
> I'm using Activewares Perl 5.003 bld 306 on NT S 4.0
> with IIS 3.0.
> Using PerlIS for the moment but have some problems with it.
> This feature would lessen the need for PerlIs wouldn't it ?
> Does anyone know if IIS 3.0 can keep Perl.exe in memory
> permanently ?
> Gratefull for any answer.
> /regards
------------------------------
Date: Thu, 14 Aug 1997 14:01:12 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Perl and HTML
Message-Id: <olkvs5.l6e.ln@localhost>
Laurent Bailleux (laurent@syntem.eerie.fr) wrote:
: I want to run a perl script thanks to a html link,
: in order to create an always "up-to-date" web page.
: My script is "OK" in a shell, but I am not able to
: make it run in my browser.
Hmmm. That sounds similar to:
"My CGI script runs from the command line but not the browser.
Can you help me fix it?"
: What are the steps to reach this aim ?
See the above question in the Perl FAQ, part 9 ;-)
--
Tad McClellan SGML Consulting
tadmc@flash.net Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 14 Aug 1997 16:02:01 -0400
From: Denis Papathanasiou <dpapathanas@banmail.ml.com>
Subject: perl and oracle stored procedures
Message-Id: <33F36439.7FE8@banmail.ml.com>
How would I use perl (DBI and or Oracle DBD) to call a stored procedure
from an oracle db and return multiple rows?
I've tried using the stored procedure name as part of the
$cursor=$dbh->prepare statment, but that is apperently only for standard
sql statements.
I'm running Oracle 7.2 on a unix solaris OS, and I'm using
DBD-Oracle-0.44 with DBI-0.77.
Thanks in advance.
Regards,
Denis Papathanasiou
dpapathanas@banmail.ml.com
------------------------------
Date: Thu, 14 Aug 1997 12:51:47 -0700
From: Alan Hobesh <ahobesh@ucop.edu>
Subject: perl compiler error with CTlib
Message-Id: <33F361D2.470789B1@ucop.edu>
Hi,
I am using the perl compiler from Malcolm Beattie, alpha3 version with
perl 5.002 on an AIX platform. When I try to compile a small test
script with CTlib (CTlib is version 2.07) I get this error:
ld: 0711-317 ERROR: Undefined symbol: XS_Sybase__CTlib_ct_callback
This function is from the CTLib package. I have tried the -uCTlib.pm
option, but with the same result.
Here is the output:
Using C backend
executing bperl -MO=C,-v, a_test.pl > a_test.c
a_test.pl syntax OK
Total number of OPs processed: 357
NULLOP count: 12
Real 3.63
User 3.51
System 0.09
a_test.c generated successfully.
executing bperl cc_harness -O2 -o a_test a_test.c
gcc -D_ALL_SOURCE -I/home/ahobesh/tools/perl/lib/aix/5.002/CORE -O2 -o
a_test a_test.c -L/home/ahobesh/tools/perl/lib/aix/5.002/CORE -lperl
-ldbm -lld -lm -lc
-lbsd -lPW
collect2: ld returned 8 exit status
ld: 0711-317 ERROR: Undefined symbol: XS_Sybase__CTlib_ct_callback
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more
information.
Real 11.84
User 11.20
System 0.40
The perl source basically says use Sybase::CTlib and then calls
$dbh = new Sybase::CTlib $u,$p,$s,pwacgi;
if (!(defined($dbh))) { die; }
ct_callback(CS_CLIENTMSG_CB, \&msg_cb);
ct_callback(CS_SERVERMSG_CB, "srv_cb");
Any ideas how to get this to compile?
Thanks,
Alan Hobesh
------------------------------
Date: 14 Aug 1997 18:44:40 GMT
From: coop@housing1.stucen.gatech.edu (Brian "AGENT GORDON COLE" Atkins)
Subject: Re: perl question
Message-Id: <5svjmo$pvs@smash.gatech.edu>
Because variables inside variables are not "interpolated" as you
put it. The data in the file is read line by line into the $_ var,
and Perl doesn't look in there to see if it should do anything.
What you need to do is do a search and replace on each line like
this before you print it out:
s/\$cheese/foo/g;
In article <5sv8r4$4g@catapult.gatech.edu>,
+jeff <gt5146c@acmey.gatech.edu> wrote:
>I've got a script that does three things, set a variable $cheese = "foo",
>and open up file handle FILE for reading, and print the contents of this
>file to standard output. The file that has been opened has, somewhere in
>int, a string that looks like this: $cheese. When I output to stdout, why
>won't the $cheese in the file be interpolated into "foo"? The code looks
>like this:
>
>$cheese = "foo";
>open( FILE, "$file" );
>while( <FILE> ) { print "$_"; }
>
>
>and the contents of $file are as follows:
>
>=======
>this is just $cheese for me
>======
>
>Any ideas?
>
>+jeff
--
. . all is a blank before us,
All waits undream'd of in that region, that inaccessible land.
Walt Whitman
------------------------------
Date: Thu, 14 Aug 1997 14:44:49 -0400
From: Rob Starling <rstarling@btg.com>
Subject: Re: perl question
Message-Id: <33F35221.42D8@btg.com>
+jeff wrote:
>
> I've got a script that does three things, set a variable $cheese = "foo",
> and open up file handle FILE for reading, and print the contents of this
> file to standard output. The file that has been opened has, somewhere in
> int, a string that looks like this: $cheese. When I output to stdout, why
> won't the $cheese in the file be interpolated into "foo"? The code looks
> like this:
>
> $cheese = "foo";
> open( FILE, "$file" );
> while( <FILE> ) { print "$_"; }
>
> and the contents of $file are as follows:
>
> =======
> this is just $cheese for me
> ======
>
> Any ideas?
>
> +jeff
try:
while( <FILE> ) { s/\$(\w+)/${$1}/ge; print; }
--Rob
#include <disclaimer.h>
------------------------------
Date: 14 Aug 1997 14:54:11 -0400
From: mjcanup@pobox.com (Mark Canup)
Subject: Re: perl question
Message-Id: <5svk8j$hul@lennon.cc.gatech.edu>
in git.unix.questions, +jeff said the following...
// I've got a script that does three things, set a variable $cheese =
// "foo", and open up file handle FILE for reading, and print the contents
// of this file to standard output. The file that has been opened has,
// somewhere in int, a string that looks like this: $cheese. When I output
// to stdout, why won't the $cheese in the file be interpolated into
// "foo"? The code looks like this:
//
// $cheese = "foo";
// open( FILE, "$file" );
// while( <FILE> ) { print "$_"; }
//
//
// and the contents of $file are as follows:
//
// =======
// this is just $cheese for me
// ======
you need to evaluate the expression in the file. eg,
$cheese = 'foo';
open( FILE, $file ) || die $!;
while( <FILE> ) { eval "print \"$_\"\n"; }
or in perl5,
while( <FILE> ) { eval qq(print "$_\n"); }
is a little more readable.
hope this helps...
--
mark canup | all work and no play makes mark a dull boy
icslib/buzzback director | all work and no play makes mark a dull boy
mjcanup@pobox.com | all work and no play makes mark a dull boy
http://www.pobox.com/~mjcanup/ | all work and no play makes mark a dull boy
------------------------------
Date: Thu, 14 Aug 1997 14:17:29 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: perl question
Message-Id: <9klvs5.1ae.ln@localhost>
+jeff (gt5146c@acmey.gatech.edu) wrote:
: I've got a script that does three things, set a variable $cheese = "foo",
: and open up file handle FILE for reading, and print the contents of this
: file to standard output. The file that has been opened has, somewhere in
: int, a string that looks like this: $cheese. When I output to stdout, why
: won't the $cheese in the file be interpolated into "foo"? The code looks
: like this:
: $cheese = "foo";
: open( FILE, "$file" );
: while( <FILE> ) { print "$_"; }
while( <FILE> ) { s/\$(\w+)/${$1}/g; print}
Don't need the double quotes either.
Don't even need to specify that $_ is what is to be printed ;-)
Don't need the semicolon on the last statement in a block, though
it is often a good idea to put it in there anyway in case you add
a statement after it later.
: and the contents of $file are as follows:
: =======
: this is just $cheese for me
: ======
: Any ideas?
Perl does not interpolate *data*. It only interpolates code.
It does not know that the data you are reading in should be
interpreted as code (you can tell it that you want it to be
treated as code with eval() I suppose...).
--
Tad McClellan SGML Consulting
tadmc@flash.net Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 14 Aug 1997 12:51:19 -0500
From: "Eric G. Phillips" <eric@jriver.com>
Subject: Perlscript on Active Server Pages
Message-Id: <33F34597.C8E2261D@jriver.com>
Hey, I've got some quesions about PerlScript, specifically for Active
Server Pages.
First, does anyone know how to access variables submitted to an .asp
page by an on-line form? I know what the VBScript syntax looks like,
but I can't get Perlscript to do it.
Also, I'm trying to get Perlscript and VBScript to play nicely on an
Active Server Page. Since you can call Perlscript functions from
VBScript (see http://www.activestate.com/PerlScript/vbs-pl-param.asp ),
I figured I'd just have a few subroutines for doing stuff Perl is handy
for (i.e. regular expressions). But when I pass string variables
through Perl functions, the VBScript wigs out on my SQL statements.
The problem I'm working on is I have I Perl subroutine that I pass a
string into. I use the regular expression on the string and return the
new string. I can output in VBScript and it looks fine, but when I try
and run a simple SQL Query (i.e. SELECT * FROM table WHERE cell =
string), the asp server gives me an error (even if the subrouine does
nothing to the parameter its passed but return it):
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access 97 Driver] Syntax error in string in
query expression 'cell = 'string'.
Yet, if I don't run m Perl sub routine, the above statement executes
without any problem.
Any thoughts?
P.S. is there a Perlscript newsgroup out there somewhere?
------------------------------
Date: Thu, 14 Aug 1997 16:03:10 -0500
From: Ken Keith <ken.keith@marcgroup.com>
Subject: pipes and Open2
Message-Id: <33F3728E.1E77@marcgroup.com>
I am attempting to do bidirectional communication between a newly
written perl script and a very old legacy fortran program. I need the
two to handle each others I/O and wanted to know:
1) Is the IPC::Open2 library module reliable?
2) Should the following example found in the Programming Perl 2nd
Edition work for me?
use FileHandle;
use IPC::Open2;
$pid = open2( \*Reader, \*Writer, "my_fortran_prog" );
Writer->autoflush();
print Writer "stuff\n"; # send output to "my_fortran_prog"
$got = <Reader>; # receive info from "my_fortran_prog"
I am running on HP-UX version 10.10.
------------------------------
Date: 14 Aug 1997 14:14:34 -0400
From: ajs@lorien.ajs.com (Aaron Sherman)
Subject: Re: Problem With Join()
Message-Id: <5svhua$6sd@lorien.ajs.com>
perrella andrew c <perrella@ehsn9.cen.uiuc.edu> wrote:
>
>I have a data file that has information separated by new lines
>
>open(admin_info, "./admin/ip-admin.dat");
> undef $/;
> $admin_data = <admin_info>;
> $/ = '\n';
> close(admin_info);
>
> @ip_data = split(/\n/, $admin_data);
open(ADMIN,"<$file")||die($!);
chop(@ip_data = <ADMIN>);
close ADMIN
will do the same thing.
> local($new_info) = join("\n", @ip_data);
>
> open (change, ">./admin/ip-admin.dat");
> print change "$new_info";
> close (change);
>
>The Above code returns SCALAR(0x83c488) everywhere I would like to have a
>new line
This would indicate that you are inserting a reference to a scalar
variable. Did you perhaps try something like:
$n="\n";
join(\$n,@data);
?
>error type 2:
>
> local($new_info) = join('\n', @ip_data);
>
> open (change, ">./admin/ip-admin.dat");
> print change "$new_info";
> close (change);
>
>literally writes the charecters "\n" into my file.
'\n' is a litteral string "backslash followed by the lettern en".
-AJS
------------------------------
Date: Fri, 15 Aug 1997 00:44:09 +0300
From: eric <eric@migvan.co.il>
Subject: Problems with http file upload using cgi.pm and cgi-lib.pl
Message-Id: <33F37C29.7D41CD75@migvan.co.il>
I've been trying to use the http file upload with cgi-lib.pl and have
been having some trouble.
I run perl5 on NT (Intel). with IIS 4.0 (had the same problems with
2.0).
If anyone has a working example of an upload.pl file that works with the
above configuration, I'd love to see it.
And now to my problems.
I have been successful in uploading files to my server using both
libraries, however I can't seem to be able to upload files larger than
50k or so (with CGI.pm I got as far as: 59,000 bytes).
For the cgi-lib.pl library I used the sample fup.pl file from The
cgi-lib.pl Home Page http://www.bio.cam.ac.uk/cgi-lib/. I tried changing
the e $cgi_lib::maxdata value but the program went into a infinite loop
buffering 10's of megs of "I don't know what" in to my disk. It disabled
any other process and forced me to boot the server.
With CGI.pm things seemed a little more stable, however as stated above,
files larger than 59,000 bytes would not upload.
I'd appreciate any help.
--
***************************
* Eric Yellin *
* Migvan Effect *
* Development Manager *
* and WebMaster *
* Eric@migvan.co.il *
* http://www.migvan.co.il *
***************************
------------------------------
Date: Fri, 15 Aug 1997 00:45:34 +0300
From: eric <eric@migvan.co.il>
Subject: Problems with http file upload using cgi.pm and cgi-lib.pl
Message-Id: <33F37C7E.FAEDF7F1@migvan.co.il>
I've been trying to use the http file upload with cgi-lib.pl and have
been having some trouble.
I run perl5 on NT (Intel). with IIS 4.0 (had the same problems with
2.0).
If anyone has a working example of an upload.pl file that works with the
above configuration, I'd love to see it.
And now to my problems.
I have been successful in uploading files to my server using both
libraries, however I can't seem to be able to upload files larger than
50k or so (with CGI.pm I got as far as: 59,000 bytes).
For the cgi-lib.pl library I used the sample fup.pl file from The
cgi-lib.pl Home Page http://www.bio.cam.ac.uk/cgi-lib/. I tried changing
the e $cgi_lib::maxdata value but the program went into a infinite loop
buffering 10's of megs of "I don't know what" in to my disk. It disabled
any other process and forced me to boot the server.
With CGI.pm things seemed a little more stable, however as stated above,
files larger than 59,000 bytes would not upload.
I'd appreciate any help.
--
***************************
* Eric Yellin *
* Migvan Effect *
* Development Manager *
* and WebMaster *
* Eric@migvan.co.il *
* http://www.migvan.co.il *
***************************
------------------------------
Date: Thu, 14 Aug 1997 13:48:47 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Puting pattern in a variable
Message-Id: <fujvs5.m3e.ln@localhost>
Bob Wilkinson (b.wilkinson@pindar.co.uk) wrote:
: In article <33F0BE62.41C67EA6@teleglobe.ca>, Vladimir Parkhaev
: <vlad@teleglobe.ca> wrote:
: > I've created an array of patterns. And I need
: >
: > foreach $regex (@List) {
: > if ($_ =~ $regex) {
: > print "OK";
: > }
: > else {
: > print "No match";
: > }
: >
: > }
: Try something like
: my $regex = join("|",@List);
: if (/$regex/) {
If this is not in a larger loop where $regex gets recalculated, then try:
if (/$regex/o) {
^ much faster
: print "OK\n";
: } else {
: print "No match\n";
: }
--
Tad McClellan SGML Consulting
tadmc@flash.net Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 14 Aug 1997 12:27:56 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Gary Oberbrunner <garyo@oberbrunner.com>
Subject: Re: Simple question on s/// operator in expressions
Message-Id: <Pine.GSO.3.96.970814122238.11893I-100000@julie.teleport.com>
On Thu, 14 Aug 1997, Gary Oberbrunner wrote:
> I often want to do a substitution on a string and use the result
> 'in-line', without having to create a new variable just to hold the
> result (or modify the original string).
In addition to my earlier suggestion, I have another one that I ought to
post before Randal does. :-)
$foo = "my string\n";
print map { local($_) = $_; s/my/my new/; $_ } $foo;
Of course, this still creates a temporary variable, just in a different
(and possibly more convenient) way. Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 14 Aug 1997 21:22:02 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: sorting...
Message-Id: <EExA0q.F8t@world.std.com>
[a copy of this article was sent by e-mail to the cited author]
Anagrams of the Word <jefpin@bergen.org> writes:
>foreach (sort values %MAIN_CHOICES){
> print "$MAIN_CHOICES{$_} has a value of $_\n <br>";
>}
>That sorts alphabetically by values.
No it doesn't, Jeff. Run it and see.
If a hash is assigned a value, like this:
$hash{key} = 'value';
you can't say:
$hash{value}
and get 'key'. (Unless you explicitly assign $hash{value} = 'key' for
each key/value pair as well. And in most cases, that isn't something
you'd want to do.)
Just like the other sorting question you misanswered the other day,
the answer to this one is in the FAQ. <URL:http://www.perl.com/
CPAN/doc/manual/html/pod/perlfaq4/How_do_I_sort_a_hash_optionaly.html>
foreach (sort { $MAIN_CHOICES{$a} cmp $MAIN_CHOICES{$b} } keys %MAIN_CHOICES){
print "$MAIN_CHOICES{$_} has a value of $_\n <br>";
}
--
Andrew Langmead
------------------------------
Date: Thu, 14 Aug 1997 21:38:47 GMT
From: wdr1@cs.uchicago.edu (William Reardon)
Subject: Trouble compiling perl on Solaris 2.5
Message-Id: <EExAsn.I3F@midway.uchicago.edu>
I'm having trouble compiling perl 5.004_01 on a Solaris 2.5
box. The trouble seems to start when it's "Making POSIX (dynamic)".
I get the following:
Making POSIX (dynamic)
Note (probably harmless): No library found for -lposix
Note (probably harmless): No library found for -lcposix
Writing Makefile for POSIX
make[1]: Entering directory
... [does a few lines fine then ...]
cc -c -I/usr/local/include -O -DVERSION=\"1.02\"
-DXS_VERSION=\"1.02\" -fpic -I../.. POSIX.c
In file included from /usr/include/termios.h:13,
from POSIX.xs:34:
/usr/include/sys/termios.h:32: warning: `CTRL' redefined
/usr/local/include/sys/ttychars.h:65: warning: this is the location of
the previous definition
/usr/include/sys/termios.h:150: warning: `CINTR' redefined
/usr/local/include/sys/ttychars.h:71: warning: this is the location of
the previous definition
/usr/include/sys/termios.h:153: warning: `CKILL' redefined
/usr/local/include/sys/ttychars.h:70: warning: this is the location of
the previous definition
/usr/include/sys/termios.h:154: warning: `CEOT' redefined
/usr/local/include/sys/ttychars.h:76: warning: this is the location of
the previous definition
... [spews various other warnings then ...]
POSIX.xs:176: parse error before `*'
POSIX.xs:176: warning: data definition has no type or storage class
POSIX.xs: In function `XS_POSIX__SigSet_new':
POSIX.xs:2566: `POSIX__SigSet' undeclared (first use this function)
POSIX.xs:2566: (Each undeclared identifier is reported only once
POSIX.xs:2566: for each function it appears in.)
POSIX.xs:2566: parse error before `RETVAL'
POSIX.xs:2569: `RETVAL' undeclared (first use this function)
POSIX.xs:2569: `sigset_t' undeclared (first use this function)
POSIX.xs:2569: parse error before `)'
POSIX.xs: In function `XS_POSIX__SigSet_DESTROY':
POSIX.xs:2585: `POSIX__SigSet' undeclared (first use this function)
POSIX.xs:2585: parse error before `sigset'
POSIX.xs:2583: `sigset' undeclared (first use this function)
[... snip...]
I managed to get perl 5.003 compiled without a hitch under
Solaris 2.4, so I thought I'd give 5.004_01 a shot, but I'm stuck as
to how to go about solving the above problem. Any hints or
suggestions? If you'd like to the see the parts I cut out of the
above (or the config.sh), just let me know & I'll email them. I
wasn't sure how useful it would be to post the whole thing, and
didn't want bog down anyone.
Thanks,
-Bill
--
William Reardon wdr1@nhma.com
I will not hang donuts on my person
------------------------------
Date: Thu, 14 Aug 1997 14:10:30 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Uninitialized Value? Really?
Message-Id: <67lvs5.59e.ln@localhost>
Jeff Stampes (stampes@xilinx.com) wrote:
: I always use -w....
: I even use strict a lot...
: I thought I had the hang of ensuring good safe data under these
: rules, but 5.004_01 has me confused.
: In a script with a -w and no use strict, I have the code in one
: of my subroutines (Yes, I know getopt could be used for this, I'm
: just not....) :
: sub parse_args
: {
: my (@args) = (@_);
: my $pkg = '';
: my $ver = '';
: my $rid = '';
: my @platforms = ();
: my %platforms = (
: sun => 1,
: sol => 1,
: nt => 1,
: hp => 1,
: rs6000 => 1, );
[snip]
: if (@platforms == ()) {@platforms = keys %platforms} ## Line 317
I assume you are trying to check if @platforms has any elements in it?
-w is complaining about the () part, not about either @platforms
nor %platforms.
Can't you just do this instead?
if (@platforms == 0) {@platforms = keys %platforms} ## Line 317
: When I run this, I get:
: Use of uninitialized value at patch_build line 317.
: Hmmm...Sure looks like I initialized the only two values mentioned
: in like 317. Anyone have any idea what it's bitching about?
--
Tad McClellan SGML Consulting
tadmc@flash.net Perl programming
Fort Worth, Texas
------------------------------
Date: 14 Aug 1997 19:30:15 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Why doesn't sort take a reference any more?
Message-Id: <5svmc7$4bj@agate.berkeley.edu>
In article <33f318e9.526978643@news.rev.net>,
Bernard Cosell <bernie@rev.net> wrote:
> { $compsub = sub {second sort criteria} ; }
> ...
> sort $compsub (keys %hash) { ...}
>
> I'd been struggling a bit to try to understand what this error meant:
>
> not a GLOB reference at ./call_logs.pl line 96.
>
> which didn't seem to make much sense. But upon looking at the
> perlfunc man page, I discovered an interesting change from Camel 2.
> Camel 2 says "SUBNAME may be a scalar variable name (unsubscripted) in
> which case the value provides the name of (or a reference to) the
> actual subroutine to use" That has been -removed- from perlfunc.
What do you mean "removed"? In which version of perlfunc it was
there?
Overall it looks like a bug, so a bug report may help you a lot. I
also cannot get a case where the above description will lead to
confusion (off my sleeve).
Ilya
------------------------------
Date: Thu, 14 Aug 1997 16:11:37 -0500
From: John Tucker <jatucker@austin.dsccc.com>
Subject: XS (converting perl array to char**..)
Message-Id: <33F37489.54F1@austin.dsccc.com>
Hello,
I'm using perlxs to create a perl extension package for a set C
functions
and most of thes functions expect a "char**" member which represents an
array of file pathnames.
In my perl ".xs" file I would like to create a direct mapping
to the C function, by allowing someone to call it
from a perl script with a perl array variable for the files
and then be apple to translate that array into the "char**"
format expected by your function.
The following shows a the way I want the Perl interface to
the C function to be and the ".xs" code that I'm trying to develop:
---------------------------------------------------------------------
#!/usr/local/bin/perl
use MyExt;
my $result = &MyExt::func(@files, "fixed all errors.");
---------------------------------------------------------------------
int
func(files, branch="", comment=".")
char **files;
char *comment;
CODE:
{
int numFiles = ??; /* How do I set the count??? */
for(int i = 0; i < numFiles; i++) {
printf("file(%d) = %s", i, files[i]);
}
RETVAL = numFiles;
}
OUTPUT:
RETVAL
------------------------------------------------------------------
Thanks,
John
------------------------------
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 868
*************************************