[29386] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 630 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jul 7 09:09:48 2007

Date: Sat, 7 Jul 2007 06:09:06 -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           Sat, 7 Jul 2007     Volume: 11 Number: 630

Today's topics:
        Certfication in AWK or SHell programming  ehabaziz2001@gmail.com
    Re: Certfication in AWK or SHell programming <ts@dionic.net>
    Re: DBIx::Simple variable interpolation problem <justin.0707@purestblue.com>
    Re: In windows, start default app associated with file  <stoupa@practisoft.cz>
    Re: In windows, start default app associated with file  <rvtol+news@isolution.nl>
    Re: In windows, start default app associated with file  <lambik@kieffer.nl>
    Re: Iterating over a hash <jurgenex@hotmail.com>
        new CPAN modules on Sat Jul  7 2007 (Randal Schwartz)
    Re: re-lurking <bik.mido@tiscalinet.it>
    Re: re-lurking <rvtol+news@isolution.nl>
    Re: re-lurking <bik.mido@tiscalinet.it>
    Re: retrieving news messages <bik.mido@tiscalinet.it>
    Re: retrieving news messages <wyzelli@yahoo.com>
    Re: retrieving news messages <bik.mido@tiscalinet.it>
    Re: validating a group of variables <xicheng@gmail.com>
    Re: validating a group of variables <jurgenex@hotmail.com>
    Re: validating a group of variables <noreply@gunnar.cc>
    Re: validating a group of variables <stoupa@practisoft.cz>
    Re: validating a group of variables <bik.mido@tiscalinet.it>
    Re: validating a group of variables <paduille.4061.mumia.w+nospam@earthlink.net>
    Re: validating a group of variables <paduille.4061.mumia.w+nospam@earthlink.net>
    Re: validating a group of variables <rvtol+news@isolution.nl>
    Re: validating a group of variables <paduille.4061.mumia.w+nospam@earthlink.net>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Sat, 07 Jul 2007 05:01:54 -0700
From:  ehabaziz2001@gmail.com
Subject: Certfication in AWK or SHell programming
Message-Id: <1183809714.801056.80550@k79g2000hse.googlegroups.com>

Hello,
can I have any kind of certfifcation in Awk and SED and if the answer
is NO What is the nearest certfication to SED,AWK and even any
certfifcation to shell programming?
Thanks



------------------------------

Date: Sat, 07 Jul 2007 13:23:27 +0100
From: Tim Southerwood <ts@dionic.net>
Subject: Re: Certfication in AWK or SHell programming
Message-Id: <468f85d5$0$645$5a6aecb4@news.aaisp.net.uk>

 ehabaziz2001@gmail.com coughed up some electrons that declared:

> Hello,
> can I have any kind of certfifcation in Awk and SED and if the answer
> is NO What is the nearest certfication to SED,AWK and even any
> certfifcation to shell programming?
> Thanks

Why would you want to? Noone cares about certification in use of basic
tools, especially after the MS sausage factory got a reputation for
churning out worthless MSCE's, half of whom shouldn't be left alone with a
hoover, let alone a production system.

Read some books, try some things and then talk knowledgeably about it to
future employers - that's all they want. And please drop c.l.p.m off the
reply unless you really have a perl query.

Cheers

Tim


------------------------------

Date: Sat, 07 Jul 2007 10:38:14 -0000
From: Justin C <justin.0707@purestblue.com>
Subject: Re: DBIx::Simple variable interpolation problem
Message-Id: <slrnf8ur97.pvs.justin.0707@satori.local>

In article <1183728033.340188.296130@n2g2000hse.googlegroups.com>, Paul Lalli wrote:
> On Jul 6, 6:29 am, Justin C <justin.0...@purestblue.com> wrote:
>> Yes, it's me again with more of the same... Maybe I should just say
>> "Thank you Paul" now?
> 
> I'm tickled that you have that much faith in my powers of debugging,
> but please don't discount the wealth of other people in this newsgroup
> who can help you.

On the last few posts I've made it's been you who's replied first, and
with a reply that has enabled me to progress. I don't discount others
here, I'm a long time reader of this group - but I'm a long way from
being a contributor - and I've seen the knowledge and experience here is
quite amazing.

[snip]
>> my $query = $dataSource->query('SELECT key FROM prospect WHERE ? ~* ?', $field, $sc) ;
> 
> http://search.cpan.org/~timb/DBI-1.58/DBI.pm#Placeholders_and_Bind_Values
> 
> (I realize you're using DBIx::Simple, but that's just a wrapper around
> DBI itself).
> 
> You can't use place holders for column names.  Place holders are used
> for values only.

