[19638] in Perl-Users-Digest
Perl-Users Digest, Issue: 1833 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Sep 27 18:05:35 2001
Date: Thu, 27 Sep 2001 15:05:09 -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: <1001628309-v10-i1833@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 27 Sep 2001 Volume: 10 Number: 1833
Today's topics:
Re: Creating modules (Mark Jason Dominus)
DBI/MySQL "$sth->fetch" help needed (martinblack)
Re: DBI/MySQL "$sth->fetch" help needed (John J. Trammell)
email attachment <min_c_lee@yahoo.com>
Re: email attachment (Chris Fedde)
Re: Encrypt/Decrypt (redmist)
Re: Encrypt/Decrypt <info_NS1@sundialservices.com>
Re: Encrypt/Decrypt <bart.lateur@skynet.be>
Get the descriptions of the Newsgorups in (News::NNTPCl <webmaster@kwakeb.net>
Re: Get the descriptions of the Newsgorups in (News::NN <tony_curtis32@yahoo.com>
Re: Help: mail script (WIN) <bwalton@rochester.rr.com>
how do I know if Perl:TK is installed? <mdulrich@unity.ncsu.edu>
Re: how do I know if Perl:TK is installed? <mjcarman@home.com>
Re: How to know the script is already running or not??? <thomas@baetzler.de>
Re: How to know the script is already running or not??? (Chris Fedde)
Re: launching acrobat on Win32 <bart.lateur@skynet.be>
Re: Managing Child Processes (Abigail)
Re: maths (Mark Jason Dominus)
Re: maths <bart.lateur@skynet.be>
Re: maths <mjcarman@home.com>
Re: maths <uri@sysarch.com>
Re: Mission Statement for this newsgroup? <thompson-nospam@new.rr.com>
Re: Mission Statement for this newsgroup? (Randal L. Schwartz)
Re: Not sure what type of cgi script I need! (Abigail)
Re: Parsing a string <gte574u@prism.gatech.edu>
procmail-like task in Perl? <burns_cindy@hotmail.com>
Re: Security of letting user specify regex in CGI scrip <bart.lateur@skynet.be>
test <nospam@newsranger.com>
Re: testing the "flatness" of a structured file (Mark Jason Dominus)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 27 Sep 2001 18:45:06 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: Creating modules
Message-Id: <3bb373b2.5d8a$1c9@news.op.net>
In article <spc2rtcsn5t2tqfcref6cn7f58k54jm8s9@4ax.com>,
GunneR <ds@ss.com> wrote:
>Im having trouble creating a simple module (just to get started). I've
>had a bit of trouble finding good documentation on creating modules.
The Very Very Short Tutorial About Modules in Perl may be helpful:
http://perl.plover.com/Hello/
It has the smallest possible example of a module, only 18 lines long,
and a list of exercises.
Then there's an example of an OO module, about the same size.
--
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print
------------------------------
Date: 27 Sep 2001 13:35:39 -0700
From: martinblack26@yahoo.com (martinblack)
Subject: DBI/MySQL "$sth->fetch" help needed
Message-Id: <c025943b.0109271235.5c1c5537@posting.google.com>
Hi, I am having trouble with a DBI script. I can't seem to access the
rows returned from the SQL command. I have tried numerous methods to
grab the rows, but no such luck. I am not getting any error messages
from this script, and I am at my wits end. Any help would be very much
appreciated. Thanks in advance.
Cheers.
Martinblack.
Below is a copy of the script:
#!/usr/bin/perl
BEGIN {
open (STDERR, ">html/error.txt");
}
### search.cgi
use CGI qw/:standard/;
use DBI;
$q = new CGI;
# input..................................
$io{'id'} = $id = $q->param('id') || '';
$io{'title'} = $title = $q->param('title') || '';
# mainline...............................
&DBstart;
if (defined $io{'id'} && $io{'id'} ne '') {
($company_id, $product_id) =
$id=~/^([A-Za-z]{1,3})\-([A-Za-z\-0-9]{1,})$/;
&clean($company_id);
&clean($product_id);
$SQL = "select company_id, product_id, title,
description, spex, price, sex
from product
where product_id='$product_id' and
company_id='$company_id';";
&Do_SQL;
#print "Content-type: text/html\n\n";
#print "hi \n Here's the first command: $SQL";
#$dbh->disconnect || die "disconnection problem: ", $dbh->errstr;
#exit;
} else {
&clean($title);
$SQL = "select company_id, product_id, title,
description, spex, price, sex
from product
where title='$title';";
#print "Content-type: text/html\n\n";
#print "hi \n Here's the second command: $SQL";
#$dbh->disconnect || die "disconnection problem: ", $dbh->errstr;
#exit;
&Do_SQL;
}
eval {&fetch_results;};
if($@){
$dbh->disconnect;
print "Content-type: text/html\n\n";
print "An ERROR occurred! $@\n";
exit;
}
&print_results;
$sth->finish() || die "finish problem: ", $sth->errstr;
$dbh->disconnect || die "disconnection problem: ", $dbh->errstr;
exit;
# the subs are coming.............................
sub fetch_results {
while ($x = $sth->fetchrow_hashref) {
$com = $x->{'company_id'};
$pro = $x->{'product_id'};
$tit = $x->{'title'};
$des = $x->{'description'};
$spe = $x->{'spex'};
$pri = $x->{'price'};
$morf = $x->{'sex'};
$newid = $com ."-".$pro;
}
$sth->execute;
}
#sub alternate {
# my($com, $pro, $tit, $des, $spe, $pri, $morf);
# $sth->bind_columns(undef, \$com, \$pro, \$tit, \$des, \$spe,
\$pri, \$morf) || die "bind problem: ", $sth->errstr;
# while ($sth->fetch) {
# print "Content-type: text/html\n\n";
# print "hi\n";
# print join("\t", $com, $pro, $tit, $des, $spe, $pri, $morf),
"\n";
# exit;
# }
#}
sub print_results {
print <<HTML;
<HTML><HEAD><TITLE>Search Thing</TITLE></HEAD>
<BODY BGCOLOR="#FFFFFF">
<CENTER><FONT SIZE=6>Search Results</FONT></CENTER>
<HR WIDTH=80%>
<P>
<CENTER><TABLE BORDER=1 CELLSPACING=0>
<TR>
<TD BGCOLOR="#c0c0c0" COLSPAN=6>
<CENTER><B>MySQL/Perl Integration Example</B></CENTER>
</TD>
</TR>
<TR>
<TD BGCOLOR="c0c0c0">
<FONT SIZE=2 FACE=ARIAL><CENTER><B>id</B>=
$newid</CENTER></FONT></TD>
<TD BGCOLOR="c0c0c0">
<FONT SIZE=2 FACE=ARIAL><CENTER><B>title</B>=
$tit</CENTER></FONT></TD>
<TD BGCOLOR="c0c0c0">
<FONT SIZE=2 FACE=ARIAL><CENTER><B>description</B>=
$des</CENTER></FONT></TD>
<TD BGCOLOR="c0c0c0">
<FONT SIZE=2 FACE=ARIAL><CENTER><B>spex</B>=
$spe</CENTER></FONT></TD>
<TD BGCOLOR="c0c0c0">
<FONT SIZE=2 FACE=ARIAL><CENTER><B>price</B>=
$pri</CENTER></FONT></TD>
<TD BGCOLOR="c0c0c0">
<FONT SIZE=2 FACE=ARIAL><CENTER><B>sex</B>=
$morf</CENTER></FONT></TD>
</TR>
HTML
}
sub DBstart() {
$DBname= "dbi:mysql:blabla";
$DBhost = "localhost";
$DBusername = "myuname";
$DBpassword = "mypswrd";
$dbh = DBI->connect("$DBname:$DBhost", $DBusername, $DBpassword) ||
die "connection problem: ", $dbh->errstr;
$dbh->{'RaiseError'} = 1;
$dbh;
}
sub Do_SQL{
eval{
$sth = $dbh->prepare($SQL);
};
if($@){
$dbh->disconnect;
print "Content-type: text/html\n\n";
print "An ERROR occurred! $@\n";
exit;
} else {
$sth->execute;
}
return ($sth);
}
sub clean {
$_[0]=~s/\'/\\\'/g;
return $_[0];
}
sub disconnect{
$dbh->disconnect || die "disconnection problem: ", $dbh->errstr;
}
------------------------------
Date: Thu, 27 Sep 2001 16:08:22 -0500
From: trammell@haqq.hypersloth.invalid (John J. Trammell)
Subject: Re: DBI/MySQL "$sth->fetch" help needed
Message-Id: <slrn9r75a5.rvf.trammell@haqq.hypersloth.net>
On 27 Sep 2001 13:35:39 -0700, martinblack <martinblack26@yahoo.com> wrote:
> Hi, I am having trouble with a DBI script. I can't seem to access the
> rows returned from the SQL command. I have tried numerous methods to
> grab the rows, but no such luck. I am not getting any error messages
> from this script, and I am at my wits end. Any help would be very much
> appreciated. Thanks in advance.
Are you sure any lines are being returned? Can you demonstrate
that you have the machinery in place to do a simple select, e.g.
"SELECT * FROM foo"?
> #!/usr/bin/perl
#!/usr/bin/perl -w
use strict;
>
> BEGIN {
> open (STDERR, ">html/error.txt");
open(...) or die "can't open error.txt: $!";
> }
>
[snip]
> $SQL = "select company_id, product_id, title,
> description, spex, price, sex
> from product
> where product_id='$product_id' and
> company_id='$company_id';";
Trailing semicolons in SQL? Probably an error.
[snip]
> sub DBstart() {
> $DBname= "dbi:mysql:blabla";
> $DBhost = "localhost";
> $DBusername = "myuname";
> $DBpassword = "mypswrd";
>
> $dbh = DBI->connect("$DBname:$DBhost", $DBusername, $DBpassword) ||
> die "connection problem: ", $dbh->errstr;
How is this ever going to work? You want $DBI::errstr.
> $dbh->{'RaiseError'} = 1;
Good.
> $dbh;
>
> }
--
[W]hen the manager knows his boss will accept status reports without
panic or preeemption, he comes to give honest appraisals.
- F. Brooks, _The Mythical Man-Month_
------------------------------
Date: Thu, 27 Sep 2001 19:11:42 GMT
From: "Michael" <min_c_lee@yahoo.com>
Subject: email attachment
Message-Id: <ORKs7.470$Le.19003@sea-read.news.verio.net>
Where do I specify the path of an attachment through a Perl generated email?
Michael
------------------------------
Date: Thu, 27 Sep 2001 20:05:47 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: email attachment
Message-Id: <vELs7.722$Owe.326903808@news.frii.net>
In article <ORKs7.470$Le.19003@sea-read.news.verio.net>,
Michael <min_c_lee@yahoo.com> wrote:
>Where do I specify the path of an attachment through a Perl generated email?
>
>Michael
>
perldoc -q attachment
Found in /usr/local/lib/perl5/5.6.1/pod/perlfaq9.pod
How do I use MIME to make an attachment to a mail message?
This answer is extracted directly from the MIME::Lite doc-
umentation. Create a multipart message (i.e., one with
attachments).
use MIME::Lite;
### Create a new multipart message:
$msg = MIME::Lite->new(
From =>'me@myhost.com',
To =>'you@yourhost.com',
Cc =>'some@other.com, some@more.com',
Subject =>'A message with 2 parts...',
Type =>'multipart/mixed'
);
### Add parts (each "attach" has same arguments as "new"):
$msg->attach(Type =>'TEXT',
Data =>"Here's the GIF file you wanted"
);
$msg->attach(Type =>'image/gif',
Path =>'aaa000123.gif',
Filename =>'logo.gif'
);
$text = $msg->as_string;
MIME::Lite also includes a method for sending these
things.
$msg->send;
This defaults to using sendmail(1) but can be customized
to use SMTP via the Net::SMTP manpage.
--
This space intentionally left blank
------------------------------
Date: 27 Sep 2001 12:05:15 -0700
From: redmist@users.sourceforge.net (redmist)
Subject: Re: Encrypt/Decrypt
Message-Id: <95f26b43.0109271105.67fa8ea6@posting.google.com>
I don't know what your requirements are, but Benjamin Trott's
excellent Crypt::OpenPGP might be useful.
red
justin@desertedge.com (J G) wrote in message news:<dd6675f4.0109261214.262c01b1@posting.google.com>...
> I need to be pointed to a simple tool that allows me to take simple
> text, such as a login and password, and encrypt it (to be stored in a
> database.) Then obviously, I'd like to Un-encrypt that information.
> Any advise on a a simple perl module for this?
>
> Note: I've been using Unix Crypt, but as you all know, this does not
> allow an un-encrypt.
------------------------------
Date: Thu, 27 Sep 2001 12:34:36 -0700
From: Sundial Services <info_NS1@sundialservices.com>
Subject: Re: Encrypt/Decrypt
Message-Id: <3BB37F4C.74B1@sundialservices.com>
The most common technique I've seen is to perform a one-way hash on the
password value (such as MD5), then store the hashed value or a portion
thereof. This creates a one-way encryption of the password that cannot
be decoded. (The value is often "salted" with the username so that, if
users select the same password, the encrypted value is not the same.)
There are very sound reasons why a password should be stored in
unencryptable form. It makes a stolen password-file essentially
useless.
Also, be aware that many Unix systems use the PAM (Pluggable
Authentication Module) system for authentication. If this is available,
you should use it. This allows you to present the user's credentials to
the system and to receive a yea-or-nay response back. It allows the
system administrators to implement a consistent authentication system,
throughout all PAM-compliant apps on the system (and the system itself).
redmist wrote:
>
> I don't know what your requirements are, but Benjamin Trott's
> excellent Crypt::OpenPGP might be useful.
>
> red
>
> justin@desertedge.com (J G) wrote in message news:<dd6675f4.0109261214.262c01b1@posting.google.com>...
> > I need to be pointed to a simple tool that allows me to take simple
> > text, such as a login and password, and encrypt it (to be stored in a
> > database.) Then obviously, I'd like to Un-encrypt that information.
> > Any advise on a a simple perl module for this?
> >
> > Note: I've been using Unix Crypt, but as you all know, this does not
> > allow an un-encrypt.
--
------------------------------------------------------------------
Sundial Services :: Scottsdale, AZ (USA)
mailto:info@sundialservices.com (PGP public key available.)
------------------------------
Date: Thu, 27 Sep 2001 19:44:34 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Encrypt/Decrypt
Message-Id: <ca07rt4jooh06e5npc4atocjqv87rpv18k@4ax.com>
J G wrote:
>I need to be pointed to a simple tool that allows me to take simple
>text, such as a login and password, and encrypt it (to be stored in a
>database.) Then obviously, I'd like to Un-encrypt that information.
No it's not that obvious. Most Unix and Apache password systems do not
try to decrypt the stored passwords. Instead, they encrypt what the user
supplies, and compare *that* to what is stored.
Oh, and perl's built-in crypt() might just do.
--
Bart.
------------------------------
Date: Thu, 27 Sep 2001 22:22:49 +0300
From: "eDeveloper" <webmaster@kwakeb.net>
Subject: Get the descriptions of the Newsgorups in (News::NNTPClient)
Message-Id: <9ovujj$n4$1@ns1.isu.net.sa>
Hi
I'm programming a script for newsgroups by module (News::NNTPClient)
Everything looks good, but I couldn't get the description of Newsgroups
How to get it ?
Regards,
eDeveloper
------------------------------
Date: Thu, 27 Sep 2001 14:43:15 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Get the descriptions of the Newsgorups in (News::NNTPClient)
Message-Id: <871ykso1ws.fsf@limey.hpcc.uh.edu>
>> On Thu, 27 Sep 2001 22:22:49 +0300,
>> "eDeveloper" <webmaster@kwakeb.net> said:
> Hi I'm programming a script for newsgroups by module
> (News::NNTPClient)
> Everything looks good, but I couldn't get the
> description of Newsgroups
$nntpclient->list('newsgroups')
hth
t
--
Yes way! Mmmmkay?
------------------------------
Date: Thu, 27 Sep 2001 21:39:52 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Help: mail script (WIN)
Message-Id: <3BB39B79.1B1E3748@rochester.rr.com>
bill wrote:
>
> In <3BB002BC.80F6B3D4@rochester.rr.com> Bob Walton <bwalton@rochester.rr.com> writes:
>
> >bill wrote:
> >> The mail must come from the "usual" SMTP server (i.e. the one used by
> >> the usual mail program when mail is sent from the machine in
> >> question).
> >...
> >> bill
>
> >Well, when it comes to SMTP servers, there really isn't a "usual" SMTP
> >server associated with a given machine.
>
> For example, I use Emacs's RMAIL for all my mail from Unix. I never
> specify an SMTP server, even when I install Emacs for the first time
> in a machine. Emacs somehow finds out what SMTP server to use when
> sending my mail, so I figured it must be able to get that information
> from the OS somehow.
>
> bill
With Unix and Unix-like OS's, an email system is generally built right
into the OS, typically called sendmail. Windoze has no such
counterpart, and, as an OS, knows nothing about email. Hence the
necessity for Windoze users to provide their own email programs and
servers, usually via SMTP. And also the necessity of any application
that wants to deal with email in a Windoze environment to have the user
supply the name of external servers, usually a POP-server for incoming
and an SMTP-server for outgoing email. So in Unix, one can use email as
a natural part of the OS; in Windoze, one cannot. Your OP asked about
email on Windoze.
--
Bob Walton
------------------------------
Date: Thu, 27 Sep 2001 13:59:32 -0400
From: Marc Ulrich <mdulrich@unity.ncsu.edu>
Subject: how do I know if Perl:TK is installed?
Message-Id: <3BB36904.2FFDA1D6@unity.ncsu.edu>
I'm writing a script which would like to test for the installation of
Perl/Tk. What is the best / appropriate way to do that?
I hope this isn't a FAQ I missed...
Marc
------------------------------
Date: Thu, 27 Sep 2001 13:57:18 -0500
From: Michael Carman <mjcarman@home.com>
Subject: Re: how do I know if Perl:TK is installed?
Message-Id: <3BB3768E.9DE3F40D@home.com>
Marc Ulrich wrote:
>
> I'm writing a script which would like to test for the installation
> of Perl/Tk. What is the best / appropriate way to do that?
If you just want to know:
perl -e "use Tk"
If perl doesn't complain about "Can't locate Tk.pm ..." then it's
installed.
If you want to test for this within a script (and recover gracefully if
it's not) you'll need to use an eval:
eval "use Tk";
if ($@) {
# Couldn't find Tk. Now what?
# ...
}
-mjc
------------------------------
Date: Thu, 27 Sep 2001 22:07:07 +0200
From: Thomas Bätzler <thomas@baetzler.de>
Subject: Re: How to know the script is already running or not???
Message-Id: <1117rt82gersqudc9r7tcqhngppb1d0s67@4ax.com>
On Fri, 28 Sep 2001, "Dennis" <hkdennis2k@yahoo.com.hk> wrote:
>Can I only let the script run one copy only?prevent two or more same script running???
Certainly. Stuff like lockfiles or semaphores should do the trick,
depending on your target platform and what you're trying to achive.
The low-tech solution would certainly be to use a lock file. See the
perlopentut doc page for details about opening and flock()ing files
correctly.
HTH,
--
use strict;my($i,$t,@r)=(0,'5 -.@BHJPT4acd6e2hk2lmn2o4r2s3tuz',map{ord}
split//,unpack('u*','L#`T&)QD5#0`#!!`#%1D)#08`#P05!!(3``$$"``#"0L&``('.
'"`P<!`````0$`'));$t=~s/(\d)(.)/$2x$1/eg;map{$t.=substr$t,$i,1,''while
$_--;$i++}@r;print"$t\n";# Thomas@Baetzler.de - http://baetzler.de/perl
------------------------------
Date: Thu, 27 Sep 2001 20:14:21 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: How to know the script is already running or not???
Message-Id: <xMLs7.723$Owe.327352832@news.frii.net>
In article <9ovn4l$b0v9@rain.i-cable.com>,
Dennis <hkdennis2k@yahoo.com.hk> wrote:
>Can I only let the script run one copy only?prevent two or more same
>script running???
>
Here is one way that works on unix.
my $pidfile = '/var/run/somename.pid';
if (-f $pidfile) {
unless (open(F, $pidfile)) {
die ("can't open pidfile $pidfile: $!");
}
my $pid = <F>;
close F;
chomp($pid);
if (kill(0, $pid)) {
die ("all ready running as pid $pid");
}
}
unless (open(F, ">$pidfile")) {
die ("can't open pidfile $pidfile: $!");
}
print F "$$\n";
close F;
--
This space intentionally left blank
------------------------------
Date: Thu, 27 Sep 2001 18:45:49 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: launching acrobat on Win32
Message-Id: <pts6rto4vft037pff1ilhpm4hhc4vseqr2@4ax.com>
Allan wrote:
>Here is where I am now:
>
> my $command = "cmd.exe /c start $helpFilename";
> my $result = system ($command);
>
>This works provided $helpFilename does not contain spaces. Anyone
>know how to escape/quote stuff so system and cmd are happy?
Put quotes around the filename.
my $command = "cmd.exe /c start \"$helpFilename\"";
--
Bart.
------------------------------
Date: 27 Sep 2001 18:14:25 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Managing Child Processes
Message-Id: <slrn9r6r1g.l6l.abigail@alexandra.xs4all.nl>
Kevin J. Schmidt (kschmidt@mindspring.com) wrote on MMCMXLVIII September
MCMXCIII in <URL:news:92541e99.0109261346.3f239018@posting.google.com>:
__ Ok, here is the basic program
__
__ 1: #!/usr/bin/perl
__ 2:
__ 3: $SIG{CHLD} = \&REAPER;
__ 4:
__ 5: sub REAPER {
__ 6: my $stiff;
__ 7: while ($stiff = waitpid(-1, &WNOHANG) > 0) {
Is this what you want? Do you want to assign the result of
waitpid(-1, &WNOHANG) > 0
to $stiff?
__ 8: #do something
__ 9: }
__ 10: $SIG{CHLD} = \&REAPER;
__ 11: }
Abigail
--
sub camel (^#87=i@J&&&#]u'^^s]#'#={123{#}7890t[0.9]9@+*`"'***}A&&&}n2o}00}t324i;
h[{e **###{r{+P={**{e^^^#'#i@{r'^=^{l+{#}H***i[0.9]&@a5`"':&^;&^,*&^$43##@@####;
c}^^^&&&k}&&&}#=e*****[]}'r####'`=437*{#};::'1[0.9]2@43`"'*#==[[.{{],,,1278@#@);
print+((($llama=prototype'camel')=~y|+{#}$=^*&[0-9]i@:;`"',.| |d)&&$llama."\n");
------------------------------
Date: Thu, 27 Sep 2001 18:30:14 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: maths
Message-Id: <3bb37036.5d07$16a@news.op.net>
In article <3bb31576$0$225$ed9e5944@reading.news.pipex.net>,
Chris <na@na> wrote:
>wow, what a friendly bunch you lot are.
>
>i have a script when i need a little help with and look at the abuse i get.
You got a prompt, polite, and correct answer, in the form of a
direction to the parts of the perl documentation that describe
solutions to your problem in detail.
If you'd get the chip off your shoulder, you might realize this.
Instead, you decided to insult the person who gave their time to help
you because you didn't feel that they had done enough for you.
>if you dont think i deserve help then dont help me,
You did get help. People are angry at you because you are behaving
like an ingrate.
Nobody is telling you that you can't ask for help; you did ask for
help you you received help. If you didn't find the help to be
helpful, you can post a followup question saying that you didn't
understand, or explaining the part of your problem that is not yet
solved. But your snide and sarcastic complaints are not going to get you
what you want. They will just make people angry with you.
This post is also intended to be helpful. I'm not telling you to shut
up. I'm not telling you that you can't post whatever you like. But I
am telling you that people here have perceived your behavior as
ungrateful and juvenile, and that will make it more difficult for you
to get more help in the future. You can continue to behave that way,
or you can accept my advice and act on it.
Take it any way you want.
--
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print
------------------------------
Date: Thu, 27 Sep 2001 18:47:08 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: maths
Message-Id: <50t6rt8gnd9bs20vqrpp09df77vrtdfv3n@4ax.com>
NEWS wrote:
>i have made a script when calculates a value from one standard input dived
>by another standard input times by another standard input etc etc.
>
>the scalar value im left is correct to aprrox 18 decimal places, how do i
>correct this to just two decimal places ?
??? How can 2 decimal places be more correct that 18 correct decimal
places?
--
Bart.
------------------------------
Date: Thu, 27 Sep 2001 13:36:37 -0500
From: Michael Carman <mjcarman@home.com>
Subject: Re: maths
Message-Id: <3BB371B5.481311C1@home.com>
Chris wrote:
>
> i know more about the internet than you to buddy.
Entirely possible, but pure speculation. We have no measure of either
your or Thomas' knowledge of the Internet.
> but im not going to harp on about all the internet things i know
In other words, you're not going to provide anything which might back up
your unsubstantiated claim. I hope you'll understand if we doubt you.
At any rate, your knowledge of the Internet is irrelevant at the moment.
You came here seeking advice about using Perl -- an area where Thomas is
presumably more knowledgeable. Your criticism of him is like going to
your doctor with chest pains only to tell him that he's an idiot because
you know more about fixing carburetors.
> i dont even care whether you use capital letters.
That's okay, Uri doesn't seem to know where his shift key is either.
> thank you all for you help with my perl questions.
I realize that this is sarcastic, but you should be thankful. Nobody is
under any obligation to answer any of your questions. Thomas did answer
yours; correctly and concisely.
> -q -f flags dont work with perldoc (for me).
Then something is wrong with your installation and you should fix it.
-mjc
------------------------------
Date: Thu, 27 Sep 2001 21:08:39 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: maths
Message-Id: <x7ite49w99.fsf@home.sysarch.com>
>>>>> "MC" == Michael Carman <mjcarman@home.com> writes:
MC> That's okay, Uri doesn't seem to know where his shift key is either.
I DO KNOW WHERE IT IS. i just don't like to use it much for email and
usenet. my web pages and docs are properly capitalized.
>> thank you all for you help with my perl questions.
and this twit has such a grasp of the internet and such a lousy grasp of
english. and there is no indication that it is not his primary language.
>> -q -f flags dont work with perldoc (for me).
MC> Then something is wrong with your installation and you should fix it.
me thinks, he needs the fixing more than his installation.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Search or Offer Perl Jobs -------------------------- http://jobs.perl.org
------------------------------
Date: Thu, 27 Sep 2001 18:15:03 GMT
From: "P. Thompson" <thompson-nospam@new.rr.com>
Subject: Re: Mission Statement for this newsgroup?
Message-Id: <Pine.LNX.4.33.0109271314550.17578-100000@malacandra.localnet>
http://umweb1.unitedmedia.com/comics/dilbert/career/bin/ms2.cgi
On Thu, 27 Sep 2001, Mr. Sunblade wrote:
> Is there one? I searched google for a bit, but didn't find one.
>
> Just curious.
>
> Regards,
>
> Mr. Sunblade
>
>
>
--
Leave the nospam in, correct email address
------------------------------
Date: 27 Sep 2001 12:02:57 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Mission Statement for this newsgroup?
Message-Id: <m11ykssbha.fsf@halfdome.holdit.com>
>>>>> "P" == P Thompson <thompson-nospam@new.rr.com> writes:
P> http://umweb1.unitedmedia.com/comics/dilbert/career/bin/ms2.cgi
and reload each day. :)
--
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: 27 Sep 2001 18:42:52 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Not sure what type of cgi script I need!
Message-Id: <slrn9r6smr.l6l.abigail@alexandra.xs4all.nl>
Snipes (pilotsnipes@yahoo.com) wrote on MMCMXLVII September MCMXCIII in
<URL:news:ae7dfa3b.0109251327.19e776@posting.google.com>:
\\ Would anyone be kind enough to recommend a script for me to run on a
\\ web server at work? Every Friday an e-mail with 6 attachments are
\\ delivered to my e-mail account, they are small, simple .html files
\\ which contain the next weeks roster information for 6 different groups
\\ of people.
\\
\\ I then upload them to the webserver and make them available to anyone
\\ who wants to log on and download the particular file (ie, their
\\ roster) that they are interested in. Very few people if any, are
\\ interested in getting all 6.
\\
\\ I would like to be able to have a "mailing list" or something similar,
\\ that the users can subscribe to which allows them to select which of
\\ the 6 files they want to receive to their own e-mail. When the e-mail
\\ arrives on Friday to my account, I would like the server to run a
\\ script/program that takes each attachment and "forwards" or
\\ "auto-responds" it to the people who are looking for it.
Two things.
1) I fail to see why you need a CGI program to do this stuff. It's
not impossible, but it sounds as useful as using the Queen Elizabeth II
to travel from Pittsburg to Chicago.
2) What's got this to do with Perl? So far, you've done zero coding,
and apparently, you need handholding all the way. Perhaps you want
comp.programs.gimme.gimme.gimme.
Abigail
--
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'
# Three nesting kingfishers.
# Swordmaster Mushashi beside
# a pond. Eshun.
------------------------------
Date: Thu, 27 Sep 2001 14:20:10 -0400
From: "Brady Doll" <gte574u@prism.gatech.edu>
Subject: Re: Parsing a string
Message-Id: <9ovqk0$8lf$1@news-int.gatech.edu>
Thank you that helped me do what I wanted.
"Andrew Cady" <please@no.spam> wrote in message
news:87k7yk4qxu.fsf@homer.cghm...
> "Rob - Rock13.com" <rob_13@excite.com> writes:
>
> > Brady Doll <news:9oub86$hhs$1@news-int.gatech.edu>:
> >
> > > I am attempting to parse a string which has an attribute followed
> > > by a value... Attribute="value"
> > >
> > > this was the code i was attempting to use, however the (.*) causes
> > > it to freeze.
> > >
> > > m/(?:\s*)([\w])(?:\=)(?:[\'\"])(.*)(?:[\'\"])/;
>
> Some problems in your (OP's) use of regexes:
>
> (?:\s*) <-- entirely unnecessary to specify precedence with
> parentheses here, the default precedence is what you want. Use \s*
>
> ([\w]) <-- you don't need a character class with just one character,
> even a special character like \w that matches multiple characters.
> Just use (\w). This matches only a single character, though, you
> really want (\w+).
>
> (?:[\'\"]) <-- ' and " don't need to be escaped in a character class,
> and again the parentheses are unnecessary. Just use ['"].
>
> (?:\=) <-- = doesn't need to be escaped, doesn't need parens. Just
> use =.
>
> (.*) <-- * is greedy, so this will match to the end of the line, even
> if the line ends with a ' or ". Either use (.*?)['"] or use
> ([^'"]*)['"]. The former is more correct and the latter faster. Or,
> use alternation as in the first regex I have listed below.
>
> (?:[\'\") <-- see my previous comment on this construct.
>
> Your exact same regex, with the unnecessary punctuation removed, would
> be:
>
> m/\s*(\w)=['"](.*)['"]/; # doesn't work
>
> Change that to:
>
> m/\s*(\w+)=['"](.*?)['"]/; # does work
>
> ...by adding just two characters, and it will work (if there are no
> quotes in value). The main problem was the \w instead of \w+. It
> only worked when Attribute was one character long. Also see my regex
> below, which will handle quotes in the value a little bit better.
>
> > > What should be put in place of the (.*)...is there anything or am
> > > I just going to have to result to a different method to parse this
> > > string then using a reg. ex.?
> >
> > My first thought would be, perhaps? m/(.*)=['|"]([^"]+)['|"]/;
>
> You don't use | to mean "or" in a character class like you do outside
> one; or is implied, you just list the characters. Also your regex
> would match the closing single-quote in the field and wouldn't handle
> an empty field (and the first greedy .* would cause performance
> problems and would match a second = in the line). Something like this
> would be a little better:
>
> m/^\s*([^=]*)=(?:'([^']*)'|"([^"]*)")/; ($attr,$val) = ($1, $2||$3);
>
> ...which will handle attr="don't" or attr='10" pianist', but still
> can't handle escaped quotes. That'd be a little more effort (but
> still not really hard).
------------------------------
Date: 27 Sep 2001 17:35:04 -0400
From: Cynthia Burns <burns_cindy@hotmail.com>
Subject: procmail-like task in Perl?
Message-Id: <9p0628$po6$1@panix3.panix.com>
How can I write a Perl script that periodically
checks a mail server, scans the messages, and
removes (possibly after resending to a different
address) those that match certain criteria? Is
there a Perl module that facilitates this task?
This is functionality similar to procmail, but
I want to write my own script to do it. It
should be able to provide authentication info
to the mail server.
Thanks,
Cynthia
------------------------------
Date: Thu, 27 Sep 2001 18:45:01 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Security of letting user specify regex in CGI script?
Message-Id: <ups6rt00uboll25qbv6bi3pa8cmtf8ta43@4ax.com>
Jay McGavren wrote:
>> $query = eval "sub { /\ba\b/ and (/\bb\b/ or /\bc\b/ }";
>
>True, but letting the user specify any portion of an eval gives me the
>jitters.
You don't. You extract bare words from his string, and build this code
from it. There are no unsafe barewords.
eval 'sub{ /\bexit\b/ }';
Nothing usafe about that.
--
Bart.
------------------------------
Date: Thu, 27 Sep 2001 17:06:18 GMT
From: . <nospam@newsranger.com>
Subject: test
Message-Id: <e0Js7.7325$ev2.12502@www.newsranger.com>
------------------------------
Date: Thu, 27 Sep 2001 18:37:08 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: testing the "flatness" of a structured file
Message-Id: <3bb371d4.5d5c$36a@news.op.net>
In article <qdf8zf0pwoz.fsf@www.ibexnet.de>,
Walter Hafner <hafner@augusta.de> wrote:
>I'm sure there is a simple solution - i just can't see it.
It seems to me that any file with nested BEGIN..END constructions must
have two BEGINs in a row. So perhaps something like this:
> # slurp input. Files are small enough (< 50 KB)
> open IN, "<testfile" or die $!;
> my $file = join "", <IN>;
> close IN;
> my @chunks = ($file =~ /\[BEGIN.*?\].*?\[END.*?\]/sg);
for my $chunk (@chunks) {
if ($chunk =~ /\[BEGIN(.*?)\].*\[BEGIN(.*?)\]/) {
die "Nested begin blocks! (BEGIN $2 follows BEGIN $1)\n";
}
}
A chunk should never contain a BEGIN construction itself; if it does,
we abort the program with an error message.
>I just don't see it! ARGH! I feel SO stupid!
I hope this is helpful.
--
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print
------------------------------
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.
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 V10 Issue 1833
***************************************