[29520] in Perl-Users-Digest
Perl-Users Digest, Issue: 764 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Aug 17 06:09:36 2007
Date: Fri, 17 Aug 2007 03:09:04 -0700 (PDT)
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, 17 Aug 2007 Volume: 11 Number: 764
Today's topics:
DF in HTML <ajit.bakshi@gmail.com>
Re: DF in HTML (Jens Thoms Toerring)
Re: DF in HTML usenet@DavidFilmer.com
Gaa! UNIX hack tries PPM and fails! usenet@DavidFilmer.com
Re: Gaa! UNIX hack tries PPM and fails! <ayaz@dev.null>
Re: Help: How to use filehandle to save files? <bik.mido@tiscalinet.it>
new CPAN modules on Fri Aug 17 2007 (Randal Schwartz)
Re: Newbie Perl question <bik.mido@tiscalinet.it>
Re: Parsing Huge File - must use version of perl compil <manjunatha.nayak@gmail.com>
Posting Guidelines for comp.lang.perl.misc ($Revision: tadmc@seesig.invalid
Re: Replacing Print Location.. <paduille.4061.mumia.w+nospam@earthlink.net>
Re: Using Subroutines with CGI::Session::MySQL? <paduille.4061.mumia.w+nospam@earthlink.net>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 16 Aug 2007 23:47:19 -0700
From: sonu <ajit.bakshi@gmail.com>
Subject: DF in HTML
Message-Id: <1187333239.943095.283180@x35g2000prf.googlegroups.com>
<<df>> is disk free command in Unix. I am using Sun OS 5.9. When
executed df command i get output like
[XXX@XXXXdb:~]#df -h
Filesystem size used avail capacity Mounted on
/dev/dsk/c0t8d0s0 6.3G 2.0G 4.3G 32% /
/xxx 0K 0K 0K 0% /proc
mnttab 0K 0K 0K 0% /etc/mnttab
fd 0K 0K 0K 0% /dev/fd
swap 948M 104K 947M 1% /var/run
swap 2.1G 1.2G 947M 57% /tmp
/dev/dsk/YYY 8.3G 4.2G 4.0G 52% /export/home/u01
/dev/dsk/YYY 8.3G 1.7G 6.5G 22% /export/home/u02
/dev/dsk/YYYY 8.3G 3.3G 5.0G 40% /export/home/u03
i want this output to come in html formate
so on mail it will look like
---------------------------------------------------------------------------=
=AD-----------------|
Filesystem | size | used | avail | capacity| Mounted
on|
---------------------------------------------------------------------------=
=AD----------------
|
/dev/dsk/c0t8d0s0| 6.3G | 2.0G | 4.3G | 32% |/
|
---------------------------------------------------------------------------=
=AD----------------|
/xxx | 0K | 0K | 0K | 0% |/
proc |
---------------------------------------------------------------------------=
=AD-----------------|
basically in row column format like we see a table on html page.
I know how to mail it but i don't know how to change this text output
from df to an html page.
step 1 will be
df > 123
then how to change and replace the text each and every time using
program?
------------------------------
Date: 17 Aug 2007 08:16:09 GMT
From: jt@toerring.de (Jens Thoms Toerring)
Subject: Re: DF in HTML
Message-Id: <5il3q9F3q76nvU1@mid.uni-berlin.de>
sonu <ajit.bakshi@gmail.com> wrote:
> <<df>> is disk free command in Unix. I am using Sun OS 5.9. When
> executed df command i get output like
> [XXX@XXXXdb:~]#df -h
> Filesystem size used avail capacity Mounted on
> /dev/dsk/c0t8d0s0 6.3G 2.0G 4.3G 32% /
> /xxx 0K 0K 0K 0% /proc
> mnttab 0K 0K 0K 0% /etc/mnttab
> fd 0K 0K 0K 0% /dev/fd
> swap 948M 104K 947M 1% /var/run
> swap 2.1G 1.2G 947M 57% /tmp
> /dev/dsk/YYY 8.3G 4.2G 4.0G 52% /export/home/u01
> /dev/dsk/YYY 8.3G 1.7G 6.5G 22% /export/home/u02
> /dev/dsk/YYYY 8.3G 3.3G 5.0G 40% /export/home/u03
> i want this output to come in html formate
> so on mail it will look like
> ---------------------------------------------------------------------------?-----------------|
> Filesystem | size | used | avail | capacity| Mounted
> on|
> ---------------------------------------------------------------------------?----------------
> |
> /dev/dsk/c0t8d0s0| 6.3G | 2.0G | 4.3G | 32% |/
> |
> ---------------------------------------------------------------------------?----------------|
> /xxx | 0K | 0K | 0K | 0% |/
> proc |
> ---------------------------------------------------------------------------?-----------------|
> basically in row column format like we see a table on html page.
> I know how to mail it but i don't know how to change this text output
> from df to an html page.
> step 1 will be
> df > 123
> then how to change and replace the text each and every time using
> program?
You don't need to write the output of df to a file, you can start
it with it's stdout redirected to a pipe to the perl script and
the read in it's output and immediately convert it in the script:
use strict;
use warnings;
open my $f, "df -h |" or die "Can't run 'df -h'.\n";
print "<table>\n";
while ( <$f> ) {
print "<tr>\n";
for my $field ( split /\s+/ ) {
print "<td>$field</td>\n",
}
print "</tr>\n";
}
print "</table>\n";
close $f;
This create a HTML table from the output of df.
Regards, Jens
--
\ Jens Thoms Toerring ___ jt@toerring.de
\__________________________ http://toerring.de
------------------------------
Date: Fri, 17 Aug 2007 08:31:13 -0000
From: usenet@DavidFilmer.com
Subject: Re: DF in HTML
Message-Id: <1187339473.631315.188990@e9g2000prf.googlegroups.com>
On Aug 16, 11:47 pm, sonu <ajit.bak...@gmail.com> wrote:
> <<df>> is disk free command in Unix. I am using Sun OS 5.9.
But it's not controlled by any sort of standards, so the output can be
different on other systems (or even if you upgrade your own system).
And sometimes the output can change if strange things happen (very
large filesystems get added, etc). Parsing the output of system
commands can be risky and failure-prone.
I recommend that you access this information using a Perl module such
as http://search.cpan.org/~iguthrie/Filesys-Df-0.92/Df.pm, which will
allow your program to work on practically any flavor of *NIX for all
eternity.
Or you can use http://search.cpan.org/~iguthrie/Filesys-DfPortable-0.85/DfPortable.pm
and it will even work on Windows!
--
The best way to get a good answer is to ask a good question.
David Filmer (http://DavidFilmer.com)
------------------------------
Date: Fri, 17 Aug 2007 08:24:42 -0000
From: usenet@DavidFilmer.com
Subject: Gaa! UNIX hack tries PPM and fails!
Message-Id: <1187339082.985279.199730@x35g2000prf.googlegroups.com>
I'm a UNIX hack, but I want to run Web Scraping Proxy on a Windows box
that does not have internet access (I'm scraping local pages). So I
installed ActivePerl. So far, so good.
But WSP needs some old SSLeay crypto modules. ActiveState doesn't
supply crypto modules (http://aspn.activestate.com/ASPN/Downloads/
ActivePerl/PPM/Repository) but they kindly provide a link to the
University of Winnipeg, specifically mentioning the two modules I
require (Crypt-SSLeay and Net_SSLeay).
Since I don't have web access on the target PC then I am looking for a
PPM file so I can do a local install.
I found where the plain PPMs are supposedly published:
http://theoryx5.uwinnipeg.ca/ppms/x86
And I downloaded the one I need: http://theoryx5.uwinnipeg.ca/ppms/x86/Crypt-SSLeay.tar.gz
What I expected to find therein was a file named whatever.ppm that I
could run ppm against. But the tarball contains a directory structure
that looks like this:
[.....]
drwxrwxrwx 0 0 0 Dec 26 12:20:22 2006 blib/html/site
drwxrwxrwx 0 0 0 Dec 26 12:20:22 2006 blib/html
-rw-rw-rw- 0 0 0 Dec 26 12:19:22 2006 blib/lib/auto/Crypt/
SSLeay/.exists
drwxrwxrwx 0 0 0 Dec 26 12:19:22 2006 blib/lib/auto/Crypt/
SSLeay
drwxrwxrwx 0 0 0 Dec 26 12:19:22 2006 blib/lib/auto/Crypt
drwxrwxrwx 0 0 0 Dec 26 12:19:22 2006 blib/lib/auto
[.....]
There is no README or anything telling me what to do with this. Is
this a PPM? Am I supposed to just unroll this somewhere on my Windows
box? Where? What is this thing?
Can anybody help a poor UNIX hack figure this out?
Thanks!
------------------------------
Date: Fri, 17 Aug 2007 14:48:32 +0500
From: Ayaz Ahmed Khan <ayaz@dev.null>
Subject: Re: Gaa! UNIX hack tries PPM and fails!
Message-Id: <20070817144832.f4261b62.ayaz@dev.null>
"usenet@DavidFilmer.com" typed:
> What I expected to find therein was a file named whatever.ppm that I
> could run ppm against. But the tarball contains a directory structure
> that looks like this:
>
> [.....]
> drwxrwxrwx 0 0 0 Dec 26 12:20:22 2006 blib/html/site
> drwxrwxrwx 0 0 0 Dec 26 12:20:22 2006 blib/html
> -rw-rw-rw- 0 0 0 Dec 26 12:19:22 2006 blib/lib/auto/Crypt/
> SSLeay/.exists
> drwxrwxrwx 0 0 0 Dec 26 12:19:22 2006 blib/lib/auto/Crypt/
> SSLeay
> drwxrwxrwx 0 0 0 Dec 26 12:19:22 2006 blib/lib/auto/Crypt
> drwxrwxrwx 0 0 0 Dec 26 12:19:22 2006 blib/lib/auto
> [.....]
>
> There is no README or anything telling me what to do with this. Is
> this a PPM? Am I supposed to just unroll this somewhere on my Windows
> box? Where? What is this thing?
Um ...
$ perl Makefile.PL
$ make
# make install
... perhaps.
--
Ayaz Ahmed Khan
------------------------------
Date: Fri, 17 Aug 2007 11:11:21 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Help: How to use filehandle to save files?
Message-Id: <94oac3hjoev9tmbs7rfbgibksegtqasik1@4ax.com>
On Fri, 17 Aug 2007 08:03:52 +0800, Amy Lee
<openlinuxsource@gmail.com> wrote:
>However, I still got a problem, why I must use use some variables to open
>files? In my source code, I use
Your question doesn't make sense. You *probably* refer to lexical
filehandles e.g.
open my $fh, ...
well, that's just the same as
open FH, ....
except that the latter will be a package global, the former... a
lexical and it has the usual advantage of lexicals. As a filehandle,
it has the additional advantage of not requiring an explicit close()
because an implicit one will take effect on scope exit.
>open EST, '<', $EST
>
>to open a file.
You use this to open a file *for reading*.
>If I use <EST> to operate this function, how can I save the files?
You use <EST> to *read* ("lines") from that filehandle. You can
continue to use print() to "save the files" - in your jargon. Just
either kick the filheandle in as in
print OUT "What I want to print to the file\n";
or if you prefer
select OUT;
then
print "What I want to print to the file\n";
will automatically go to the file. But do a favour to both yourself
and us by asking someone who can surely explain the whole thing much
better than any of us could, the docs:
perldoc -f open
perldoc -f print
perldoc -f select
See:
#!/usr/bin/perl
use strict;
use warnings;
print "Amy, please enter a filename:\n";
my $file;
TRY: {
chomp($file=<STDIN>);
for ($file) {
print "At least one charachter please, retry:\n" and
redo TRY unless length;
print "File exists, choose another one:\n" and
redo TRY if -e;
}
}
{
open my $out, '>', $file or
die "Can't open `$file': $!\n";
print $out "Stuffing something into `$file' for Amy.\n";
}
print "See Amy? We stuffed something into `$file', ",
"Check for yourself!";
__END__
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: Fri, 17 Aug 2007 04:42:17 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Fri Aug 17 2007
Message-Id: <JMwIEH.241v@zorch.sf-bay.org>
The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN). You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.
Acme-ESP-1.002003
http://search.cpan.org/~tyemq/Acme-ESP-1.002003/
The power to implant and extract strings' thoughts.
----
Apache-Status-DBI-1.012
http://search.cpan.org/~timb/Apache-Status-DBI-1.012/
Show status of all DBI database and statement handles
----
Authen-Prepare-0.01
http://search.cpan.org/~dnarayan/Authen-Prepare-0.01/
Prepare a set of authentication credentials
----
Bricklayer-Templater-0.9.3
http://search.cpan.org/~zaphar/Bricklayer-Templater-0.9.3/
yet another templating system. Pure perl, highly flexible with very few dependencies.
----
Catalyst-Plugin-tv_interval-0.4
http://search.cpan.org/~fayland/Catalyst-Plugin-tv_interval-0.4/
call tv_interval of Time::HiRes to ease profiling.
----
Catalyst-View-Email-0.05
http://search.cpan.org/~jshirley/Catalyst-View-Email-0.05/
Send Email from Catalyst
----
Crypt-AON-0.08
http://search.cpan.org/~zandet/Crypt-AON-0.08/
All-Or-Nothing Encryption
----
Crypt-AON-Util-0.06
http://search.cpan.org/~zandet/Crypt-AON-Util-0.06/
Util functions for Crypt::AON
----
DashProfiler-1.07
http://search.cpan.org/~timb/DashProfiler-1.07/
collect call count and timing data aggregated by context
----
Debug-Smart-0.003
http://search.cpan.org/~shibuya/Debug-Smart-0.003/
Debug messages for smart logging to the file
----
Expect-Simple-0.03
http://search.cpan.org/~djerius/Expect-Simple-0.03/
wrapper around the Expect module
----
Getopt-Std-WithCheck-0.04
http://search.cpan.org/~tpaba/Getopt-Std-WithCheck-0.04/
Perl extension for process command line arguments with custom check on them
----
HTML-Menu-TreeView-0.7.4
http://search.cpan.org/~lze/HTML-Menu-TreeView-0.7.4/
----
IPC-MorseSignals-0.02
http://search.cpan.org/~vpit/IPC-MorseSignals-0.02/
Communicate between processes with Morse signals.
----
IPC-MorseSignals-0.03
http://search.cpan.org/~vpit/IPC-MorseSignals-0.03/
Communicate between processes with Morse signals.
----
Module-ThirdParty-0.23
http://search.cpan.org/~saper/Module-ThirdParty-0.23/
Provide information for 3rd party modules (outside CPAN)
----
Net-ARP-1.0.1
http://search.cpan.org/~crazydj/Net-ARP-1.0.1/
Perl extension for creating ARP packets
----
Net-FTPServer-XferLog-1.4
http://search.cpan.org/~tbone/Net-FTPServer-XferLog-1.4/
parse FTP server xfer logs.
----
Net-FTPServer-XferLog-1.5
http://search.cpan.org/~tbone/Net-FTPServer-XferLog-1.5/
parse FTP server xfer logs.
----
Net-LDAP-HTMLWidget-0.05
http://search.cpan.org/~andremar/Net-LDAP-HTMLWidget-0.05/
Like FromForm but with Net::LDAP and HTML::Widget
----
PDL-LinearAlgebra-0.04
http://search.cpan.org/~ellipse/PDL-LinearAlgebra-0.04/
Linear Algebra utils for PDL
----
POE-Component-CPAN-YACSmoke-1.03
http://search.cpan.org/~bingos/POE-Component-CPAN-YACSmoke-1.03/
Bringing the power of POE to CPAN smoke testing.
----
ParaDNS-1.3
http://search.cpan.org/~msergeant/ParaDNS-1.3/
a DNS lookup class for the Danga::Socket framework
----
Params-Classify-0.004
http://search.cpan.org/~zefram/Params-Classify-0.004/
argument type classification
----
Statistics-Gtest-0.04
http://search.cpan.org/~dcfleck/Statistics-Gtest-0.04/
calculate G-statistic for tabular data
----
SystemPerl-1.281
http://search.cpan.org/~wsnyder/SystemPerl-1.281/
SystemPerl Language Extension to SystemC
----
Test-Inline-2.206
http://search.cpan.org/~adamk/Test-Inline-2.206/
Lets you put tests in your modules, next to tested code
----
WWW-Myspace-0.70
http://search.cpan.org/~grantg/WWW-Myspace-0.70/
Access MySpace.com profile information from Perl
----
WebService-Recruit-Dokoiku-0.10
http://search.cpan.org/~kawasaki/WebService-Recruit-Dokoiku-0.10/
A Interface for Dokoiku Web Service Beta
----
WebService-Recruit-Dokoiku-0.11
http://search.cpan.org/~kawasaki/WebService-Recruit-Dokoiku-0.11/
A Interface for Dokoiku Web Service Beta
If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.
This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
http://www.stonehenge.com/merlyn/LinuxMag/col82.html
print "Just another Perl hacker," # the original
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Fri, 17 Aug 2007 11:19:32 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Newbie Perl question
Message-Id: <ekpac3dacn94ihgt2qfcdg9pupbue0sd1a@4ax.com>
On Thu, 16 Aug 2007 21:44:38 GMT, "Jürgen Exner"
<jurgenex@hotmail.com> wrote:
>>> Well, glob does shell filename globbing only, it doesn't do RE
>>> matching. And the OP was explicitely asking for RE matching which
>>> makes the task a lot more complicated.
>>
>> A lot? Well nothing that a simple grep() can't handle.
>
>True. But how do you get that initial list of file/directory names that you
>feed into grep() without generating the full list of all files in all
>directories recursively?
Well, I can't. Of course I can't: grep() takes a list: since we do not
have lazy list evaluation (yet) the list must be generated in advance,
in some way or another. In that case I wouldn't do the check in a grep
but directly in the finding code. OTOH as most of use understood it,
the OP *didn't* want to match *recursively*.
>I couldn't come up with anything better than the either that or to use
>something like File::Find to filter while traversing the tree.
Indeed.
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: Fri, 17 Aug 2007 08:26:13 -0000
From: Majnu <manjunatha.nayak@gmail.com>
Subject: Re: Parsing Huge File - must use version of perl compiled for huge files.
Message-Id: <1187339173.934267.124130@57g2000hsv.googlegroups.com>
On Aug 14, 7:40 am, Joe Smith <j...@inwap.com> wrote:
> Majnu wrote:
> > Hello,
>
> > I have a strange problem. I have a flat file of about 6 million rows,
> > each row of 600 bytes. I read the file line by line after opening like
> > this:
>
> > open(IN, "cat $InputFile |") or die "Failed to open the File";
> > ##This was changed from open(IN, "< $InputFile") because Perl
> > outrightly refused to open the file.
> > while(<IN>) {......
>
> > The problem is that, at times, Perl just stops after reading 3,334,601
> > records.
>
> You neglected to mention which version of perl and which OS, but I
> can see the cause of both of your problems.
>
> % perl -le 'print 600*3_334_601'
> 2000760600
>
> % perl -V | grep large
> useperlio=define d_sfio=undef uselargefiles=define
>
> You cannot process more than 2 gigabytes (can't even open a file
> bigger than 2 GB) when using a version of perl that expects file
> sizes to fit into a signed 32-bit int.
>
> Check your 'perl -V'; I'm sure it is _not_ compiled with 'uselargefiles=define'.
>
> You need to upgrade to perl v5.8.x immediately.
>
> -Joe
Thanks for the replies.
Yes. The Perl version seems to be the problem here. Though the perl
available was 5.8, withing the script, 5.2 was used, which,
unfortunately was not copiled with uselargefiles option.
------------------------------
Date: Fri, 17 Aug 2007 07:11:23 GMT
From: tadmc@seesig.invalid
Subject: Posting Guidelines for comp.lang.perl.misc ($Revision: 1.8 $)
Message-Id: <vSbxi.28002$RX.16647@newssvr11.news.prodigy.net>
Outline
Before posting to comp.lang.perl.misc
Must
- Check the Perl Frequently Asked Questions (FAQ)
- Check the other standard Perl docs (*.pod)
Really Really Should
- Lurk for a while before posting
- Search a Usenet archive
If You Like
- Check Other Resources
Posting to comp.lang.perl.misc
Is there a better place to ask your question?
- Question should be about Perl, not about the application area
How to participate (post) in the clpmisc community
- Carefully choose the contents of your Subject header
- Use an effective followup style
- Speak Perl rather than English, when possible
- Ask perl to help you
- Do not re-type Perl code
- Provide enough information
- Do not provide too much information
- Do not post binaries, HTML, or MIME
Social faux pas to avoid
- Asking a Frequently Asked Question
- Asking a question easily answered by a cursory doc search
- Asking for emailed answers
- Beware of saying "doesn't work"
- Sending a "stealth" Cc copy
Be extra cautious when you get upset
- Count to ten before composing a followup when you are upset
- Count to ten after composing and before posting when you are upset
-----------------------------------------------------------------
Posting Guidelines for comp.lang.perl.misc ($Revision: 1.8 $)
This newsgroup, commonly called clpmisc, is a technical newsgroup
intended to be used for discussion of Perl related issues (except job
postings), whether it be comments or questions.
As you would expect, clpmisc discussions are usually very technical in
nature and there are conventions for conduct in technical newsgroups
going somewhat beyond those in non-technical newsgroups.
The article at:
http://www.catb.org/~esr/faqs/smart-questions.html
describes how to get answers from technical people in general.
This article describes things that you should, and should not, do to
increase your chances of getting an answer to your Perl question. It is
available in POD, HTML and plain text formats at:
http://www.rehabitation.com/clpmisc.shtml
For more information about netiquette in general, see the "Netiquette
Guidelines" at:
http://andrew2.andrew.cmu.edu/rfc/rfc1855.html
A note to newsgroup "regulars":
Do not use these guidelines as a "license to flame" or other
meanness. It is possible that a poster is unaware of things
discussed here. Give them the benefit of the doubt, and just
help them learn how to post, rather than assume that they do
know and are being the "bad kind" of Lazy.
A note about technical terms used here:
In this document, we use words like "must" and "should" as
they're used in technical conversation (such as you will
encounter in this newsgroup). When we say that you *must* do
something, we mean that if you don't do that something, then
it's unlikely that you will benefit much from this group.
We're not bossing you around; we're making the point without
lots of words.
Do *NOT* send email to the maintainer of these guidelines. It will be
discarded unread. The guidelines belong to the newsgroup so all
discussion should appear in the newsgroup. I am just the secretary that
writes down the consensus of the group.
Before posting to comp.lang.perl.misc
Must
This section describes things that you *must* do before posting to
clpmisc, in order to maximize your chances of getting meaningful replies
to your inquiry and to avoid getting flamed for being lazy and trying to
have others do your work.
The perl distribution includes documentation that is copied to your hard
drive when you install perl. Also installed is a program for looking
things up in that (and other) documentation named 'perldoc'.
You should either find out where the docs got installed on your system,
or use perldoc to find them for you. Type "perldoc perldoc" to learn how
to use perldoc itself. Type "perldoc perl" to start reading Perl's
standard documentation.
Check the Perl Frequently Asked Questions (FAQ)
Checking the FAQ before posting is required in Big 8 newsgroups in
general, there is nothing clpmisc-specific about this requirement.
You are expected to do this in nearly all newsgroups.
You can use the "-q" switch with perldoc to do a word search of the
questions in the Perl FAQs.
Check the other standard Perl docs (*.pod)
The perl distribution comes with much more documentation than is
available for most other newsgroups, so in clpmisc you should also
see if you can find an answer in the other (non-FAQ) standard docs
before posting.
It is *not* required, or even expected, that you actually *read* all of
Perl's standard docs, only that you spend a few minutes searching them
before posting.
Try doing a word-search in the standard docs for some words/phrases
taken from your problem statement or from your very carefully worded
"Subject:" header.
Really Really Should
This section describes things that you *really should* do before posting
to clpmisc.
Lurk for a while before posting
This is very important and expected in all newsgroups. Lurking means
to monitor a newsgroup for a period to become familiar with local
customs. Each newsgroup has specific customs and rituals. Knowing
these before you participate will help avoid embarrassing social
situations. Consider yourself to be a foreigner at first!
Search a Usenet archive
There are tens of thousands of Perl programmers. It is very likely
that your question has already been asked (and answered). See if you
can find where it has already been answered.
One such searchable archive is:
http://groups.google.com/advanced_group_search
If You Like
This section describes things that you *can* do before posting to
clpmisc.
Check Other Resources
You may want to check in books or on web sites to see if you can
find the answer to your question.
But you need to consider the source of such information: there are a
lot of very poor Perl books and web sites, and several good ones
too, of course.
Posting to comp.lang.perl.misc
There can be 200 messages in clpmisc in a single day. Nobody is going to
read every article. They must decide somehow which articles they are
going to read, and which they will skip.
Your post is in competition with 199 other posts. You need to "win"
before a person who can help you will even read your question.
These sections describe how you can help keep your article from being
one of the "skipped" ones.
Is there a better place to ask your question?
Question should be about Perl, not about the application area
It can be difficult to separate out where your problem really is,
but you should make a conscious effort to post to the most
applicable newsgroup. That is, after all, where you are the most
likely to find the people who know how to answer your question.
Being able to "partition" a problem is an essential skill for
effectively troubleshooting programming problems. If you don't get
that right, you end up looking for answers in the wrong places.
It should be understood that you may not know that the root of your
problem is not Perl-related (the two most frequent ones are CGI and
Operating System related), so off-topic postings will happen from
time to time. Be gracious when someone helps you find a better place
to ask your question by pointing you to a more applicable newsgroup.
How to participate (post) in the clpmisc community
Carefully choose the contents of your Subject header
You have 40 precious characters of Subject to win out and be one of
the posts that gets read. Don't waste them. Take care while
composing them, they are the key that opens the door to getting an
answer.
Spend them indicating what aspect of Perl others will find if they
should decide to read your article.
Do not spend them indicating "experience level" (guru, newbie...).
Do not spend them pleading (please read, urgent, help!...).
Do not spend them on non-Subjects (Perl question, one-word
Subject...)
For more information on choosing a Subject see "Choosing Good
Subject Lines":
http://www.cpan.org/authors/id/D/DM/DMR/subjects.post
Part of the beauty of newsgroup dynamics, is that you can contribute
to the community with your very first post! If your choice of
Subject leads a fellow Perler to find the thread you are starting,
then even asking a question helps us all.
Use an effective followup style
When composing a followup, quote only enough text to establish the
context for the comments that you will add. Always indicate who
wrote the quoted material. Never quote an entire article. Never
quote a .signature (unless that is what you are commenting on).
Intersperse your comments *following* each section of quoted text to
which they relate. Unappreciated followup styles are referred to as
"top-posting", "Jeopardy" (because the answer comes before the
question), or "TOFU" (Text Over, Fullquote Under).
Reversing the chronology of the dialog makes it much harder to
understand (some folks won't even read it if written in that style).
For more information on quoting style, see:
http://web.presby.edu/~nnqadmin/nnq/nquote.html
Speak Perl rather than English, when possible
Perl is much more precise than natural language. Saying it in Perl
instead will avoid misunderstanding your question or problem.
Do not say: I have variable with "foo\tbar" in it.
Instead say: I have $var = "foo\tbar", or I have $var = 'foo\tbar',
or I have $var = <DATA> (and show the data line).
Ask perl to help you
You can ask perl itself to help you find common programming mistakes
by doing two things: enable warnings (perldoc warnings) and enable
"strict"ures (perldoc strict).
You should not bother the hundreds/thousands of readers of the
newsgroup without first seeing if a machine can help you find your
problem. It is demeaning to be asked to do the work of a machine. It
will annoy the readers of your article.
You can look up any of the messages that perl might issue to find
out what the message means and how to resolve the potential mistake
(perldoc perldiag). If you would like perl to look them up for you,
you can put "use diagnostics;" near the top of your program.
Do not re-type Perl code
Use copy/paste or your editor's "import" function rather than
attempting to type in your code. If you make a typo you will get
followups about your typos instead of about the question you are
trying to get answered.
Provide enough information
If you do the things in this item, you will have an Extremely Good
chance of getting people to try and help you with your problem!
These features are a really big bonus toward your question winning
out over all of the other posts that you are competing with.
First make a short (less than 20-30 lines) and *complete* program
that illustrates the problem you are having. People should be able
to run your program by copy/pasting the code from your article. (You
will find that doing this step very often reveals your problem
directly. Leading to an answer much more quickly and reliably than
posting to Usenet.)
Describe *precisely* the input to your program. Also provide example
input data for your program. If you need to show file input, use the
__DATA__ token (perldata.pod) to provide the file contents inside of
your Perl program.
Show the output (including the verbatim text of any messages) of
your program.
Describe how you want the output to be different from what you are
getting.
If you have no idea at all of how to code up your situation, be sure
to at least describe the 2 things that you *do* know: input and
desired output.
Do not provide too much information
Do not just post your entire program for debugging. Most especially
do not post someone *else's* entire program.
Do not post binaries, HTML, or MIME
clpmisc is a text only newsgroup. If you have images or binaries
that explain your question, put them in a publically accessible
place (like a Web server) and provide a pointer to that location. If
you include code, cut and paste it directly in the message body.
Don't attach anything to the message. Don't post vcards or HTML.
Many people (and even some Usenet servers) will automatically filter
out such messages. Many people will not be able to easily read your
post. Plain text is something everyone can read.
Social faux pas to avoid
The first two below are symptoms of lots of FAQ asking here in clpmisc.
It happens so often that folks will assume that it is happening yet
again. If you have looked but not found, or found but didn't understand
the docs, say so in your article.
Asking a Frequently Asked Question
It should be understood that you may have missed the applicable FAQ
when you checked, which is not a big deal. But if the Frequently
Asked Question is worded similar to your question, folks will assume
that you did not look at all. Don't become indignant at pointers to
the FAQ, particularly if it solves your problem.
Asking a question easily answered by a cursory doc search
If folks think you have not even tried the obvious step of reading
the docs applicable to your problem, they are likely to become
annoyed.
If you are flamed for not checking when you *did* check, then just
shrug it off (and take the answer that you got).
Asking for emailed answers
Emailed answers benefit one person. Posted answers benefit the
entire community. If folks can take the time to answer your
question, then you can take the time to go get the answer in the
same place where you asked the question.
It is OK to ask for a *copy* of the answer to be emailed, but many
will ignore such requests anyway. If you munge your address, you
should never expect (or ask) to get email in response to a Usenet
post.
Ask the question here, get the answer here (maybe).
Beware of saying "doesn't work"
This is a "red flag" phrase. If you find yourself writing that,
pause and see if you can't describe what is not working without
saying "doesn't work". That is, describe how it is not what you
want.
Sending a "stealth" Cc copy
A "stealth Cc" is when you both email and post a reply without
indicating *in the body* that you are doing so.
Be extra cautious when you get upset
Count to ten before composing a followup when you are upset
This is recommended in all Usenet newsgroups. Here in clpmisc, most
flaming sub-threads are not about any feature of Perl at all! They
are most often for what was seen as a breach of netiquette. If you
have lurked for a bit, then you will know what is expected and won't
make such posts in the first place.
But if you get upset, wait a while before writing your followup. I
recommend waiting at least 30 minutes.
Count to ten after composing and before posting when you are upset
After you have written your followup, wait *another* 30 minutes
before committing yourself by posting it. You cannot take it back
once it has been said.
AUTHOR
Tad McClellan and many others on the comp.lang.perl.misc newsgroup.
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
------------------------------
Date: Thu, 16 Aug 2007 23:04:15 -0500
From: "Mumia W." <paduille.4061.mumia.w+nospam@earthlink.net>
Subject: Re: Replacing Print Location..
Message-Id: <13ca8iriabd17b4@corp.supernews.com>
On 08/16/2007 07:15 PM, Bill H wrote:
> [...]
> What I would like best is to do something that I used to do back in my
> Basic programming days on CP/M machines, when done with one program,
> chain to another and have the variables stay intact. In the case of
> Perl I would just want to be able to access the same Env values that
> the 1st program that was called by the user access (ie form data,
> cookies etc) in place of the variables staying intact as was done on
> the old Basic programs.
>
> I hope this makes since.
>
> Bill H
>
This last part (almost) sounds like a job for "exec": perldoc -f exec
However, you would have to explicitly place the form values and cookies
into the environment. If you're using CGI, the QUERY_STRING is already
in the environment.
The procedure would be to do some processing and place the form values
and cookies into the environment, then exec() the other
script--replacing the current script's code with the new script while
maintaining the data in the environment.
Data stored in Perl variables would be destroyed, so saving into the
environment (or somewhere else) is required with this method.
------------------------------
Date: Thu, 16 Aug 2007 23:14:12 -0500
From: "Mumia W." <paduille.4061.mumia.w+nospam@earthlink.net>
Subject: Re: Using Subroutines with CGI::Session::MySQL?
Message-Id: <13ca8it2919ocb7@corp.supernews.com>
On 08/16/2007 07:26 PM, L. D. James wrote:
> [...]
> I had been wondering if perl leaked, and how much cleanup it did when
> exiting the application from a subroutine without doing cleanup.
>
Mod_perl is a strange environment. It's built for breath-taking
efficiency, but it complicates programming. This wasn't a Perl leak--it
was an effect of the additional complexity brought by mod_perl.
> All my fill access programs close the file handle before exiting
> perl. However, many of my mysql programs exited out the subroutine
> when it finished doing its job, thereby often never reaching the $dbh-
> disconnect() at the end of the code. This is especially the case
> where my code reaches an error. I display a message then exits. I'm
> sure, by the way, that the "die" function does some cleanup. As far
> as all my other routines, I'm updating them to go to a "finish()"
> subroutine to cleanup before exiting.
>
> Thanks again for all the help and discussion. I had lost a night of
> sleep trying to figure out what was going wrong.
>
> -- L. James
>
You're quite welcome.
Enclosing the entire program in curly braces might also work to make
sure that variables go out of scope properly, and I think you can
configure mod_perl to compile programs in a much less persistent (and
efficient) way; I think this is called PerlRun mode.
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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 V11 Issue 764
**************************************