Ah. I see.

>> I realise you've not got the data to check this, but a
>> full working code snippet is below
> 
> EXCELLENT!

I've learnt that much from reading this newsgroup :)
> 
>> ('working' meaning that should I
>> change the first ? to a field name then I get results). Anyway, here's
>> the code I have:
>>
>> #!/usr/bin/perl
>>
>> use warnings ;
>> use strict ;
>> use DBIx::Simple ;
>>
>> my ($dataSource, @results) ;
>> sub db_connect {
>>     my ( $user, $password) = ("justin", "grobble") ;
>>     $dataSource = DBIx::Simple->connect(
>>         'dbi:Pg:database=prospects', $user, $password,
>>         { RaiseError => 1 , AutoCommit => 1 }
>>     ) or die DBI::Simple->error ;
>>
>> }
>>
>> while (@ARGV) {
>>     my $sc = pop @ARGV ;        #       Search criteria
>>     my @dbFields = qw/contact co_name ad1 ad2 ad3 town county p_code country tel1 tel2/ ;
>>     foreach my $field (@dbFields) {
>>         db_connect();
> 
> URG.  Why are you connecting to the database multiple times?  Very
> very wasteful.  Connect once, then run your queries multiple times.

I did have the connect statement before the subroutine that is the above
code. The connect got moved into the subroutine as part of my 'testing',
forgot to move it back up, and before the loop.
> 
>>         my $query = $dataSource->query('SELECT key FROM prospect WHERE ? ~* ?', $field, $sc) ;
> 
> Like I said, you can't use placeholders for column names.  Just put
> the columnname directly into your SQL:
> my $query = $dataSource->query("SELECT key FROM prospect WHERE $field
>= ?", $sc);

Oooh, no placeholders, but vars/$scalars are OK? That's good news... I see you've changed the quote from singles to doubles, vars not being interpreted inside singles - I suppose my not having read DBI.pm docs (or possibly my being green) I didn't think of that... I did wonder about putting the var inside the quotes but realised it wouldn't work because they were single, not double... never occurred to me that I might be able to use doubles! [duh!]
> 
> 
>> Any suggestions why a field name as a variable makes this not work?
> 
> Read the URL I pasted above.  The db interface needs to know the
> actual syntax of the SQL statement before it can be prepared.  The
> column name is needed to validate the SQL.

I will, and I knew there had to be a way of not writing the SQL statement a whole bunch of times.

Thank you for your help with this.

As a side note, I'm really happy with the way my Perl is improving, the tasks aren't getting any easier, but I think that's because each project I take on is more complex. Where once I couldn't see a way of achieving something and therefore didn't attempt it, I am finding that with each project I finish others are presenting themselves, often things I'd never though of. I just wish work afforded more time to spend coding than it does. My job is managing a wholesale company with a staff of thirteen, I can do it in my sleep, I'm fortunate in that we have a very good team at the moment, but there are a lot of other tasks and projects that mean I only get to sit and look at automation (like the above) a couple of afternoons a week. I know I could pay someone else to do it, but I'm not going to give away the one part of my job I really enjoy.

	Justin.

-- 
Justin C, by the sea.


------------------------------

Date: Sat, 7 Jul 2007 07:29:58 +0200
From: "Petr Vileta" <stoupa@practisoft.cz>
Subject: Re: In windows, start default app associated with file type
Message-Id: <f6n8dr$6q1$3@ns.felk.cvut.cz>

Lambik wrote:
> "Philipp" <sicsicsic@freesurf.ch> wrote in message
> news:1183712192_504@sicinfo3.epfl.ch...
>> Hello
>>  From my perl script on windows I want to start the default viewer
>> for pdf files.
>> Is there an easy way of doing programatically what the OS does when
>> you double-click on file with a certain type?
>> ie.
>> 1) get file type
>> 2) find associated app
>> 3) start app with file as argument
>>
> exec "rundll32.exe url.dll, FileProtocolHandler my.pdf "
Can you explain me what is the "FileProtocolHandler" ? Please wrote 2 
examples for my.pdf on web and on local disk.
-- 

Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail. Send me your mail 
from another non-spammer site please.)





------------------------------

Date: Sat, 7 Jul 2007 12:28:00 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: In windows, start default app associated with file type
Message-Id: <f6o13u.1f8.1@news.isolution.nl>

