[12523] in Perl-Users-Digest
Perl-Users Digest, Issue: 6123 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jun 25 03:07:26 1999
Date: Fri, 25 Jun 99 00:00:23 -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 Fri, 25 Jun 1999 Volume: 8 Number: 6123
Today's topics:
[Perl Mongers] 1999 White Camel Awards (brian d foy)
Aliasing subroutines and other naming tricks <brundlefly76@hotmail.com>
Re: CGI.pm: submit + image? (Peter Bismuti)
Re: CGI.pm: submit + image? (Peter Bismuti)
Re: DBD::ODBC error Undefined symbol "SQLAllocEnv" <ken_north@nospam.csi.com>
Re: DBI and ODBC (on NT-server) (Eric Bohlman)
formatting text in email <owls@the-spa.com>
Re: formatting text in email (Eric Bohlman)
Re: formatting text in email <tchrist@mox.perl.com>
Re: Help a newbie! (Eric Bohlman)
Re: How can I get size of uploaded image via CGI? <webmaster@chatbase.com>
Re: How can I read a whole file in one go ? (Larry Rosler)
Re: How can I use Perl variables in Javascript ? (Andrew Johnson)
Re: How can I use Perl variables in Javascript ? (Martien Verbruggen)
Re: Newbie - Perl books - which to get? (Robert Niederman)
Re: Newbie can't delete file <webmaster@chatbase.com>
Re: Onchat.com using java? How about perl? <webmaster@chatbase.com>
Re: Perl Distribution & Runtime <webmaster@chatbase.com>
Re: Perl in Win32 (Robert White)
PID of backticked process? (Stevie Strickland)
Re: PID of backticked process? (Stevie Strickland)
problem passing array back okurios@my-deja.com
problems with chmod function (Peter Bismuti)
Re: problems with chmod function (Larry Rosler)
Re: Regular Expression - Doubt (Eric Bohlman)
Text::ParseWords 5.004_04 / 5.004_05 (R. Freeman)
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 25 Jun 1999 01:12:19 -0400
From: brian@pm.org (brian d foy)
Subject: [Perl Mongers] 1999 White Camel Awards
Message-Id: <brian-2506990112200001@126.pittsburgh-01-02rs.pa.dial-access.att.net>
FOR IMMEDIATE RELEASE CONTACT: Sara Winge
June 24, 1999
707/829-0515 x285
sara@oreilly.com
http://www.oreilly.com
WHITE CAMEL AWARDS TO BE PRESENTED AT O'REILLY'S PERL CONFERENCE 3.0
SEBASTOPOL, CA-The rare white camel, prized by desert-dwellers, is the
inspiration for a new award recognizing the Perl community's "unsung
heroes"-those who have devoted extraordinary creativity, energy, and time
to the non-technical work that supports Perl's active and loyal user
community. The White Camel awards will be presented to individuals who have
made outstanding contributions to Perl Advocacy, Perl User Groups, and the
Perl Community at O'Reilly's Perl Conference 3.0 on August 24, 1999. The
camel has come to symbolize Perl since it first appeared on the cover of
O'Reilly & Associates' classic Programming Perl in 1991.
Perl Mongers (http://www.pm.org), a not-for-profit organization whose
mission is to establish Perl user groups, conceived of and will administer
the White Camel awards. Perl users will be able to nominate people for the
awards at http://www.perl.com/whitecamel after July 8. The awards are
sponsored by Perl Mongers, O'Reilly & Associates, and sourceXchange
(http://www.sourceXchange.com), a web-based marketplace for Open Source
development.
"Perl's user community has had a huge role in its adoption and ongoing
development ," said Madeline Schnapp, O'Reilly's Perl Product Manager.
"With a marketing budget of zero, the community has championed a technology
that has greater market share than its well-funded proprietary competitors.
We're delighted that the Perl Mongers initiated the White Camel awards, and
we're proud to sponsor them."
ABOUT O'REILLY & ASSOCIATES
O'Reilly & Associates is recognized worldwide for its definitive books on
open source software, the Internet, programming, Windows NT and UNIX.
O'Reilly also produces
award-winning Internet software, technical conferences, and innovative
web-based courses. From their pioneering bestseller The Whole Internet
User's Guide & Catalog (designated one of 100 Books of the Century by the
New York Public Library) to GNN (the first Internet portal and commercial
website) to WebSite (the first web server software for desktop PCs),
O'Reilly has been at the forefront of Internet development. Information
about the company can be found at http://www.oreilly.com.
# # #
Sara Winge sara@oreilly.com
Public Relations
O'Reilly & Associates, 101 Morris St., Sebastopol, CA 95472
707-829-0515 x285, Fax 707-829-0104, http://www.oreilly.com
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>
------------------------------
Date: Fri, 25 Jun 1999 05:36:39 GMT
From: Brundle <brundlefly76@hotmail.com>
Subject: Aliasing subroutines and other naming tricks
Message-Id: <7kv4h7$r2o$1@nnrp1.deja.com>
2 questions:
I need to create an alias for a subroutine, so I can have it point to
either of two subroutines:
For example:
I want to switch the subroutine
deliver)
to actually be an alias for
deliver_smtp
or
deliver_ftp
as needed.
Here's another one:
I want to do some trickery where I can alias a string for a namespace,
so I can create objects base on variables (its late I know Im not making
this too clear):
Instead of:
if($string eq 'FOO'){
$object=new FOO;
}
I want to say:
$object=new $string; # Where string is 'FOO' and I create new FOO object
Thanks in advance for any help.
Thanks
Chris
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 25 Jun 1999 05:39:32 GMT
From: bismuti@cs.fsu.edu (Peter Bismuti)
Subject: Re: CGI.pm: submit + image?
Message-Id: <7kv4mk$n56$2@news.fsu.edu>
Abigail (abigail@delanet.com) wrote:
: Peter Bismuti (bismuti@cs.fsu.edu) wrote on MMCXX September MCMXCIII in
: <URL:news:7kkd7r$838$1@news.fsu.edu>:
: :: I would like to use the submit function that display an image instead of
: :: the standard button and label. I do NOT mean an image_button, which does
: :: not allow you to pass back a value with the name, just the coordinates
: :: where you clicked on the image. I want it to behave *exactly* like a regular
: :: submit button just with an image displayed instead of the normal labeled
: :: button. Can this be done? If not this is a major oversite in...CGI?...CGI.p
^^^^^^^^^^^^^^^^^
Have you been smoking a bit tooo much weed lately?
:
:
: And your Perl question is?
:
:
:
: Abigail
: --
: package Just_another_Perl_Hacker; sub print {($_=$_[0])=~ s/_/ /g;
: print } sub __PACKAGE__ { &
: print ( __PACKAGE__)} &
: __PACKAGE__
: ( )
:
:
: -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
: http://www.newsfeeds.com The Largest Usenet Servers in the World!
: ------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 25 Jun 1999 05:41:41 GMT
From: bismuti@cs.fsu.edu (Peter Bismuti)
Subject: Re: CGI.pm: submit + image?
Message-Id: <7kv4ql$n56$3@news.fsu.edu>
This is very much a Perl questions, it is a CGI.pm question, are you
familiar with CGI.pm?
Now I have a question for you, when are you going to get a life, you loser?
Martin Quensel (martin@adoma.se) wrote:
:
: Peter Bismuti skrev i meddelandet <7kkd7r$838$1@news.fsu.edu>...
: >I would like to use the submit function that display an image instead of
: >the standard button and label. I do NOT mean an image_button, which does
: >not allow you to pass back a value with the name, just the coordinates
: >where you clicked on the image. I want it to behave *exactly* like a
: regular
: >submit button just with an image displayed instead of the normal labeled
: >button. Can this be done? If not this is a major oversite
: in...CGI?...CGI.pm?
:
:
: I am reasonably sure it can be done!
:
: Let me ask you a question....
: If you want help with your car, do you go to the bank asking them to help
: you fix your car?
: If you ansvered yes on that one, do you go to the garage asking the car
: repairguys/gals for a loan?
:
: Lets say i work at a bank!
: When you come in, asking me if i can help you with your (for example) engine
: problem..what do you think i will ansver on that one?
:
: Your problem is not a perl one... Its a HTML one.
: Lets say for example that you have a script that outputs a HTML file..well
: then the problem is still HTML related as long as the script prints the
: HTML. If it doesent print the HTML, then its something wrong with your perl
: script.
:
: A perl question:
:
: why does this not work on my machine!
: print<<"HTML"
: <html>
: <head><title>quess!
: </title></head>
: HTML
: (ansver: cause its a syntax error)
:
: A Non Perl Question:
: why is the background in the HTML file black?
:
: print<<"HTML";
: <html><head><title>
: HTML question!</title>
: </head><body bgcolor="#000000">
: HTML
:
:
: There are a lot of HTML newsgroups out there, if you ask your question there
: you will have a higher chance of getting a soloution for your problem.
: I am not that good at HTML, if i where i would have ansvered you, even if
: you did post in the wrong newsgroup.
:
: Best regards
: Martin Quensel
:
:
------------------------------
Date: Thu, 24 Jun 1999 23:24:51 -0700
From: "Ken North" <ken_north@nospam.csi.com>
Subject: Re: DBD::ODBC error Undefined symbol "SQLAllocEnv"
Message-Id: <uo2SSPtv#GA.223@nih2naaa.prod2.compuserve.com>
I haven't used DBD but I'll give it a shot.
Philip Hallstrom wrote in message ...
>
>but then dbdodbc.h complains that I do not have iodbc.h (and I don't,
not
>even in the distribution for iODBC). I commented that out and it
compiles
>just fine, but fails make test with:
My guess is iodbc.h is the header that declares the ODBC functions.
> Undefined symbol "SQLTables" at
/usr/libdata/perl/5.00502/DynaLoader.pm line 168.
SQLTables is a catalog function that gets a list of tables. You must
be missing a library.
>
>Undefined symbol "SQLAllocEnv"
SQLAllocEnv is a function that is used by all ODBC programs -- you
have to allocate an environment handle before you can use any of the
other ODBC functions. SQLAllocEnv is deprecated for ODBC 3.0, repalced
by SQLAllocHandle.
You are apparently missing a header and a library or libraries....
>Can someone shed some light on what I'm missing? Or what I need to
do to
>get this to work.
>
>I know I could use DBI::Mysql stuff, and I would if I could, but I
can't
>this time...
>
>Thanks!
>
>-philip
>
>
>
>
------------------------------
Date: Fri, 25 Jun 1999 04:14:35 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: DBI and ODBC (on NT-server)
Message-Id: <ebohlmanFDv7sC.Bp1@netcom.com>
Kristian Elbo (Kelbo@rhk.dk) wrote:
: I'm trying to use an Access-database for storage of some data, and I'm
: trying to exstract these data using sql and ODBC under NT.
: The following use of the DBI module in Perl5 works, with the 'official'
: perl5-release, but the server on which I have to place the script uses
: an interpreter from ActiveState based on perl5, and when I run the
: script I get a strange error message that DBI is not a part of @INC ??.
: meaning .. ?????
That the server where you're placing the script doesn't have DBI
installed. DBI isn't part of the standard Perl distribution; it's an
optional module available from CPAN. Ask whoever is in charge of such
things to install DBI and DBD::ODBC.
------------------------------
Date: Fri, 25 Jun 1999 04:22:39 GMT
From: "Virginia Wiswell" <owls@the-spa.com>
Subject: formatting text in email
Message-Id: <juDc3.254$8e5.19353@monger.newsread.com>
I am getting input from an html form that I need to format fairly strictly
in the body of an email message. It must be in plain text. I would like to
use 'format's if possible. Can I do this with MailTools? Mail::Sendmail? I'm
missing that link (no, I'm not THE missing link) of logic between file
handles, format names and 'write' as opposed to 'print'. If I sound really
confused, then I have successfully conveyed my state of mind. Reading perl
docs for 2 hours will do that.
TIA for any help/suggestions.
Virginia
------------------------------
Date: Fri, 25 Jun 1999 04:43:40 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: formatting text in email
Message-Id: <ebohlmanFDv94s.D0v@netcom.com>
Virginia Wiswell (owls@the-spa.com) wrote:
: I am getting input from an html form that I need to format fairly strictly
: in the body of an email message. It must be in plain text. I would like to
: use 'format's if possible. Can I do this with MailTools? Mail::Sendmail? I'm
: missing that link (no, I'm not THE missing link) of logic between file
: handles, format names and 'write' as opposed to 'print'. If I sound really
: confused, then I have successfully conveyed my state of mind. Reading perl
: docs for 2 hours will do that.
The section of perlfaq5 entitled "How can I write() into a string" should
clear up your confusion.
------------------------------
Date: 24 Jun 1999 23:22:27 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: formatting text in email
Message-Id: <37731213@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc,
ebohlman@netcom.com (Eric Bohlman) writes:
:The section of perlfaq5 entitled "How can I write() into a string" should
:clear up your confusion.
Perhaps. Or perhaps perlform will help. Then again, maybe it won't.
Formats aren't the best answer to all problems. Just to some.
--tom
--
The reductionist approach has its place, as does the holistic approach.
Render therefore unto Unix the things which are Unix's, and unto Perl
the things that are Perl's. :-) Larry Wall in <1994Nov10.185030.16615@netlabs.com>
------------------------------
Date: Fri, 25 Jun 1999 03:59:42 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Help a newbie!
Message-Id: <ebohlmanFDv73I.Aou@netcom.com>
Bob Bridges (bbridges@seark.net) wrote:
: I'm a newbie Perl programmer and i'm looking for a couple of commands. I
: need a command to read a opened file and copy all of its text content into
: a scalar variable. I also need one to put the date (month day, year)
: and/or time (hh-mm-ss, not the UNIX second counter) into a scalar variable.
Read:
1) The section of perlop dealing with input operators
2) The section of perlvar dealing with $/
3) The section of perlfunc dealing with localtime()
Within half an hour you should be able to do everything you mentioned.
------------------------------
Date: Thu, 24 Jun 1999 21:57:31 -0700
From: TRG Software : Tim Greer <webmaster@chatbase.com>
Subject: Re: How can I get size of uploaded image via CGI?
Message-Id: <37730C3B.4281DC6C@chatbase.com>
Brian Wagener wrote:
>
> I have made a script that allows a person to upload a graphic file,
> either a jpg or gif, and I need to be able to see if it is within the
> size specs. I don't see a way in perl to get info from a graphic file.
> I am using perl 5.005 if anyone can help me I would be very happy.
> Thanks in advance.
> Brian
This question has been answered about 5 times this week, therein
creating about 5 threads all with answers. If your news reader doesn't
pick up posts that long ago, try a search at www.deja.com (they archive
all the posts that are on the NG's) and search using the relevant
keywords. You'll find your answer.
Good luck.
--
Regards,
Tim Greer : webmaster@chatbase.com | software@linkworm.com
The ChatBase: http://www.chatbase.com | 250,000+ hits daily Worldwide!
TRG Software: http://www.linkworm.com | CGI scripts in Perl/C, & more.
Unix/NT/Novell Administration, Security, Web Design, ASP, SQL, & more.
Freelance Programming & Consulting, Musician, Martial Arts, +Sciences.
------------------------------
Date: Thu, 24 Jun 1999 21:12:50 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: How can I read a whole file in one go ?
Message-Id: <MPG.11dca19032ec8611989c41@nntp.hpl.hp.com>
In article <ebohlmanFDv47K.7Jw@netcom.com> on Fri, 25 Jun 1999 02:57:20
GMT, Eric Bohlman <ebohlman@netcom.com> says...
> Michael Stillwell (mist@yoyo.cc.monash.edu.au) wrote:
> : Tom Christiansen <tchrist@mox.perl.com> wrote:
> : : On very rare occasion, you may have an algorithm that demands
> : : that the entire file be in memory at once as one scalar. The
> : : simplest solution to that is:
> : :
> : : $var = `cat $file`;
> :
> : Is there any other language where the recommended way to read an
> : entire file into memory involves a shell command? I find this
> : extraordinary---and more than a little inelegant.
...
> Shelling out to cat to read a file is, IMHO, on the level of shelling out
> to expr to evaluate a simple arithmetic expression. Much of the reason
> that Perl exists is that there are certain things that *can* be done in
> shells using a set of distinct tools, but are tedious and error-prone, not
> to mention inefficient, to do that way. Some operations are so
> fundamental that it makes sense to build them into a language rather than
> externalize them.
Reading a file in toto should be one of those fundamental Perl
operations, but it isn't. One has to open the file (checking for
failure), binmode it (sometimes), localize and undef $/, then slurp the
file, then close it. That's a lot of baggage.
...
> A good example of appropriate granularity is Perl's sort() function.
> Sure, anything it can do can also be done by calling the Unix sort
> program, but in many cases that means writing lots of marshalling code.
The Unix sort command sorts lines of text. The Perl sort function can
sort lists of arrays or hashes of any complexity.
> At the same time, there are cases (huge volumes of data, etc.) where
> shelling out to a purpose-built tool is the best approach, and the extra
> marshalling effort pays off. The Perl approach of having a built-in
> sorting function, but keeping it simple and letting you use an external
> tool if you have rare-but-complicated needs, is a good compromise. It
> would, IMHO, be a granularity mistake to try to extend Perl's sort() to
> handle sets of data too large to fit in virtual memory. It would also be
> a granularity mistake to drop it altogether.
Agreed. The primary benefit of the external sort is that it can do
merge sorts using disk or tape for intermediate storage. It is *less*
flexible than the Perl sort, but much more capable of dealing with huge
volumes of data.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Fri, 25 Jun 1999 04:16:15 GMT
From: andrew-johnson@home.com (Andrew Johnson)
Subject: Re: How can I use Perl variables in Javascript ?
Message-Id: <joDc3.1743$59.11647@news1.rdc2.on.home.com>
In article <1dtxbfs.1mtqzwa5umw4gN@usol-209-186-16-69.uscom.com>,
David Glasser <glasser@iname.com> wrote:
[snip]
! This won't work either, because Nina was using <<EndOfHTML, which won't
! interpret the variable anyway.
#!/usr/bin/perl -w
use strict;
my $var = q[It won't?];
print<<EndOfHTML;
$var
Why do you think that?
EndOfHTML
__END__
regards
andrew
------------------------------
Date: Fri, 25 Jun 1999 04:52:06 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: How can I use Perl variables in Javascript ?
Message-Id: <WVDc3.247$MJ1.11070@nsw.nnrp.telstra.net>
In article <1dtxbfs.1mtqzwa5umw4gN@usol-209-186-16-69.uscom.com>,
glasser@iname.com (David Glasser) writes:
> This won't work either, because Nina was using <<EndOfHTML, which won't
> interpret the variable anyway.
# perl -w
my $var = 12;
print <<EndOfHTML;
Hmmm???
This is \$var: $var
EndOfHTML
__END__
Hmmm???
This is $var: 12
Martien
--
Martien Verbruggen |
Interactive Media Division | Useful Statistic: 75% of the people
Commercial Dynamics Pty. Ltd. | make up 3/4 of the population.
NSW, Australia |
------------------------------
Date: Fri, 25 Jun 1999 04:43:55 GMT
From: bobn@interaccess.com (Robert Niederman)
Subject: Re: Newbie - Perl books - which to get?
Message-Id: <930285835.361.39@news.remarQ.com>
I highly recommend the Perl Cookbook - lots of useful examples *and* good explanations.
- Bob Niederman
------------------------------
Date: Thu, 24 Jun 1999 21:55:34 -0700
From: TRG Software : Tim Greer <webmaster@chatbase.com>
Subject: Re: Newbie can't delete file
Message-Id: <37730BC6.37BAE6AC@chatbase.com>
roberthp@my-deja.com wrote:
>
> Hello:
>
> All I'm trying to do is open a directory and delete a file. I can list
> the directory contents ok, but when I try to "unlink" a file, I get an
> error that the file doesn't exist. I don't get it. Could this be a
> permissions problem, but with an error message that doesn't indicate as
> such?
>
> Any help would be greatly appreciated.
> Thanks,
> Robert
>
> Code below:
> ------------------------------------
> use POSIX;
> opendir (DESKTOP, "c:/winnt/profiles/all users/desktop") ||
> die "Open: $!";
> foreach $name (sort readdir(DESKTOP)) {
> print "$name\n";
> }
> unlink ("Acrobat Reader 4.0.lnk") ||
> die "Delete: $!";
> closedir (DESKTOP);
> ---------------------------------------------
> The output produced is as follows:
>
> Delete: No such file or directory at script line 8.
> .
> ..
> Acrobat Reader 4.0.lnk
> Emergency Undelete.lnk
> PrimalSCRIPT.lnk
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.
This question has already been answered in a prior threat in regards to
your specific question/post earlier.
--
Regards,
Tim Greer : webmaster@chatbase.com | software@linkworm.com
The ChatBase: http://www.chatbase.com | 250,000+ hits daily Worldwide!
TRG Software: http://www.linkworm.com | CGI scripts in Perl/C, & more.
Unix/NT/Novell Administration, Security, Web Design, ASP, SQL, & more.
Freelance Programming & Consulting, Musician, Martial Arts, +Sciences.
------------------------------
Date: Thu, 24 Jun 1999 21:09:55 -0700
From: TRG Software : Tim Greer <webmaster@chatbase.com>
To: hotister@my-deja.com
Subject: Re: Onchat.com using java? How about perl?
Message-Id: <37730113.3F33E4B9@chatbase.com>
hotister@my-deja.com wrote:
>
> just curious, I think the onchat.com was using java to implement
> the web-based comic-like chat room (sort of like M$ V-Chat, but no
> client -- except the web browser -- is needed)..
By going to that site and the fact it loads a Java app, I'd have to say
I think you're correct in your assumption. Java only needs to work
through a web browser and requires no plug-ins or clients (other then
your browser), which is the point of web based chat systems. Of course,
it doesn't have to be Java based.
> Uh.. is that possible to implement such a monster using perl only?
Well, yes. But Java is better suited for such styles of chat rooms, as
those function in the way(s) they do based on that fact. You'd be hard
pressed to create a perl based chat site and have it function in the
same manner as java chat rooms, just as with java trying to look and
feel like a Perl based CGI chat room. I personally don't care for the
java chat styles, but some people love it.
> (yes, I have read the Perl FAQ already)...
The FAQ will very likely not cover such a question.
> Also does anyone know any
> detail how the onchat.com implemented their web-based chat program?
Look at their site.. It says "loading Java" when you go to their rooms.
This isn't a Perl question if you're simply asking what language some
other site uses. Of course, they can use Java and Perl for CGI chat
rooms, as many people do that and you only have the Java interface as
the top layer.
> (most of the perl chat scripts that I tried really sucks)..
There's a lot out there that "suck", but so do a lot of free programs
and cheaper/low-end Perl programs of any kind. If you learn how to
program in Perl, then you'll be able to create a chat room any way you
like, because from there it's all just based on your own opinion of what
"sucks" or not. There's a lot of good books and info out there, all on
or linked from www.perl.com's web site.
> thanks
Good luck... :-)
--
Regards,
Tim Greer : webmaster@chatbase.com | software@linkworm.com
The ChatBase: http://www.chatbase.com | 250,000+ hits daily Worldwide!
TRG Software: http://www.linkworm.com | CGI scripts in Perl/C, & more.
Unix/NT/Novell Administration, Security, Web Design, ASP, SQL, & more.
Freelance Programming & Consulting, Musician, Martial Arts, +Sciences.
------------------------------
Date: Thu, 24 Jun 1999 22:00:31 -0700
From: TRG Software : Tim Greer <webmaster@chatbase.com>
Subject: Re: Perl Distribution & Runtime
Message-Id: <37730CEF.C52968C9@chatbase.com>
Jalil Feghhi wrote:
>
> I was wondering:
>
> 1. Can Perl be used in commercial software? If so, how/where a license to do
> so should be obtained?
You can read info about this subject at www.perl.com.
> 2. Is there a way to make perl installers so that perl code and runtime get
> installed on a target machine, especially windows?
What does this question mean? I must be tired. If you want to know if
you can code a Perl script to install the entire program you create for
any given system, then yes, you can simply create an install file,. and
when they run it, it installs into the proper places with the proper
info. You'll need to have a configuration file for them to change the
appropriate paths and variables most likely though. Is that what you
mean?
--
Regards,
Tim Greer : webmaster@chatbase.com | software@linkworm.com
The ChatBase: http://www.chatbase.com | 250,000+ hits daily Worldwide!
TRG Software: http://www.linkworm.com | CGI scripts in Perl/C, & more.
Unix/NT/Novell Administration, Security, Web Design, ASP, SQL, & more.
Freelance Programming & Consulting, Musician, Martial Arts, +Sciences.
------------------------------
Date: Fri, 25 Jun 1999 06:17:27 GMT
From: richly@samart.co.th (Robert White)
Subject: Re: Perl in Win32
Message-Id: <37731192.18879774@news.samart.co.th>
"Spud" <spud200@earthlink.net> wrote:
>For some reason when I try to execute my perl programs in Windows a black
>DOS-like screen comes up for a second and then dissappears. I'm running
>ActivePerl 517. Help, please!
can get Hidden
http://www.owt.com/users/rsavard/software.html
works well
Robert just another perl hacker in Bangkok
http://members.xoom.com/robertmwhite/perl.html
------------------------------
Date: Fri, 25 Jun 1999 05:58:23 GMT
From: sstrickl@resnet.gatech.edu (Stevie Strickland)
Subject: PID of backticked process?
Message-Id: <slrn7n66js.hm.sstrickl@kelewan.dhis.org>
Okay, I wanted a quick way to grep the process table for a certain
string without returning the process doing the grepping. So I've
got the following:
#!/usr/bin/perl -w
foreach $_ (`ps x`) { print if (/$ARGV[0]/ && !/\s*$$/); }
So far, so good. But if I do the following:
[sstrickl@kelewan]:~$ grepps ps
380 ? S 8:24 esd -terminate -nobeeps -as 2
2789 pts/1 R 0:00 ps x
[sstrickl@kelewan]:~$
That last 'ps x', of course, is the one spawned off from the perl
process. So my question is "Is there a way to find the PID of a
process spawned using backticks?" I've checked perlop, perlvar, and
various sections of perlfaq8 detailing various issues with backticks,
but nothing yet...
Hmmmmm... I just read perlipc, and I found what gave me the following:
#!/usr/bin/perl -w
$kpid = open(PS_X, "-|");
if($kpid) {
while(<PS_X>) {
print if (/$ARGV[0]/ && !/\s*(?:$$|$kpid)/);
}
} else {
exec("ps", "x") || die "Can't exec program: $!";
}
... which works. Beautifully. At least in every case that I
just tried (not many, truthfully, since I just wrote it a few
seconds ago and gave it the "ps" case, the "bash" case (to find
existing ones), and the "check" case (to check to make sure
nothing's returned if there aren't any)), it works :)
Though I've solved the problem I was having, the question I posed
still remains... is it possible? I mean, I like the IPC version,
it just gave me the first perl script I've written using it, but
I was trying for a one-liner on this one ;)
If not, no worries, I had a educational experience even without
it, but if there is, perhaps I can still try for the one-liner :)
Thanks,
Stevie
--
Stevie Strickland | 325912 Georgia Tech Station
sstrickl@resnet.gatech.edu | Georgia Institute of Technology
http://computersprache.net/~sstrickl | Atlanta, GA 30332
Official Debian GNU/Linux Developer | Cyberlink/#Debian on IRC
------------------------------
Date: Fri, 25 Jun 1999 06:47:22 GMT
From: sstrickl@cc.gatech.edu (Stevie Strickland)
Subject: Re: PID of backticked process?
Message-Id: <slrn7n69fp.30a.sstrickl@kelewan.dhis.org>
On Fri, 25 Jun 1999 05:58:23 GMT, Stevie Strickland
<sstrickl@resnet.gatech.edu> wrote:
[snip]
>Hmmmmm... I just read perlipc, and I found what gave me the following:
>
>#!/usr/bin/perl -w
>$kpid = open(PS_X, "-|");
>if($kpid) {
> while(<PS_X>) {
> print if (/$ARGV[0]/ && !/\s*(?:$$|$kpid)/);
> }
>} else {
> exec("ps", "x") || die "Can't exec program: $!";
>}
I was reading Chapter 14 in Learning Perl ("Process Management"), when
I realized something... the open command returns the pid of the opened
process at any time, not only when called with "-|"... so I did too
much work above... so now I'm down to this:
#!/usr/bin/perl -w
$kpid = open(PS_X, "ps x|");
while(<PS_X>) {
print if (/$ARGV[0]/ && !/\s*(?:$$|$kpid)/);
}
Hmmmmmm... the question still stands, of course, but I'm much more
satisfied with this script than the one above... this one's pretty
much a two-liner, which is close enough for me! :)
Stevie
P.S. I wish Programming Perl and the Perl Cookbook would hurry up
and get here... UPS estimates they'll be here on next Monday... that's
much too long for me :p
--
Stevie Strickland | 325912 Georgia Tech Station
sstrickl@cc.gatech.edu | Georgia Institute of Technology
http://kelewan.dhis.org/~sstrickl | Atlanta, GA 30332
Official Debian GNU/Linux Developer | Cyberlink/#Debian on IRC
------------------------------
Date: Fri, 25 Jun 1999 05:03:57 GMT
From: okurios@my-deja.com
Subject: problem passing array back
Message-Id: <7kv2jo$qh4$1@nnrp1.deja.com>
Folks,
I am trying to pass an array to a subroutine in a module and get it
back.
get.pl
--------
use strict;
use MyStuff::DataLoad;
use MyStuff::Mydb;
<OMIT the getting database handle stuff>;
$stmt="select * from acad_student where email_id='trj97j'";
my @rows;
if ( (MyStuff::DataLoad::query_stu($stmt,$mydb,\@rows)) ) {
print "Found";
while ( @rows ) {
print;
}
}
else {
print "ERR:" . $MyStuff::DataLoad::loadtxt . "\n";
print "ERR:" . $MyStuff::DataLoad::loaderr . "\n";
}
--- MyStuff::DataLoad
sub query_stu {
(my $query, my $handle,my $rows)=@_;
if ( ! $query || ! $handle ) {
MyStuff::DataLoad::load_vars("2","values not set");
return 0;
}
my $err1;
my $err2;
MyStuff::Mydb::exec_cmd($query,$handle,\$err1,\$err2,\$rows);
if ( $err1 ne 0 ) {
$err2="User found";
MyStuff::DataLoad::load_vars($err1,$err2);
return 1;
}
else {
MyStuff::DataLoad::load_vars($err1,$err2);
return 0;
}
}
--- in MyStuff::Mydb
sub exec_cmd {
(my $stmt,my $handle,my $errcd,my $errtxt,my $rows)=@_;
if ( ! $stmt || ! $handle ) {
$$errcd=2;
$$errtxt="No SQL statement or database handle was passed.";
return 0;
}
my $sth = $handle->prepare($stmt);
if ( ! $sth ) {
$$errcd=0;
print "$$errtxt";
$$errtxt=$handle->err;
return 0;
}
if ( ! $sth->execute ) {
$$errcd=0;
$$errtxt=$handle->err;
print "$$errtxt";
return 0;
}
my $fndrows=$sth->rows;
if ( $fndrows gt 0 ) {
$$errcd=$fndrows;
$$errtxt="success";
$row=$sth->fetchall_arrayref;
}
else {
$$errcd=0;
$$errtxt="No records found";
}
return 1;
}
--
The problem is that I can't print out in my original program (get.pl)
the array that is saved in $row in Mydb::exec_cmd. The print does not
work.
What am I missing?
keith
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 25 Jun 1999 05:36:26 GMT
From: bismuti@cs.fsu.edu (Peter Bismuti)
Subject: problems with chmod function
Message-Id: <7kv4gq$n56$1@news.fsu.edu>
I tried using the chmod function
chmod($perm,$filename)
where the striung $perm = '0775' for example. This didn't
work like I thought it should, it set the permissions to all
kinds of bizarre values. Can anyone explain why?
Here is my script if you're intresested.
#!/usr/local/bin/perl
#________________________________________________________________________
#
# setwebperm.pl - change the group bit of file permissions to
# be identical to that of the owner.
#________________________________________________________________________
use File::Find;
#........................................................................
# read in starting directory
# if given as command line arguement, an absolute
# path must be given
#........................................................................
if (!($ARGV[0])){ # if the command line arg is not given
chop($dir = `pwd`);
}else{
$dir = $ARGV[0]; # given as an absolute path
}
print "traversing directory = $dir\n";
#........................................................................
# now start traversing through directory tree
#........................................................................
$webmast_uid = 31654;
$webmast_gid = 500;
find(\&action, $dir);
#........................................................................
# this subroutine defines the action to be performed on
# each file touched by the `File::Find::find` command.
#........................................................................
sub action(){
$filename = $File::Find::name;
@entry = stat($filename);
$uid = $entry[4];
if ($uid == $webmast_uid){
$mode = $entry[2];
$s_bit = $mode; $s_bit &= 07000; $s_bit /= 8**3;
$u_bit = $mode; $u_bit &= 00700; $u_bit /= 8**2;
$g_bit = $mode; $g_bit &= 00070; $g_bit /= 8**1;
$o_bit = $mode; $o_bit &= 00007;
$perm = $s_bit.$u_bit.$u_bit.$o_bit;
chmod ($perm,$filename);
}
}
------------------------------
Date: Thu, 24 Jun 1999 23:40:03 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: problems with chmod function
Message-Id: <MPG.11dcc408c4dfb658989c42@nntp.hpl.hp.com>
[Posted and a courtesy copy sent.]
In article <7kv4gq$n56$1@news.fsu.edu> on 25 Jun 1999 05:36:26 GMT,
Peter Bismuti <bismuti@cs.fsu.edu> says...
> I tried using the chmod function
>
> chmod($perm,$filename)
>
> where the striung $perm = '0775' for example. This didn't
> work like I thought it should, it set the permissions to all
> kinds of bizarre values. Can anyone explain why?
The *string* '0775' when converted to an integer has the *decimal* value
775. The *integer constant* 0775 has the *octal* value 0775. Nuff
said???
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Fri, 25 Jun 1999 04:05:31 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Regular Expression - Doubt
Message-Id: <ebohlmanFDv7D8.B1n@netcom.com>
Sunitha (nsunitha@cse.unl.edu) wrote:
: sub Validate_Sentence{
: local ($string) = @_;
: local($ch);
: while (/&#([^;]*);/g) {
: $ch=sprintf("%c", $1);
: $string =~ s/&#[^;]*;/$ch/;
: }
: $string;}
:
: For eg: if my line is : o[.sub]2[/]-electrode
: it should return me $string = "sub electrode"
The code you described looks to be an attempt at replacing SGML character
references with literal characters. It has nothing to do with the task
in your example. How to do the latter depends on how your data is
formatted; s/(o\[\.|\]2\[\/\]-)//g; would work for your example, but
probably for nothing else. More details, please.
------------------------------
Date: Fri, 25 Jun 1999 06:27:24 GMT
From: rick@iwtools.com (R. Freeman)
Subject: Text::ParseWords 5.004_04 / 5.004_05
Message-Id: <37741e40.1756113@nntp.best.com>
I wrote a script that uses Text::ParseWords and worked beautifully on
a machine with Perl 5.004_04
Now I'm on a different server, with Perl 5.004_05, and the call to
ParseWords' quotewords function no longer works.
$terms = 'perl programmer';
$delim = ' ';
@terms = quotewords($delim, 0, $terms);
used to give me
$terms[0] = 'perl' and
$terms[1] = 'programmer'
Now @terms is empty.
I looked at the modules themselves, in the /lib/perl5 directory, and
they are indeed different, but it's all over my head.
Any hints here?
Thanks,
Rick
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 6123
**************************************