[6848] in Perl-Users-Digest
Perl-Users Digest, Issue: 473 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 14 05:17:22 1997
Date: Wed, 14 May 97 02:00:34 -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, 14 May 1997 Volume: 8 Number: 473
Today's topics:
Re: [Q] Getting date of a file?? (brian d foy)
Re: Array of Lists (Chipmunk)
Basic debugging <mfry@his.com>
Basic question -"Do you set execute bits"? brennan@byte-back.com
Best Perl Book <loay@micron.net>
Re: CGI Environment vars <glynis@butterfly.hjsoft.com>
Re: control-M makes for very long $_ <gwhassan@prodigy.net>
Re: dialling a modem from perl (Chipmunk)
Re: File Copy <chchee@iti.gov.sg>
Re: Finding a pattern in a file (*)
Re: Flushing pipes (*)
Re: FTP support in perl (*)
ftp.pl (Mike Vallabh)
grep pat from multiple files Query??????
Re: grep pat from multiple files (Tad McClellan)
Re: How do You use perl to Permanently Change a Directo (Lack Mr G M)
Re: How to start TCP-Server under inetd ??? <merlyn@stonehenge.com>
Re: MacPerl question (John L. Daschbach)
Re: New draft of scripting white paper <cimarron@dis.org>
Pattern Matching Help Needed!! (Frank Fisher)
PLL file <dingzq@imedia.com.sg>
Re: private scalar for each instance of an object? <friedman@uci.edu>
Q: Is Win95 Perl5 select() for device COM1 implemented? <tomjenn@pacbell.net>
Re: setuid script problems (Brooks Davis)
speeding up a regex (Justin C Lloyd)
Re: speeding up a regex (Justin C Lloyd)
Timing Out While waiting for user input <bhaney@elvis.turner.com>
Trouble building perl5.003 on solaris (Jete Software Inc.)
Using DBI across a network (Danny Aldham)
Re: Want perl on Win95 Platform dominic@thiru.vetri.com
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 14 May 1997 03:45:09 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: [Q] Getting date of a file??
Message-Id: <comdog-1405970345090001@nntp.netcruiser>
In article <5langu$nt4@ds2.acs.ucalgary.ca>, wycheung@acs3.acs.ucalgary.ca
(Wing-yee Cheung) wrote:
> I looked into Randal's learning perl..it mentioned about the ability to
> grab the last modification date of a file by doing -M file and it does
> returns value...but how to do it?? Or shoudl I do ($mtime) = (stat("file"));
> which returns some weird numbers....thanks in advance!!
how to use it depends on what you want to do with it.
remember that -M and friends return ages since the time *the script
was started* [1,2], so they are not the same as the numbers you get
from stat().
stat()'s return values [2] are only wierd until you realize what they
are. of course,
[1] see pp. 83 - 87 of the Blue Camel
Programming Perl, Larry Wall
Tom Christensen, & Randal L. Schwartz
ISBN 1-56592-149-6.
<URL:http://www.ora.com>
[2] see the perlfunc man page
--
brian d foy <URL:http://computerdog.com>
one line thank you notes with lots of quoted text is not appreciated
------------------------------
Date: 12 May 1997 04:23:40 GMT
From: Ronald.J.Kimball@dartmouth.edu (Chipmunk)
Subject: Re: Array of Lists
Message-Id: <5l660c$jsc$2@dartvax.dartmouth.edu>
In article <EA0B89.AwC@midway.uchicago.edu>
wdr1@midway.uchicago.edu (William D. Reardon) writes:
> I'm trying to create a data structure that is just an array of
> lists. Just to get something to get started, I tried doing something
> like this:
>
> for $v (1 .. $vxs) {
> $array[$v] = (3,2,1) ;
> }
>
> The above, however, just creates an array with each element equal to
> 1. What am I doing wrong here? I read the Lists of Lists thing, but
> I'm still stumped.
It looks like (3,2,1) is evaluating to the last element in the list,
which is 1. What you need to do is:
$array[$v] = [ (3,2,1) ];
in which [ (3,2,1) ] is reference to the array (3,2,1).
You can then get the values back by either $array[$x][$y], which is a
single value, or $array[$x], which is the array reference, or @{
$array[$x] }, which is the array.
I hope that helps. You need to pay careful attention to all the syntax
in the LoL doc.
Chipmunk
------------------------------
Date: Tue, 13 May 1997 18:53:38 -0400
From: Michael Fry <mfry@his.com>
Subject: Basic debugging
Message-Id: <3378F0F2.6980@his.com>
I've got maybe 5 days of Perl under my belt, so bear with me if this is
completely idiotic...
I've been trying to run a fairly simple script (below) on an NCSA Web
server. The script compiles successfully from the command line, showing
me the HTML output from the print statements. The browser, on the other
hand, gives me a '500 server error' and the ever ambiguous 'Error:
HTTPd: malformed header from script ...dearfry.pl'
What's happening that makes the script good only from the command line?
Does that 'malformed header' error message usually mean something more
specific?
And is there a specific error, syntactical or otherwise, that the 'error
log' refers to when it says (cryptically) 'errno is 2' ???
Thanks very much.
Michael Fry
#!/usr/local/bin/perl
require 'cgi-lib.pl';
&ReadParse(*in);
$count=0;
#use the count function to name the variables and
#then assign them to the 'entries' array
while ($count<5) {
$ffield="firstname" . ($count+1);
$lfield="lastname" . ($count+1);
$gfield="gender" . ($count+1);
$entries[$count]="$in{$ffield}::$in{$lfield}::$in{$gfield}";
++$count;
}
print "Content-type: text/html\n\n";
print <<EOF;
<HTML><HEAD><TITLE>Suggested Salutations</TITLE></HEAD>
<BODY>
<CENTER><H2>Suggested Salutations</H2>
<TABLE BORDER>
<TR>
<TH>First Name</TH>
<TH>Last Name</TH>
<TH>Salutation</TH>
<th>Informal</th>
</TR>
EOF
;
foreach $single_entry (@entries) {
($firstname, $lastname, $gender)=split ("::", $single_entry);
if ($gender eq "female") {
$title="Ms.";
} else {
$title="Mr.";
}
print <<EOF;
<TR>
<td>$firstname</td>
<td>$lastname</td>
<td>Dear $title $lastname,</td>
<td>Dear $firstname,</td>
</TR>
EOF
;
}
print "</TABLE></CENTER></BODY></HTML>\n";
------------------------------
Date: Sun, 11 May 1997 23:47:52 +0000
From: brennan@byte-back.com
Subject: Basic question -"Do you set execute bits"?
Message-Id: <33765AA6.96@byte-back.com>
I am trying to get a perl script to run on a web server (not my
server). I have written the basic "hello" perl to test to see if I
could get it to work. I get a "500 server error", I then wrote a perl
that returned a complete header and got a "Document contains no data"
error. I have run the script locally and it works great. The webmaster
for this site tells me that I have to set the bit execute on the script
for it to work. I think that he doesn't know what he is talking about,
since the script is just a text file. Do you have to set the execute
bit on a perl script? or (This is what I think) is the problem likely to
be on the server pathway? I just really need to know about the execute
bit thing.
Brennan
------------------------------
Date: Tue, 13 May 1997 01:15:14 -0600
From: "Loay M. A." <loay@micron.net>
Subject: Best Perl Book
Message-Id: <33781502.24C3@micron.net>
I've heard about Perl and I am impressed so far. Could someone
please, recommend a good Perl book for me as a starting point.
Thank you,,,
mailto:loay@micron.net
------------------------------
Date: 13 May 1997 23:22:27 -0400
From: John M. Flinchbaugh <glynis@butterfly.hjsoft.com>
Subject: Re: CGI Environment vars
Message-Id: <5lbb5j$1b@butterfly.hjsoft.com>
The Nightshadow <nightshadow@thevortex.com.nospam> wrote:
> Can some1 pls give me a pointer to a list of environment variables
> used in CGI? Thanks.
just write a simple shell script to print the environment:
--cut--cut--cut--
#!/bin/sh
echo "Content-type: text/html"
echo
echo
set
--cut--cut--cut--
--
____________________}John Flinchbaugh{______________________
| -> glynis@hjsoft.com <- john@cs.millersv.edu |
| glynis@netrax.net http://www.netrax.net/~glynis |
~~Powered by Linux: Reboots are for hardware upgrades only~~
------------------------------
Date: Wed, 14 May 1997 00:28:40 +0000
From: Greg Hassan <gwhassan@prodigy.net>
To: Tom Lewis-Flood <t.lewisflood@elsevier.com>
Subject: Re: control-M makes for very long $_
Message-Id: <33790738.12647858@prodigy.net>
Tom Lewis-Flood wrote:
>
> 2. The script is supposed to print the file between html <PRE> tags.
> When the script says,
> while (<FILEHANDLE>) {
> print;
> }
> and nothing comes out, but when I change the file with the commandline,
> perl -p -i -e 's#^M#\n#g' filename.txt
> it outputs the file properly.
>
> 3. I've tried things like,
> s#\cM#\n#g;
> while (<FILEHANDLE>) {
> print;
> }
> but it doesn't seem to change a thing.
>
> I could really use a hand. Thanks.
>
maybe do:
while (<FILEHANDLE>) {
s/\cM//g;
print;
}
also be sure that the open(FILEHANDLE... exists
and it has '|| die("error: $!");' or something similiar
after it. If you don't have the die clause then you
really don't know whether the file is being opened or
not. and if the file doesnt get open then you don't get output :)
_Greg
--
============================================
Greg Hassan
The Independent Solution
Web Developer (CGI, Java, C, Perl, Oracle)
http://www.hassan.com/
gwhassan@prodigy.net
============================================
World-Wide Classified Listings
(http://www.hassan.com/.classifieds/)
Or Maybe a Birthday coming up?
Try: (http://www.hassan.com/cooie/)
============================================
------------------------------
Date: 12 May 1997 12:33:13 GMT
From: Ronald.J.Kimball@dartmouth.edu (Chipmunk)
Subject: Re: dialling a modem from perl
Message-Id: <5l72m9$a7n$1@dartvax.dartmouth.edu>
In article <5l348q$k2n$1@news.netusa.net>
Eli the Bearded <usenet-tag@qz.little-neck.ny.us> writes:
> I wanted a quikc hack to send dial commands to a modem because my
> touch tone-phone is dead. I don't especially feel like buying a
> new one and people who tell me to do so will be flamed.
>
> Anyway, I wrote a quick hack to do it and it worked. Then I decided
> to beef it up, and it stopped working. I can't figure out why it
> stopped working. I am using perl 5.003 with '-w'. It should work
> from the command line or interactively. The slightly stripped code
> for command line use is:
>
> ...
>
> I never get any warnings or errors, but it does not work either.
> Anyone have any suggestions?
Give us the original, working code for comparison.
Also:
> ...
> syswrite MODEM,"ATX0\n",5 || die "$0: Can't talk to the modem.\n";
|| binds pretty strongly, you either need to use parentheses or 'or'.
> ...
> $dial="[0-9*#]";
> $invdial="[^0-9*#]";
> ...
> $block =~ y:$invdial::d;
> $length = 8 + ($block =~ y:$dial:$dial:) ;
It looks like you're using that last line just to count the number of
characters in $block. Why don't you just do
$length = 8 + length($block) ?
> ...
> syswrite MODEM,"ATD $block ;\r\n",$length || warn "$!";
Once again, || binds rather strongly. Uses parentheses or 'or'.
Chipmunk
------------------------------
Date: Tue, 13 May 1997 16:41:17 +0800
From: Benny Chee <chchee@iti.gov.sg>
Subject: Re: File Copy
Message-Id: <Pine.SOL.3.91.970513163922.18365A-100000@hercules.iti.gov.sg>
> > Becky Schonfeld <rebecc60@pobox.upenn.edu> wrote:
> >
> > : Can anyone send me or recommend a very simple script to copy file1 to
> > : file2 except for one line from file1? Any help is much appreciated.
>
> --------------------------snip------snip----------------------------
#!/usr/local/bin/perl
use File::Copy;
#To copy file1.txt to file2.txt
copy ("file1.txt", "file2.txt");
---------------------------snip--------snip----------------------------
Benny Chee :) | "I used to have a life,
chchee@iti.gov.sg | but now I have a modem."
------------------------------
Date: Sun, 11 May 1997 23:30:58 -0500
From: JD@anon.com (*)
Subject: Re: Finding a pattern in a file
Message-Id: <JD-1105972330580001@fwk103102.res-hall.nwu.edu>
Hello - you seemed comfortable with Perl so I was wondering if you could
answer a question of mine. I have a field in a form where one could type
a copyright symbol or a registered symbol ( ascii: %A ) I have a
function called fix that translates most annoying sequences HOWEVER the
sequence used in HTML for the registerd symbol is ® and the perl
script translates %A as blank spaces. Any idea why? - thanx - piggy
------------------------------
Date: Sun, 11 May 1997 23:39:08 -0500
From: JD@anon.com (*)
Subject: Re: Flushing pipes
Message-Id: <JD-1105972339080001@fwk103102.res-hall.nwu.edu>
Hi - I am having trouble getting the registerd and copyright symbols to
translate from a form filed to the .html on the fly. I know the sequences
for both in HTML ® © but when I use the perl program to show
these symbols it translates them to %A for registered ( ..I forget what it
does to copy ) but then I try to translate it back on the fly with the s~/
/ /g; function and it gives white space. :< any idea how come? - thanx -
piggy
------------------------------
Date: Sun, 11 May 1997 23:37:10 -0500
From: JD@anon.com (*)
Subject: Re: FTP support in perl
Message-Id: <JD-1105972337100001@fwk103102.res-hall.nwu.edu>
Hi - I am having trouble getting the registerd and copyright symbols to
translate from a form filed to the .html on the fly. I know the sequences
for both in HTML ® © but when I use the perl program to show
these symbols it translates them to %A for registered ( ..I forget what it
does to copy ) but then I try to translate it back on the fly with the s~/
/ /g; function and it gives white space. :< any idea how come? - thanx -
piggy
------------------------------
Date: 14 May 1997 06:48:47 GMT
From: mike@cs.waikato.ac.nz (Mike Vallabh)
Subject: ftp.pl
Message-Id: <5lbn8f$ee0$1@ogre.cs.waikato.ac.nz>
Hi there,
I am currently using perl 5.001 patchlevel 1m on a Dec 2000/300 running
Digital Unix v3.2C.
I have written a small test program that makes use of ftp.pl.
It simply connects to a remote site.
Changes directory.
Performs a directory listing.
Then quits.
The program works fine.
However, if I connect to an FTP server running Netware version 3 or 4 I
am unable to perform the "Change directory".
Eg, I get:
CWD somedir
257 "somedir" is the new directory
timed out
My program then gracefully exits.
Why does this happen??
--
/------------------------------------------------------------------------\
| Mahendra Vallabh (Mike) |
| Analyst Programmer/Network Administrator |
| Physics Department |
| School of Science |
| University of Waikato Phone: +64 (7) 856 2889 ext. 6508 |
| Hamilton Fax: +64 (7) 838 4219 |
| NZ Email: mike@cs.waikato.ac.nz |
\------------------------------------------------------------------------/
------------------------------
Date: 12 May 1997 02:53:52 GMT
From: Query??????
Subject: grep pat from multiple files
Message-Id: <5l60o0$mpq@triton.np.ac.sg>
Hi,
Would appreciate any pointers to the following problem:-
I would like to grep a pattern from multiple files. These multiple
files are defined in a script as variables with wild-cards(*).
###################
example:-
$listdir="/tmp/searach/dir";
$outfile="/tmp/get/file";
$greppat=$ARGV[0];
### I want to open all files names ending with "desc"
open (IN , "$listdir/*desc") || die "can't open $listdir to read ($!)\n";
open (OUT, ">$outfile") || die "can't open $outfile to write ($!)\n";
while <(IN>)
{
print OUT if /$greppat/;
}
###################
Thanks.
------------------------------
Date: Sun, 11 May 1997 22:51:51 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: grep pat from multiple files
Message-Id: <n446l5.qj1.ln@localhost>
Query?????? wrote:
: Hi,
: Would appreciate any pointers to the following problem:-
Since you already appear to have located the problem, I assume you
really are asking for pointers to a solution ;-)
: I would like to grep a pattern from multiple files. These multiple
: files are defined in a script as variables with wild-cards(*).
: ###################
: example:-
: $listdir="/tmp/searach/dir";
: $outfile="/tmp/get/file";
: $greppat=$ARGV[0];
: ### I want to open all files names ending with "desc"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Then you'll need to loop through each file (or open a filehandle for each).
One file per filehandle is all you get (at one time).
So, then the problem becomes how to get the list of filenames?
The best way (because you get the full power of regular expressions,
rather than the very limited set of wildcards offered by globbing)
would be:
opendir(DIR, ".") || die "could not opendir() $!";
@fnames = grep /desc$/, readdir(DIR);
closedir(DIR);
Another way would be to use a filename glob:
@fnames = <*desc>;
then:
foreach $fname (@fnames) {
open(IN, $fname) || die "uh oh $!";
while (<IN>) {
print if /$greppat/;
}
close(IN);
}
--
Tad McClellan SGML Consulting
Tag And Document Consulting Perl programming
tadmc@flash.net
------------------------------
Date: Mon, 12 May 1997 10:35:07 BST
From: gml4410@ggr.co.uk (Lack Mr G M)
Subject: Re: How do You use perl to Permanently Change a Directory?
Message-Id: <1997May12.103507@ukwit01>
Keywords: change directory permanent
In article <5l3b1s$4fq@sf18.dseg.ti.com>, simonson@skopen.dseg.ti.com (Kevin M Simonson) writes:
|> As you can see below, I'm trying to use the Unix "cd" command inside a
|> "perl" script to change my default directory. I want to do this because
|> there are a lot of commands I want to execute in the directory I'm "cd"ing
|> to. However, whether I try to execute the "cd" using the "system ()" com-
|> mand, or within a couple of backtics, the "cd" doesn't appear to take per-
|> manent effect, since the "pwd" afterwards shows I'm still in the directory
|> I started out with.
|>
|> Does anyone out there know why this is happening? And/or what I can
|> do to change my default directory so that it will _stay_ changed? Thanks
|> in advance.
The system call is run by another (sub-) process, so it is that
process which see the change. This is intentional (for security
reasons). No sub-process may change the environment of its parent (and
the working-diretcory is part of the environment, since it affects all
non-fully-qualified filenames).
Instead of using system('cd xyz'), use the perl builtin funtion:
chdir xyz;
indeed, you should also check you made it...
chdir xyz or die "Couldn't chdir to xyz: $!\n";
----------- Gordon Lack ----------------- gml4410@ggr.co.uk ------------
The contents of this message *may* reflect my personal opinion. They are
*not* intended to reflect those of my employer, or anyone else.
------------------------------
Date: 12 May 1997 03:37:31 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: Rolf Hatt <rolf@hallo.ch>
Subject: Re: How to start TCP-Server under inetd ???
Message-Id: <8cu3k9nfh0.fsf@gadget.cscaper.com>
[comp.lang.perl has been dead for two years. Use comp.lang.perl.misc.]
>>>>> "Rolf" == Rolf Hatt <rolf@hallo.ch> writes:
Rolf> I try to write a server program which should be startet from inetd.
Rolf> I bind the socket port to the one listed in the /etc/services, but it
Rolf> fails with the error msg: port already in use.
Rolf> Has somebody an idea how to this ??
You must choose if you are writing (1) daemon code or (2) something
that gets launched from inetd. If #2, you just read from stdin
and write to stdout, and inetd will launch a separate independent
process for each connection. You don't even have to touch sockets!
If #1, you'll want to look at "man perlipc" to get it right, and you
*won't* be involving inetd *at all*.
print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,495.69 collected, $182,159.85 spent; just 477 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: 09 May 1997 23:07:59 -0800
From: jldasch@3-cities.com (John L. Daschbach)
Subject: Re: MacPerl question
Message-Id: <jldaschsozvu7n4.fsf@3-cities.com>
"Erik D. Perkins" <Erik_Perkins@nt.com> writes:
>
> how do i open an application from within MacPerl and feed it
> (repeatedly) a whole file as its input?
>
I'm not a MacPerl expert, just a sometimes user. My experience has
been that the Applescript/Perl method sometimes works for this type of
problem, but it requires the application to have some Applescript
interface I think.
It's funny how the OS's that have a high level system scripting
language that can interact with programs are dying out in favore of
one's that don't (Mac/Applescript, OS2/ReXX).
--
John L. Daschbach
jldasch@3-cities.com
------------------------------
Date: Sun, 11 May 1997 22:22:03 -0700
From: Cimarron Taylor <cimarron@dis.org>
Subject: Re: New draft of scripting white paper
Message-Id: <3376A8FB.65F3@dis.org>
Raymond Johnson wrote:
>
> I think I would agree that domain-specific languages will continue to
> frow in usage. However, I don't think that general purpose language
> usage will shrink at all - what evidence do you have of it's decline?
> I think the use of both domain-specific and general purpose languages
> will grow as more of the world increases computer use.
I guess it depends on how you tally up usage. The actual use of currently
popular general purpose programming languages will probably increase as
long as the population itself increases, as will all things cultural
although the specific brand of general purpose language which is most
popular may vary from time to time.
Perhaps I should instead say that I think the number of programmers who
will earn a living using a general purpose language alone is declining
and will continue to decline because simple general purpose programming
skills are becoming as common as other communication skills and in many
ways we will have scripting languages like Tcl to thank for this. The
scripting language is becoming the tool of the information-age laborer.
This may just be wishful thinking, but I predict the distinguishing
characteristics of professional programmers of the next century will be
the algorithms they know, the problems they can solve and the technologies
they understand and not knowledge of a particular brand of general purpose
language or operating system. The "real" programming problems of the next
century will either require more sophisticated programming paradigms than
in use today or a radically different method for creating programs altogether.
>
> Tcl is interesting in this space because it is often used to create domain
> specific languages. The extension mechanism in Tcl is powerful enough to
> develop any type of new command, language construct, or programming paradigm
> that makes sense for a given domain. That's really what application level
> scripting languages are all about. Tcl is just one easy way to do that.
I disagree. The domain-specific languages you can build with Tcl
are pretty much limited to the variations of the simple procedural
constructs Tcl and most other shell languages have. Tcl is really
just a variation of /bin/sh which makes it easy to run commands in
the same process.
To put it another way, I've never heard anyone speak of extending the
"programming paradigm" of /bin/sh when they create a new executable.
Why should that terminology apply to Tcl?
To me the main difference between Tcl bindings to domain-specific
API libraries and a true domain-specific language is that the fundamental
execution model of a Tcl binding cannot differ from the semantics forced
on you by the Tcl interpreter whereas the execution model of a domain-specific
language can adopt the semantics most appropriate to the problem.
Cimarron Taylor
cimarron@dis.org
------------------------------
Date: Mon, 12 May 1997 03:22:50 GMT
From: frank@primemail.com (Frank Fisher)
Subject: Pattern Matching Help Needed!!
Message-Id: <33768ba1.5083407@nntp.a001.sprintmail.com>
I have a string I'm trying to match on:
$filter = "this is a test string 1234****";
$str = "1234****";
I get the following perl error:
/*/: ?+* follows nothing in regexp at test.pl line 58
this is line 58:
if ($str =~ /$filter$/)
Is there anyway to turn off perl trying to see the * char as a special
character? I need to look at the last part of the string which is
1234****
Thanks...
--frank
------------------------------
Date: 13 May 1997 08:28:11 GMT
From: "Robert Ding" <dingzq@imedia.com.sg>
Subject: PLL file
Message-Id: <01bc5f77$eb569c00$12b710ac@Robert.imedia.com.sg>
Does anybody tell me what's .pll file, is it perl link library? and how to
use it ?
------------------------------
Date: 12 May 1997 04:53:55 GMT
From: "Eric D. Friedman" <friedman@uci.edu>
Subject: Re: private scalar for each instance of an object?
Message-Id: <5l67p3$7cg@news.service.uci.edu>
[mailed, posted]
In article <m34tc97h1d.fsf@gsubc.dot.edu>,
David Ishee <dmi1@ra.msstate.edu> wrote:
>I am trying to write my first perl object. In this object, I need to
>have a private scalar variable that is global for the object, but each
>instance of this object needs to have it's own private copy. I've got
>a get_data subroutine to give $data to the outside world if someone
>wants it.
Remember that an object is just a reference that's been blessed into a
particlar class. Assuming that you're using a hash reference (standard
practice, though you could certainly use an array or scalar ref if you
wanted to), you can create a hash entry for your scalar, and it will be
available to all of the methods in your object's namespace. Since each
instance has its own hash, the scalars for each object can have
different values. Perl doesn't really have 'private' variables, though
you can use stylistic conventions to indicate that something shouldn't
be messed with. for example
sub _my_private_function { }
HTH,
Eric
--
Eric D. Friedman
friedman@uci.edu
------------------------------
Date: Tue, 13 May 1997 19:21:39 -0700
From: Tom Jennings <tomjenn@pacbell.net>
Subject: Q: Is Win95 Perl5 select() for device COM1 implemented?
Message-Id: <337921B2.60F5@pacbell.net>
Q: Does select() really work on Win95 serial device "COM1" opened with
sysopen()? It seems to return "ready" always.
I'm trying to do non-locking I/O to a serial device, to get ASCII text
from a lab instrument tied to COM1. For now I'm using ugly old msdos
"MODE" to set bit rate, etc. Lab inst. spews text 9600-8-N-1 when button
pushed.
sysopen(HANDLE, "COM1", O_RDWR) doesn't raise DTR etc; that may be an
indication of unsupported. Faking CD, DSR, etc has no effect.
'perl -w' sez O_NDELAY and O_NOCTTY not supported!
Wiring etc OK, as I can read text with a homemade ("C") term prog.
Help!?
If you care to look, here's code frag massively edited for brevity. Any
hints GREATLY appreciated. I did RTFM FAQs, etc...
...
# open
sysopen(SERIAL, "COM1", O_RDWR) or die ...
# create bit masks
$rbits= $wbits= "0";
vec($rbits, fileno(SERIAL), 1)= 1; # read
vec($wbits, fileno(SERIAL), 1)= 1; # write
# Poll
($v, $foo)= select ($i= $rbits, $o= $wbits, undef, 0);
# test results
if ($i & $rbits) {
$r= sysread (SERIAL, $c= "", 1); # OK to read...
...
} else {
# not OK, read will block
}
------------------------------
Date: 14 May 1997 04:58:03 GMT
From: brdavis@orion.ac.hmc.edu (Brooks Davis)
Subject: Re: setuid script problems
Message-Id: <5lbgor$6pl$1@cinenews.claremont.edu>
Russ Poldrack (poldrack@psych.stanford.edu) wrote:
: I am trying to run a perl script from a bourne shell script that has a
: setuid wrapper written in C (in Solaris). Looking at the perlsec man
: page and FAQ, it is not clear how to set up the perl script so that it
: can do file operations with the proper setuid characteristics. Right now
: I get insecure path and insecure dependency errors. any suggestions
: would be most appreciated.
This sounds to me like a problem with the setuid wrapper, not a perl problem,
although you could solve it in perl if you wanted to. If you want to
solve it in perl (and the version of Solaris you are running is modern,
like 2.5+) then you can simple make the script setuid.
The correct solution is probably to not do that at all and just have the
setuid wrapper work correctly. If the wrapper is running as super-user,
some behavior changes to help prevent you from shooting your self in the
foot. For more information read the setuid(2) manpage carefully. It took
me a couple times through to figure out what was going on, but it's not
actually all that bad.
HTH,
Brooks
------------------------------
Date: 12 May 1997 05:27:14 GMT
From: lloyd@cs.fsu.edu (Justin C Lloyd)
Subject: speeding up a regex
Message-Id: <5l69ni$nl8$1@news.fsu.edu>
I'm working on a program that has to read the entire password file for each
student on a roster, often many rosters, and perform a regex check *on each
line*. The purpose is to find the usernames of the people on the rosters.
What I have works pretty good, but given the amount of data I've been speeding
it up as best I can. Here is what I have:
The persons name in the roster (I'll use mine as an example) is in the format
LLOYD JUSTIN C
There may or may not be a middle initial, and there may be something extra,
such as JR, SR, III, etc. The names in the password file look like
Justin C Lloyd
But they don't always match (i.e., extra whitespace, middle initial might be
in only one of two places, etc).
I simply want to know if the regex I am using can be sped up any more. I've
read most of Jeffrey Friedl's "Mastering Regular Expressions", but I know
there are some savvy people out there who've been doing this stuff a lot
longer than I have, such as Jeffrey. :)
Anyway, my Perl 5.003 regex is this:
$_[5] =~ /^($first|$firstinit)?\s+($middle\s+)?$last$/i
@_ contains the result of a pwent call, and $first, $middle, and $last contain
what you would expect, and $firstinit is the person's first initial. I ignore
the extra stuff (Jr, Sr, III).
Any ideas that I might be overlooking? If you need any more details, e-mail
me.
JcL
--
Justin C. Lloyd ______________________________________________________________
Graduate Teaching Assistant phone: 904/644-0559
Department of Computer Science email: lloyd@cs.fsu.edu
Florida State University www: http://www.cs.fsu.edu/~lloyd
P + L = :)
------------------------------
Date: 12 May 1997 06:29:50 GMT
From: lloyd@cs.fsu.edu (Justin C Lloyd)
Subject: Re: speeding up a regex
Message-Id: <5l6dcu$pjg$1@news.fsu.edu>
Just me again, responding to my own message. After weeks of thinking about
this, I finally post a question and then come up with something. I changed
$_->[5] =~ /^($first|$firstinit)?\s+($middle\s+)?$last$/
to
$_->[5] =~ /^$firstinit/ && /^($first|$firstinit)?\s+($middle\s+)?$last$/
\________________/
and that sped it up tremendously.
I would, however, still appreciate any advice people may have. You can never
learn too much...
JcL
--
Justin C. Lloyd ______________________________________________________________
Graduate Teaching Assistant phone: 904/644-0559
Department of Computer Science email: lloyd@cs.fsu.edu
Florida State University www: http://www.cs.fsu.edu/~lloyd
P + L = :)
------------------------------
Date: Mon, 12 May 1997 08:26:05 -0400
From: Brian Haney <bhaney@elvis.turner.com>
Subject: Timing Out While waiting for user input
Message-Id: <33770C5D.50E7@elvis.turner.com>
What I am trying to accomplish is asking a user for input. If they
do not enter input within a specific amount of time, the program will
continue.
A general algorithm would be:
if (wait 60 sec for user input) {
take user input;
} else { # no user input after 60 sec
do other code;
}
Thanks,
Brian
--
Brian Haney Brian.Haney@turner.com
Turner Broadcasting System, Inc.
One CNN Center, 11 South
Box 105366
Atlanta, GA 30348 FAX : (404) 588-6000
------------------------------
Date: 13 May 1997 23:15:50 -0400
From: jete@dgs.dgsys.com (Jete Software Inc.)
Subject: Trouble building perl5.003 on solaris
Message-Id: <5lbap6$d9q@dgs.dgsys.com>
I was attempting to build 5.003 on Solaris X86 and keep getting the following
errors when trying to compile sdbm.c
/export/home/SUNWspro/SC2.0.1/cc -c -I/usr/local/include -I/usr/include \
-O -DVERSION=\"0.10\" -DXS_VERSION=\"0.10\" -Kpic -I../../.. \
-DSDBM -DDUFF sdbm.c
"sdbm.c", line 39: syntax error, probably missing ",", ";" or "="
"sdbm.c", line 39: formal parameter lacks name: param #1
"sdbm.c", line 39: formal parameter lacks name: param #2
"sdbm.c", line 39: syntax error before or at: malloc
"sdbm.c", line 39: warning: function prototype parameters must have types
"sdbm.c", line 39: warning: old-style declaration; add "int"
"sdbm.c", line 40: syntax error, probably missing ",", ";" or "="
I get this with both the Sunpro and the gcc compilers. Here is the offending
line from the program.
extern Malloc_t malloc proto((MEM_SIZE));
extern Free_t free proto((Malloc_t));
So where does it expect to find Malloc_t???
Thanks!!
-- Norman
------------------------------
Date: 11 May 1997 22:51:28 -0700
From: danny@hendrix.postino.com (Danny Aldham)
Subject: Using DBI across a network
Message-Id: <5l6b50$4i5$1@hendrix.postino.com>
I am working thru this months Perl Journal and am trying out the DBI
examples by Alligator Descartes and Tim Bunce. My box is running SCO
Openserver with perl5.003. On the network I have a Redhat linux box
running Postgresql and an HPUX box running Oracle. I want to connect
to the Oracle box and pull data to insert onto the Linux box. But,
I cannot seem to find the correct syntax to connect to either
database. I try $dbh = DBI->connect($database,$user,$auth) but
get an error, as I would expect, since I haven't told it what
system the database is on, and I am not sure how to. I must be
missing something simple and would appreciate any help.
--
Danny Aldham SCO Ace, MCSE www.postino.com
------------------------------
Date: Wed, 14 May 1997 01:35:07 -0600
From: dominic@thiru.vetri.com
Subject: Re: Want perl on Win95 Platform
Message-Id: <863591033.7963@dejanews.com>
In article <01bc5fbf$858e0280$62ab85cd@mardon>,
"Don Botten" <donb@wcnet.org> wrote:
>
> I am running windows 95 and would like to test my perl scripts in my
> computer. Up to now I have telneted into my isp and checked them out on
> unix. The perl interpreters I have found are for Windows NT or OS2.
>
> Can anyone help me with this.
>
> donb@wcnet.org
check http://www.activeware.com
Regards
Dominic
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
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 473
*************************************