Petr Vileta schreef:
> Lambik:

>> exec "rundll32.exe url.dll, FileProtocolHandler my.pdf "
>
> Can you explain me what is the "FileProtocolHandler" ? 
> Please wrote 2
> examples for my.pdf on web and on local disk.

Hey! Use Google, or msdn: 
http://search.msdn.microsoft.com/search/?query=FileProtocolHandler 

-- 
Affijn, Ruud

"Gewoon is een tijger."


------------------------------

Date: Sat, 7 Jul 2007 14:58:09 +0200
From: "Lambik" <lambik@kieffer.nl>
Subject: Re: In windows, start default app associated with file type
Message-Id: <468f8d93$0$37722$5fc3050@dreader2.news.tiscali.nl>

"Petr Vileta" <stoupa@practisoft.cz> wrote in message
news:f6n8dr$6q1$3@ns.felk.cvut.cz...
> Lambik wrote:
> > "Philipp" <sicsicsic@freesurf.ch> wrote in message
> > news:1183712192_504@sicinfo3.epfl.ch...
> >> Hello
> >>  From my perl script on windows I want to start the default viewer
> >> for pdf files.
> >> Is there an easy way of doing programatically what the OS does when
> >> you double-click on file with a certain type?
> >> ie.
> >> 1) get file type
> >> 2) find associated app
> >> 3) start app with file as argument
> >>
> > exec "rundll32.exe url.dll, FileProtocolHandler my.pdf "
> Can you explain me what is the "FileProtocolHandler" ? Please wrote 2
> examples for my.pdf on web and on local disk.
> -- 
>
> Petr Vileta, Czech republic
> (My server rejects all messages from Yahoo and Hotmail. Send me your mail
> from another non-spammer site please.)


You're kidding, right? Have you even tried? my.pdf is a local file. exec
"rundll32.exe url.dll, FileProtocolHandler
http://tiger.la.asu.edu/Quick_Ref/perl_quickref.pdf" opens from the web.
Sounds logical right?




------------------------------

Date: Sat, 07 Jul 2007 01:33:12 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Iterating over a hash
Message-Id: <s3Cji.1033$t05.609@trndny09>

