[15881] in Perl-Users-Digest
Perl-Users Digest, Issue: 3294 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jun 8 18:10:49 2000
Date: Thu, 8 Jun 2000 15:10:23 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <960502223-v9-i3294@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 8 Jun 2000 Volume: 9 Number: 3294
Today's topics:
Re: How to turn off "Deep recursion" warnings? <lr@hpl.hp.com>
Re: How to turn off "Deep recursion" warnings? (Abigail)
Re: Java/Swing GUI for DBI/MySQL <dalekh@my-deja.com>
Re: Larry Rosler interview on perl.com! <lr@hpl.hp.com>
Re: Larry Rosler interview on perl.com! <care227@attglobal.net>
Re: Multiple Threads Running Perl via Shared Lib - Poss <dan@tuatha.sidhe.org>
Re: My site host has no perl interpreter... <eolfreddyNOeoSPAM@hotmail.com.invalid>
Re: Obtaining stats of a remote file <gellyfish@gellyfish.com>
Re: Perl and memory consumption <dmeyers@panix.com>
Re: Perl and memory consumption (Greg Andrews)
Re: Perl and memory consumption <dan@tuatha.sidhe.org>
Re: Perl/Tk system() call <methos495@earthlink.net>
Re: perldoc help <methos495@earthlink.net>
PerlMagick Help <nigh_postal@my-deja.com>
Re: PLEASE HELP: Perl for WWW <nospam@nospam.com>
Re: PLEASE HELP: Perl for WWW <care227@attglobal.net>
Re: QUICK question on gmtime(time) and localtime(time) <lr@hpl.hp.com>
Re: QUICK question on gmtime(time) and localtime(time) <Jonathan.L.Ericson@jpl.nasa.gov>
Re: sending mails with perl (Robie Basak)
Simple print question <jpl@lanl.gov>
Re: Simple print question (Abigail)
Re: Simple print question <lr@hpl.hp.com>
site_perl vs lib <nospam@nospam.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 8 Jun 2000 14:00:23 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: How to turn off "Deep recursion" warnings?
Message-Id: <MPG.13a9a9401145851698ab47@nntp.hpl.hp.com>
In article <slrn8jvlc7.r67.tjla@thislove.dyndns.org> on Thu, 08 Jun 2000
17:16:36 GMT, Gwyn Judd <tjla@guvfybir.qlaqaf.bet> says...
...
> If you call this with (say) arguments 3,8 then you get hundreds and
> hundreds of "Deep recursion..." warnings. Is there any way to turn these
> off for a situation like this when you know the algorithm terminates?
$SIG{__WARN__} = sub { };
...
> #!/usr/bin/perl -w
Had you put 'use strict;' in here, you would have discovered that the
array @vals and the scalar $vals have nothing to do with each other.
> use integer;
>
> my @vals;
>
> sub ack {
> my ($x, $y) = @_;
>
> return $vals->[$x][$y] if $vals->[$x][$y];
>
> return $vals->[$x][$y] = $y + 1 if ($x == 0);
> return $vals->[$x][$y] = ack($x - 1, 1) if ($y == 0);
> return $vals->[$x][$y] = ack($x - 1, ack($x, $y - 1));
So take out the '->' on each of the above lines.
> }
>
> my ($x, $y) = @ARGV;
my
> $result = ack ($x, $y);
>
> print "ack($x, $y) = $result\n";
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 8 Jun 2000 21:52:53 GMT
From: abigail@arena-i.com (Abigail)
Subject: Re: How to turn off "Deep recursion" warnings?
Message-Id: <8hp4jl$lfn$1@news.panix.com>
On Thu, 8 Jun 2000 14:00:23 -0700, Larry Rosler <lr@hpl.hp.com> wrote:
++ In article <slrn8jvlc7.r67.tjla@thislove.dyndns.org> on Thu, 08 Jun 2000
++ 17:16:36 GMT, Gwyn Judd <tjla@guvfybir.qlaqaf.bet> says...
++
++ ...
++
++ > If you call this with (say) arguments 3,8 then you get hundreds and
++ > hundreds of "Deep recursion..." warnings. Is there any way to turn these
++ > off for a situation like this when you know the algorithm terminates?
++
++ $SIG{__WARN__} = sub { };
Or:
no warnings 'recursion';
which can be localized to the sub.
Abigail
------------------------------
Date: Thu, 08 Jun 2000 19:40:50 GMT
From: dkh <dalekh@my-deja.com>
Subject: Re: Java/Swing GUI for DBI/MySQL
Message-Id: <8hosru$f1d$1@nnrp1.deja.com>
Here is a Java/Swing MySQL client(no experience using it):
http://web.mysql.com/Contrib/mysql-admin-using-java+swing.tar.gz
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 8 Jun 2000 11:59:47 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Larry Rosler interview on perl.com!
Message-Id: <MPG.13a98cfd42d64a0698ab45@nntp.hpl.hp.com>
In article <7a8zwgcass.fsf@merlin.hyperchip.com> on Thu, 08 Jun 2000
18:00:50 GMT, Ala Qumsieh <aqumsieh@hyperchip.com> says...
>
> Drew Simonis <care227@attglobal.net> writes:
>
> > Lauren Smith wrote:
> > >
> > > Drew Simonis <care227@attglobal.net> wrote in message
> > >
> > > What were the reasons given by LW for his anti-certification attitude?
> > >
> > > Lauren
> >
> > Actually, he was in favor of ANSI certification for the language.
> > Read the whole interview at www.perl.com
>
> You missed something:
Something BIG!
> LW eq Larry Wall
> LW ne Larry Rosler
>
> :-)
Which is why I chose the signature below for the Perl newsgroups.
> But I don't know the answer to the question.
Neither do I. I didn't consult him before expressing my (biased from
personal history) opinion.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 08 Jun 2000 15:54:41 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: Larry Rosler interview on perl.com!
Message-Id: <393FFA01.A8CE93F0@attglobal.net>
Larry Rosler wrote:
>
> Neither do I. I didn't consult him before expressing my (biased from
> personal history) opinion.
>
I'm just excited about the idea. Larry Rosler is a big name,
and just his mention of the idea could lend weight to the
notion. I think it would be a great thing for the language,
specifically the way it is viewed from the unwashed.
------------------------------
Date: Thu, 08 Jun 2000 20:16:26 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: Multiple Threads Running Perl via Shared Lib - Possible? Safe?
Message-Id: <uaT%4.106823$hT2.425339@news1.rdc1.ct.home.com>
Guy Resh <gresh@earthlink.net> wrote:
> On Tue, 06 Jun 2000 15:32:58 GMT, Dan Sugalski <dan@tuatha.sidhe.org>
> wrote:
>>Guy Resh <gresh@earthlink.net> wrote:
>>> Currently, Perl 5.6 (and 5.005_03 for that matter) can be MADE to
>>> support multiple concurrent threads, by either running a single
>>> interpreter instance with multiple threads sharing the single instance
>>> (i.e. configure USE_THREADS), or by using MULTIPLICITY, where each
>>> thread runs with it's own interpreter instance. There are SEVERAL
>>> nasties here with both of the above, not the least of which:
>>
>>> With USE_THREADS:
>>> 1) performance is less than "optimal" as there are several global
>>> mutexes (sv_mutex comes to mind) that kill performance.
>>
>>You don't even need to get this far for performance to be bad--it's pretty
>>slow as it is, even with a single thread.
> My "coding day" is typically spent looking at ways to improve
> performance by:
> 1) minimization (or elimination) of unnecessary or inefficient code
> (including my own).
There's definitely some of this in the threaded code. It is, after all, a
first cut and hasn't seen much optimization or tuning.
> 2) optimizing concurrency; i.e. find and replace code serialized
> around one or more mutexes/locks.
Tossing unnecessary mutex aquisition's another way to speed things
up--that's also not optimized at the moment.
> 3) repeat 1 & 2 all day long between meetings :)
Heh. Bring a laptop and you can do it in the meeting too. :)
> Applications are often made "MT-safe" by simply mutexing around
> variables, or worse, functions, which obviously kills performance.
> Targetting mutexes is often easier to tune/replace than trying to
> figure out a foreign (undocumented) piece of code, trying to minimize
> the number of machine instructions being executed. With the cost of
> hardware going down (and getting faster) and the cost of software
> developers going up, throwing faster hardware at crappy software is
> unfortunately what a lot of companies promote. :(
Now that sounds sadly familiar. :( It's cheaper and easier to pork up the
hardware than it is to fix the software.
> Simply removing the SV mutex and adding a per-thread PV pool more
> than DOUBLED the thread concurrency rate since we were typically
> running 300+ threads in the single (Solaris) Netscape process. I was
> initially constrained to a single Netscape process since another part
> of the application (C++) was only MT-aware and not MP (and MT-)-aware,
> forcing me to try and get as much bang for the buck within a single
> process. With a single process, I averaged 150-300 TPS (on a secure
> HTTPS server, with hardware SSL). I've recently made the code
> MP-aware (via shared memory/IPC, which basically tripled the
> performance even further.
That sounds about right. Are you building with perl's malloc? Tweaking its
mutex use could also boost your concurrency rate a bunch.
> Perl blows away the Java JVMs that we're now using in production in
> other applications. I can't say if the 1.2 or 2.0 Sun JVMs (or any
> other for that matter) will outperform what we have now with Perl as I
> haven't had the inclination to try and reimplement everything BACK to
> Java (Perl was used to replace a Java server-based architecture).
> While I like C++ & Java from a language standpoint, embedding Perl in
> HTML has made time to market a LOT SHORTER, with Perl extensions in
> C/C++ being written and added as needed.
Yay! Details, I want details! :) (Privately's OK, or catch me at TPC)
>>> 3) there are a few instances where MT-safe versions of certain
>>> functions weren't implemented (localtime_r/gmtime_r come to mind).
>>
>>This is arguably a Configure/C library issue--the source either should use
>>a macro-ized version that's #defined to the right thing, or your C libray
>>should behave properly when running threaded.
> Agreed - all I did basically was to add appropriate "#ifdef
> USE_THREADS" to the Perl source, and use the "_r" versions if set.
> Easy enough, and made localtime() usable :)
Might be better to mess with the header files to set up Localtime() to
call either localtime() or localtime_r(), depending on the platform, and
changing the source to reference the new macro. Got a list of functions
you h ad problems with? I might be able to mess with it some.
>>> With MULTIPLICITY:
>>> 1) as currently implemented, there is a global pointer that indicates
>>> which interpreter instance is currently "active", so only one thread
>>> can actually be running at a time, lest they stomp on one another
>>> #2 & #3 from USE_THREADS apply above as well...
>>
>>This isn't exactly true anymore, at least not as of 5.6.0. There's a
>>call--PERL_SET_CONTEXT(my_perl)--that'll do it. (my_perl is supposed to be
>>the interpreter structure, I think. No docs for it that I can find yet)
> Docs? Isn't the source enough? :P
Let's not go there right now... :)
> I had thought the same thing myself, but the curinterp variable was
> getting stomped on by the above via dTHX in memory routines (in
> util.c/handy.h if I remember correctly). If you trace the macros, the
> few remaining globals can be a veritable minefield, just waiting for
> Purify to barf all over the place. I left curinterp there, but it's
> basically not referenced anymore (or set, for that matter, if I
> recall). If I had my druthers, I'd support ALL globals (for those
> who want to only run single process/single thread, MULTIPLICITY with
> and WITHOUT thread support, but BOTH using/passing contexts around;
> i.e. 3 possible configurations to keep things "simple" (?!) :)
That's all supposed to be handled transparently, but stuff's apparently
slipped through. If you can get me a list (or a patch, though I know the
problems there) I can see about getting this fixed.
>>Do the threads share any data? If not, 5.6.0's MULTIPLICITY should do this
>>for you without needing any workarounds now.
> The threads under the covers share data in a shared memory segment
> (now). MULTIPLICITY would have probably done a lot for me last year,
> alas, I was initially trying to save on the memory, since the cost of
> a single interpreter instance can get out of hand with 1000+ threads
> each with their own interpreter instance. I'm still tweaking memory
> usage, but decided to use MULTIPLICITY with 5.6 about a month ago.
The interpreter structure's not that big once threads are introduced, so
the MULTIPLICITY route's not that much bigger a deal than the current
thread structure. Thread stack's by far a bigger memory hog, as you've
likely found.
The ITHREAD stuff has some interesting possibilities over a plain
MULTIPLICITY build, not the least of which is the potential to share the
parsed program's optree like you can with threads, minus some of the
headaches the current thread implementation has.
>>This probably wasn't necessary with a MULTIPLICITY build, and it's not
>>needed for an ITHREAD build. (Which is probably the way threads are going
>>to move, at least once I get some free time)
> Being relatively new to the MULTIPLICITY camp, having been burnt by
> the "true" globals, I basically did surgery until I felt I had
> encapsulated everything into "well-behaved" compartments (contexts).
> The real trick is getting BOTH MULTIPLITY _AND_ USE_THREADS working at
> the same time (not that I need that).
Now *that* should be fun. :) I don't know that it's worht that much
effort, though.
> If I ever get the time, I may
> revert back to the baseline source tree (with 5.6.1?), and see what
> performance gains are had with each of the "tweaks" that I've
> implemented thus far.
If you have some, do please try and get the OK to send in the patches.
Speed boosts are good.
>>Well, I'll be giving a threads tutorial on Monday at TPC. Care to drop by?
>>:)
> I wish - I'll be lucky to get to the Monterey conference this year the
> way things are going of late...
Well, drop by anyway if you're there on monday, or look me up. I'll be
there for the whole thing.
Dan
------------------------------
Date: Thu, 08 Jun 2000 11:53:14 -0700
From: freddy <eolfreddyNOeoSPAM@hotmail.com.invalid>
Subject: Re: My site host has no perl interpreter...
Message-Id: <033eb11d.7cdcdc1e@usw-ex0108-063.remarq.com>
Well, I have had many problems with my site hosts, believe
me!
They will only give technical support for stuff like basic
counter and form scripts, so I am planning on changing to
more professional people.
Thanks for the help!
* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!
------------------------------
Date: 8 Jun 2000 19:51:39 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Obtaining stats of a remote file
Message-Id: <8hopvr$ou7$1@orpheus.gellyfish.com>
On Wed, 07 Jun 2000 16:07:43 +0800 Jason Q. wrote:
> Hi there
>
> Is it possible, via a Perl script, to obtain info (equivalent of Perl's
> "stat" function) of a file that is on a remote server?
>
Sure, if you have the filesystem that the file resides on mounted by
NFS (but mind your hamster) , SMB, NCP or some other network file
system mechanism. If you mean you want to do this via some protocol
like HTTP, FTP, gopher or whatever then I'm afraid you have asked in the
wrong place.
/J\
--
fortune oscar homer
------------------------------
Date: 08 Jun 2000 14:15:20 -0400
From: David Meyers <dmeyers@panix.com>
Subject: Re: Perl and memory consumption
Message-Id: <yobvgzk11l3.fsf@panix2.panix.com>
> > > > Dan Sugalski wrote:
> > > > > No. There's a very small overhead to using a module,
> > > > > Modules certainly *can* take a lot of memory,
"Godzilla!" <godzilla@stomp.stomp.tokyo> wrote:> >
> > > > Let me know when you have made up your mind
> > > > whether or not modules are memory bloat hogs.
|Odo| <jasonb885@my-deja.com> writes:
> You have trouble reading? How much memory a module uses obviously must
> be looked at on a module by module basis.
Jason, you've reached a point in the discussion
where you are wating your time by further interacing
with the Godzilla troll. It's quite incapable of
reading that which, even out of context, Dan wrote
quite clearly.
Once a troll's errors have been publicly corrected,
continuing to argue helps nobody. Correct it and
move on.
--d
------------------------------
Date: 8 Jun 2000 11:47:10 -0700
From: gerg@ncal.verio.com (Greg Andrews)
Subject: Re: Perl and memory consumption
Message-Id: <8hopne$k6k$1@ncal.verio.com>
jkline@one.net writes:
><SNIP code bloat, modules, etc....>
>
>How can someone be so against modules?
>
It looks to me like this particular someone is so against modules
because the contributors of clpm have, in the past, been so in
favor of modules.
Analyze the posts from this particular someone and you'll find
that they follow a single theme: Attack the group's sacred cows.
As the technical discussion in this thread reveals, there's no
carefully thought out principle or philosophy behind the disapproval
of modules. When pressed for specifics, this someone retreats into
vague statements. The disapproval is not based in real experience
with modules. It's based on the desire to counter the group's
approval of modules.
The same is true for this someone's advocacy/encouragement against
the use of perl5, -w, 'use strict', CGI argument parsing methods,
and the CGI module in particular. If the group is for it, this
someone is against it.
This is the monty python Argument Clinic Sketch, played out for
you in your favorite newsgroup.
-Greg
--
::::::::::::::::::: Greg Andrews gerg@wco.com :::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
------------------------------
Date: Thu, 08 Jun 2000 18:59:14 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: Perl and memory consumption
Message-Id: <62S%4.106160$hT2.425071@news1.rdc1.ct.home.com>
Neil Kandalgaonkar <nj_kanda@alcor.concordia.ca> wrote:
> In article <d3P%4.105717$hT2.424851@news1.rdc1.ct.home.com>,
> Dan Sugalski <dan@tuatha.sidhe.org> wrote:
>>A good point, and one you should take to heart, Gojira. You very obviously
>>don't understand how modules work, or are unable to properly discern
>>between generalities and specifics. I'll assume the former here.
> The troll has never shown any interest in learning anything, only in
> disrupting the newsgroup.
Well, there's hope for everyone, and no reason to be rude regardless.
> She faded away for a week or two after it
> seemed people were catching on to her, but she's back again.
I was assuming Gojira was on the perl cruise. Certainly couldn't hurt.
Dan
------------------------------
Date: Thu, 08 Jun 2000 20:06:02 GMT
From: methos <methos495@earthlink.net>
Subject: Re: Perl/Tk system() call
Message-Id: <393FFD92.3194CFB8@earthlink.net>
You may need to fork() a separate process in order to handle this.
That's my best guess.
I'm not sure if you can do any modal specific actions in PTK Windows.
--
- Methos -
"Patience comes to those who wait"
- Anonymous -
debers@my-deja.com wrote:
> How do I invoke a separate program from a TK gui?
>
> When I use system('prog_path') the second application launches but the
> toplevel window is unavailable until I close the second application.
>
> I'm running Perl/Tk on Windows98.
>
> Thanks in advance!
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
------------------------------
Date: Thu, 08 Jun 2000 20:13:56 GMT
From: methos <methos495@earthlink.net>
Subject: Re: perldoc help
Message-Id: <393FFF69.80A13948@earthlink.net>
Well I'm not sure about the perldoc issue,
but you should be able to get the file listing on an HTML page via CGI script.
Place these files in a dropdown list, and and call a CGI script which uses the
stat function on the selected file.
This should be able to give you file size, as well as most file uinformation you
need.
--
- Methos -
"Patience comes to those who wait"
- Anonymous -
spurcell wrote:
> Hello,
> I am trying to use the perldoc to try and solve a problem. The problem is
> that I want to point at a tar file, and get the filesize of it.
>
> But I want to know how to do this in the future.
> I glanced through the HTML active state pages, but it is overwhelming trying
> to find filesize information.
>
> So then I went to the command line, and tried
> perldoc -q "filesize"
> perldoc -f "filesize"
> perldoc -q "size"
>
> but I can't find any entries.
>
> I can never seem to find answers in the help, so I must be doing something
> wrong. Could someone get me on the right track here.
> Thanks
> Scott
------------------------------
Date: Thu, 08 Jun 2000 21:05:52 GMT
From: nigh_postal <nigh_postal@my-deja.com>
Subject: PerlMagick Help
Message-Id: <8hp1r2$j8j$1@nnrp1.deja.com>
I'm trying to install PerlMagick on a linux machine and I've run into a
slew of problems. Someone had previously installed an older version of
PerlMagick (4.0 something or other) and we needed the 5.2 version.
After running into problem after problem I uninstalled ImageMagick and
PerlMagick, got the latest versions of both, and then reinstalled
ImageMagick and PerlMagick (in that order). Both seemed to work fine,
but when I try to use the module I get the following error:
------------------------ Error Log --------------------------
perl: can't resolve symbol 'GetImagePixels'
perl: can't resolve symbol 'SyncImagePixels'
perl: can't resolve symbol 'GetOnePixel'
[Thu Jun 8 15:38:39 2000] upload.cgi: [Thu Jun 8 15:38:39 2000]
Magick.pm: [Thu Jun 8 15:38:39 2000] DynaLoader.pm: Can't load
'/usr/lib/perl5/site_perl/i486-linux/auto/Image/Magick/Magick.so' for
module Image::Magick: Unable to resolve symbol at /usr/lib/p
erl5/i486-linux/5.00403/DynaLoader.pm line 155.
[Thu Jun 8 15:38:39 2000] upload.cgi: [Thu Jun 8 15:38:39 2000]
Magick.pm: [Thu Jun 8 15:38:39 2000] DynaLoader.pm:
[Thu Jun 8 15:38:39 2000] upload.cgi: [Thu Jun 8 15:38:39 2000]
Magick.pm: [Thu Jun 8 15:38:39 2000] DynaLoader.pm: at upload.
cgi line 9
[Thu Jun 8 15:38:39 2000] upload.cgi: BEGIN failed--compilation
aborted at upload.cgi line 9.
--------------------------------------------------------------
Does anybody have any idea what's going on?
Thanks,
-Cody
--------------------------------------------------------------
"Luke, join the Dark Side. We have better benefits"
- JCW
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 8 Jun 2000 20:28:41 GMT
From: The WebDragon <nospam@nospam.com>
Subject: Re: PLEASE HELP: Perl for WWW
Message-Id: <8hovlp$6fm$0@216.155.33.31>
In article <2f5617ba.315f0063@usw-ex0101-005.remarq.com>, JenX
<jeniNOjeSPAM@hotbot.com.invalid> wrote:
| Hello!
|
| Thank you for your reply. I guess what I need to know is how to
| teach myself Perl on a regular ol' PC. I don't have UNIX or a
| sysadmin, and I kinda need things explained in layman's terms.
|
| I'm just a recent graphic design grad looking to learn some more
| programming (which I REALLY want to learn and am very excited
| about). I know some javascript and I worked with that in a
| regular text editor and put it into an HTML file. I was told
| that perl was a little bit harder than javascript, but was the
| next thing to learn and that if I knew Javascript, I could learn
| perl. So here is what I am trying to do: Use a plain 'ol text
| editor like notepad to make perl scripts and run them in
| Internet Explorer. I am doing the tutorials on webmonkey.com. I
| want to first learn the concepts, then make a script that will
| work and be applicable in the web work I do.
|
| Could you show me what to do? This all seems so confusing at
| first. I appreciate all your help.
|
| Thanks so much!
The very first thing I would do if you are interested in learning perl
more seriously is find, download, and install perl on your machine. :->
THEN spend a goodly portion of time browsing all the FAQ files and
various documentation that comes with the install. (yes, there's TONS of
good docs and examples that come with any complete perl install)
THEN spend a LOT of spare time reading (READING! not posting!) this
newsgroup to see what sort of questions newbies ask, and what responses
they get.. this in and of itself can be *incredibly* enlightening and is
NOT to be overlooked as a source of raw spontanous information.
then, as you gain snatches of knowledge you'll have some better ideas of
what can and can not be done with perl. Take everything with a grain of
salt.. if you don't understand something, FIRST look it up in the
FAQ/docs, THEN look in Programming Perl (the book) and if you're still
stuck, post some code examples here of your 'learning' scripts and ask
useful questions that show what you tried and how you think it failed.
The final step to becoming a perl programmer is to (and take this from
me, it HELPS) have a literal *vision* of what you want to accomplish..
you MUST be able to see the finished product in its entirety visualized
before you as if it were complete.. then all you need do is 'solve all
the little steps one at a time' in order to reach the goal (the vision)
from your starting point.
One of the nice things about perl is the Motto -- There's More Than One
Way To Do It, or TMTOWTDI. As long as you reach the goal, the
particulars aren't all that important.. but it DOES pay to grow with
your experience, and find better and more efficient ways of doing things
as you progress.
I mean, who would have thought something like this would work, unless
you saw it run right before your mystified eyes, and then went back and
literally figured it out by REALLY reading it?
-=-BEGIN code [kudos to Randal Schwartz for this little giggler]
#!perl
print join('',grep(s/.*"(.)".*/$1/,split(/\n/,<<)));
Gimme a "J"!
Gimme a "u"!
Gimme an "s"!
Gimme a "t"!
Gimme a " "! :-)
Gimme an "a"!
Gimme an "n"!
Gimme an "o"!
Gimme a "t"!
Gimme an "h"!
Gimme an "e"!
Gimme an "r"!
Gimme a " "! :-)
Gimme a "P"!
Gimme an "e"!
Gimme an "r"!
Gimme an "l"!
Gimme a " "! :-)
Gimme an "h"!
Gimme an "a"!
Gimme a "c"!
Gimme a "k"!
Gimme an "e"!
Gimme an "r"!
Gimme a ","! :-)
What's that spell??
-=-END code
best advice is start small.. small blocks of example code.. see what
they do and how they work, slowly fit the pieces together to do what you
want, and study your butt off.
In just about three weeks I was able to put together enough perl and CGI
with the kind assistance of the denizens of this group (who either
helped me correct my misunderstandings of perl syntax, or literally MADE
ME read the relevant docs over and over until I DID understand it enough
to do it myself (in the case of complex hashes of lists)) and enabled me
to produce a fully working rather complex script that I had envisioned
the end product for but had no idea when I started it, how to program
it.
half the problem is the approach --
1. study the docs
2. break the problem down into tiny solvable pieces
3. come back here and ask knowledgable well-thought-out questions
about the parts you are having trouble solving
the other half of the problem is the follow-through --
1. make sure you know where you are going before you start your
journey, and you'll get there a LOT quicker, because you'll have a MUCH
better idea of what problems you'll need to solve to get there, as well
as which direction to run in (back to that 'vision' thing again ;)
:-)
--
send mail to mactech (at) webdragon (dot) net instead of the above address.
this is to prevent spamming. e-mail reply-to's have been altered
to prevent scan software from extracting my address for the purpose
of spamming me, which I hate with a passion bordering on obsession.
------------------------------
Date: Thu, 08 Jun 2000 16:44:53 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: PLEASE HELP: Perl for WWW
Message-Id: <394005C5.79D2A8D7@attglobal.net>
The WebDragon wrote:
>
>
> THEN spend a LOT of spare time reading (READING! not posting!) this
> newsgroup to see what sort of questions newbies ask, and what responses
> they get.. this in and of itself can be *incredibly* enlightening and is
> NOT to be overlooked as a source of raw spontanous information.
>
What I find very educational is crafting a response to every
post. disclaimer: DO NOT ACTUALLY POST THESE.
I try to find a solution to the interesting problems, and then
compare my solution to the ones posted by the experts.
Doing this, I actually practice with real world problems
and see what I could do to make my code better.
------------------------------
Date: Thu, 8 Jun 2000 12:07:38 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: QUICK question on gmtime(time) and localtime(time)
Message-Id: <MPG.13a98ed68a78df398ab46@nntp.hpl.hp.com>
In article <393FBCB5.3A0DD842@coaps.fsu.edu> on Thu, 08 Jun 2000
11:33:10 -0400, Stacey Campbell <campbell@coaps.fsu.edu> says...
> I need to know if gmtime(time) and localtime(time) return 0 or 00 for
> midnight GMT. (And if it uses double digits for hours < 10.)
Why do you need to know any of this?
I assume you know that those functions return divverent values depending
on context. In list context, they return lists of *numbers*, so your
question is meaningless. In scalar context, they return strings, and
you can do some experiments yourself to find out what the strings look
like.
But you can and should format your string output any way you like, using
sprintf or POSIX::strftime.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 08 Jun 2000 12:19:15 -0700
From: Jon Ericson <Jonathan.L.Ericson@jpl.nasa.gov>
Subject: Re: QUICK question on gmtime(time) and localtime(time)
Message-Id: <393FF1B3.FE64F04A@jpl.nasa.gov>
Stacey Campbell wrote:
> I need to know if gmtime(time) and localtime(time) return 0 or 00 for
> midnight GMT. (And if it uses double digits for hours < 10.)
Did you read 'perldoc -f gmtime' and 'perldoc -f localtime'? Did you
try one or two test cases? (Hint: perl -e 'print scalar gmtime(0)' and
perl -e 'print((gmtime(0))[2])') If you did these things, you wouldn't
have to ask the question at all (and your answer would be nearly as
QUICK as your question). (My guess is that you are going to want to
read 'perldoc -f sprintf' (and the perl FAQ).)
Jon
--
Knowledge is that which remains when what is
learned is forgotten. - Mr. King
------------------------------
Date: 8 Jun 2000 20:21:50 GMT
From: rb@localhost.localdomain (Robie Basak)
Subject: Re: sending mails with perl
Message-Id: <slrn8k002s.2p4.rb@localhost.localdomain>
On Thu, 08 Jun 2000 16:49:43 GMT, Stefan T. said:
>hi everybody!
>
>with the following lines of a perl script i can send a mail:verschicken:
>
>-----script-----
>#!/usr/bin/perl
>open MAIL,"|mail nothing\@nomail.at ";
>print MAIL"hello world"; #:-)
>close MAIL;
>------script-----
>
>so what i now want to now is:
>1. can i give this mail an subject to (at the moment there is no subject
>send with this mail)
>the second thing is: i would like to give this mail an other sender adress
>(From Header) how can i realize this??
Use the -s option - see `man mail`.
>becaus if i send a mail the sender adress is like this:
>stefan@chello192168043.surfer.tirol.at
>and i would like to change it to xyz@xxx.com or somthing else
See `man mail`; if it's not there, then you may want to call sendmail
or qmail-inject directly, passing the headers. For example:
open MAIL, "|/var/qmail/bin/qmail-inject" or die;
print MAIL <<EOT;
From: xyz@xxx.com
To: nothing@nomail.at
Subject: My subject
Contents of mail
EOT
close MAIL or die;
>P.S.: sorry for the crossposting!
Then don't do it, or set Followup-To appropriately.
Robie.
--
------------------------------
Date: Thu, 08 Jun 2000 13:27:48 -0600
From: John Layne <jpl@lanl.gov>
Subject: Simple print question
Message-Id: <393FF3B4.267E4908@lanl.gov>
Hi there,
I want to print out the binary value of a variable to a file. But when I
do this:
$byte = 0;
print OUT $byte;
I get ASCII 30 and not 0. How do I write out the binary value of the
variable?
Thanks,
John Layne
------------------------------
Date: 8 Jun 2000 20:09:12 GMT
From: abigail@arena-i.com (Abigail)
Subject: Re: Simple print question
Message-Id: <8houh7$jvd$1@news.panix.com>
On Thu, 08 Jun 2000 13:27:48 -0600, John Layne <jpl@lanl.gov> wrote:
++ Hi there,
++
++ I want to print out the binary value of a variable to a file. But when I
++ do this:
++
++ $byte = 0;
++ print OUT $byte;
++
++ I get ASCII 30 and not 0. How do I write out the binary value of the
++ variable?
By making $byte contain ASCII 0 of course.
$byte = "\x00";
Abigail
------------------------------
Date: Thu, 8 Jun 2000 14:28:36 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Simple print question
Message-Id: <MPG.13a9afe3daf10b9298ab48@nntp.hpl.hp.com>
In article <8houh7$jvd$1@news.panix.com> on 8 Jun 2000 20:09:12 GMT,
Abigail <abigail@arena-i.com> says...
> On Thu, 08 Jun 2000 13:27:48 -0600, John Layne <jpl@lanl.gov> wrote:
> ++ I want to print out the binary value of a variable to a file. But when I
> ++ do this:
> ++
> ++ $byte = 0;
> ++ print OUT $byte;
> ++
> ++ I get ASCII 30 and not 0. How do I write out the binary value of the
> ++ variable?
>
> By making $byte contain ASCII 0 of course.
>
> $byte = "\x00";
Amusing?
For the OP:
perldoc -f pack
For one character, chr() will do, but pack() is more general.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 8 Jun 2000 18:12:55 GMT
From: The WebDragon <nospam@nospam.com>
Subject: site_perl vs lib
Message-Id: <8honn7$fpj$0@216.155.33.31>
I never knew about this site_perl thing before and have installed many a
module update into lib.
I'm mildly surprised that I didn't see any info about site_perl other
than that very brief mention in preferences, but with the folder
non-existent prior to installing the cpan-mac business, who knew?
If I understand this correctly, MacPerl will use any modules installed
in site_perl, preferring them over the ones in lib? or is there
something else I need to do ?
the docs overall on this are pretty sketchy instead of the more
intentially pedantic ones I would have expected. I managed to figure out
how to get the DBI installed after about an hour of skull sweat, but it
should have been much simpler and more completely explained than it
was.. some of us are still perl newbies! :D
--
send mail to mactech (at) webdragon (dot) net instead of the above address.
this is to prevent spamming. e-mail reply-to's have been altered
to prevent scan software from extracting my address for the purpose
of spamming me, which I hate with a passion bordering on obsession.
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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.
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 V9 Issue 3294
**************************************