[7554] in Perl-Users-Digest
Perl-Users Digest, Issue: 1180 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Oct 15 13:17:20 1997
Date: Wed, 15 Oct 97 10:00:38 -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 Wed, 15 Oct 1997 Volume: 8 Number: 1180
Today's topics:
[cperl-mode] How do I get that kind of indent: <nico@idnet.fr>
Re: Another Perl vs C question <seay@absyss.fr>
Re: Cannot Use use <barnett@houston.Geco-Prakla.slb.com>
CGI scripts to access client hard drives praveen_s@trigent.com
Re: global variable under "use strict" (Toutatis)
Re: global variable under "use strict" (Andrew M. Langmead)
Re: global variable under "use strict" (Jeremy D. Zawodny)
Help Needed : Perl Signals <ds56947@fmr.com>
How do I can set lines per page with write function. <Pierre.Bergdolt@ansf.alcatel.fr>
hv.c gives problems when installing <j.kiser@ix.netcom.com>
Is there an FAQ <ramsan00@mh.uk.sbphrd.com>
LWP + Net::SSLeay? <lydia@elmer.harvard.edu>
Perl 5.004_02 access violation under WinNT 3.51 Server <beadles@nortel.com>
PERL for DOS FAQ <ramsan00@mh.uk.sbphrd.com>
Re: Perl OLE and MSWord (David Brewster)
Re: Perl OLE and MSWord (Mike Torrence)
Perl output in another frame <abt@unistat.demon.co.uk>
Perl/Win95 interaction... (Brian DeRosa)
Please excuse this Win 32 question (Bill Moseley)
Re: Please excuse this Win 32 question (Jeremy D. Zawodny)
Quoting a variable in a regexp (Shay)
SCO Unix (Herbert Travis)
Re: statics or const in perl ? <seay@absyss.fr>
Re: statics or const in perl ? <seay@absyss.fr>
String manipulation in Perl <jgoerzen+usenet@complete.org>
Re: String manipulation in Perl (Jeremy D. Zawodny)
Re: sybperl/oraperl mpeppler@mbay.net
Re: Time? (Bob Wilkinson)
Re: Trying to pass a file handle under strict mode <seay@absyss.fr>
Upload file through WWW question <tle@spso.gsfc.nasa.gov>
Re: Upload file through WWW question (Jeremy D. Zawodny)
Using UNIX message catalogs from Perl? Anyone? <jdturner@intrex.net>
Re: Writing/Reading Bin Files (need example) <seay@absyss.fr>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 15 Oct 1997 18:38:52 +0100
From: Nicolas MONNET <nico@idnet.fr>
Subject: [cperl-mode] How do I get that kind of indent:
Message-Id: <3444FF3E.6F6A0895@idnet.fr>
I want something like:
very_long_function_name(
"Parameter 1",
second_parameter(),
0
);
instead of:
very_long_function_name(
"Parameter 1",
second_parameter(),
0
);
... which, you have to admit, sucks as much as one can. Is it just possible?
I'm not that familiar with elisp/emacs. Is there a way to twiddle cperl so
that it will treat parentheses as braces somehow? (let alone all the electric stuff)
Thank you so much for your help...
--
nico@skiin.com
------------------------------
Date: Wed, 15 Oct 1997 17:36:16 +0200
From: Doug Seay <seay@absyss.fr>
Subject: Re: Another Perl vs C question
Message-Id: <3444E2F0.72C00487@absyss.fr>
Fritz W Feuerbacher wrote:
>
> John Armsby (jaws@atl.mindspring.com) wrote:
>
> : thought (true or false) that Perl compiling would slow things down. I
> : also have been afraid that all those Perl compilations by the users
> : would put extra pressure on the hard disks. It seems that the C
>
> What would happen is when your perl script gets envoked, the os loads the
> perl interpreter into memory then your script and points the interpreter
> to the beginning of your script. This is sort of compiling it on the fly.
> I doubt if its creating a whole lot of hard drive overhead. When a C
> program runs it has to be read off the hard disk to in order to get into
> memory. What would be more efficient is if the os would keep the perl
> interpreter in memory all the time so it has it ready when a script comes
> along. This would only be practical if scripts were being run constantly.
That and using shared libs like crazy. Once TomC posted that his perl
executable was around 11k, all the rest was in shared libraries. At his
site, I'd guess that these libraries would be used often, effectively
running constantly.
The load time would then be 11k for the executable plus the size of the
script. If the shared libraries had been swapped out, a bit more disk
access would be needed to swap them back in. I agree that the disk
access will be fairly low.
- doug
------------------------------
Date: Wed, 15 Oct 1997 09:28:52 -0500
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: Cannot Use use
Message-Id: <3444D324.4402@houston.Geco-Prakla.slb.com>
Rick wrote:
(snip)
> I am trying to make use of Perl modules but cannot get "use"
> to find the modules. Even when adding the command:
> push (@INC, "/usr/local/perl/lib");
> then
> use Carp;
>
> I still get the same error:
> Can't locate Carp.pm in @INC at test.pl line 14.
> BEGIN failed--compilation aborted at upload.pl line 14.
I was getting a similar error for quite some time.
I'm currently using perl5.004_01 currently.
What I did was set up the environment variable PERL5LIB to point to the
location of the perl libs (setenv PERL5LIB /usr/local/lib/perl5, in my
case). After that, I was able to use the libraries. After re-compiling
the perl interpreter, I was able to run scripts without the variable
being set. (Original copy of perl was not pointed correctly to
libraries.)
Is /usr/local/perl/lib where your perl libraries are? What are the
defaults in your include variable? You can create a short program that
just prints out the @INC variable. Use that to confirm that the library
files exist in the directories.
(snip)
> Any suggestions would be appreciated,
> Rick
Hope this helps. :-)
Dave
**All comments are those of someone else.**
--
"Security through obscurity is no security at all."
-comp.lang.perl.misc newsgroup posting
------------------------------------------------------------------------
* Dave Barnett U.S.: barnett@houston.Geco-Prakla.slb.com *
* DAPD Software Support Eng U.K.: barnett@gatwick.Geco-Prakla.slb.com *
------------------------------------------------------------------------
------------------------------
Date: Wed, 15 Oct 1997 09:24:03 -0600
From: praveen_s@trigent.com
To: satheeshkumar_rsr@trigent.com
Subject: CGI scripts to access client hard drives
Message-Id: <876924534.6101@dejanews.com>
I am looking for help on Perl CGI scripts or mechanisms to pop up a
file
dialog box, read the selected file which resides on the clients hard
drive and pass the data to the server for processing. Can this be done
using Perl and HTML only? (Without any client side scripting).
This also holds good for saving, say a text file on the clients hard
drive.
Responses will be helpfull in solving the above problem
Thanks,
Praveen
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: 15 Oct 1997 14:05:56 GMT
From: toutatis@_SPAMTRAP_toutatis.net (Toutatis)
Subject: Re: global variable under "use strict"
Message-Id: <toutatis-ya023180001510971605560001@news.euro.net>
In article <3448b00e.152191029@igate.hst.moc.com>, zawodny@hou.moc.com
(Jeremy D. Zawodny) wrote:
> On 15 Oct 1997 11:01:46 +0200, Heiko Klein <hklein@ikp.uni-koeln.de>
> wrote:
>
> >Some global variables would do, but I like to use strict.
>
> You can have "global" variables (depending on what you mean by global)
> like this.
>
> ---cut---
>
> #!/usr/local/bin/perl
>
> use strict;
>
> my $global_foo = 50;
You can not define a global variable with 'my': au contraire.
If you want to define a global variable, say:
$global = 'value';
However, 'strict' wants you to fully specify the package name, so
you have to be more specific:
$packagename::global = 'value';
UNLESS you tell strict you intend to use $global as a global, by saying:
use vars qw($global);
--
Toutatis
------------------------------
Date: Wed, 15 Oct 1997 16:20:36 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: global variable under "use strict"
Message-Id: <EI3pEC.DGw@world.std.com>
Heiko Klein <hklein@ikp.uni-koeln.de> writes:
>How can I tell get_data_from_socket, where to get the socket data,
>without having them passed from graphik. And without reconnecting!
>Some global variables would do, but I like to use strict.
Using the "use strict" pragma doesn't stop you from using globals, you
just have to either fully qualify them with their package, or tell
perl which globals are exempt.
Either always refer to it as "$main::buffer" (or whatever package you
are in) or use the "vars" pragma to tell perl not to complain about it
as in:
use vars '$buffer';
--
Andrew Langmead
------------------------------
Date: Wed, 15 Oct 1997 16:42:06 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: global variable under "use strict"
Message-Id: <3444f224.169108925@igate.hst.moc.com>
[cc'd automagically to original author]
On 15 Oct 1997 14:05:56 GMT, toutatis@_SPAMTRAP_toutatis.net
(Toutatis) wrote:
>In article <3448b00e.152191029@igate.hst.moc.com>, zawodny@hou.moc.com
>(Jeremy D. Zawodny) wrote:
>
>> On 15 Oct 1997 11:01:46 +0200, Heiko Klein <hklein@ikp.uni-koeln.de>
>> wrote:
>>
>> >Some global variables would do, but I like to use strict.
>>
>> You can have "global" variables (depending on what you mean by global)
>> like this.
>>
>> ---cut---
>>
>> #!/usr/local/bin/perl
>>
>> use strict;
>>
>> my $global_foo = 50;
>
>You can not define a global variable with 'my': au contraire.
>If you want to define a global variable, say:
>$global = 'value';
>However, 'strict' wants you to fully specify the package name, so
>you have to be more specific:
>$packagename::global = 'value';
>UNLESS you tell strict you intend to use $global as a global, by saying:
>use vars qw($global);
But my way of doing "global" variables should have satisfied the
original need, no?
Is there anything "wrong" with doing it that way? I don't know of
anything, but maybe I've been mis-informed.
Jeremy
--
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio
http://www.marathon.com/
Unless explicitly stated, these are my opinions only--not those of my employer.
------------------------------
Date: Wed, 15 Oct 1997 10:28:25 -0500
From: Ed Tolsch <ds56947@fmr.com>
Subject: Help Needed : Perl Signals
Message-Id: <3444E119.19EC@fmr.com>
I'm trying to duplicate some functionality in Perl which currently
exists in Korn shell regarding signals. In Korn shell the fake signal
ERR enables you to 'trap' a script or function exiting with a non-zero
status.
How can I reproduce this in Perl without explicitly checking the exit
status of each Perl command?
I'm aware of the Perl signals such as INT, TERM, QUIT, etc. Is there
something similiar to the Korn shell's ERR in Perl?
Any help in this would be greatly appreciated.
------------------------------
Date: Wed, 15 Oct 1997 16:22:41 +0200
From: Pierre BERGDOLT <Pierre.Bergdolt@ansf.alcatel.fr>
Subject: How do I can set lines per page with write function.
Message-Id: <3444D1B0.2781@ansf.alcatel.fr>
Hi there,
I use the "format" and "write" to get a pretty output,
the "write" instruction automatically generate ^L and print the top of
page (that been defined with format ...._TOP=) every 66 lines by
default. How can I change this number of lines??
Thank's to answer by e-mail.
--
-----------------------------------------------------------
Pierre Bergdolt Pierre.Bergdolt@ansf.alcatel.fr
Alcatel TELECOM
1 a 7, rue Ampere tel: + 33 (0)1.69.81.12.79
91300 Massy - FRANCE fax: + 33 (0)1.69.81.17.23
-----------------------------------------------------------
------------------------------
Date: Wed, 15 Oct 1997 07:58:39 +0000
From: Jeffee Kiser <j.kiser@ix.netcom.com>
Subject: hv.c gives problems when installing
Message-Id: <344477AF.6C0B@ix.netcom.com>
I am installing version 5.004_01 on my workstation using SunOS in my
local directory, and I get an error during the make portion of the
installation regarding the hv.c file. It says that there is a problem at
or before HEK in the file at 4 different lines. I'm pretty sure that
this is regrarding the function calls to New and Newz but am not totally
sure. If anyone has had similar problems with this, some insight would
be greatly appreciated.
Jeff Kiser
j.kiser@ix.netcom.com
jeffk@oaktech.com (where I'll probably be)
------------------------------
Date: Wed, 15 Oct 1997 16:58:54 +0100
From: "Naseem . Ramsahye" <ramsan00@mh.uk.sbphrd.com>
Subject: Is there an FAQ
Message-Id: <3444E83E.41C6@mh.uk.sbphrd.com>
Hi all,
Can anyone please point me to an FAQ on using/installing PERL with
DOS/Win3.2 Win95.
Thanks in advance
Naseem
--
=====================================================================
Naseem A. Ramsahye
CASS (Computational Chemistry) H34 /3-025
SmithKline Beecham Pharmaceuticals
New Frontiers Science Park (North)
Third Avenue
Harlow, Essex, CM19 5AW
Email:ramsan00@mh.uk.sbphrd.com Tel:(01279) 627864
=====================================================================
------------------------------
Date: Wed, 15 Oct 1997 12:31:47 -0400
From: lydia <lydia@elmer.harvard.edu>
Subject: LWP + Net::SSLeay?
Message-Id: <Pine.SUN.3.91.971015122814.9041G-100000@elmer.harvard.edu>
Has anyone tried to use LWP for connecting to sites that use SSL?
Is there any documentation about how to use these modules together?
Thanks for any help you can provide.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-
Lydia Ievins lydia_ievins@harvard.edu
Office for Information Systems 617/495-3724
Harvard University Library
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-
------------------------------
Date: Wed, 15 Oct 1997 10:15:31 -0500
From: "John T. Beadles" <beadles@nortel.com>
Subject: Perl 5.004_02 access violation under WinNT 3.51 Server
Message-Id: <3444DE13.7456@nortel.com>
Downloaded and installed Perl 5.004_02 distribution for WinNT
primarily to be able to use LWP. LWP works but sporadically
crashes once or twice per day, leaving a console message up:
PERL.EXE
Access Violation (0xc0000005), Address 0x20202020
This puts me in a bad spot, because I'm using this perl script for
a server administration task. Anybody got any comments?
------------------------------------------------------------------
John T. Beadles - Sr. RF Systems Engineer - Nortel CDMA RF Design
Office: 972-685-7813 Email (office): removethis.beadles@nortel.com
Fax: 972-684-3767 Email (home): removethis.jbeadles@pobox.com
Any opinions are mine and to do not represent those of my employer
------------------------------------------------------------------
------------------------------
Date: Wed, 15 Oct 1997 17:14:50 +0100
From: "Naseem . Ramsahye" <ramsan00@mh.uk.sbphrd.com>
Subject: PERL for DOS FAQ
Message-Id: <3444EBFA.167E@mh.uk.sbphrd.com>
Hello,
Could anyone please point me to an FAQ for PERL for DOS / WIN95?
Thanks in advance
Naseem
--
=====================================================================
Naseem A. Ramsahye
CASS (Computational Chemistry) H34 /3-025
SmithKline Beecham Pharmaceuticals
New Frontiers Science Park (North)
Third Avenue
Harlow, Essex, CM19 5AW
Email:ramsan00@mh.uk.sbphrd.com Tel:(01279) 627864
=====================================================================
------------------------------
Date: 15 Oct 1997 13:56:48 GMT
From: david@internation.co.uk (David Brewster)
Subject: Re: Perl OLE and MSWord
Message-Id: <622i30$e19$1@alpha.ftech.net>
Martin Schwartz (schwartz@cs.tu-berlin.de) wrote:
: Hello David,
: : use OLE;
: : $wd = CreateObject OLE 'Word.Basic'
: : or warn "Couldn't create new instance of word baseic!!";
: : $wd->Open( 'testfile' );
: : How do I actually open a full Microsoft Word window ?
: Upps, I'm sorry that I cannot check this out, but I would expect you'd
: have to create a 'Word.Document' object. Would you?
Hi,
I meant to mention that "testfile" was an already existing document.
Thanks
David
------------------------------
Date: Wed, 15 Oct 1997 13:53:28 GMT
From: mst@fadavis.com (Mike Torrence)
Subject: Re: Perl OLE and MSWord
Message-Id: <3444cabf.1128126@news.idt.net>
On 15 Oct 1997 11:10:30 GMT, david@internation.co.uk (David Brewster)
wrote:
>Hi
>
>Simple program:
>
>use OLE;
>$wd = CreateObject OLE 'Word.Basic'
> or warn "Couldn't create new instance of word baseic!!";
>$wd->Open( 'testfile' );
>
>It opens Word, but it doesn't appear on the taskbar (using Win95) and
>I only know it has opened word because if I cntrl-alt-del it there is
>a word process going. It also closes after the perl script finishes.
>
>How do I actually open a full Microsoft Word window ?
>
>Thanks
>David
I use the following:
# Initiate OLE to launch Word
$application = CreateObject OLE 'Word.Application' || die $!;
$application->{'Visible'}=1;
--------------------------------------------------------------------------
**************************************************************************
The preceding does not necessarily reflect my employer's opinion. Nor does
it necessarily reflect my opinion all of the time.
Who is General Failure and why is he reading my hard disk?
--------------------------------------------------------------------------
Mike Torrence
mst@fadavis.com
mtorrenc@iname.com
F.A. Davis (http://www.fadavis.com)
--------------------------------------------------------------------------
------------------------------
Date: Wed, 15 Oct 1997 17:34:27 +0100
From: "Alp Bora Toker" <abt@unistat.demon.co.uk>
Subject: Perl output in another frame
Message-Id: <876933473.6922.0.nnrp-01.9e98215b@news.demon.co.uk>
Firstly, I'm not sure weather this is the correct newsgroup to post to, but
please can you help anyway? I'm relatively new to Perl 5 CGI programming for
Web sites, but I have written a small server-side script. When the submit
button is pressed on the HTML web page, the results of the script are
usually displayed in the same HTML frame. Can anyone help me to select the
frame into which the results are displayed so that the submit button can be
on another separate frame without having reloading the entire frame-set?
Alp Bora Toker.
------------------------------
Date: 15 Oct 1997 16:09:21 GMT
From: derosbr@cig.mot.com (Brian DeRosa)
Subject: Perl/Win95 interaction...
Message-Id: <622prh$h5u$1@trotsky.cig.mot.com>
First, I have a question about "do-ability:"
Is it possible to have a perl script interact with Win95 programs that would
normally take user input manually? (for example, if I have a Win95 based
program that asks for information fields to be filled in, is there a way of
having a perl script provide the stdin?)
I know this is possible on a Unix based system, but I have no experience doing
it under Win95.
How about handling interaction between multiple programs? (ie, taking output
from one and reformatting it for input in another program).
If these things are, in part or whole, possible, could someone recommend a good
text/book on the subject or where I might find more information?
I'd appreciate if you could cc: my e-mail with responses. <8)
Thanks.
Brian
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Brian De Rosa OFFICE PHONE: +1-847-632-3803
Software Engineer (Motorola) OFFICE FAX: +1-847-435-9636
Arlington Heights, IL E-MAIL: derosbr@cig.mot.com
------------------------------
Date: 15 Oct 1997 15:43:12 GMT
From: moseley@netcom.com (Bill Moseley)
Subject: Please excuse this Win 32 question
Message-Id: <622oag$86u$1@nnrp2.snfc21.pbi.net>
I asked this question on the perl-win32-user list without any luck.
I've installed Perl for Win 32 on my PC.
Does anyone know how to say in the DOS world:
find . -name "*.txt" |xargs perl script.pl
I have a bunch of text files in a directory tree that I need to modify.
Thanks,
PS: if not too much trouble, please CC: my email. Thanks.
--
Bill Moseley
mailto:moseley@netcom.com
------------------------------
Date: Wed, 15 Oct 1997 16:46:27 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: Please excuse this Win 32 question
Message-Id: <3445f32e.169375088@igate.hst.moc.com>
[cc'd automagically to original author]
On 15 Oct 1997 15:43:12 GMT, moseley@netcom.com (Bill Moseley) wrote:
>I asked this question on the perl-win32-user list without any luck.
Hm, I don't remember seeing it there--or I'd have answered it then. Of
course, things have been a bit hectic lately.
>I've installed Perl for Win 32 on my PC.
>
>Does anyone know how to say in the DOS world:
>
> find . -name "*.txt" |xargs perl script.pl
>
>I have a bunch of text files in a directory tree that I need to modify.
Have a look at the File::Find module. It will let you do directory
tree walking in Perl. :-)
Jeremy
--
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio
http://www.marathon.com/
Unless explicitly stated, these are my opinions only--not those of my employer.
------------------------------
Date: Wed, 15 Oct 1997 14:39:21 GMT
From: shayv@geocities.com (Shay)
Subject: Quoting a variable in a regexp
Message-Id: <3444d594.11900478@news.ibm.net.il>
here's the problem.
i have a perl script as follows:
---------------------------
open(F, infile) or die "Can't open infile";
$a=175;
$pattern1="JOHNNY_" . $a . "_.._+";
$pattern2="JOHNNY_$a_.._+";
while(<F>)
{
print "Case 1: " . $_ . "\n" if (/JOHNNY_$a_.._+/);
print "Case 2: " . $_ . "\n" if (/JOHNNY_175_.._+/);
print "Case 3: " . $_ . "\n" if (/$pattern1/);
print "Case 4: " . $_ . "\n" if (/$pattern2/);
}
---------------------------
infile is:
---------------------------
11 JOHNNY_174_EF_01 1 2 3
2 JOHNNY_175_EF_01 1 2 3
33 JOHNNY_176_EF_01 1 2 3
---------------------------
cases 2 and 3 are true.
my question is: how can i quote a variable in a regexp without using
another variable (for interpolation ?!?), and why does case 3 succeeds
and cases 1 and 4 fail.
well, i've looked it up in the faq and it says to add a \Q. tried it
and it didn't work. (btw, what does \Q _actually_ say?)
thanks in advance.
Shay
ps, please reply via email as well: shayv@geocities.com
------------------------------
Date: 15 Oct 1997 16:46:28 GMT
From: sport@lamedicare.com (Herbert Travis)
Subject: SCO Unix
Message-Id: <622s14$pde@news1.iamerica.net>
I am running SCO Unix Open Server V. I have been unable to find a PERL
binary that will with this OS. (I don't have a C compiler) Where can I
get this. Thanks
------------------------------
Date: Wed, 15 Oct 1997 16:38:55 +0100
From: Doug Seay <seay@absyss.fr>
Subject: Re: statics or const in perl ?
Message-Id: <3444E38F.497@absyss.fr>
dave wrote:
> perldoc constant
>
> There are numerous cautions on use of them. I'm just wondering if they provide
> enough benefit to warrant the additional complication?
As far as I'm concerned, they rival sliced bread. After rereading the
docs, I still don't see any problems. At least not with scalars, they
aren't as nice with lists. Here is the "BUGS" section from the 5.004
"contant.pm" and my comments on each "bug"
In the current version of Perl, list constants are not
inlined and some symbols may be redefined without generating
a warning.
This could be a problem for some people, I guess. The lack of inlining
may hurt the optimizer, but that isn't a big deal. Redefinition could
be a problem, I guess. It hasn't bitten me yet, but I don't use lists
too often.
It is not possible to have a subroutine or keyword with the
same name as a constant. This is probably a Good Thing.
Excellent. I wouldn't call this a bug at all. But then, I think "-w"
and "use strict" being optional are bugs. Some of us _like_ this sort
of thing.
Unlike constants in some languages, these cannot be
overridden on the command line or via environment variables.
Great. Why would I want some stupid environment variable to change a
constant value? That would be a major pain with tainting (-T) anyway.
I don't want to sound harsh, but I fail to see any problems. Am I
overlooking something, or are you looking for problems? Please tell us
what are your concerns. The docs for this are _very_ technical, perhaps
even a bit too implementation specific. Not only do you read what
constants do, but also how they do it. Maybe it is this presentation
that bothers you.
------------------------------
Date: Wed, 15 Oct 1997 17:21:54 +0200
From: Doug Seay <seay@absyss.fr>
Subject: Re: statics or const in perl ?
Message-Id: <3444DF92.713F406A@absyss.fr>
Saviz Artang - MPG ~ wrote:
>
> Well let me tell you what I intend to do with this capability and
> maybe then it would make perl sense. There is a data base of
> information that I make a perl structure out of. I wanted to
> let the user enter perl queries to this data base via the
> eval command ( this way I wont have to have bizzilion different
> commands and options for queries. A very perlish idea ! )
> but I wanted to make sure that the user wont
> be able to change the data structure I created.
Your data structure is a hash, isn't it? You can do that simply with
something like
sub modify($$$)
{
my ($self, $field, $value) = @_;
# only allow the modification of existing fields
# don't allow creation of new ones
unless ( exists $self->{$field} )
{ die "not a good field $field\n"; }
# this is a half-hearted attempt to avoid stuffing scalar
# values where there should be list references
# you will need to make this more powerful
unless ( ref($value) eq ref($self->{$field} }
{ die "not a good type for field $field\n"; }
$self->{$field} = $value;
}
should do the trick. Of course, I may have misunderstood what you
wanted. Also, I wouldn't use eval(), I would stick this in AUTOLOAD. I
often do something like this because I'm too lazy to type in a dozen
get/set methods and I think it is poor style to muck with the internal
values of an object without using a method.
- doug
------------------------------
Date: 15 Oct 1997 10:56:49 -0500
From: John Goerzen <jgoerzen+usenet@complete.org>
Subject: String manipulation in Perl
Message-Id: <87bu0r58am.fsf@garfield.complete.org>
Hello,
I am a C programmer moving over to Perl. I have really enjoyed some
of Perl's powerful string manipulation features such as regexps, the
"x" and "." operators, the "eq" (and similar) operators, etc.
However, there is something that C excels at that I seem to be unable
to do with like ease in Perl.
In C, since every string is an array, I can reference each individual
character as I need to. I can also say things like:
string[3] = 'Q';
string[3] = 32; (same as string[3] = ' ';)
string[3] = 'a' + 5;
I cannot seem to find an easy way to to this in Perl. It appears that
I can split a string into an array using unpack and then use pack to
move it back. But -- this still doesn't give me the ease of mixing
characters with ASCII values that I get in C. How can I do this sort
of thing in Perl? And is it even possible? If not, will it ever be?
Thanks!
--
John Goerzen | Running Debian GNU/Linux (www.debian.org)
Custom Programming | Debian GNU/Linux is a free replacement for
jgoerzen@complete.org | DOS/Windows -- check it out at www.debian.org.
------------------------------
Date: Wed, 15 Oct 1997 16:54:54 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: String manipulation in Perl
Message-Id: <3447f3f7.169575586@igate.hst.moc.com>
[cc'd automagically to original author]
On 15 Oct 1997 10:56:49 -0500, John Goerzen
<jgoerzen+usenet@complete.org> wrote:
You posted this to comp.lang.perl.misc, which is a dead newsgroup (and
has been for a couple years). Please notify your news server
administrator so that s/he can remove it.
>I am a C programmer moving over to Perl. I have really enjoyed some
>of Perl's powerful string manipulation features such as regexps, the
>"x" and "." operators, the "eq" (and similar) operators, etc.
Welcome, then. :-)
>However, there is something that C excels at that I seem to be unable
>to do with like ease in Perl.
>
>In C, since every string is an array, I can reference each individual
>character as I need to. I can also say things like:
>
> string[3] = 'Q';
> string[3] = 32; (same as string[3] = ' ';)
> string[3] = 'a' + 5;
>
>I cannot seem to find an easy way to to this in Perl. It appears that
>I can split a string into an array using unpack and then use pack to
>move it back. But -- this still doesn't give me the ease of mixing
>characters with ASCII values that I get in C. How can I do this sort
>of thing in Perl? And is it even possible? If not, will it ever be?
To my knowledge, what you're doing doesn't easily map into the Perl
Way of doing things. You certainly can access individual pieces of a
string (characters, words, etc.) using pack/unpack, or maybe substr().
The free interchange of ASCII values and their character counterparts,
however, isn't a given in Perl. Since Perl often decides whether to
interpret a chunk of data as a string or number (float, int, etc.)
based on the context in which they're used, it's a bit of mindset
shift.
You may find the ord() function helpful in some contexts, but I'm hard
pressed to come up with a nice elegant solution. That's not to say
that one doesn't exist, it's just that I'd need to think on it some
more.
Some more food for thought. Think about what you're trying to
accomplish in a larger sense. Might there be a more "Perl Way" of
doing it? Perhaps you could post some code or an idea of what
functionality you're trying to implement.
Jeremy
--
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio
http://www.marathon.com/
Unless explicitly stated, these are my opinions only--not those of my employer.
------------------------------
Date: Wed, 15 Oct 1997 10:23:29 -0600
From: mpeppler@mbay.net
To: pperroud@interlog.com
Subject: Re: sybperl/oraperl
Message-Id: <876928657.10933@dejanews.com>
In article <62072r$69u$1@news.interlog.com>,
pperroud@interlog.com (Patrick Charles Perroud) wrote:
>
> I was wondering if someone could point me in the right direction?
>
<snip!>
> We have recently purchased and application that uses Oracle 7.3.x
> running on Solaris 2.5.1 and was wondering if there was a perl
> beast out there that
> would allow me to access both RDBM's. I need to select from, and
> update
> tables on both Oracle and Sybase at the same time.
You should get perl5.004, and the DBI, DBD::Oracle and DBD::Sybase
modules. This will let you access Sybase and Oracle servers from the
same perl code, using a single API.
The modules are available from http://www.perl.com/CPAN/authors/id/TIMB
and http://www.perl.com/CPAN/authors/id/MEWP
Go to http://www.perl.com and browse around (maybe also go to
http://reference.perl.com and select the 'database' topic) to
get more information.
Michael
--
Michael Peppler -||- Data Migrations Inc.
mpeppler@datamig.com -||- http://www.mbay.net/~mpeppler
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: Wed, 15 Oct 1997 15:10:42 +0100
From: b.wilkinson@pindar.com (Bob Wilkinson)
Subject: Re: Time?
Message-Id: <b.wilkinson-1510971510420001@ip57-york.pindar.co.uk>
In article <01bcd6bf$b71f2320$3c7237c0@rollanet.org.rollanet.org>, "Mdoc"
<mdoc@rollanet.org> wrote:
> I am wondering how I would get the time from varous locations around the
> world, say China? Would I do it with GMT +/-, or another way? Any help
> would be appreciated!
>
> Thanks,
> Vic
>
> mdoc@rollanet.org
This may be sub-optimal, but it is one way you could proceed.
1. Visit your local travel agent, and purchase an airline ticket to the
location of your choice.
2. Travel to this pre-determined location.
3. Ask a local what time it is there.
4. Return to your starting location.
While typing this nonsense, I've had an idea for a more efficient method.
1. Find the international dialling code of a city in, say China.
2. Telephone a few numbers at random, until you find someone with whom you can
communicate.
3. Ask them to tell you the time there.
A further bright idea popped into my head whils typing the above drivel.
1. Try the on-line docs, try "man timezone", "man 3v ctime", or if you want you
could try paper which lists the differences, then apply the difference to that
given to you by the date function on your computer.
Bob
Facetious or Mad
P.S. What does this question have to do with perl
--
.sig file on holiday
------------------------------
Date: Wed, 15 Oct 1997 16:58:52 +0100
From: Doug Seay <seay@absyss.fr>
Subject: Re: Trying to pass a file handle under strict mode
Message-Id: <3444E83C.47F1@absyss.fr>
Allen Choy wrote:
>
> Hi,
>
> I'm trying to pass a file handle to a function using strict mode,
> but I keep on getting a BAREWORD warning when I run the script
> with -wc options enabled. Adding the * to each file handle
> seems to do the trick, but is this the right way of doing it?
Reading the FAQ will tell you about both typeglob
&function(*HANDLE);
and typeglob reference
&function(\*HANDLE);
but I'd say that a blessed reference is easier. Something like
my $file = IO::File->new("</path/to/file") or
die "can't open /path/to/file\n";
&function($file);
should do the trick.
- doug
------------------------------
Date: Wed, 15 Oct 1997 11:55:47 -0400
From: Truong Le <tle@spso.gsfc.nasa.gov>
Subject: Upload file through WWW question
Message-Id: <3444E783.1152@spso.gsfc.nasa.gov>
Hi all,
I tried to upload multiple files through netscape and have the troubles
when 2 different files (in different directory) have the same name.
Only the first file was uploaded but not the second one. For example,
If have these codes:
#!/usr/local/bin/perl
use CGI;
my $req = new CGI;
print $req->header;
my @filenames = map $req->param($_), qw (file1 file2);
my $count = 1;
my $file;
foreach $file(@filenames) {
next if ($file =~ m/^\s*$/);
my ($bytesread, $buffer, $bytes);
open (OUTFILE, ">/tmp/$file-$count") ||
die "Can't open $file\n";
while ($bytesread = read($file, $buffer, 1024)) {
$bytes += $bytesread;
print OUTFILE $buffer;
}
close($file);
close(OUTFILE);
print "$file ($bytes bytes) was uploaded.\n");
$count++;
}
exit;
After running this script, if file1 and file2 are the same name,
file1 was successfully uploaded and file2 was 0 bytes. Does anyone
know how I avoid this problem? Thanks
Truong Le
------------------------------
Date: Wed, 15 Oct 1997 16:48:16 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: Upload file through WWW question
Message-Id: <3446f37c.169453230@igate.hst.moc.com>
[cc'd automagically to original author]
On Wed, 15 Oct 1997 11:55:47 -0400, Truong Le <tle@spso.gsfc.nasa.gov>
wrote:
>I tried to upload multiple files through netscape and have the troubles
>when 2 different files (in different directory) have the same name.
Netscape is a company. Are you referring to one of their server or
client (browser) products?
Jeremy
--
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio
http://www.marathon.com/
Unless explicitly stated, these are my opinions only--not those of my employer.
------------------------------
Date: Wed, 15 Oct 1997 10:56:27 -0400
From: John Turner <jdturner@intrex.net>
Subject: Using UNIX message catalogs from Perl? Anyone?
Message-Id: <3444D99B.171E94EA@intrex.net>
I wish to use the UNIX catalog facility from a perl program has this
already been done by someone or do I have to write a module for this?
catopen()
catclose()
catgets()
These are the three system calls I need.
Email me jdturner@intrex.net if you know of something.
John Turner
------------------------------
Date: Wed, 15 Oct 1997 16:54:53 +0100
From: Doug Seay <seay@absyss.fr>
Subject: Re: Writing/Reading Bin Files (need example)
Message-Id: <3444E74D.7929@absyss.fr>
James A. Kivisild wrote:
>
> I posted something before asking how to read from binary files in Perl.
> I should clarify
> my question. I know I need to use read() and possible unpack() but I'd like an
> example of how to read from a file
>
> The particular file I need to read from used the following struct in C
What about read() bothers you?
my $buffer;
my $bytes = 10;
read(INPUT_FILE, $buffer, $bytes);
Will read upto 10 bytes from INPUT_FILE and put them in the variable
$buffer, just as you would expect. There is an optional OFFSET field in
read(), but don't use it. The default value does what most people want.
The unpack is a bit more problematic as C doesn't define how these
structs will be layed out. Yes, you will need to tune your Perl to use
the specific C compiler that produced them (although most Unix based C
compilers use exactly the same layout). This thread has come up several
times this year. Try using DejaNews to find these articles. From
memory, I'd use the pattern
> #define MAXLEN 10
> typedef struct
> {
> long b;
> long m;
> } xint;
>
> struct userinfo
> {
> char name[MAXLEN];
> xint a;
> xint b;
> xint c;
> char reserved[28];
> };
> typedef struct userinfo userinfo;
unpack('A10xx LL LL LL A28', $data);
Note that I'm not trying to preserve the xint struct as it isn't all
that useful. That and unpack() isn't really good at multi-level data.
Those two "x"s should make the next field start at the 12th byte (3rd
word boundry).
- doug
------------------------------
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 1180
**************************************