Tad McClellan wrote:
> limitz <steamaccount2@gmail.com> wrote:
>> $length = $end-$beginning+1;
>                           ^^
>> for my $i (0 .. $length-1) {
>                         ^^
> What is the point of adding one followed by subtracting one?

In this particular case it actually makes sense. Otherwise the variable 
would have to be called "LastIndex" or "LengthMinusOne" or something like 
that.
While technically you are right from a documentation and readability point 
of view using $length and subtracting 1 when needed seems to be preferable.

jue 




------------------------------

Date: Sat, 7 Jul 2007 04:42:16 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Sat Jul  7 2007
Message-Id: <JKsL2G.Eox@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.

AppConfig-1.66
http://search.cpan.org/~abw/AppConfig-1.66/
Perl5 module for reading configuration files and parsing command line arguments. 
----
Audio-M4P-0.37
http://search.cpan.org/~billh/Audio-M4P-0.37/
Perl QuickTime / MP4 / iTunes Music Store audio / video file tools 
----
Bio-DOOP-DOOP-0.27
http://search.cpan.org/~tibi/Bio-DOOP-DOOP-0.27/
DOOP API main module 
----
Bundle-MasteringPerl-20070706
http://search.cpan.org/~bdfoy/Bundle-MasteringPerl-20070706/
All modules mentioned in Mastering Perl 
----
Business-PhoneBill-Allopass-1.08
http://search.cpan.org/~bpgn/Business-PhoneBill-Allopass-1.08/
A class for micro-payment system from Allopass 
----
Business-Tax-VAT-Validation-0.14
http://search.cpan.org/~bpgn/Business-Tax-VAT-Validation-0.14/
A class for european VAT numbers validation. 
----
Business-Tax-VAT-Validation-0.15
http://search.cpan.org/~bpgn/Business-Tax-VAT-Validation-0.15/
A class for european VAT numbers validation. 
----
CGI-Application-Dispatch-Server-0.50
http://search.cpan.org/~markstos/CGI-Application-Dispatch-Server-0.50/
A simple HTTP server for developing with CGI::Application::Dispatch 
----
CGI-Application-Dispatch-Server-0.51
http://search.cpan.org/~markstos/CGI-Application-Dispatch-Server-0.51/
A simple HTTP server for developing with CGI::Application::Dispatch 
----
CGI-Install-0.04
http://search.cpan.org/~adamk/CGI-Install-0.04/
Installer for CGI applications 
----
Carp-REPL-0.01
http://search.cpan.org/~sartak/Carp-REPL-0.01/
read-eval-print-loop on die 
----
Carp-REPL-0.02
http://search.cpan.org/~sartak/Carp-REPL-0.02/
read-eval-print-loop on die 
----
Carp-REPL-0.03
http://search.cpan.org/~sartak/Carp-REPL-0.03/
read-eval-print-loop on die 
----
Carp-REPL-0.04
http://search.cpan.org/~sartak/Carp-REPL-0.04/
read-eval-print-loop on die 
----
Convert-Age-0.01
http://search.cpan.org/~cfedde/Convert-Age-0.01/
convert integer seconds into a "compact" form and back. 
----
DBD-ODBC-1.14_1
http://search.cpan.org/~mjevans/DBD-ODBC-1.14_1/
ODBC Driver for DBI 
----
Google-Adwords-v1.3.0
http://search.cpan.org/~rohan/Google-Adwords-v1.3.0/
an interface which abstracts the Google Adwords SOAP API 
----
HTML-Feature-1.0.5
http://search.cpan.org/~miki/HTML-Feature-1.0.5/
an extractor of feature sentence from HTML 
----
IO-CSVHeaderFile-0.04
http://search.cpan.org/~vasek/IO-CSVHeaderFile-0.04/
Perl extension for CSV Files 
----
IO-Socket-SIPC-0.05
http://search.cpan.org/~bloonix/IO-Socket-SIPC-0.05/
Serialize perl structures for inter process communication. 
----
IO-Socket-SIPC-0.06
http://search.cpan.org/~bloonix/IO-Socket-SIPC-0.06/
Serialize perl structures for inter process communication. 
----
Incunabulum-0.01
http://search.cpan.org/~apeiron/Incunabulum-0.01/
Extensible, plugin-based weblogging framework 
----
Mail-SpamCannibal-0.80
http://search.cpan.org/~miker/Mail-SpamCannibal-0.80/
A tool to stop SPAM 
----
Net-SSH-Expect-0.07
http://search.cpan.org/~bnegrao/Net-SSH-Expect-0.07/
SSH wrapper to execute remote commands 
----
OpenGL-Image-1.00
http://search.cpan.org/~bfree/OpenGL-Image-1.00/
copyright 2007 Graphcomp - ALL RIGHTS RESERVED Author: Bob "grafman" Free - grafman@graphcomp.com 
----
PMIR-0.01
http://search.cpan.org/~ingy/PMIR-0.01/
Personally Man, I'd Relax 
----
SQL-Interp-1.00
http://search.cpan.org/~markstos/SQL-Interp-1.00/
Interpolate Perl variables into SQL statements 
----
STAFService-0.02
http://search.cpan.org/~semuelf/STAFService-0.02/
Perl extension for writing STAF Services easily. 
----
Test-Config-System-0.31
http://search.cpan.org/~iank/Test-Config-System-0.31/
System configuration related unit tests 
----
Test-Config-System-0.32
http://search.cpan.org/~iank/Test-Config-System-0.32/
System configuration related unit tests 
----
Text-Microformat-0.03
http://search.cpan.org/~kgrennan/Text-Microformat-0.03/
A Microformat parser 
----
Text-Microformat-0.04
http://search.cpan.org/~kgrennan/Text-Microformat-0.04/
A Microformat parser 
----
Text-Report-1.003
http://search.cpan.org/~davidius/Text-Report-1.003/
Perl extension for generating mixed columnar formatted reports and report templates 
----
Text-Stripper-1.16
http://search.cpan.org/~bera/Text-Stripper-1.16/
a module for shortening text 
----
WWW-Bugzilla3-0.3
http://search.cpan.org/~swined/WWW-Bugzilla3-0.3/
perl bindings for Bugzilla 3.0 api 
----
WWW-Myspace-0.68
http://search.cpan.org/~grantg/WWW-Myspace-0.68/
Access MySpace.com profile information from Perl 
----
Workflow-0.28
http://search.cpan.org/~jonasbn/Workflow-0.28/
Simple, flexible system to implement workflows 
----
XML-XPathScript-1.52
http://search.cpan.org/~yanick/XML-XPathScript-1.52/
a Perl framework for XML stylesheets 
----
base-2.12
http://search.cpan.org/~rgarcia/base-2.12/
Establish an ISA relationship with base classes at compile time 
----
fwlog-1.3
http://search.cpan.org/~edb/fwlog-1.3/
extract connection data from firewall logs 


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: Sat, 07 Jul 2007 11:33:48 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: re-lurking
Message-Id: <njju831jefc4341cmdfhed7aonp0vo1mpi@4ax.com>

On Fri, 6 Jul 2007 20:46:56 -0400, "Wade Ward" <invalid@invalid.nyet>
wrote:

>I have tried to get perl scripts to work for me and failed at it enough to 
>consider the endeavor a failure.  I appreciated very much forum help as I 

Oh, C'mon! It's nice that you have this careful approach at this ng,
with lurking and all (as opposed to the arrogant plz-spoon-feed-me
newbies) but don't put it that high on the melodrama scale! Just
follow one of the following scenarios (or both):

SCENARIO 1:

Take your learning book and make your way through the examples and the
exercises. When you're stuck, search the docs, the faq, and possibly
this group's past archives. If you can't find anything, included where
to look in the docs, *please* ask here.

SCENARIO 2:

Despite Uri's comment, I *don't* think that downloading articles from
Usenet would qualify as the first baby step after hello world. But it
is feasible. Of course you should use a suitable module, like
Net::NNTP, which you've been pointed to. Then you should read the
module's documentation over and over again till you understand every
single bit of syntax and semantics for the each given "element" of it.
If you can't, then again, ask. Start with incremental steps. E.g.
print the server's time stamp, then a list of available articles
before attempting to download them, and so on. Of course if you really
are only beyond hello world, there are a lot of things you're deemed
not to understand: e.g. some methods return *arrayrefs*. Then you'll
need to read about *references* either in your book or in

  perldoc perlref

But seriously, this task is more complicated than one may naively
expect. I got intrigued myself and tried the beast, it turned our that
the command corresponding to the newnews method was not supported at
either of the news servers I have access to. (One requires
authentication, the other doesn't.) I had to modify the code heavily
and handwrite the code to only get the nodes from some date on: I also
parsed the headers myself, while probably several NNTP headers parsing
module exists - but I couldn't find one. In the end what I got is:


  #!/usr/bin/perl
  
  use strict;
  use warnings;
  use Net::NNTP;
  use Date::Parse;
  
  my $nsrv='news.tiscali.it';
  my $grp='comp.lang.perl.misc';
  
  my $nntp=Net::NNTP->new($nsrv) or die "Can't login to `$nsrv'$!\n";
  my (undef, $first, $last, undef)=$nntp->group($grp)
    or die "Can't access $grp\n";
  
  my ($since, @arts)=time-24*60*60;
  ART: for my $art (reverse $first..$last) {
      for ( @{$nntp->head($art)} ) {
          chomp;
          next unless s/^NNTP-Posting-Date: //;
          defined(my $time=str2time $_)
            or warn "Couldn't parse date for article $art ($_)\n"
            and next ART;
          last ART if $time < $since;
          unshift @arts, $art;
          last;
      }
  }
  
  $nntp->article($_,\*STDOUT) for @arts;
    
  __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: Sat, 7 Jul 2007 12:50:01 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: re-lurking
Message-Id: <f6o29i.1gk.1@news.isolution.nl>

Michele Dondi schreef:

> it turned our that
> the command corresponding to the newnews method was not supported at
> either of the news servers I have access to.

That was actually one of the reasons why I mentioned:
  http://www.xs4all.nl/~rvtol/perl/xover_clpm.pl 
:)

-- 
Affijn, Ruud

"Gewoon is een tijger."


------------------------------

Date: Sat, 07 Jul 2007 13:32:54 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: re-lurking
Message-Id: <49uu83l2e6nmir6j2s7vjibr1u31m0nnbq@4ax.com>

On Sat, 7 Jul 2007 12:50:01 +0200, "Dr.Ruud" <rvtol+news@isolution.nl>
wrote:

>That was actually one of the reasons why I mentioned:
>  http://www.xs4all.nl/~rvtol/perl/xover_clpm.pl 
>:)

