[30901] in Perl-Users-Digest
Perl-Users Digest, Issue: 2146 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jan 21 16:09:47 2009
Date: Wed, 21 Jan 2009 13:09:14 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 21 Jan 2009 Volume: 11 Number: 2146
Today's topics:
Re: CGI.pm and Use of uninitialized value in pattern ma <noreply@gunnar.cc>
Re: CGI.pm and Use of uninitialized value in pattern ma <uri@stemsystems.com>
Re: CGI.pm and Use of uninitialized value in pattern ma <noreply@gunnar.cc>
Re: CGI.pm and Use of uninitialized value in pattern ma <Alexander.Farber@gmail.com>
Re: CGI.pm and Use of uninitialized value in pattern ma <Alexander.Farber@gmail.com>
Re: FAQ 2.7 Is there an ISO or ANSI certified version o <larry@example.invalid>
Re: function calls in double quoted strings <cartercc@gmail.com>
Re: inputting the ephemerides <larry@example.invalid>
Re: inputting the ephemerides <jimsgibson@gmail.com>
Re: Mathematica 7 compares to other languages <soul.mirror1@gmail.com>
printing out last several articles in a group <larry@example.invalid>
Re: returning calculation results in perl scripts spanish26@gmail.com
Re: The Seven Stages of a Perl Programmer (was: Re: Wha <darkon.tdo@gmail.com>
Re: What do you need to have to be considered a Master <jurgenex@hotmail.com>
Re: What do you need to have to be considered a Master <cartercc@gmail.com>
Re: What do you need to have to be considered a Master <cwilbur@chromatico.net>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 21 Jan 2009 19:18:47 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: CGI.pm and Use of uninitialized value in pattern match
Message-Id: <6tp7c4Fbtn1hU1@mid.individual.net>
A. Farber wrote:
> I have a habit of untainting input data this way in my
> CGI scripts (example: http://pastebin.com/m46057a70):
>
> $user = $1 if $query->param('user') =~ /(\w{3,12})/;
> $pass = $1 if $query->param('pass') =~ /(\w{8})/;
> .....
> unless ($user and $pass and ...) {
> print $query->start_form(), ...
> } else {
> # do the real work with untainted data
> }
>
> and wonder, how to get rid of the warnings
> "Use of uninitialized value in pattern match (m//)"
> without (ab)using the no warnings qw(uninitialized)?
If the form include input controls named "user" respective "pass", those
parameters are always defined whether the fields were filled or not.
Consequently I don't understand the problem in the first place.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Wed, 21 Jan 2009 14:10:03 -0500
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: CGI.pm and Use of uninitialized value in pattern match
Message-Id: <x71vuw8ohg.fsf@mail.sysarch.com>
>>>>> "GH" == Gunnar Hjalmarsson <noreply@gunnar.cc> writes:
GH> A. Farber wrote:
>> I have a habit of untainting input data this way in my
>> CGI scripts (example: http://pastebin.com/m46057a70):
>> $user = $1 if $query->param('user') =~ /(\w{3,12})/;
>> $pass = $1 if $query->param('pass') =~ /(\w{8})/;
>> .....
>> unless ($user and $pass and ...) {
>> print $query->start_form(), ...
>> } else {
>> # do the real work with untainted data
>> }
>> and wonder, how to get rid of the warnings
>> "Use of uninitialized value in pattern match (m//)"
>> without (ab)using the no warnings qw(uninitialized)?
GH> If the form include input controls named "user" respective "pass",
GH> those parameters are always defined whether the fields were filled or
GH> not. Consequently I don't understand the problem in the first place.
you can always fake a form submission with LWP that doesn't set all the
fields and that could trigger the uninit warning. web apps should always
do full server side validation and never assume good data is coming in
(especially even when using javascript to validate stuff).
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- http://perlhunter.com/college.html ---------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
------------------------------
Date: Wed, 21 Jan 2009 20:50:49 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: CGI.pm and Use of uninitialized value in pattern match
Message-Id: <6tpcomFbti0oU1@mid.individual.net>
Uri Guttman wrote:
>>>>>> "GH" == Gunnar Hjalmarsson <noreply@gunnar.cc> writes:
>
> GH> A. Farber wrote:
> >> I have a habit of untainting input data this way in my
> >> CGI scripts (example: http://pastebin.com/m46057a70):
> >> $user = $1 if $query->param('user') =~ /(\w{3,12})/;
> >> $pass = $1 if $query->param('pass') =~ /(\w{8})/;
> >> .....
> >> unless ($user and $pass and ...) {
> >> print $query->start_form(), ...
> >> } else {
> >> # do the real work with untainted data
> >> }
> >> and wonder, how to get rid of the warnings
> >> "Use of uninitialized value in pattern match (m//)"
> >> without (ab)using the no warnings qw(uninitialized)?
>
> GH> If the form include input controls named "user" respective "pass",
> GH> those parameters are always defined whether the fields were filled or
> GH> not. Consequently I don't understand the problem in the first place.
>
> you can always fake a form submission with LWP that doesn't set all the
> fields and that could trigger the uninit warning.
Indeed, but if Alex doesn't like such direct access to his script, those
warnings might be a good thing (or not...).
> web apps should always
> do full server side validation and never assume good data is coming in
> (especially even when using javascript to validate stuff).
Absolutely. It was not my intention to give any other impression.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Wed, 21 Jan 2009 13:01:16 -0800 (PST)
From: "A. Farber" <Alexander.Farber@gmail.com>
Subject: Re: CGI.pm and Use of uninitialized value in pattern match
Message-Id: <e8f332c0-45c5-4dc1-9c90-6afc6479e3a9@t39g2000prh.googlegroups.com>
On 21 Jan., 16:50, mer...@stonehenge.com (Randal L. Schwartz) wrote:
> Apparently, you believe that Perl has tail-recursion elimination. =A0It d=
oesn't.
> You should probably have written this as a loop instead. =A0Something lik=
e:
>
> =A0 {
> =A0 =A0 =A0$pass =3D [your calculation here];
> =A0 =A0 =A0return $pass if $len < 8; # short passwords skip checks
> =A0 =A0 =A0# if any quality check fails, try again:
> =A0 =A0 =A0redo if $pass =3D~ tr/0-9// < 2;
> =A0 =A0 =A0redo if $pass =3D~ tr/a-z// < 2;
> =A0 =A0 =A0redo if $pass =3D~ tr/A-Z// < 2;
> =A0 =A0 =A0return $pass; # passed all checks, return it
> =A0 }
Thank you Randal, this looks good! Don't know why I wanted recursion
Gunnar, yes I just always check and untaint every input
and don't assume my script will be called from my web-form only.
Greetings from Germany
Alex
------------------------------
Date: Wed, 21 Jan 2009 13:02:21 -0800 (PST)
From: "A. Farber" <Alexander.Farber@gmail.com>
Subject: Re: CGI.pm and Use of uninitialized value in pattern match
Message-Id: <fb1d3c3c-9ca2-40bb-ad9d-799642c30355@t26g2000prh.googlegroups.com>
And also when the script is called for
the 1st time, then those params aren't defined
------------------------------
Date: Wed, 21 Jan 2009 12:41:27 -0700
From: Larry Gates <larry@example.invalid>
Subject: Re: FAQ 2.7 Is there an ISO or ANSI certified version of Perl?
Message-Id: <1jkr0y5in74xm$.8vb6eiztmj16.dlg@40tude.net>
On Wed, 21 Jan 2009 06:03:02 -0800, PerlFAQ Server wrote:
> 2.7: Is there an ISO or ANSI certified version of Perl?
>
> Certainly not. Larry expects that he'll be certified before Perl is.
This was a big shock to me when I started up with perl a year ago. It
takes some getting used to if you come from languages like C and fortran.
--
larry gates
If I thought that I could design a language that will never disappoint
anyone, I'd be a lot stupider than I already think I am, I think.
-- Larry Wall in <20050328202308.GA21733@wall.org>
------------------------------
Date: Wed, 21 Jan 2009 08:17:31 -0800 (PST)
From: cartercc <cartercc@gmail.com>
Subject: Re: function calls in double quoted strings
Message-Id: <f094bf2c-7b26-4f67-9576-eada6c2414f5@f3g2000yqf.googlegroups.com>
On Jan 20, 11:23=A0am, RedGrittyBrick <RedGrittyBr...@spamweary.invalid>
wrote:
> Most people think it a mistake to confuse data and code.
One of my New Years resolutions is to become competent in Lisp. So
far, I'm making good progress.
One of the Big Deals about Lisp is that there's no distinction between
code and data -- code IS data and data IS code!
I haven't wrapped my mind around this idea, yet. When I do, I'll share
it with you. However, Lisp is a fifty year old language that some very
smart people advocate and that's used in some very complex
applications, so maybe there's something to it.
One of my Christmas presents to myself was MJD's 'Higher Order Perl'.
I haven't read past the first chapter (due to time constraints) but it
addresses some big ideas, and I'm looking forward to reading it
sometime this year.
CC
------------------------------
Date: Wed, 21 Jan 2009 12:25:11 -0700
From: Larry Gates <larry@example.invalid>
Subject: Re: inputting the ephemerides
Message-Id: <lwwnfv8fi7p0$.1l7av06n4c4v6.dlg@40tude.net>
On Wed, 21 Jan 2009 07:07:02 GMT, sln@netherlands.com wrote:
> I'm falling down laughing. This is better than the Comedy chanel.
Apparently this regex has a side effect that involves a catastrophic loss
of seating stability.
my $filename = 'eph6.txt';
open(my $fh, '<', $filename) or die "cannot open $filename: $!";
while (<$fh>) {
/(\w+)\W+(\d{2}).*?(\d{2}).*?(\d{2}).*?([-+]\d{2}).*?(\d+\.\d+)/;
print "string one is $1\n";
print "string two is $2\n";
print "string three is $3\n";
print "string four is $4\n";
print "string five is $5\n";
print "string six is $6\n";
print $_;
}
close($fh)
# perl faulk14.pl
C:\MinGW\source>perl faulk14.pl
string one is Sun
string two is 19
string three is 43
string four is 51
string five is -21
string six is 17.8
Sun 19h 43m 51s -21 17.8' 0.984 -35.020 87.148 Set
...
string one is Pluto
string two is 18
string three is 40
string four is 17
string five is -52
string six is 108.052
Pluto 18h 6m 40s -17 44.9' 32.485 -52.833 108.052 Set
C:\MinGW\source>
Still having trouble pickup up -17 with ([-+]\d{2}) .
--
larry gates
Besides, it's good to force C programmers to use the toolbox occasionally.
:-)
-- Larry Wall in
<1991May31.181659.28817@jpl-devvax.jpl.nasa.gov>
------------------------------
Date: Wed, 21 Jan 2009 13:01:25 -0800
From: Jim Gibson <jimsgibson@gmail.com>
Subject: Re: inputting the ephemerides
Message-Id: <210120091301256870%jimsgibson@gmail.com>
In article <lwwnfv8fi7p0$.1l7av06n4c4v6.dlg@40tude.net>, Larry Gates
<larry@example.invalid> wrote:
> On Wed, 21 Jan 2009 07:07:02 GMT, sln@netherlands.com wrote:
>
> > I'm falling down laughing. This is better than the Comedy chanel.
>
> Apparently this regex has a side effect that involves a catastrophic loss
> of seating stability.
>
> my $filename = 'eph6.txt';
> open(my $fh, '<', $filename) or die "cannot open $filename: $!";
>
> while (<$fh>) {
>
>
> /(\w+)\W+(\d{2}).*?(\d{2}).*?(\d{2}).*?([-+]\d{2}).*?(\d+\.\d+)/;
>
> print "string one is $1\n";
> print "string two is $2\n";
> print "string three is $3\n";
> print "string four is $4\n";
> print "string five is $5\n";
> print "string six is $6\n";
> print $_;
> }
> close($fh)
>
> # perl faulk14.pl
>
>
> C:\MinGW\source>perl faulk14.pl
> string one is Sun
> string two is 19
> string three is 43
> string four is 51
> string five is -21
> string six is 17.8
> Sun 19h 43m 51s -21 17.8' 0.984 -35.020 87.148 Set
> ...
> string one is Pluto
> string two is 18
> string three is 40
> string four is 17
> string five is -52
> string six is 108.052
> Pluto 18h 6m 40s -17 44.9' 32.485 -52.833 108.052 Set
> C:\MinGW\source>
>
> Still having trouble pickup up -17 with ([-+]\d{2}) .
You are actually having trouble extracting '6' from '6m' with (\d{2}),
which causes all of your other matches to shift up one. You are better
off matching a string of digits with (\d+), rather than insisting upon
a specific number. If not, you should use (\d{1,2}).
--
Jim Gibson
------------------------------
Date: Wed, 21 Jan 2009 10:06:34 -0800 (PST)
From: "soul.mirror1@gmail.com" <soul.mirror1@gmail.com>
Subject: Re: Mathematica 7 compares to other languages
Message-Id: <4d86021f-d25c-4b96-b1a2-3a0c162a6154@a26g2000prf.googlegroups.com>
On Dec 4 2008, 5:11=A0am, Andreas Waldenburger <geekm...@usenot.de>
wrote:
> On Wed, 03 Dec 2008 20:38:44 -0500 Lew <no...@lewscanon.com> wrote:
>
> > Xah Lee wrote:
> > > enough babble ...
>
> > Good point. =A0Plonk. =A0Guun dun!
>
> I vaguely remember you plonking the guy before. Did you unplonk him in
> the meantime? Or was that just a figure of speech?
>
> teasingly yours,
> /W
Andreas Waldenburger, I hold up a mirror to your soul!
A couple of years ago you started posting to the newsgroup
comp.lang.java.programmer. Unlike most newbies, instead of lurking for
a while and then contributing on-topic posts about Java, you jumped
into the nearest available flamewar and immediately got in up to your
neck. Then, on November 13, 2007, you stooped to intentionally
misquoting one of your opponents. When he wrote
http://groups.google.com/group/comp.lang.java.programmer/msg/7797d4e90afa4a=
20?dmode=3Dsource
you quoted him thusly:
http://groups.google.com/group/comp.lang.java.programmer/msg/0386cc91ce75a3=
c6?dmode=3Dsource
A few days later, you did it again, misquoting this post
http://groups.google.com/group/comp.lang.java.programmer/msg/fca19d413549f4=
99?dmode=3Dsource
in this one:
http://groups.google.com/group/comp.lang.java.programmer/msg/397e1d4b23537c=
1b?dmode=3Dsource
In both cases, you publicly portrayed this poor man as a pervert, even
though, whatever his other faults, that is clearly not one of them.
Since that date, you have continued to participate on and off in a
flamewar with many of the same participants, including the one you so
mistreated that November. In fact, it seems that the very SAME
flamewar is still in progress, in another newsgroup, fourteen whole
months later, and you are still in it up to your neck.
Repeatedly you have claimed to be primarily motivated by finding the
disrupting of newsgroups to be entertaining. This is tantamount to
admitting to being a troll.
If you have an excuse for your behavior, please speak now, and give
your apology before the witnesses gathered here.
If you do not, then know that your soul is forever tainted!
------------------------------
Date: Wed, 21 Jan 2009 12:39:48 -0700
From: Larry Gates <larry@example.invalid>
Subject: printing out last several articles in a group
Message-Id: <ehnjccqhz65i.pyhw1cfde36s$.dlg@40tude.net>
#!/usr/bin/perl
use strict;
use warnings;
use Net::NNTP ();
use constant NUMBER_OF_ARTICLES => 5;
use constant GROUP_NAME => 'comp.lang.perl.misc';
use constant SERVER_NAME => 'news.individual.net';
use constant NNTP_DEBUG => 0;
my $USER = '';
my $PASS = '';
my $PORT = 119;
my $nntp = Net::NNTP->new(SERVER_NAME, 'Debug' => NNTP_DEBUG) or die;
$nntp->authinfo($USER,$PASS) or die $!;
my($article_count, $first_article, $last_article) =
$nntp->group(GROUP_NAME) or die;
# Which XOVER fields contain Subject: and From:?
my $count = 0;
my %xover_fmt = map( ($_, $count++), @{ $nntp->overview_fmt or die} );
die unless exists $xover_fmt{'Subject:'};
my $subject_offset = $xover_fmt{'Subject:'};
my $from_offset = $xover_fmt{'From:'};
my(@xover, $start_article);
RETRIEVE: while ($#xover+1 < NUMBER_OF_ARTICLES and $last_article >=
$first_article) {
# How many articles do we need? Stop retrieving if we have enough
my $articles_required = NUMBER_OF_ARTICLES - ($#xover+1) or last
RETRIEVE;
# Fetch overview information for the articles
$start_article = $last_article - ($articles_required-1);
print "start art is $start_article \n";
$start_article = $start_article > $first_article ? $start_article :
$first_article;
my $xover_query = $start_article == $last_article ?
$start_article :
[$start_article, $last_article];
my $xover_ref = $nntp->xover($xover_query) or die;
# Store headers for the articles we've retrieved
foreach (sort {$b <=> $a} keys %$xover_ref) {
push @xover, $xover_ref->{$_};
}
} continue {
# Move the pointer forward to fetch previous articles
$last_article = $start_article - 1;
}
foreach my $counter ( @xover ) {
if ($counter->[$from_offset] eq 'Larry <larry@example.invalid>') {
print STDOUT "'Look Ma! No \$_!'\n";
}
}
my $msg_ids_ref = $nntp->newnews(time() - 10*60*60);
$msg_ids_ref => my $number;
print "number is $number\n";
die "Failed to retrieve message ids\n" unless @{$msg_ids_ref};
print " msg id ref is $msg_ids_ref\n";
open my $ofh, '>', 'articles.txt'
or die "Cannot open articles.txt: $!";
for my $msg_id (@{$msg_ids_ref}) {
$nntp->article($msg_id, $ofh)
or die "Failed to retrieve article $msg_id\n";
}
close $ofh;
# Disconnect from the NNTP server
$nntp->quit;
# perl van2.pl
C:\MinGW\source>perl van2.pl
Useless use of private variable in void context at van2.pl line 69.
start art is 642831
Use of uninitialized value in concatenation (.) or string at van2.pl line
70.
number is
msg id ref is ARRAY(0x1a16f40)
C:\MinGW\source>
This script uses two different means to get the last several articles. I'm
trying to reconcile them, so far, without success.
my $msg_ids_ref = $nntp->newnews(time() - 10*60*60);
$msg_ids_ref => my $number;
print "number is $number\n";
I $msg_ids_ref was a pointer to a integer, and that to reference it, I
would use =>, but perl.exe doesn't think too much of that.
Grateful for any tips.
--
larry gates
pos += screamnext[pos] /* does this goof up anywhere? */
-- Larry Wall in util.c from the perl source code
------------------------------
Date: Wed, 21 Jan 2009 08:19:20 -0800 (PST)
From: spanish26@gmail.com
Subject: Re: returning calculation results in perl scripts
Message-Id: <a07ca2ab-bd55-497c-9f18-f56b29b893c2@v5g2000pre.googlegroups.com>
Thank you, i signed for the Google API developers key on Monday and i
was issued the key.
I ran the program on the command prompt, but got error. when
debugging.
On Jan 21, 9:11=A0pm, "A. Sinan Unur" <1...@llenroc.ude.invalid> wrote:
> spanis...@gmail.com wrote innews:5b1c0202-fbb0-4928-80fc-5bab2aae0891@l33=
g2000pri.googlegroups.com:
>
> > I am running a program using perl scripts to calculate the proximity
> > between two search terms when they are entered in the form box, i can
> > successfully view the form boxes, but when i click on the calculate
> > button after entering the term, i do not get any result, the values do
> > not show any result
>
> I do not have a Google API key so I can't try out your code. AFAIK,
> Google no longer hands out keys for that service:http://google-code-updat=
es.blogspot.com/2006/12/beyond-soap-search-ap...
>
> I will point out that you need to divide the problem into two separate
> questions:
>
> 1) Are you getting back results?
>
> 2) Are those results being output properly?
>
> As I said, I cannot look into (1) above. (2) is a stealth CGI question,
> not a Perl question, but let's look at the code below.
>
> > #!"C:\Program Files\xampp\perl\bin\perl.exe"
> > # ngd-calculator.cgi
> > #
> > # wjt
> > #http://history.uwo.ca/faculty/turkel/
> > #
> > # 5 aug 2006
>
> Here, you are missing:
>
> use strict;
> use warnings;
>
> Please see the posting guidelines for why you should include
> those pragmas so that you can help yourself and help others help
> you more effectively.
>
> > use SOAP::Lite;
> > use CGI;
> > use POSIX qw(log10);
> > use List::Util qw(max min);
>
> <snip>
>
> Code accessing Google Search service. You should test this part
> separately from the command line.
>
> </snip>
>
> > # Create the search page
> > $query =3D new CGI;
>
> my $query =3D CGI->new;
>
> Avoid indirect object notation.
>
> > print $query->header;
> > print $query->start_html('NGD Calculator');
> > print "<H1>Normalized Google Distance (NGD) Calculator</H1>";
>
> Here, you are mixing CGI.pm's output generation routines with plain HTML.
> I would recommend using HTML::Template or some other similar solution
> to separate presentation from logic.
>
> Also, by default, CGI.pm outputs XHTML in which upper case tags
> are not valid AFAIK.
>
> In any case, you should try the script from the command line to see
> what happens there. Seehttp://search.cpan.org/~lds/CGI.pm-3.42/CGI.pm#DEB=
UGGING
>
> Please provide a small, self-contained example others can run from
> the command line that still exhibits the problem.
>
> Sinan
> --
> A. Sinan Unur <1...@llenroc.ude.invalid>
> (remove .invalid and reverse each component for email address)
>
> comp.lang.perl.misc guidelines on the WWW:http://www.rehabitation.com/clp=
misc/
------------------------------
Date: Wed, 21 Jan 2009 11:51:58 -0800 (PST)
From: darkon <darkon.tdo@gmail.com>
Subject: Re: The Seven Stages of a Perl Programmer (was: Re: What do you need to have to be considered a Master at Perl?)
Message-Id: <88147542-d0f7-4314-8041-abdd4c1637b7@p2g2000prn.googlegroups.com>
On Jan 17, 8:27=A0am, Tad J McClellan <ta...@seesig.invalid> wrote:
> I can't find Tom Christiansen's original, so I'll go with Nat's
> reconstruction of:
>
> =A0 =A0The Seven Stages of a Perl Programmer
>
> (From http://prometheus.frii.com/~gnat/yapc/2000-stages/)
That has to be incomplete, because it would put me mostly in the
"Adept" category, and I don't consider myself that good.
And anyway, the longest program or module I've written in Perl is less
than 1000 lines; even less if you remove comments and whitespace
inserted for readability. Should that count in some way? After all,
one necessary (but not sufficient) way to become better at a
programming language is actually programming in it.
------------------------------
Date: Wed, 21 Jan 2009 08:45:45 -0800
From: Jrgen Exner <jurgenex@hotmail.com>
Subject: Re: What do you need to have to be considered a Master at Perl?
Message-Id: <8ljen4lcbmripqh0is2ui2prrounavecef@4ax.com>
cartercc <cartercc@gmail.com> wrote:
>Competent programmers can program in any language whether or not they
>know it; incompetent programmers cannot program in any language
>whether or not they know it.
I beg to differ on the first part of your statement
>(I'm not an especially competent programmer, but I've had the
>opportunity to write projects in about a dozen different languages.
>It's much better to use a language that you know pretty well, but it's
>possible to use any language -- particularly true if you are in a MS
>environment where you can pretty much figure it out whether you use
>VB, C#, J#, C++, etc. and rely on the VS IDE to do your drags and
>drops.)
Those languages are very similar to each other and use the same
concepts. You get used to the different syntax and the quirks, an off
you go.
But have you ever tried programming in Prolog, APL, Lisp, Haskel, or
TeX/Metafont, PostScript, ...? Good luck! A competent programmer with
proper education will get aquainted with those eventually while an
incompetent programmer may never, but "can program in any language" is a
very long shot when looking at programming languages from different
paradigms.
jue
------------------------------
Date: Wed, 21 Jan 2009 09:30:45 -0800 (PST)
From: cartercc <cartercc@gmail.com>
Subject: Re: What do you need to have to be considered a Master at Perl?
Message-Id: <6105a180-714a-4640-a065-402d81f5c40d@a26g2000prf.googlegroups.com>
On Jan 21, 11:45=A0am, J=FCrgen Exner <jurge...@hotmail.com> wrote:
> cartercc <carte...@gmail.com> wrote:
> >Competent programmers can program in any language whether or not they
> >know it; incompetent programmers cannot program in any language
> >whether or not they know it.
>
> I beg to differ on the first part of your statement
Why? Do you think that a competent programmer can't learn a particular
language? Obviously, you have to know a little bit of a language
before you start using it, but the main part is figuring out the
logic, and the logic isn't language specific. Unless you think it is,
but then you should give an example of some language specific logic.
> But have you ever tried programming in Prolog, APL, Lisp, Haskel, or
> TeX/Metafont, PostScript, ...? Good luck!
I wrote an application in Erlang within the past year for the purpose
of parallizing computation of a particular problem. I bought
Armstrong's book on Erlang, spent about twenty hours reading through
the book and a few hours actually writing the script. I've written a
few small Lisp scripts. The only project that I completely failed at
was one in Scheme.
> A competent programmer with
> proper education will get aquainted with those eventually while an
> incompetent programmer may never, but "can program in any language" is a
> very long shot when looking at programming languages from different
> paradigms.
Can you write a flow chart 'in any language?' If so, you can program
in that language. Yes, a different paradigm (object-oriented,
functional, declarative) takes some getting used to, but the basic
structures (selection, iteration, recursion) don't differ from
language to language. I'm not saying that it's easy, but it's
possible.
Also, knowing C and Java means that you can pick up Perl and C# pretty
easy. Knowing Scheme and Lisp means that you can pick up Erlang pretty
easy. The more you know the easier it becomes.
CC
------------------------------
Date: Wed, 21 Jan 2009 13:05:50 -0500
From: Charlton Wilbur <cwilbur@chromatico.net>
Subject: Re: What do you need to have to be considered a Master at Perl?
Message-Id: <86wscozg8x.fsf@mithril.chromatico.net>
>>>>> "PJH" == Peter J Holzer <hjp-usenet2@hjp.at> writes:
PJH> On 2009-01-20 22:13, Tad J McClellan <tadmc@seesig.invalid> wrote:
>> Charlton Wilbur <cwilbur@chromatico.net> wrote:
>>> One of my favorites:
>>>
>>> You have a string that comes from a freeform text field where
>>> the user is expected to enter a telephone number.
>>
>> I sure hope that is restricted to "a US phone number"...
PJH> And I hope it isn't. Local conventions for phone numbers,
PJH> street addresses, etc. differ a lot, and software tends to be
PJH> used outside that local context. Forcing a non-US customer to
PJH> guess US conventions, or worse, rejecting a phone number
PJH> because it has too many or too few digits is a major annoyance.
Of course - but if we tried to get a candidate to write code to validate
*any* phone number worldwide, it would take unreasonably long for an
interview. And we'd need to have a considerably more extensive spec.
The question is useful because it's slightly open-ended, especially
phrased that way. Candidates who ask "Hm, are we matching US phone
numbers or phone numbers from anywhere?" are showing that they are aware
that the practices in the US are not universal, which is a very good
trait to have when you're developing software that's used around the
world.
But it's an interview question aimed at assessing the candidate's
fluency with regular expressions. Because of that, it helps to keep it
in a domain that people are familiar with, both in terms of valid input
(you can reasonably have both 7-digit and 10/11-digit US phone numbers)
and in terms of what fool things people are likely to do (do they write
the phone number 1 (617) 555-1212? 617.555.1212? 1-617-555-1212? is
16-17-5551-212 correct?)
So the goal of the exercise -- what you need to pass with flying colors
-- is to come up with a snippet of code or a regular expression that
matches a US phone number, and an acknowledgement that phone systems in
other countries have different formats for their phone numbers.
Charlton
--
Charlton Wilbur
cwilbur@chromatico.net
------------------------------
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 2146
***************************************