[11633] in Perl-Users-Digest
Perl-Users Digest, Issue: 5233 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Mar 26 09:02:06 1999
Date: Fri, 26 Mar 99 06:00:24 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 26 Mar 1999 Volume: 8 Number: 5233
Today's topics:
Re: Anything lchown()-like in Perl? <halfdan@no-junk-mail.pison.com>
Re: array question (Bart Lateur)
Re: Calculating the current time in London or GMT+x <sb@sdm.de>
Re: Calculating the current time in London or GMT+x <neil.johnson@soton.sc.philips.com>
Re: calendar files (Jonathan Stowe)
Re: Copying and renaming files with invalid filenames (Bart Lateur)
Re: Copying and renaming files with invalid filenames <Wm.Blasius@ks.sel.alcatel.de>
Re: Database utilisation in web site design <fty@utk.edu>
Re: Deep Recursion error in a tie'd variable <rick.delaney@home.com>
Re: embeded Perl on Win32 <Marcin.Kasperski@softax.com.pl>
Re: FFT/FT in perl? <cschmitz@stud.informatik.uni-trier.de>
Re: Help with DBI and DBD::Oracle <cschmitz@stud.informatik.uni-trier.de>
Help... Running Perl on NT (H.A.)
Re: Help... Running Perl on NT <tavi367@ibm.net>
Re: Help... Running Perl on NT <tavi367@ibm.net>
Re: How to take advantage of Win9X printer drivers. <ibelgaufts@gfc-net.de>
Re: Is there a statement to activate a setenv command <dave@mag-sol.com>
Re: need help getting started! <cschmitz@stud.informatik.uni-trier.de>
Newbie: Browser keeps trying to download scripts.. <mbennett7777@hotmail.com>
Re: newbie:need help stripping out comments <coyote38@pacbell.net>
Re: Perl Error DBI.pm in @INC <cschmitz@stud.informatik.uni-trier.de>
Re: perl for win32 <tavi367@ibm.net>
Re: perl for win32 c4jgurney@my-dejanews.com
Re: Perl sending strange signal - Please help <ibelgaufts@gfc-net.de>
problem by using PERL & MySQL via DBI <Ralf.Berlau@Bigfoot.de>
Q on procmail piped to perl <tavi367@ibm.net>
Re: Quicksort won't work (Darren Smurthwaite)
Re: Reading results of external commands (Tad McClellan)
regexp + eval + coffee = hairloss <halfdan@no-junk-mail.pison.com>
Re: SENDMAIL not allowing Content-Type: multipart/mixed (I.J. Garlick)
SIGPIPE and SIGCHLD Signals on win32. Please tell me wh <ppa@itmasters.com>
Sorry to be angry, but i do not know what is wrong. <ppa@itmasters.com>
Re: Using Win32::Perms <carvdawg@patriot.net>
Re: Values of 'true' and 'false'? (Bart Lateur)
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 26 Mar 1999 12:25:15 +0000
From: Halfdan Ingvarsson <halfdan@no-junk-mail.pison.com>
Subject: Re: Anything lchown()-like in Perl?
Message-Id: <36FB7CAB.A61920AD@no-junk-mail.pison.com>
Abigail wrote:
>
> Halfdan Ingvarsson (halfdan@no-junk-mail.pison.com) wrote on MMXXXII
> September MCMXCIII in <URL:news:36FA88F4.B3EA4C22@no-junk-mail.pison.com>:
> $$ Haloo..
> $$
> $$ Was there any way in perl to change the owner of a symbolic link (ie.
> $$ not the file it points to) without resorting to 'system()' (which is
> $$ slow)?
>
> chown $uid, $gid, readlink $file;
Doesn't that work in exactly the same way as
chown $uid, $gid, $file
?
I was under the impression that chown() traverses the symbolic links
until it finds the original and the applies the chown() operation on
that file, not the symbolic link file itself.
What I'm trying to achieve is something like ('foo' is a symbolic link
pointing to 'bar'):
> ls -l /ext0/SAA
lrwxr-xr-x 1 halfdan user 27 Mar 25 19:50 current ->
/ext0/SAA/3.8SP1
drwxr-xr-x 7 root sys 111 Mar 25 19:05 3.8SP1
Then I do:
> lchown.pl root.sys current
And I would get:
> ls -l /ext0/SAA
lrwxr-xr-x 1 root sys 27 Mar 25 19:50 current ->
/ext0/SAA/3.8SP1
drwxr-xr-x 7 root sys 111 Mar 25 19:05 3.8SP1
Ie. the same functionality as:
> chown -h root.sys current
Anyone? Pweeease?
Ciao,
H.
Halfdan Ingvarsson, Guru, Pison Ltd. -- What do you want to crash today?
'What sets us programmers apart from other trades is that we have the
ability to create our own tools if we don't like the current ones.'
---==[ Unsolicited e-mail will be proofread at a $1500 charge ]==---
------------------------------
Date: Fri, 26 Mar 1999 10:16:13 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: array question
Message-Id: <36fc5da9.2607784@news.skynet.be>
gwebb@reedtech.com wrote:
>> But to deal with 'foo.bar.txt' properly, you want:
>>
>> $file_extension =~ s/.*\.//g;
>
>Thanks for catching my missing '*'. However with the star added
>
>$file_extension =~ s/[^.]*\.//g;
>
>will properly deal with 'foo.bar.txt'. Also note that the 'g' flag is
>unnecessary in your case since '.*' will slurp up the whole string, then
>backtrack to the first '.' character it finds.
I can't follow. Why do something so complicated (and possibly slow?)
$file_extension =~ s/.*\.//;
ONE substitution. Kill everything up to and including the last period.
Note that this will fail (as will yours ;-) if there is NO extension,
i.e. no period. The extension should be a null string in that case.
Bart.
------------------------------
Date: 26 Mar 1999 10:11:05 GMT
From: Steffen Beyer <sb@sdm.de>
Subject: Re: Calculating the current time in London or GMT+x
Message-Id: <7dfmfp$480$1@solti3.sdm.de>
In article <36FA5AD1.3EEE2C9@soton.sc.philips.com>, Neil Johnson <neil.johnson@soton.sc.philips.com> wrote:
> Californian daylight saving , I believe is very similar to British and
> European daylight saving. The only difference is that in Britain and
> Europe the clocks go forward a week earlier than California (28th March).
> The clocks go back on the same date.
AFAIK, DST begins and ends also in the middle of a week in the U.S.
In Europe, however, switching always occurs on a weekend, in the night
from saturday to sunday, at 2 o'clock (respectively, 3) in the morning.
Regards,
--
Steffen Beyer <sb@engelschall.com>
http://www.engelschall.com/u/sb/download/ (Free Perl and C Software
http://www.perl.com/CPAN/authors/id/STBEY/ for Download)
New: Build'n'Play 2.1.0 (all-purpose Unix batch installation tool)
http://www.oreilly.de/catalog/perlmodger/bnp.html
------------------------------
Date: Fri, 26 Mar 1999 10:40:09 GMT
From: Neil Johnson <neil.johnson@soton.sc.philips.com>
Subject: Re: Calculating the current time in London or GMT+x
Message-Id: <36FB6409.A2145972@soton.sc.philips.com>
> But (gmtime)[9] should give you
> the $isdst for GMT at that moment.
I believe that gmtime[8] will give you $isdst.
NJ
------------------------------
Date: Fri, 26 Mar 1999 11:42:25 GMT
From: gellyfish@gellyfish.com (Jonathan Stowe)
Subject: Re: calendar files
Message-Id: <36fb7280.9215325@news.dircon.co.uk>
On Thu, 25 Mar 1999 16:37:56 -0700, ray zeuner <rzeuner@buyitnow.com>
wrote:
>Hello,
>
>Doesn anyone know of any calendar.pl files that work under unix. Such as
>retrieving the current months data into some type of array.
>
Do you mean some thing like the example I posted in:
<http://www.dejanews.com/[ST_rn=ps]/getdoc.xp?AN=457176881>
/J\
------------------------------
Date: Fri, 26 Mar 1999 10:22:21 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Copying and renaming files with invalid filenames
Message-Id: <36fd5f36.3004727@news.skynet.be>
Nick Hall wrote:
>I just got a CD-R from a company that used a Mac to create all the datasets
>(and burn the CD). It is filled with a whole bunch of files with invalid
>filenames that don't even come close to ISO9660 (or Joliet, or whatever).
>There are directories that look like:
>
>SECTION 25/26
>99' Priced Sec. 03
>
>and files that look like:
>
>03-7974/7975
>
>If I try to read in these files with a "cat" command under linux or "cd" to
>these directories, I get an error about the path not being found. I even
>tried it under windows in a fleeting hope, but to no avail. I need to be able
>to read these files. I was wondering if someone would help me out. Ideally, I
>need a program that can go through the CD and copy the entire thing to the
>hard drive and if it finds any bad filenames, it will change the invalid
>character to something else (probably a "-" or something like that).
If your system can't read the files, Perl won't be able to read them
either.
You really should complain to those people. If they check an option "use
ISO compatible filenames" (or something similar) when burning the CD,
uyour troubles are over. Not too much work, and CD-R's are really cheap,
so that *must* be the best solution.
Bart.
------------------------------
Date: Fri, 26 Mar 1999 13:33:18 +0100
From: William Blasius #42722 <Wm.Blasius@ks.sel.alcatel.de>
To: Nick Hall <nick_hall@usa.net>
Subject: Re: Copying and renaming files with invalid filenames
Message-Id: <36FB7E8E.15FB7483@ks.sel.alcatel.de>
Nick Hall wrote:
>
> Hi,
>
> I just got a CD-R from a company that used a Mac to create all the datasets
> (and burn the CD). It is filled with a whole bunch of files with invalid
> filenames that don't even come close to ISO9660 (or Joliet, or whatever).
> There are directories that look like:
>
> SECTION 25/26
> 99' Priced Sec. 03
>
> and files that look like:
>
> 03-7974/7975
>
> If I try to read in these files with a "cat" command under linux or "cd" to
> these directories, I get an error about the path not being found. I even
> tried it under windows in a fleeting hope, but to no avail. I need to be able
> to read these files. I was wondering if someone would help me out. Ideally, I
> need a program that can go through the CD and copy the entire thing to the
> hard drive and if it finds any bad filenames, it will change the invalid
> character to something else (probably a "-" or something like that). The
> problem I've been having is that whatever command (e.g. "cp") I try to copy
> the files, it reports that it can't find the file. Can someone help me
> please? I appreciate any help.
>
> Nick
This may sound trivial, and I don't know if it will work in your case,
but if
you have enough free disk space you might be able to copy the CD
wholesale to
a filetree on your hard drive with cpio (I'd try into an otherwise
disposable
partition ;-) and then write a little script to go through the
directories as
files and edit them in place to produce valid filenames.
Good luck,
Wm Blasius
Stuttgart
------------------------------
Date: Fri, 26 Mar 1999 07:59:19 -0500
From: Jay Flaherty <fty@utk.edu>
Subject: Re: Database utilisation in web site design
Message-Id: <36FB84A7.92F3B351@utk.edu>
liu singloon wrote:
> Does anyone know of some programs that will allow me to
>
> 1. Create an easy to use database ? - I have Access 7 but don't know much
> about it.
> 2. Generate custom designed html files for database data on movie release
> dates ?
I see your web hosting service provides mySQL. mySQL is a free and very
robust database. Go to www.mysql.com
------------------------------
Date: Fri, 26 Mar 1999 13:46:39 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Deep Recursion error in a tie'd variable
Message-Id: <36FB91AB.718E04B4@home.com>
[posted & mailed]
Kelly E Jones wrote:
>
> I didn't know about the 'closure' construct. This is useful (I
> learned something!), but I'm not sure it's what I want here: If I
> understand correctly, this will always use the value from the @a array
> which existed when @b was tied?
This is true of my example.
> But if @a changes after the tie, then I want @b to change as well.
Then remove this line that makes a copy of the original array.
$constant = [ @$constant ];
> (I wasn't able to get your code to run yet, due to syntax problems).
Syntax problems? From moi? I did cut and paste it from a tested
program. :-(
[quote from Camel]
> I extrapolate this to mean that if I create a hard reference to a
> value, that reference is completely independant of the original
> variable name, and thus accessing the thingy through the reference
> should not involve a FETCH on the original variable name. What am I
> missing?
This is interesting. I never noticed this property of tied variables
before. Your analysis seems correct. I don't know what's going on
internally but I suspect that the reason FETCH is called in your array
case is because the reference you have is for the *array* and not the
scalar elements contained within it.
The FETCH method for tied arrays is for access to the scalar elements of
an array. When you store a reference to the array, you increase the
reference count of the array, but not its elements. Imagine each
element of an array as a scalar variable that you must access to get at
the value inside.
@a = ($a0, $a1, $a2);
When you ask for $a[2], you are actually asking for the value of $a2
which will call Package->FETCH($a2). Now take a reference to @a:
$ra = \@a;
When you ask for $ra->[2], you are still asking for the value of $a2 and
thus Package->FETCH($a2) is called.
Obviously there are not really named variables $a0, $a1, etc. contained
in @a but you can see that whether you are accessing an element directly
or through a reference, it is the SAME element. So FETCH is called.
There is a nice discussion of this (unrelated to tie) in the first
chapter of the Panther book.
Hope this helps.
--
Rick Delaney
rick.delaney@home.com
------------------------------
Date: Fri, 26 Mar 1999 10:58:40 GMT
From: Marcin Kasperski <Marcin.Kasperski@softax.com.pl>
Subject: Re: embeded Perl on Win32
Message-Id: <36FB6424.847A2EB6@softax.com.pl>
Jurgen, could you tell me how have you compiled your perl (taking just
defaults or is some other way) ?
I suspect that the problem is caused by either different perl
configuration or the fact, that we use Microsoft Visual C++
-- Marcin Kasperski Marcin.Kasperski<at>softax.com.pl
-- marckasp<at>friko6.onet.pl
-- Moje pogl1dy s1 moimi pogl1dami, nikogo poza mn1 nie reprezentuj1.
-- (My opinions are just my opinions.)
------------------------------
Date: 26 Mar 1999 10:16:25 GMT
From: Christoph Schmitz <cschmitz@stud.informatik.uni-trier.de>
Subject: Re: FFT/FT in perl?
Message-Id: <7dfmpp$gef$2@fu-berlin.de>
mnanao@sbl.salk.edu wrote:
: Does anyone have any routines for calculating FFTs or FTs
: in perl? I'm sure there is a way to embed a C/C++ FFT into
Have a look at the Perl Data Language (PDL), available from CPAN. This
might be what you're looking for.
Christoph
--
-- Christoph Schmitz <cschmitz(at)stud.informatik.uni-trier.de> --
The generation of random numbers is too important to be left to chance.
------------------------------
Date: 26 Mar 1999 10:42:41 GMT
From: Christoph Schmitz <cschmitz@stud.informatik.uni-trier.de>
Subject: Re: Help with DBI and DBD::Oracle
Message-Id: <7dfob1$gef$4@fu-berlin.de>
David Burch <burchd@erols.com> wrote:
: I have built both DBI and DBD::Oracle on a Solaris system. I can
: connect,
: [...]
: I have enclosed my database table description as well as a sample perl
: program that I am using. A plain select on the CLOB returns 80
: characters
Hi,
I don't have any experience with Oracle LOB types, but I recall reading
about them in the DBD::Oracle pod. Here's an excerpt:
When fetching LOBs, they are treated just like LONGs and
are subject to $sth->{LongReadLen} and
$sth->{LongTruncOk}.
$sth sounds like DBI --> perldoc DBI:
LongReadLen (unsigned integer, inherited)
This attribute may be used to control the maximum
length of 'long' ('blob', 'memo' etc.) fields which
the driver will read from the database automatically
when it fetches each row of data.
As I said, I've never used LOBs yet, but this might be the problem.
Christoph
--
-- Christoph Schmitz <cschmitz(at)stud.informatik.uni-trier.de> --
------------------------------
Date: 26 Mar 1999 12:07:28 GMT
From: ns-am528@chebucto.ns.ca (H.A.)
Subject: Help... Running Perl on NT
Message-Id: <7dfta0$hgd$1@News.Dal.Ca>
I've been having so many trouble getting Perl script to run on my NT server 4.0
that about to quite :-( I configured everything right according to the
instructions and the help I got from the newsgroup.
The error I'm getting lately is simply when I click on Submit in one of my HTML
forms to run the .PL file, it opens a Save As window instead of executing the
script? Does anyone out there know why I'm getting that?
Any help or hints will greatly be appreciated.
Thanks
------------------------------
Date: Fri, 26 Mar 1999 08:19:02 -0500
From: "tavi" <tavi367@ibm.net>
Subject: Re: Help... Running Perl on NT
Message-Id: <36fb88b9@news1.us.ibm.net>
>H.A. wrote in message <7dfta0$hgd$1@News.Dal.Ca>...
>I've been having so many trouble getting Perl script to run on my NT server
4.0
>that about to quite :-( I configured everything right according to the
>instructions and the help I got from the newsgroup.
>
>The error I'm getting lately is simply when I click on Submit in one of my
HTML
>forms to run the .PL file, it opens a Save As window instead of executing
the
>script? Does anyone out there know why I'm getting that?
Join this mailing list. Good help is availabe there.
Perl-Win32-Web@listserv.ActiveState.com
walter
------------------------------
Date: Fri, 26 Mar 1999 08:23:05 -0500
From: "tavi" <tavi367@ibm.net>
Subject: Re: Help... Running Perl on NT
Message-Id: <36fb89ac@news1.us.ibm.net>
H.A. wrote in message <7dfta0$hgd$1@News.Dal.Ca>...
>I've been having so many trouble getting Perl script to run on my NT server
4.0
>that about to quite :-( I configured everything right according to the
>instructions and the help I got from the newsgroup.
>
>The error I'm getting lately is simply when I click on Submit in one of my
HTML
>forms to run the .PL file, it opens a Save As window instead of executing
the
>script? Does anyone out there know why I'm getting that?
The 'Save As...' dialog is a warning that there is something wrong with your
script and the browser has no clue what to do with it.
I suggest you 'Save' it to disk, open the file and see what it says. 9 times
out 10 it will give you the perl error message.
I always test my scripts from the command line before sending it through the
web server.
Also, if you used CGI.pm to creae your script, it has a built-in, automatic,
feature that allows you to run your CGI script from the command prompt.
Hope this helps.
Walter
------------------------------
Date: Fri, 26 Mar 1999 11:54:46 +0100
From: =?iso-8859-1?Q?J=FCrgen?= Ibelgaufts <ibelgaufts@gfc-net.de>
Subject: Re: How to take advantage of Win9X printer drivers.
Message-Id: <36FB6776.807A1375@gfc-net.de>
Matthew,
Yes, this helps indeed. Thanks.
Juergen Ibelgaufts
---------------------------------------
Matthew Bafford schrieb:
>
> Wed, 24 Mar 1999 13:10:46 +0100 -- J|rgen Ibelgaufts <ibelgaufts@gfc-net.de>:
> -> As wordpad forks itself off, your command line or perl program will be released
> -> immediately and there is no conveniant way to find out when wordpad has finished
> -> printing, so you can't find out when to delete it.
>
> FWIW, look into the /w switch to the 'start' program.
>
> -> Hoe this helps
>
> Hope this helps!
>
> -> Juergen Ibelgaufts
>
> --Matthew
------------------------------
Date: Fri, 26 Mar 1999 10:13:06 GMT
From: Dave Cross <dave@mag-sol.com>
Subject: Re: Is there a statement to activate a setenv command
Message-Id: <7dfmjd$cr4$1@nnrp1.dejanews.com>
In article <MPG.1163fd0efcb348cf9897c6@nntp.hpl.hp.com>,
lr@hpl.hp.com (Larry Rosler) wrote:
> [Posted and a courtesy copy sent.]
>
> In article <36FA526A.E49A5EC5@cs.ucc.ie> on Thu, 25 Mar 1999 15:12:42
> +0000, sean O'Connor <oconnors@cs.ucc.ie >says...
> > I'm running a perl program to access an oracle database using oraperl.
> > To make the program run I have to type in the command
> > 'setenv LD_LIBRARY_PATH ${ORACLE_HOME}/lib', before I run it. I now have
> > to run the program straight from the net using cgi so I can't type the
> > setenv command and I was wondering if there is any command in perl that
> > will run the setenv statement for me.
>
> $ENV{LD_LIBRARY_PATH} = "$ORACLE_HOME/lib";
>
> will set the environment variable for the Perl program itself and for
> its children.
Given that $ORACLE_HOME is an environment variable, you should probably write
it like this:
$ENV{LD_LIBRARY_PATH} = "$ENV{ORACLE_HOME}/lib";
I'm not that familiar with oraperl, but you sometimes need to do a similar
thing with sybperl. In those cases you would need to set the variable within
a BEGIN block. This may also be the case with oraperl.
Dave...
--
Dave Cross
Magnum Solutions Ltd: <http://www.mag-sol.com/>
London Perl M[ou]ngers: <http://london.pm.org/>
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 26 Mar 1999 10:23:48 GMT
From: Christoph Schmitz <cschmitz@stud.informatik.uni-trier.de>
Subject: Re: need help getting started!
Message-Id: <7dfn7k$gef$3@fu-berlin.de>
sheela tiwary <stiwar1@gl.umbc.edu> wrote:
: I have a simple perl script that works fine when I run it in the UNIX
: environment. However it won't run on the web-page, the web page just
: displays the contents of the file instead of the results.
You'll have to configure your web server so that it knows when to return
just the contents of a file (as in your case) and when to run the file
as an executable and return the output. AFAIK, this is usually done by specifying
an extension (if it ends with .pl, execute it), or by specifying a location
(if it is in /cgi-bin, execute it). Of course, it depends on the web server
you are using.
Refer to the documentation of your web server and/or to your web
administrator. Many sites (like ours) don't allow "ordinary" users to
use scripts for security reasons.
HTH,
Christoph
--
-- Christoph Schmitz <cschmitz(at)stud.informatik.uni-trier.de> --
The generation of random numbers is too important to be left to chance.
------------------------------
Date: Fri, 26 Mar 1999 08:25:20 -0500
From: Mark Bennett <mbennett7777@hotmail.com>
Subject: Newbie: Browser keeps trying to download scripts..
Message-Id: <36FB8AC0.32FBB599@hotmail.com>
I was able to install perl and run these scripts on other machines but
one machine is being a pain.
no matter what when the script is run it tries to either download the
file or runs the script from the perl exe in the dos window.
(yes, I'm on the machine of the evil empire... sorry)
Any insight would be appreciated.
Thanks
Mark
mbennett7777@hotmail.com
------------------------------
Date: Fri, 26 Mar 1999 01:04:19 -0800
From: "coyote38" <coyote38@pacbell.net>
Subject: Re: newbie:need help stripping out comments
Message-Id: <X5IK2.445$uu1.8849@typhoon-sf.pbi.net>
I was converting a bunch of c to perl and wrote this bit of code to handle
the comments. You could easily modify it to strip out the comments. The
nit-picks won't like it, but the code works.
#! /usr/bin/perl5 -w
#
# Eric Allen, PhD
# 01-MAR-1999
#
# Converts c comment lines to perl comment lines in a given c file.
#
if(! $ARGV[0])
{
print "Convert c comments in what file?\n --> ";
$convertFile = <STDIN>;
if(! $convertFile)
{
die("Terminated. No filename entered.\n");
}
}
else
{
$convertFile = $ARGV[0];
}
chomp $convertFile;
$commentOn = 0;
open INFILE,"<$convertFile" || die("Terminated. Could not open input file
$convertFile\n");
open OUTFILE,">$convertFile.conv" || die("Terminated. Could not open output
file $convertFile.conv\n");
while($nextLine = <INFILE>)
{
chomp $nextLine;
if($nextLine =~ /\/\*/) # if $nextLine matches /*
{
$left = $`;
$right = $';
$right =~ s/\*\///g; # substitute */ with nothing
$newLine = "$left"."# "."$right\n";
if($nextLine !~ /\*\//) # if $nextLine does not also contain */
{
$commentOn = 1; # turn comment flag on
}
print OUTFILE "$newLine";
}
elsif($commentOn) # if comment flag is on
{
if($nextLine =~ /\*\//) # if $nextLine matches */
{
$commentOn = 0; # turn comment flag off
$nextLine =~ s/\*\///g; # substitute */ with nothing
}
$newLine = "# "."$nextLine\n";
print OUTFILE "$newLine";
}
else
{
print OUTFILE "$nextLine\n";
}
}
close INFILE;
close OUTFILE;
print "All done.\n"
Martha Ferguson wrote in message <36FA97BD.522CE287@cca.rockwell.com>...
>I have a file that I want to strip out comments. Comments start with
>/* and end with */. Some of these comments extend over several
>lines. If I do a regular expression:
>
> s{/\*.*?\*/}[]gmx; (global replace of comment line with blank line)
>
>
>I get all the lines that start and end with /* */ but none of the lines
>that span multiple lines ( neither the first nor last.in the
>multi-line). But if I do the range operator:
>
> if (/\/\*/ .. /\*\//)
>
>all comments lines are found, but I don't know how to get those lines
>replaced with a blank line. I need to have the same number of lines in
>the file after comments are replaced as there was with the comments.
>
>Any suggestions would be greatly appreciated.
>
>Thanks, Matha.
>
------------------------------
Date: 26 Mar 1999 10:02:20 GMT
From: Christoph Schmitz <cschmitz@stud.informatik.uni-trier.de>
Subject: Re: Perl Error DBI.pm in @INC
Message-Id: <7dflvc$gef$1@fu-berlin.de>
Simon Ng <simon_ng@twtsg.com.sg> wrote:
: Hi,
: I can't seem to some perl to run and was return with this message.
: [...]
: Can't locate DBI.pm in @INC (@INC contains: C:\PERL\lib C:\PERL\site\lib .)
Hi Simon,
you need the DBI module, which is a generic database interface, and a
driver module (e. g. DBD-DB2, DBD-Oracle, ...) matching the database system
to be used. You can get both from the CPAN (www.cpan.org).
HTH,
Christoph
--
-- Christoph Schmitz <cschmitz(at)stud.informatik.uni-trier.de> --
The function of the expert is not to be more right than other people,
but to be wrong for more sophisticated reasons.
-- Dr. David Butler, British psephologist
------------------------------
Date: Fri, 26 Mar 1999 08:31:23 -0500
From: "tavi" <tavi367@ibm.net>
Subject: Re: perl for win32
Message-Id: <36fb8ba1@news1.us.ibm.net>
BRIAN VIVIAN wrote in message
<7deh5s$22v$1@nclient3-gui.server.virgin.net>...
>hi I have recently installed Gurusary Sarathy Perl version 5.004_02.
>when I try to run scripts which require cgi-lib.pl I get this error
>message:-
>
>Can't locate cgi-lib.pl in @INC (@INC contains: C:\USR\LOCAL\lib\site
>C:\USR\LOCAL\lib c:\perl\lib c:\perl\lib\site c:\perl\lib\site .) at
>c:\perldev\shopscript\bike.pl line 3.
>Process completed with exit code 2
>
>Has anyone got any ideas of what the solution is? I guess it is something
to
>do with the location of cgi-lib.pl (assuming that it is actually located
>somewhere).
This is external script has to be in either your Perl/lib directory, and if
not in there, you need to define to your script where.
Do you have this script?
Get it here... http://cgi-lib.stanford.edu/cgi-lib
Then you need to place it here...
C:\Perl\5.005\lib
or where ever you installed your perl.
Now it should work.
Walter
------------------------------
Date: Fri, 26 Mar 1999 13:27:14 GMT
From: c4jgurney@my-dejanews.com
Subject: Re: perl for win32
Message-Id: <7dg1v9$lq8$1@nnrp1.dejanews.com>
In article <7deh5s$22v$1@nclient3-gui.server.virgin.net>,
"BRIAN VIVIAN" <brian.vivian@virgin.net> wrote:
> hi I have recently installed Gurusary Sarathy Perl version 5.004_02.
> when I try to run scripts which require cgi-lib.pl I get this error
> message:-
>
> Can't locate cgi-lib.pl in @INC (@INC contains: C:\USR\LOCAL\lib\site
> C:\USR\LOCAL\lib c:\perl\lib c:\perl\lib\site c:\perl\lib\site .) at
> c:\perldev\shopscript\bike.pl line 3.
> Process completed with exit code 2
>
> Has anyone got any ideas of what the solution is? I guess it is something to
> do with the location of cgi-lib.pl (assuming that it is actually located
> somewhere).
>
Have you tried using the windows 'find' utility to see if you actually have
the file on your system.
If you don't it can be obtained from http://cgi-lib.stanford.edu/cgi-lib/
Personally I'd chose cgi.pm instead.
HTH
Jeremy Gurney
SAS Programmer | Proteus Molecular Design Ltd.
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 26 Mar 1999 12:04:59 +0100
From: =?iso-8859-1?Q?J=FCrgen?= Ibelgaufts <ibelgaufts@gfc-net.de>
Subject: Re: Perl sending strange signal - Please help
Message-Id: <36FB69DB.54064490@gfc-net.de>
Just for your information ( in reply to myself ): I just found
out that the SIGILL problem is *not* caused by Perl because it
also occurs when the Cobol programs are not launched by a Perl
program.
Juergen Ibelgaufts
----------------------------------------------------------------
J|rgen Ibelgaufts schrieb:
>
> Hello,
>
> I have a pPerl/Tk program on Windows NT that launches some other applications from
> time to time. The other application is a command script that sets some environment
> variables and calls an executable written in Microfocus Cobol 4.0. Launching is
> done by opening and reading a pipe like this:
>
> $cmd = "ta.cmd";
> open P, "$cmd 2>&1 |" ;
> while (<P>) {
> print L; # Print into a log file
> &progressprint ($_); # Print into a Tk listbox (part of a toplevel
> window)
> }
> close P;
>
> It works well on most of the NT machines (Windows NT 4.0 workstation or server),
> but on some machines it always fails. The Cobol runtime system comes out with a
> fatal error message "Unexpected signal 4 received".
>
> I read the Visual C documentation about signals and it says that signal 4 is
> SIGILL (illegal instruction) which is not used on Windows NT.
>
> Now it seems to me that Perl sends a SIGILL through the pipe and I have not the
> slightest idea why it happens and what to do against it.
>
> Note that the cobol part (without Perl) always runs well on all machines, and the
> Perl/Cobol combination always runs well on most machines. As far as I can see all
> our machines have identical hardware and software versions.
>
> Now I am completely run out of ideas and need help.
>
> NB. I use GS-Perl 5.005.000 and Tk8.008 built with MS Visual C 4.00.
>
> Thanks in advance
>
> Juergen Ibelgaufts
------------------------------
Date: 26 Mar 1999 14:53:24 +0100
From: "Ralf Berlau" <Ralf.Berlau@Bigfoot.de>
Subject: problem by using PERL & MySQL via DBI
Message-Id: <01be778f$b9ed06e0$0a02a8c0@INFO>
Hi all,
i have installed
PERL 5.005_02 built for i586-linux
MySQL 3.21.33.b
DBI-1.06
Msql-Mysql-modules-1.2014
on my S.u.S.E 6.0 Linux-System without any errors at installation.
Perl itself runns well. Mysqlshow shows the databases mysql and test.
But i get truoble with th following script:
--------------------------------------------------------------
#!/usr/bin/perl -w
#
# inout.pl: Connects and disconnects from a specified db
use DBI;
$user ="";
$pass="";
$database="test";
$dsn = "DBI:mysql:$database";
#connect to db
$dbh = DBI=>connect ($dsn,$user,$pass);
if ( !defined $dbh ){
die "Cannot connect to MySQL server: $DBI::errstr\n";
}
#Disconnect from the db
$dbh->disconnect;
exit;
--------------------------------------------------------------
starting the command perl -c inout.pl the following message appears
Too many arguments for connect at inout.pl line 14, near "$pass)"
inout.pl had compilation errors.
lokking for DBI=>Connect() in perldoc DBI shows that connect need these
three arguments.
After deleting the last argument ,$pass the result of "perl -c inout.pl" is
"inout.pl syntax ok".
Running this script with "perl -w inout.pl" the message
connect() on closed fd at inout.pl line 14.
Can4t locate auto/DBI/disconnect.al in @INC (@INC contains:
/usr/lib/perl5/5.00502/i586-linux
/usr/lib/perl5/5.00502
/usr/lib/perl5/site_perl/5.005/i586-linux
/usr/lib/perl5/site_perl/5.005 .) at inout.pl line 21
Whats wrong, any idea?
Ralf....
------------------------------
Date: Fri, 26 Mar 1999 08:13:58 -0500
From: "tavi" <tavi367@ibm.net>
Subject: Q on procmail piped to perl
Message-Id: <36fb8789@news1.us.ibm.net>
I want to be able to send inbound e-mail to a Perl script, and this is what
I have done toward that goal.
I am placing this question in both the Perl group and the Procmail mail list
in case someone, in either group, has done this before.
I tried both of these procmail receipts...
:0
* ^TO()perl@tscinternet.com
* HB ?? ? $HOME/vmail/perl/test.pl
| true
:0
* ^TO()perl@tscinternet\.com
| $HOME/vmail/perl/test.pl
Each time, the procmail.log file says...
^@
That's it.
Each time, each receipt, nothing else.
I know the Perl works, because...
- it creates the .out from the prompt
- it creates the .out file with: 'cat my.txt | test.pl'
At least, I think that it means the script works, and is executable.
-rwxrwxr-x 1 walter 393 Mar 25 22:07 test.pl
(The scripts are below)
I even have a shell script that will work...
:0
* ^TO()demo@tscinternet.com
* HB ?? ? $HOME/vmail/perl/demo "`date`"
| true
This works just fine. The shell script creates a .out file containing the
past message.
Anyone have any ideas?
Walter
The scripts...
==========================
#! /usr/local/bin/perl5 -w
$/ = undef; # undefine line terminator
my $message = <STDIN>; # slurp the whole file
$/ = "\n"; # redefine line terminator
open(LOG, ">>./test.out") or die "$0: Unable to open test.out: $!";
print LOG '===============================', "\n";
print LOG $message, "\n\n";
close LOG;
# eof
============================
#!/bin/sh
nl='
'
{ cat; [ -n "$@" ] && echo "$@$nl";} >>$0.out
# EOF
============================
------------------------------
Date: Fri, 26 Mar 1999 13:44:26 GMT
From: darrenNO.SPAMsmurthwaite@unn.ac.uk (Darren Smurthwaite)
Subject: Re: Quicksort won't work
Message-Id: <36fb8e73.684051664@news>
Thanks very much for that. A couple of things I did know but was just
careless and it is just for coding practice. But a lot of it helped
clear points I've missed.
Thank you all
da5
------------------------------
Date: Thu, 25 Mar 1999 19:06:47 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Reading results of external commands
Message-Id: <n2jed7.e31.ln@magna.metronet.com>
Matt Riggsby (mriggsby@sybex.com) wrote:
: I'd like to run a shell command (say, through the system command) and
^^^^^^
^^^^^^
: read the results of that command into a variable.
If you read the description for system() in perlfunc,
it will tell you how you do that.
perldoc -f system
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 26 Mar 1999 12:32:06 +0000
From: Halfdan Ingvarsson <halfdan@no-junk-mail.pison.com>
Subject: regexp + eval + coffee = hairloss
Message-Id: <36FB7E46.272CB3F6@no-junk-mail.pison.com>
I'm trying to do a path substitution perl script. Not very slick with
escapes or eval at the moment.. :-(
What I'm trying to achieve is to do something like:
$PATH_SUBST = "%\\%/% /^S:/^\/server/";
Then I call a function called 'pathSubst' which I give a path and then I
get returned the new substituted path
What I've got so far:
sub pathsub {
local ($str) = @_;
local ($link);
@linktab = split(' ', $PATH_SUBST);
foreach $link (@linktab) {
$link .= 'g'; # We want global replacements...
eval("\$str =~ s$link");
print "$tmp\n";
}
return $str;
}
But it doesn't werk and I can't for the life of me figure out why.
Heelp!!
(BTW. I'm trying to do this without resorting to regexp libraries, but
if everything else fails... etc.)
Also, this is a good cause. I'm trying to create a remote compiling
system, so that I don't have to leave my SGI to touch an NT box. Ever.
Eternal gratitude and beers all around.. ;-)
Ciao,
H.
Halfdan Ingvarsson, Guru, Pison Ltd. -- What do you want to crash today?
'What sets us programmers apart from other trades is that we have the
ability to create our own tools if we don't like the current ones.'
---==[ Unsolicited e-mail will be proofread at a $1500 charge ]==---
------------------------------
Date: Fri, 26 Mar 1999 12:06:45 GMT
From: ijg@csc.liv.ac.uk (I.J. Garlick)
Subject: Re: SENDMAIL not allowing Content-Type: multipart/mixed header
Message-Id: <F97Az9.Hyr@csc.liv.ac.uk>
In article <36fa8bc5.2338434@news2.tmisnet.com>,
strads@tmisnet.com (George Crissman) writes:
> I'm real new at this ... but did you notice that "\n\n" appears
> TWICE in the header area? That would be my first guess
> at what's causing the problem.
Yep you are new at this. It doesn't appear twice (unless there is a hidden
one on one of the strings somewhere)
The first Content-Type: line is the end of the header, the second is the
header for the first part of the attachments.
I could be wrong as well, it would be much easier to debug if a here
statement had been used. I suspect that Perl 4 doesn't support this
feature, if I am wrong then Julian would make his life much easier by
using one.
Also upgrading to Perl 5 wouldn't hurt either as has been said already.
>
> -- George Crissman
> -- strads@tmisnet.com
>
--
Ian J. Garlick
ijg@csc.liv.ac.uk
A lack of leadership is no substitute for inaction.
------------------------------
Date: Fri, 26 Mar 1999 14:53:46 +0100
From: "Patrice M.I. Parmentier" <ppa@itmasters.com>
Subject: SIGPIPE and SIGCHLD Signals on win32. Please tell me what is wrong.
Message-Id: <36FB9169.7364E4AD@itmasters.com>
I wrote the following script:
#########################################################
$SIG{PIPE} = sub {
print "SIGPIPE called...\n";
exit (-666);
};
$SIG{CHLD} = sub {
print "SIGCHLD called...\n";
exit (-555);
};
$pid = open (HPIPE, "| buggything") or die "Cannot fork\n";
print "pid = $pid\n";
$n = 0;
while (1)
{
print HPIPE $n++ . "\n";
}
#########################################################
This script just pipes a series of integers to a command 'buggything'. I
want that my script stop when the 'buggything' stops.
All works fine on Solaris, AIX and HPUX, but not on NT.... Perlfaq and
other docs tell to catch sigpipe and sigchld. I do not understand why
this script does not work on NT (the signal handlers are never called).
Probably i am unable to understand the doc, so can somebody tell me what
is wrong???
--
Patrice M.I. PARMENTIER
------------------------------
Date: Fri, 26 Mar 1999 14:20:02 +0100
From: "Patrice M.I. Parmentier" <ppa@itmasters.com>
To: sholden@cs.usyd.edu.au
Subject: Sorry to be angry, but i do not know what is wrong.
Message-Id: <36FB8980.28C76364@itmasters.com>
Sorry to be angry, but i really do not know how to modify my script to run it
properly. I catch SIGPIPE and SIGCHLD and they are never called ; in addition,
the script works fine on AIX 4.1, Solaris 2.6 and HPUX. The problem is only on
NT...
So, please do you know what is wrong?
I know that activestate perl 506 has pipe problems but i used build 509 and an
own compiled perl from 5.004_02 sources...
1. Here is the faq:
To find out if the
command succeeded, you have to catch SIGCHLD and wait() to get the exit status.
You should also catch SIGPIPE if you're writing to the child --
you may not have found out the exec() failed by the time you write. This is
documented in perlipc.
I also read perlipc.html and the perl cookbook chapter about process management ;
but my stuff does not work as documented.
2. Here is the script:
C:\Program Files\IT Masters\mcadapter\bin>cat tt.pl
$SIG{PIPE} = sub {
print "SIGPIPE called...\n";
# here could wait() but just want to know if it is called
exit (-666);
};
$SIG{CHLD} = sub {
print "SIGCHLD called...\n";
exit (-666);
};
$pid = open (HPIPE, "| buggything") or die "Cannot pipe buggything\n";
print "pid = $pid\n";
$n = 0;
while (1)
{
print HPIPE $n++ . "\n";
}
C:\Program Files\perltmp\bin>perl tt.pl
pid = 1
The name specified is not recognized as an
internal or external command, operable program or batch file.
And nothing happens...
NB: if i close the HPIPE, i get an error but i cannot stop the HPIPE if the piped
program still runs.
Patrice M.I. PARMENTIER
------------------------------
Date: Fri, 26 Mar 1999 06:09:30 +0000
From: Marquis de Carvdawg <carvdawg@patriot.net>
Subject: Re: Using Win32::Perms
Message-Id: <36FB249A.A9E08EF1@patriot.net>
Dave,
Thanks for your assistance with the module thus far. I tried out the code
that you sent to me from my posts on the ActiveState mailing list, and it
works great!
Also, I finally received your book from Amazon yesterday. I started reading
through it...I have to ask why O'Reilly didn't pick it up. It's great...much
more
useful than some of the stuff in their PRK....
Carv
> >Anyway, I am using ActivePerl build 509, and Dave's Win32::Perms module.
> >I have no trouble creating a Perms object, and can get the array of hashes
> >that describe the ACEs. However, I need to know the specific Index,
> >Account, Mask, Type, etc...the same stuff that's displayed by the Dump
> >method, but I don't want it sent to STDOUT...
>
> Once you have a Win32::Perms object and have dumped it into an array:
> $Perm->Dump( \@List );
>
> You can extract the Mask, Flags and other stuff by accessing the data in the
> @List array. Each array element is an anonymous hash containing the
> following
> values:
> DB<13> X List
> @List = (
> 0 HASH(0x9b9d5c)
> 'Access' => 'Allow'
> 'Account' => 'Rothd'
> 'Domain' => 'ROTH.NET'
> 'Entry' => 'DACL'
> 'Flag' => 2
> 'Mask' => 268435456
> 'SID' => 'S-1-5-21-143984352-578909669-1869494990-1001'
> 'Type' => 0
> 1 HASH(0x9b9dd4)
> 'Access' => 'Audit'
> 'Account' => 'Rothd'
> 'Domain' => 'ROTH.NET'
> 'Entry' => 'SACL'
> 'Flag' => 64
> 'Mask' => 268435456
> 'SID' => 'S-1-5-21-143984352-578909669-1869494990-1001'
> 'Type' => 2
> 2 HASH(0x9b9e4c)
> 'Account' => ''
> 'Domain' => ''
> 'Entry' => 'Owner'
> 'SID' => ''
> 3 HASH(0x9b9e94)
> 'Account' => ''
> 'Domain' => ''
> 'Entry' => 'Group'
> 'SID' => ''
>
> Notice that you can access the permission mask for user ROTHD with:
> $Mask = $List[0]->{Mask};
>
> You can now decode the mask (break it into human readable strings):
> Win32::Perms::DecodeMask( $Mask, \@Perms );
>
> With the next release you will be able to do this (to make things just
> a tad easier):
> Win32::Perms::DecodeMask( $List[0], \@Perms );
>
> Remember that this is a beta release and some functions may change.
> dave
>
> --
> =================================================================
> Dave Roth ...glittering prizes and
> Roth Consulting endless compromises, shatter
> http://www.roth.net the illusion of integrity
> Win32, Perl, C++, ODBC, Training
> rothd at roth dot net
>
> Our latest Perl book is now available:
> "Win32 Perl Programming: The Standard Extensions"
> http://www.roth.net/books/extensions/
> .dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 26 Mar 1999 13:47:06 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Values of 'true' and 'false'?
Message-Id: <36fb8f51.15320175@news.skynet.be>
Philip Newton wrote:
>> length($a==$b)
>> ($a>$b) * 17
>
>But
>
> $a = ($b == $c);
> ...
> # other stuff
> ...
> if ($a) { &foo; }
>
>is OK, right?
I would say so. You're not depending on $a having a particular value,
but rather, it's value as a boolean. *That* is garanteed.The numerical
or string value is not. The fact that it's stored instead of used
directly, doesn't matter.
Bart.
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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 5233
**************************************