Yeah, at a first glance I see I renivented a wHEEl. But it was fun.
Anyway, one would probably better hold a list of already downloaded
files, or perhaps just use a .newsrc, since that's what its for, and
in that case I see there's a module like News::Newsrc which should
ease the whole thing: it's not updated since 2001, but for a thing
like that it shouldn't make a difference.


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: Sat, 07 Jul 2007 08:51:16 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: retrieving news messages
Message-Id: <5pdu839fptjcrc8171utccfbtrmbf4ms12@4ax.com>

On Fri, 06 Jul 2007 21:03:41 -0400, Sherm Pendley
<spamtrap@dot-app.org> wrote:

>>>web pages from "templates". (As a very beginner I invented my own
>>>will, and my requirements were very simple.) And then managing files
>>
>> Wheel. Apologies.
>
>Getting your last wishes on record is a good thing - no need to apologize
>for having written a will. :-)

Given that I actually have cancer... I'M TOUCHING MY NUTS! (I don't
know how common it is outside of Italy - but it is a common
"superstition" or better a ritual gesture, against adverse fate.)


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: Sat, 07 Jul 2007 08:56:28 GMT
From: "Peter Wyzl" <wyzelli@yahoo.com>
Subject: Re: retrieving news messages
Message-Id: <0zIji.4252$4A1.554@news-server.bigpond.net.au>

