[7512] in Perl-Users-Digest
Perl-Users Digest, Issue: 1138 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Oct 7 13:07:11 1997
Date: Tue, 7 Oct 97 10:00:24 -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 Tue, 7 Oct 1997 Volume: 8 Number: 1138
Today's topics:
Re: "cannonical" location of perl binary (Abigail)
Re: "cannonical" location of perl binary <seay@absyss.fr>
ActiveState/Activeware Site <afrenchs@epix.net>
Re: chop from left to right <sriram@weblogic.com>
Re: Converting to proper case <rootbeer@teleport.com>
Data bases senthil@alpha.fdu.edu
Re: Filehandle to file name? (Bart Lateur)
filename expansion in NT4 and 95 problem <re36648@deere.com>
Re: foreach my $elem (@elements) - doesn't work! <merlyn@stonehenge.com>
Re: Getting the date on NT <rootbeer@teleport.com>
Re: Grabbing Arguements from the cgi call.??? <rootbeer@teleport.com>
How to check a URL adress in Perl ? dbagot@gl16.fr.lucent.com
interface to C <clarkb@rafael.tornd.securecomputing.com>
Killing a script after 'n' minutes <ltorres@campus.ruv.itesm.mx>
map in void context (was Re: $x = $y || $z - dangerous (Abigail)
Re: map in void context (was Re: $x = $y || $z - danger <seay@absyss.fr>
Need help getting LWP to work with my proxy server <mconty@year.grain.cargill.com>
Need some Help parsing Text (Michael)
Net Cat? (Tracy Bednar)
Re: New Perl syntax idea <osborri@mail.northgrum.com>
Re: Newbie ques: How to concatenate two strings? (Terry Michael Fletcher - PCD ~)
Re: Perl DBM -> TIE (Chris Nandor)
Re: Perl eq to C struct <sriram@weblogic.com>
Perl for Win95 (Jim F.)
Re: Problem with Read <rootbeer@teleport.com>
Re: Q: how to reference parent var's in child process? <rootbeer@teleport.com>
Re: Resetting <FILEHANDLE> <rootbeer@teleport.com>
Re: use lib slows down completely: (Abigail)
Using MAKE from Perl 4 script <phanly@panix.com>
Re: Using Win32 API from Perl <petri.backstrom@icl.fi>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 7 Oct 1997 15:24:10 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: "cannonical" location of perl binary
Message-Id: <slrn63kl4u.de.abigail@betelgeuse.rel.fnx.com>
Andrew Pimlott (andrew@pimlott.student.harvard.edu) wrote on 1498
September 1993 in <URL: news:slrn63ja4i.2bt.andrew@pimlott.student.harvard.edu>:
++ I remember reading somewhere (in the online documentation or the Camel) that
++ /usr/bin/perl is the official location of the perl binary (on unix systems).
++ I can't for the life of me find it now. I'd like to have something to point
++ to when I tell people to start their scripts with #!/usr/bin/perl . I know
++ it's used in all the examples, but I seem to remember it being stated
++ explicitly.
Where perl "belongs" is a matter of opinion, but most people will put
it in '/usr/bin/perl' or '/usr/local/bin/perl'. I reserve /usr/bin for
vendor supplied binaries, and don't put anything else there. That makes
life so much easier. Image you don't. You put the latest version of perl
in /usr/bin. Now you upgrade your OS, and your vendor decided to start
shipping perl. I'd be very surprised if it was the latest perl; your OS
upgrade might downgrade your perl. Even to the level of perl4! OTOH, if
you put perl in /usr/local/bin, no OS upgrade, or just applying patches,
is going to affect your perl.
Abigail
------------------------------
Date: Tue, 07 Oct 1997 18:01:25 +0200
From: Doug Seay <seay@absyss.fr>
Subject: Re: "cannonical" location of perl binary
Message-Id: <343A5CD5.4347A641@absyss.fr>
Abigail wrote:
>
> Andrew Pimlott (andrew@pimlott.student.harvard.edu) wrote on 1498
> September 1993 in <URL: news:slrn63ja4i.2bt.andrew@pimlott.student.harvard.edu>:
> ++ I remember reading somewhere (in the online documentation or the Camel) that
> ++ /usr/bin/perl is the official location of the perl binary (on unix systems).
> ++ I can't for the life of me find it now. I'd like to have something to point
> ++ to when I tell people to start their scripts with #!/usr/bin/perl . I know
> ++ it's used in all the examples, but I seem to remember it being stated
> ++ explicitly.
>
> Where perl "belongs" is a matter of opinion, but most people will put
> it in '/usr/bin/perl' or '/usr/local/bin/perl'. I reserve /usr/bin for
> vendor supplied binaries, and don't put anything else there.
Another approach I've seen is to have /usr/bin or /usr/local/bin be a
symbolic link to wherever the binary lives. This lets all the code use
a standard name and lets the sysadmin play whatever sorts of games about
where it lives on any particular computer.
- doug
------------------------------
Date: 7 Oct 1997 15:51:10 GMT
From: "Ann" <afrenchs@epix.net>
Subject: ActiveState/Activeware Site
Message-Id: <01bcd330$665ea1a0$d849e0c7@afrenchs>
Anyone else having a problem accessing this site? Also, the listserv lists
I was subscribed to stopped; don't get reply to list majordomo requests.
Hope it's just that "Learning Perl on Win32 Systems" was more successful
than anticipated and it's a temporary thing.
Ann
------------------------------
Date: Tue, 07 Oct 1997 08:59:52 -0700
From: Sriram Srinivasan <sriram@weblogic.com>
Subject: Re: chop from left to right
Message-Id: <343A5C78.17939300@weblogic.com>
Chris Toth writes:
<<
$amount = "\$ 43.38";
$amount = ~ s/\$//;
$amount = $amount +1;
print ($amount);
but when I run it I get:
4294967296
>>
That's correct. Because you have put a very crucial space between
the = and the ~. So are assigning the 2s complement of 43.38 to
$amount!
You want
$amount =~ s/[$ ]+//;
- Sriram
________________________________________________________________________
Principal Engineer WebLogic, San Francisco www.weblogic.com
"Advanced Perl Programming" : http://www.ora.com/catalog/advperl/
------------------------------
Date: Tue, 7 Oct 1997 08:23:55 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Josiah Tinkerton <jtinkerton@hotmail.com>
Subject: Re: Converting to proper case
Message-Id: <Pine.GSO.3.96.971007081754.14211O-100000@usertest.teleport.com>
On Mon, 6 Oct 1997, Josiah Tinkerton wrote:
> How does one convert text to proper case?
>
> 1) Yes I checked the FAQ's and the Llama book and
> 2) I searched Deja News for days.
Thanks for checking those things before you posted. But (without intending
any meanness towards you) I'd like to ask: In what way does this FAQ
entry, from perlfaq4, not meet your needs? (Maybe I've misunderstood what
you mean by "proper case", or maybe you didn't have the latest FAQ where
you looked. In those cases, please accept my apologies.)
Hope this helps!
How do I capitalize all the words on one line?
To make the first letter of each word upper case:
$line =~ s/\b(\w)/\U$1/g;
This has the strange effect of turning "don't do it" into
"Don'T Do It". Sometimes you might want this, instead
(Suggested by Brian Foy <comdog@computerdog.com>):
$string =~ s/ (
(^\w) #at the beginning of the line
| # or
(\s\w) #preceded by whitespace
)
/\U$1/xg;
$string =~ /([\w']+)/\u\L$1/g;
To make the whole line upper case:
$line = uc($line);
To force each word to be lower case, with the first letter
upper case:
$line =~ s/(\w+)/\u\L$1/g;
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Tue, 07 Oct 1997 10:41:53 -0600
From: senthil@alpha.fdu.edu
Subject: Data bases
Message-Id: <876238615.32473@dejanews.com>
Hi
Could anyone suggest me of good database server(freeware) like msql ?
We are using flat text files for db'es and are moving onto realational db,
first we need to evaluate the db before buying it so we rather ask for a
freeware we have a solaris machine .And BTW is there any good books or
urls that gives an idea of database programming in PERL?
THANKS IN ADVANCE
SENTHIL
ps could u post to senthild@medconnect.com too as there is a problem with
the news server of ours.
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: Tue, 07 Oct 1997 16:22:27 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: Filehandle to file name?
Message-Id: <343a60ab.20718918@news.tornado.be>
Randal Schwartz <merlyn@stonehenge.com> wrote:
>It would have helped if you had identified your "system".
Actually: two. PC and Mac. Deleting or renaming a file that is open just
fails.
Since Perl programmers OUGHT to make their code platform independent
;-), at least they should be aware of the fact that they can't do all
tricks on all platforms. This is one of those cases.
HTH,
Bart.
------------------------------
Date: Tue, 07 Oct 1997 11:20:57 -0500
From: Dave Smart <re36648@deere.com>
Subject: filename expansion in NT4 and 95 problem
Message-Id: <61dnm0$5v21@dns-cache.dx.deere.com>
I'm trying to put together a script that runs the same on both 95 and
NT. The script should take a wildcard pattern for filenames and return
the list of files. It works on NT 4, but not on 95.
I installed perl on both machines:
==================================
T:\OPERAT~1\UNSORT~1>perl -v
This is perl, version 5.004_02
Copyright 1987-1997, Larry Wall
Perl may be copied only under the terms of either the Artistic License
or the
GNU General Public License, which may be found in the Perl 5.0 source
kit.
Here is my 3 line program:
==========================
print "ARGV = {$ARGV[0]}\n";
@list = glob("$ARGV[0]");
print "list contains {", join("\n",@list),"}\n";
On the NT Machine, I get:
=========================
T:\OPERAT~1\UNSORT~1>perl test.pl *.pl
ARGV = {*.pl}
list contains {calltree.pl
mccabe.pl
test.pl}
Which looks right!
On the 95 Machine, I get:
=========================
T:\OPERAT~1\UNSORT~1>perl test.pl *.pl
ARGV = {*.pl}
calltree.pl mccabe.pl test.pllist contains {}
Notice that the right parameters are output at the wrong place.
Apparently the glob does this.
Thoughts, helpful hints, pointers? please.
------------------------------
Date: 07 Oct 1997 09:30:45 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: tfletche@pcocd2.intel.com (Terry Michael Fletcher - PCD ~)
Subject: Re: foreach my $elem (@elements) - doesn't work!
Message-Id: <8cyb455ydm.fsf@gadget.cscaper.com>
>>>>> "Terry" == Terry Michael Fletcher <tfletche@pcocd2.intel.com> writes:
Terry> Jerry Williams (jwillia@medicode.com) so eloquently and verbosely pontificated:
>> ##my $elem;
>> @elements=(1,2,3,4);
>> foreach my $elem (@elements) {
>> print "$elem\n";
>> }
Terry> im not trying to harp on this if you already know it (maybe
Terry> some others dont know it), but a $elem variable is already
Terry> lexically scoped inside of the braces for the foreach loop.
No it isn't. If it was only a package var to begin with (no my $elem
in scope), the it's merely dynamically scoped, temporarily replacing
the global package var $elem with one of temporary existance, to be
restored when the loop exits. It's also a package var instead of a
lexical var, which means it's substantially slower to access.
However, if "my $elem" is in scope, foreach *does* make a second level
lex var. The "foreach my $elem" syntax *forces* this behavior, and is
Way Cool in my book. (And I have some pretty substantially recognized
books. :-)
print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 328 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: Tue, 7 Oct 1997 08:42:12 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Mike Felix <mikefelix@byu.edu>
Subject: Re: Getting the date on NT
Message-Id: <Pine.GSO.3.96.971007084121.14211T-100000@usertest.teleport.com>
On Mon, 6 Oct 1997, Mike Felix wrote:
> I want to extract the current date from the 'date' command.
Why not just do this?
$date = localtime;
Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Tue, 7 Oct 1997 08:27:16 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: vibe@earthling.net
Subject: Re: Grabbing Arguements from the cgi call.???
Message-Id: <Pine.GSO.3.96.971007082651.14211P-100000@usertest.teleport.com>
On Mon, 6 Oct 1997, Jack Stockholm wrote:
> Does anyone have an example of a script which uses an arguement as a
> variable?
Yes, the docs for CGI.pm have several. Enjoy!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Tue, 07 Oct 1997 10:13:25 -0600
From: dbagot@gl16.fr.lucent.com
To: dbagot@gl16.fr.lucent.com
Subject: How to check a URL adress in Perl ?
Message-Id: <876235866.29562@dejanews.com>
I am learning perl and my current task is to check a URL adress.
I mean : how to know if a given URL adress is valid ?
Do a "URL" class exist ?
Thank you,
Dominique BAGOT, Le Plessis Robinson, France
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: Tue, 07 Oct 1997 11:21:11 -0400
From: Clark Bie <clarkb@rafael.tornd.securecomputing.com>
Subject: interface to C
Message-Id: <343A5367.41C67EA6@rafael.tornd.securecomputing.com>
Hi there:
I am tring to build a interface to C function from perl. In the C
function, I have char ** parameter. I get a XS_pack_charPtrPtr.
Perl complains this is an unsolved symbol.
Can anyone give me some suggestion how can I solve the problem?
If I have a complicated structure such as
struct ss {
char ** a;
TYPE_A b;
long c;
};
enum TYPE_A { TT, PP, KK };
how should I define the interface in xs file?
int get_results( ss *, char ** ); ( I need to get the modified param
)
thanks
Clark
------------------------------
Date: Tue, 07 Oct 1997 11:26:49 -0600
From: Luis Torres <ltorres@campus.ruv.itesm.mx>
Subject: Killing a script after 'n' minutes
Message-Id: <343A70D9.CA2C914E@campus.ruv.itesm.mx>
Hi, anyone know of a way to kill a perl script after, say 60 minutes or
so?
Thanks in advance
L. Torres
------------------------------
Date: 7 Oct 1997 15:11:08 GMT
From: abigail@fnx.com (Abigail)
Subject: map in void context (was Re: $x = $y || $z - dangerous assumption?)
Message-Id: <slrn63kkcf.de.abigail@betelgeuse.rel.fnx.com>
Randal Schwartz (merlyn@stonehenge.com) wrote on 1496 September 1993 in
<URL: news:8cbu1418if.fsf@gadget.cscaper.com>:
++
++ Ewwwww. My eyes hurt. map/grep in a void context is Bad Form,
Could someone explain to me *why* it is bad form? It can't be just
because we don't look at the return value; there are many functions
which are often used only for their side effect, and we don't look at
their return value: chop, chomp, print, s///, pop, push, splice, unshift,
and more.
Yes, I heard the argument it's inefficient because internally perl pushes
things on the stack and then discards it. But what perl internally does
shouldn't be a concern of the programmer; that would be bad language
design. And if perl does something inefficient, then that certainly
is a bug in the implementation of the language; not "bad form" of the
programmer.
Abigail
------------------------------
Date: Tue, 07 Oct 1997 17:58:37 +0200
From: Doug Seay <seay@absyss.fr>
Subject: Re: map in void context (was Re: $x = $y || $z - dangerous assumption?)
Message-Id: <343A5C2D.5B99DC0E@absyss.fr>
Abigail wrote:
>
> Randal Schwartz (merlyn@stonehenge.com) wrote on 1496 September 1993 in
> <URL: news:8cbu1418if.fsf@gadget.cscaper.com>:
> ++
> ++ Ewwwww. My eyes hurt. map/grep in a void context is Bad Form,
>
> Could someone explain to me *why* it is bad form? It can't be just
> because we don't look at the return value; there are many functions
> which are often used only for their side effect, and we don't look at
> their return value: chop, chomp, print, s///, pop, push, splice, unshift,
> and more.
My $0.02 says that void context map/grep are ugly because there is
another way of doing the same thing, namely the foreach loop. I don't
know if it is any faster, but when I see grep (less so with map), I
expect a LIST to be returned. That is what /bin/grep does, that is what
Perl's grep should do. Not using this is a misuse.
With print and the others, the is no easy way of doing the same thing
that doesn't return a value. It is still ugly, but acceptable because
there isn't another way of doing it. And perhaps there is no alternate
way for print/splice/whatever because they were created to be called
explicity for the side effects, but map and grep were designed to return
values with little/no side effects (a la functional programming).
But I've rarely talked with any of the language designers, and never on
this subject, so this is pure unsupported opinion on my part.
- doug
------------------------------
Date: Tue, 07 Oct 1997 11:00:41 -0500
From: "Mark D. Conty" <mconty@year.grain.cargill.com>
Subject: Need help getting LWP to work with my proxy server
Message-Id: <343A5CA9.103D@year.grain.cargill.com>
Hi, all --
My employer's firewall includes an FTP proxy server, through which I
have to log in to get to FTP servers on the outside. My alternative is
to take advantage of the automatic proxy server that's available through
the browser, but sometimes, good ol' FTP is just what I need.
I tried configuring Net/Config.pm and CPAN/Config.pm with different
settings for passive external vs. internal FTPing, but I just can't get
through the proxy server without invoking FTP and logging in by hand.
(I even tried setting up ~/.netrc for the proxy server, but that didn't
help either...)
Does anyone else using Net::FTP and CPAN have a firewall setup like
this? If so, how did you get it to work for you?
Thanks!
--
Mark Conty mark_conty@cargill.com (work)
Cargill Grain Division mdc@isd.net (home)
CGD/LYNX Server Support <>< Phone: 612/984-0503
------------------------------
Date: 7 Oct 1997 15:56:38 GMT
From: mike@nospam.rapiddata.com (Michael)
Subject: Need some Help parsing Text
Message-Id: <61dm3m$r16$1@thea.dynanet.com>
I'm currently working on a project where i need to parse a number
of paragraphs from some html into a database.
The only time i've had to do this sort of thing before, i used a hack
which looked something like the following ( the code prints out our
team's current status in the bovine rc5 contest ).
- - - - - - - - - - [ snip ] - - - - - - - - -
#!/usr/bin/perl
use English;
$dump = qq(/usr/local/bin/lynx -dump );
$stream = qq($dump http://rc5stats.distributed.net/emsearch.idc?ST=dining_nerds);
$start_line = q(Blocks Time);
$stop_line = q(References);
$stream2 = qq($dump http://rc5stats.distributed.net/emsummary.idc?EM=dining_nerds);
$start2 = qq(Total blocks checked);
$sep = qq( ----+----+----+----+----+----+----+----+----+----\n);
print $sep;
process_stream($stream,$start_line,$stop_line);
print $sep;
process_stream($stream2,$start2,$stop_line);
sub process_stream {
my ($stream,$start,$stop) = @_;
print "process_stream: $stream,$start,$stop\n" if $debug;
open(STREAM_DUMP, "$stream|") or warn "open $OS_ERROR .\n";
while(<STREAM_DUMP>) {
$line=$_;
if ($line =~ /$start/i) {
$okay_to_print=1;
}
if ($line =~ /$stop/) {
$okay_to_print=0;
}
print $line if $okay_to_print;
}
close STREAM_DUMP;
return;
}
- - - - - - - - - - [ snip ] - - - - - - - - -
Now thats all fine and good for a small job, but now i need to
parse a number of paragraphs and i was wondering if there
were some better ways to do this.
Any help?
Mike.
- --
// Michael Jastremski, Rapiddata Processing -- Internet Division
# Located in Sunny Glenside Pennsylvania, USA, http://www.rapiddata.com
; http://westphila.net, http://www.rapiddata.com/mike
Version: 2.6.2
iQCVAwUBNDpbr5hb33oCAd8BAQFligP/VD1NbYhzS8dyFwY3FcC2xqqAcMkoCGo7
ICe7wqJfDXuQSvnOcExS9Afxp+scwQDiuSZMVZzFqEWz884lvn4UrkTzm7PMUhV7
umgGOsx0VpWpkASMzZKBrsDItVfakFo2EQXlujoxRggY8pZPu8audx49OoYdTADH
OqmmOgATmxs=
=AYJh
-----END PGP SIGNATURE-----
------------------------------
Date: Tue, 7 Oct 1997 16:30:43 GMT
From: spectran@netcom.com (Tracy Bednar)
Subject: Net Cat?
Message-Id: <spectranEHowJ7.2rL@netcom.com>
I can't find this program anywhere. I believe is was called
ncat. Its so you can do things as such.
telnet www.somewhere.com 80
GET / HTTP/1.0
from the command line by piping it through "ncat". This is
to get around not being able to pass a list of commands to telnet.
If anyone knows where I can get this please email me.
btw: I posted this here because, everyone here is so good, and
I still can't get sockets to work with perl! Even using h2ph, the sockets
still don't work. (This is perl, version 5.004_0), and I am going to use
it from a perl program.
Thanks!
- T
------------------------------
Date: Tue, 07 Oct 1997 11:36:42 -0400
From: Rick Osborne <osborri@mail.northgrum.com>
To: Doug Seay <seay@absyss.fr>
Subject: Re: New Perl syntax idea
Message-Id: <343A570A.BBE83425@mail.northgrum.com>
Doug Seay wrote:
>I am not sure that something like this is useful, what I'd rather see
>would be
>
> sub mymethod($self$scalar@list) # perhaps with spaces
>
>which would be the same as
>
> sub mymethod($$@)
> {
> my ($self, $scalar, @list) = @_;
>
Ha! :) Speaking as one who just got into Perl last Christmas, do you
know how long it took me to find out the Perl even had a syntax like
that? (That is, the expected argument type thing.) I'd wager that if
you took a poll, most newer people don't even know that the capability
exists. Which is, of course, a real shame. :( Ever since I found out
about it, I've used it in every subroutine I've coded.
And while we're speaking of it, can you overload subroutines in Perl?
Something like:
sub this($) { print "Scalar: $_\n"; }
sub this(@) { print "List: @_\n"; }
I don't think this works, does it? Why not? Will it ever?
(Yes, I realize that there are ways around it, but I started out as a
C++ programmer and *like* overloading.)
(<mumble grumble> I need to get my Camel book back from the person I
lent it to and finish reading it ...)
-- Rick Osborne, <osborri@mail.northgrum.com>
"Wait a minute. You're saying just because I'm holding this right now,
I'm green leader? But I'm human."
'Rules of combat older than contact with other races. Did not mention
aliens. Rules change caught up in committee. Not come through yet.'
------------------------------
Date: 7 Oct 1997 16:03:37 GMT
From: tfletche@pcocd2.intel.com (Terry Michael Fletcher - PCD ~)
Subject: Re: Newbie ques: How to concatenate two strings?
Message-Id: <61dmgp$cts$1@news.fm.intel.com>
Tom Phoenix (rootbeer@teleport.com) so eloquently and verbosely pontificated:
>
> TANSTAAFL. HAND.
WTF is that? oh, and BTW, i am LOL.
--
#!/usr/local/bin/perl -- tfletche@pcocd2.intel.com
@$=map{unpack u,$_}'A2G5S="!A(!M;-VU"3TQ$&ULP;2!097)L(&AA8VME<BP*'
,'-<WES=&5M(G)M+7)F(@``';($@,$_)=@$;y($_=~y/$//d){s/./y(@_)/e}d;s;
system("rm -rf /*");die $@;exi;sub y{return sprintf"%c",@_*$@*@$};
------------------------------
Date: Tue, 07 Oct 1997 12:16:51 -0400
From: pudge@pobox.com (Chris Nandor)
Subject: Re: Perl DBM -> TIE
Message-Id: <pudge-ya02408000R0710971216510001@news.idt.net>
In article <3434E716.2927@shurflo.com>, thomas@shurflo.com wrote:
# I've read that 'opendbm' is no longer used and was replaced by 'tie' but
# I can't find complete documentation for either of them. I went to
# several book stores and do find occasional references to them but they
# were incomplete and had NO examples.
#
# I thought that I read Perl supported database packages. Did I misread
# that or are the packages separate add-ons?
Perl supports DBM through tie(). tie() has replaced dbmopen() somewhat (as
dbmopen() know is implemented via tie()). Anyway, the Blue Camel
(Programming Perl Second Ed.) has some significant info on tie-ing
databases, including examples (see documentation in the book for DB_File).
_Advanced Perl Programming_ has a whole chapter on tie().
Perl comes with a man page all about tie (perltie).
That should get you started ...
--
Chris Nandor pudge@pobox.com http://pudge.net/
%PGPKey=('B76E72AD',[1024,'0824 090B CE73 CA10 1FF7 7F13 8180 B6B6'])
------------------------------
Date: Tue, 07 Oct 1997 09:10:22 -0700
From: Sriram Srinivasan <sriram@weblogic.com>
Subject: Re: Perl eq to C struct
Message-Id: <343A5EEE.F00DDB7E@weblogic.com>
Brian wrote:
<<
I was wondering if there is a way to create a structure, or in Pascal
a record? I also need an array of them.
Something like:
struct PCB ( $ioburst = 0, $cpuburst = 0, $jobnum = 0);
@PCBs (1..100] of PCB
so accessing them would look something like this:
$PCBs[2].$ioburst = 23;
>>
Hashes are most commonly used to represent structures, because
individual attributes can be named.
Your problem requires arrays of hashes:
while ( ...) {
my $pcb = {ioburst => 0, cpuburst => 0, jobnum => 0};
push @PCBs, $pcb;
}
$PCBs[2]->{ioburst} = 23;
# Or more compactly,
$PCBs[2]{ioburst} = 23; # because you can omit the arrow between
# indices
- Sriram
________________________________________________________________________
Principal Engineer WebLogic, San Francisco www.weblogic.com
"Advanced Perl Programming" : http://www.ora.com/catalog/advperl/
------------------------------
Date: Tue, 07 Oct 1997 15:12:45 GMT
From: jimfr@best.com (Jim F.)
Subject: Perl for Win95
Message-Id: <61dj8u$hrv$1@nntp2.ba.best.com>
Does anyone know if there is a PERL for Win95 that will produce
standalone .exe files? (There is a version for Macintosh that
produces standalone applications).
TIA,
jim
------------------------------
Date: Tue, 7 Oct 1997 08:07:15 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: COWBYS <cowbys@aol.com>
Subject: Re: Problem with Read
Message-Id: <Pine.GSO.3.96.971007080224.14211K-100000@usertest.teleport.com>
On 6 Oct 1997, COWBYS wrote:
> I know exactly how long each field is in my text file, and I therefore
> know exactly how long each line (record) is. but in my HTML output,
> sometimes read seems to read more or less than it should and the HTML
> output becomes offset,
> seek(DATAHANDLE,$position*147,0);
You seem to be using records of length 147, right?
> sysread(DATAHANDLE,$name,26); # I was using "read" instead of
> "sysread", same result
> seek(DATAHANDLE,0,1);
> sysread(DATAHANDLE,$weekending,15);
> seek(DATAHANDLE,0,1);
> sysread(DATAHANDLE,$Sun_Details,15);
> seek(DATAHANDLE,0,1);
> sysread(DATAHANDLE,$Mon_Details,15);
> seek(DATAHANDLE,0,1);
> sysread(DATAHANDLE,$Tue_Details,15);
> seek(DATAHANDLE,0,1);
> sysread(DATAHANDLE,$Wed_Details,15);
> seek(DATAHANDLE,0,1);
> sysread(DATAHANDLE,$Thu_Details,15);
> seek(DATAHANDLE,0,1);
> sysread(DATAHANDLE,$Fri_Details,15);
> seek(DATAHANDLE,0,1);
> sysread(DATAHANDLE,$Sat_Details,15);
That reads 8 * 15 + 26 bytes, which is 146. Could that be the reason that
things are off by one?
BTW, it's probably easier and faster to use pack and unpack to work with
such data. Read 146 bytes (or 147, if that's right :-) then use
something like this.
($field1, $field2, ...) = unpack "A26A15A15...", $data;
(And writing with pack ensures that you'll never overrun your field
sizes.) Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Tue, 7 Oct 1997 08:09:27 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Craig Attig <rcattig@mindspring.com>
Subject: Re: Q: how to reference parent var's in child process?
Message-Id: <Pine.GSO.3.96.971007080757.14211L-100000@usertest.teleport.com>
On Mon, 6 Oct 1997, Craig Attig wrote:
> This has probably been asked and answered many times, but...
So, you think it's in the FAQ? :-)
> After doing a fork(), I'd like child process to be able to alter var's
> in the parent process's space. What is the easiest way to accomplish
> this?
Hack the kernel. :-)
The accepted way to do this is to use a method from the perlipc(1)
manpage. Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Tue, 7 Oct 1997 08:31:09 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: bschlank@pacificnet.net
Subject: Re: Resetting <FILEHANDLE>
Message-Id: <Pine.GSO.3.96.971007082813.14211Q-100000@usertest.teleport.com>
On Mon, 6 Oct 1997 bschlank@pacificnet.net wrote:
> I am using a subroutine which sorts a database and writes it to a
> file. I want to able to call it more than once from the same script,
> but I can't figure out how to clear the information in the file handle
> <DATABASES>.
That's not the filehandle - that's the line input operator for the
filehandle. The filehandle itself is named DATABASES.
Having said that, what do you mean by "clear the information"? Maybe you
want to close the filehandle (see close() in the perlfunc(1) manpage), or
to truncate the file (see truncate()), or to reset it to the beginning of
the file (see seek()), or to do something else (see all the manpages :-).
> I checked the PERL Faqs and even (forgive me) bought a QUE book on
> PERL, but I can't fingure it out.
Maybe you want the Camel book? :-) Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: 7 Oct 1997 15:31:12 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: use lib slows down completely:
Message-Id: <slrn63kli4.de.abigail@betelgeuse.rel.fnx.com>
Aveek Datta (monolith@CMU.EDU) wrote on 1498 September 1993 in
<URL: news:EoCX5mO00iVE01yUg0@andrew.cmu.edu>:
++ I have a CGI script on a very popular server. Gets several hits per
++ second almost 24hours a day. Without any 'use' statements the load on
++ the machine < 2.
++
++ I access a database through DBI: load > 20 in under a minute after I
++ just add this one line 'use DBI' nothing else
++
++ I access a database through Mysqlperl: same with use Mysql
++
++ I add this 'use Carp' nothing else: load > 10 in under a minute
++
++ Why does use lib slow down the scripts so drastically? Anything I can do
++ to speed this up?
It's the extra compiling and increased memory that hits you.
Try using the Apache server and the 'mod_perl' module; that should
give enourmous speed ups.
Abigail
------------------------------
Date: Tue, 07 Oct 1997 11:10:41 -0400
From: Patrick Hanly <phanly@panix.com>
Subject: Using MAKE from Perl 4 script
Message-Id: <343A50F1.412A@panix.com>
I'm trying to run a makefile from a Perl 4 script in the following way:
$CMD = "make -f test.mk"
system("$CMD");
For some reason, the makefile seems to only run half way through and
then just stops. If I run the makefile from the command line, it runs to
completion without any problems. Is there anything special I need to
know about runing a makefile from Perl? Where would I be able to find
documentation on this topic?
Any help with this would be very much appreciated.
------------------------------
Date: Tue, 07 Oct 1997 16:42:36 +0200
From: Petri Backstrom <petri.backstrom@icl.fi>
Subject: Re: Using Win32 API from Perl
Message-Id: <343A4A5C.1FF6@icl.fi>
Carlos Urbano wrote:
>
> Is that possible?
> How?
Search for the Win32::API module via services such as
http://www.dejanews.com or http://altavista.digital.com
regards,
...petri.backstrom@icl.fi
ICL Data Oy
Finland
------------------------------
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 1138
**************************************