"Michele Dondi" <bik.mido@tiscalinet.it> wrote in message 
news:5pdu839fptjcrc8171utccfbtrmbf4ms12@4ax.com...
> On Fri, 06 Jul 2007 21:03:41 -0400, Sherm Pendley
> <spamtrap@dot-app.org> wrote:
>
>>>>web pages from "templates". (As a very beginner I invented my own
>>>>will, and my requirements were very simple.) And then managing files
>>>
>>> Wheel. Apologies.
>>
>>Getting your last wishes on record is a good thing - no need to apologize
>>for having written a will. :-)
>
> Given that I actually have cancer... I'M TOUCHING MY NUTS! (I don't
> know how common it is outside of Italy - but it is a common
> "superstition" or better a ritual gesture, against adverse fate.)

So long as it is you who do the touching... <grin>

P 



------------------------------

Date: Sat, 07 Jul 2007 12:05:37 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: retrieving news messages
Message-Id: <o6pu83lji2r6d94fskbcgmddtn4bhe9e57@4ax.com>

On Sat, 07 Jul 2007 08:56:28 GMT, "Peter Wyzl" <wyzelli@yahoo.com>
wrote:

>> Given that I actually have cancer... I'M TOUCHING MY NUTS! (I don't
>> know how common it is outside of Italy - but it is a common
>> "superstition" or better a ritual gesture, against adverse fate.)
>
>So long as it is you who do the touching... <grin>

Yeah, it doesn't work by other people's intervention. Strictly
personal! In fact:

: Opinions, it is well known, are like nuts... Everyone has his own.
: - Giorgio Gaber

(translated by me - BTW: <http://en.wikipedia.org/wiki/Giorgio_Gaber>)


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: Sat, 07 Jul 2007 01:09:59 -0000
From:  Xicheng Jia <xicheng@gmail.com>
Subject: Re: validating a group of variables
Message-Id: <1183770599.234778.181450@q75g2000hsh.googlegroups.com>

On Jul 6, 7:13 pm, "Robert Valcourt"
<webmas...@know.spam.customfitonline.com> wrote:
> Hello,
>
> We have been suffering much lately from users abusing our Website forms with
> Spam. I have evaluated most of the spam submissions and im trying to modify
> my custom form-to-email perl processor to check for common spam submission
> and reject them. While this is not hard, im trying to streamline the scripts
> efficiency. Below is an example:
>
> #!/usr/bin/perl
>
> use lib '/usr/local/psa/home/vhosts/mybizdomain.com/cgi-bin/lib/';
> use CGI qw(:standard);
> use CGI::Carp qw(fatalsToBrowser);
> use Mail::Sendmail;
> use strict;
>
> my $fullname = param('fullname');
> my $emailaddy = param('emailaddy');
> my $phone = param('phone');
> my $company = param('company');
> my $website = param('website');
> my $completion = param('completion');
>
> spamattempt() if $fullname =~ /viagra/i;
> spamattempt() if $emailaddy =~ /viagra/i;
> spamattempt() if $phone =~ /viagra/i;
> spamattempt() if $fullname =~ /\@/;
>
> The real script is much longer but you get the idea. Its checking each
> defined variable for a spam match and then performing the spamattempt
> subroutine if matched. I would like to know if there is a way to check ALL
> variables against a single match. See example (not real perl cod):
>
> spamattempt() if $ANYVARIBALE =~ /viagra/i;
>
> I know I could assign all variables into an array and then cycle them trough
> a foreach but im not sure that would be any more efficient.
>
> I think the best way to do this would be to have the script check all
> submitted queries before they are assigned to variables. By this is mean
> before I start assigning param('fullname') to $fullname, there would be a
> way to check any and all params submitted before assignment. I have a hunch
> this can be done but I wouldn't know where to start.
>
> Or maybe i'm approaching this wrong completely, and in that case I would
> love to hear your thoughts.

Maybe you can just check $ENV{'QUERY_STRING'}, like

    spamattempt() if $ENV{'QUERY_STRING'} =~ /=viagra(?:&|$)/i;

(untested)
Regards,
Xicheng



------------------------------

Date: Sat, 07 Jul 2007 01:40:48 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: validating a group of variables
Message-Id: <AaCji.1034$t05.961@trndny09>

Robert Valcourt wrote:
> We have been suffering much lately from users abusing our Website
> forms with Spam. I have evaluated most of the spam submissions and im
> trying to modify my custom form-to-email perl processor to check for
> common spam submission and reject them. While this is not hard, im
> trying to streamline the scripts efficiency. Below is an example:
>
> spamattempt() if $fullname =~ /viagra/i;
> spamattempt() if $emailaddy =~ /viagra/i;
>
> The real script is much longer but you get the idea. Its checking each
> defined variable for a spam match and then performing the spamattempt
> subroutine if matched. [...]

Of course you realize that your approach is destined for failure. There is 
just no way for you to add all the variations of common spam terms that 
those slime bags come up with. Your attempt already fails with the 
deliberate misspelling "viägra". Or "Wiagra". Of any of the gazillions of 
variations out there.

If you want to stop spam being sent from your web site then you have to lock 
it down and allow mail submissions only from authenticated users.
Or at least require a "Please enter the text that you are seeing in this 
picture" for every individual mail submission. Yes, they are annoying. 
Unfortunately in real live they are the lesser evil.

jue 




------------------------------

Date: Sat, 07 Jul 2007 04:21:31 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: validating a group of variables
Message-Id: <5f8br9F3a9909U1@mid.individual.net>

Jürgen Exner wrote:
> Of course you realize that your approach is destined for failure. There is 
> just no way for you to add all the variations of common spam terms that 
> those slime bags come up with. Your attempt already fails with the 
> deliberate misspelling "viägra". Or "Wiagra". Of any of the gazillions of 
> variations out there.

That's true.

> If you want to stop spam being sent from your web site then you have to lock 
> it down and allow mail submissions only from authenticated users.
> Or at least require a "Please enter the text that you are seeing in this 
> picture" for every individual mail submission.

On that I don't agree. I have successfully stopped the automated spam 
submissions through my CGI::ContactForm module without using CAPTCHA. A 
combination of a cookie solution and a small regex to filter messages 
with HTML has proved to be sufficient.

http://search.cpan.org/perldoc?CGI%3A%3AContactForm

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


------------------------------

Date: Sat, 7 Jul 2007 07:26:05 +0200
From: "Petr Vileta" <stoupa@practisoft.cz>
Subject: Re: validating a group of variables
Message-Id: <f6n8dr$6q1$2@ns.felk.cvut.cz>

Robert Valcourt wrote:
> Hello,
>
> We have been suffering much lately from users abusing our Website
> forms with Spam. I have evaluated most of the spam submissions and im

The best way is to implement CAPTCHA into your script.
-- 

Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail. Send me your mail 
from another non-spammer site please.)





------------------------------

Date: Sat, 07 Jul 2007 10:08:03 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: validating a group of variables
Message-Id: <16eu83p72kt9q4jbi6cglr90pekkce5iek@4ax.com>

On Sat, 07 Jul 2007 01:40:48 GMT, "Jürgen Exner"
<jurgenex@hotmail.com> wrote:

>Of course you realize that your approach is destined for failure. There is 
>just no way for you to add all the variations of common spam terms that 
>those slime bags come up with. Your attempt already fails with the 
>deliberate misspelling "viägra". Or "Wiagra". Of any of the gazillions of 
>variations out there.

While it is perfectly true that you can't hope to completely block
spam, certainly a naive approach like the OP's one is deemed to fail
whereas sophisticated and complex antispam filters exist, and perhaps
he should investigate one of them. IIRC spamassassin itself is written
in Perl.


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: Sat, 07 Jul 2007 09:24:17 GMT
From: "Mumia W." <paduille.4061.mumia.w+nospam@earthlink.net>
Subject: Re: validating a group of variables
Message-Id: <5ZIji.5424$zA4.5385@newsread3.news.pas.earthlink.net>

On 07/07/2007 12:26 AM, Petr Vileta wrote:
> Robert Valcourt wrote:
>> Hello,
>>
>> We have been suffering much lately from users abusing our Website
>> forms with Spam. I have evaluated most of the spam submissions and im
> 
> The best way is to implement CAPTCHA into your script.

No it is not. Please read Gunnar's message on how to stop blog spammers 
without using captchas.

Captchas are evil. I'm not even blind, and I can barely see the capcha 
letters most of the time.

Every year since that braindamage was introduced, the captchas have 
gotten more and more unreadable. What's next? Random pixels thrown onto 
the screen that must be interpreted according to some secret, hidden 
language?



------------------------------

Date: Sat, 07 Jul 2007 09:24:20 GMT
From: "Mumia W." <paduille.4061.mumia.w+nospam@earthlink.net>
Subject: Re: validating a group of variables
Message-Id: <8ZIji.5425$zA4.1568@newsread3.news.pas.earthlink.net>

On 07/06/2007 06:13 PM, Robert Valcourt wrote:
> Hello,
> 

Hello Robert.

> We have been suffering much lately from users abusing our Website forms with 
> Spam. I have evaluated most of the spam submissions and im trying to modify 
> my custom form-to-email perl processor to check for common spam submission 
> and reject them. While this is not hard, im trying to streamline the scripts 
> efficiency. Below is an example:
> 
> #!/usr/bin/perl
> 
> use lib '/usr/local/psa/home/vhosts/mybizdomain.com/cgi-bin/lib/';
> use CGI qw(:standard);
> use CGI::Carp qw(fatalsToBrowser);
> use Mail::Sendmail;
> use strict;
> 
> my $fullname = param('fullname');
> my $emailaddy = param('emailaddy');
> my $phone = param('phone');
> my $company = param('company');
> my $website = param('website');
> my $completion = param('completion');
> 
> spamattempt() if $fullname =~ /viagra/i;
> spamattempt() if $emailaddy =~ /viagra/i;
> spamattempt() if $phone =~ /viagra/i;
> spamattempt() if $fullname =~ /\@/;
> 
> The real script is much longer but you get the idea. Its checking each 
> defined variable for a spam match and then performing the spamattempt 
> subroutine if matched. I would like to know if there is a way to check ALL 
> variables against a single match. See example (not real perl cod):
> 
> spamattempt() if $ANYVARIBALE =~ /viagra/i;
> 
> I know I could assign all variables into an array and then cycle them trough 
> a foreach but im not sure that would be any more efficient.
> [...]

I'm expanding upon what "It_Says..." says ;-)

use CGI ':cgi-lib';
my %pmhash = Vars;
 ...
spamattempt() if join('',values %pmhash) =~ /viagra/i;

What this does is to join all parameter values into a single string, 
then check if that string matches the regex.

> I think the best way to do this would be to have the script check all 
> submitted queries before they are assigned to variables. [...]

The code I wrote above does this.

Good luck.


------------------------------

Date: Sat, 7 Jul 2007 13:28:13 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: validating a group of variables
Message-Id: <f6o4kr.o8.1@news.isolution.nl>

Mumia W. schreef:

> spamattempt() if join('',values %pmhash) =~ /viagra/i;

So if one of the values ends on 'via', and the next starts with 'gra',
it should match?

-- 
Affijn, Ruud

"Gewoon is een tijger."



------------------------------

Date: Sat, 07 Jul 2007 13:08:54 GMT
From: "Mumia W." <paduille.4061.mumia.w+nospam@earthlink.net>
Subject: Re: validating a group of variables
Message-Id: <GfMji.4820$tj6.80@newsread4.news.pas.earthlink.net>

On 07/07/2007 06:28 AM, Dr.Ruud wrote:
> Mumia W. schreef:
> 
>> spamattempt() if join('',values %pmhash) =~ /viagra/i;
> 
> So if one of the values ends on 'via', and the next starts with 'gra',
> it should match?
> 

Whoa! That's not so good. I need to make that more robust probably:

use CGI ':cgi-lib'
my %pmhash = Vars;
spamattempt() if join("\0",values %pmhash) =~ /viagra/i;

Thanks.


------------------------------

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 630
**************************************


home help back first fref pref prev next nref lref last post