[27901] in Perl-Users-Digest
Perl-Users Digest, Issue: 9265 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jun 8 11:30:36 2006
Date: Thu, 8 Jun 2006 08:30:28 -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 Thu, 8 Jun 2006 Volume: 10 Number: 9265
Today's topics:
Simple GPA calculator program rmr531@gmail.com
Re: Simple GPA calculator program <john@castleamber.com>
Re: Simple GPA calculator program <john@castleamber.com>
Re: Simple GPA calculator program <tadmc@augustmail.com>
Re: Simple GPA calculator program <john@castleamber.com>
Re: Simple GPA calculator program <someone@example.com>
Re: Simple GPA calculator program rmr531@gmail.com
Re: Simple GPA calculator program <DJStunks@gmail.com>
Re: Simple GPA calculator program <tadmc@augustmail.com>
Re: Simple GPA calculator program rmr531@gmail.com
Re: Simple GPA calculator program <tadmc@augustmail.com>
Re: Sleep & print(f) problem xhoster@gmail.com
Re: Sleep & print(f) problem <jgibson@mail.arc.nasa.gov>
Re: Sleep & print(f) problem <tadmc@augustmail.com>
Re: The Nature of the =?UTF-8?B?4oCcVW5peCBQaGlsb3NvcGh <invalid@invalid.net>
Re: The Nature of the =?utf-8?q?=E2=80=9CUnix_Philosoph <kst-u@mib.org>
Unable to coonect to SQLite database file <saviourms@yahoo.co.in>
Re: Unable to coonect to SQLite database file <tadmc@augustmail.com>
Unicode statistics (uses Data::Alias) <rvtol+news@isolution.nl>
What news servers do you use atbusbook@aol.com
Where might I find a 'newer' DBI.pm (source) file? <David.Hubert.Cook@gmail.com>
Re: Where might I find a 'newer' DBI.pm (source) file? <xemoth@gmail.com>
Re: Where might I find a 'newer' DBI.pm (source) file? <tadmc@augustmail.com>
Re: Where might I find a 'newer' DBI.pm (source) file? <David.Hubert.Cook@gmail.com>
Re: Where might I find a 'newer' DBI.pm (source) file? <rvtol+news@isolution.nl>
Re: Where might I find a 'newer' DBI.pm (source) file? <David.Hubert.Cook@gmail.com>
Re: Where might I find a 'newer' DBI.pm (source) file? <rvtol+news@isolution.nl>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 6 Jun 2006 19:06:33 -0700
From: rmr531@gmail.com
Subject: Simple GPA calculator program
Message-Id: <1149645993.734186.67990@c74g2000cwc.googlegroups.com>
I have an assignment for a class that has been driving me crazy for the
past few days. Basically I need to create a simple GPA calculator that
takes in several letter grades (ex: A) and then calculates the GPA
based off that A=4 B=3 C=2 D=1 F=0. Here is what I have, sorry it in
inefficient sloppy code but I am still new to this and just want it to
work.
print "Enter the letter grade (A, B, C, D, F) for each test taken in a
class, enter Z to quit.\n";
****************************************
$score=0;
$A="A"; $B="B"; $C="C"; $D="D"; $Z="Z";
for($classes=0, $grade != $Z, $classes++)
{
$grade;
print "Enter a grade: ";
chomp($grade = <STDIN> );
if($grade == $A)
{$score + 4;}
if($grade == $B)
{$score + 3;}
if($grade == $C)
{$score + 2;}
if($grade == $D)
{$score + 1;}
else {$score + 0;}
}
$gpa=$score/$classes;
print "Your GPA is: $gpa.\n";
*******************************************************
Any help on this one is greatly appreciated, I know many of you out
there are PERL experts but if you could make the solutions very basic
that would be great, remember this is a beginner class :) I know it is
something stupid that I did but I cannot figure it out, I think that my
logic is sound. Thanks all.
------------------------------
Date: 7 Jun 2006 02:38:11 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: Simple GPA calculator program
Message-Id: <Xns97DADC19760Bcastleamber@130.133.1.4>
rmr531@gmail.com wrote:
> I have an assignment for a class
I would probably give you a D for trying.
(With your program an F is not possible).
One tip: == is for numbers, eq is for strings.
--
John Bokma Freelance software developer
&
Experienced Perl programmer: http://castleamber.com/
------------------------------
Date: 7 Jun 2006 03:53:48 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: Simple GPA calculator program
Message-Id: <Xns97DAE8EBB4FABcastleamber@130.133.1.4>
John Bokma <john@castleamber.com> wrote:
> rmr531@gmail.com wrote:
>
>> I have an assignment for a class
>
> I would probably give you a D for trying.
>
> (With your program an F is not possible).
Ok, that was stupid :-D
> One tip: == is for numbers, eq is for strings.
--
John Bokma Freelance software developer
&
Experienced Perl programmer: http://castleamber.com/
------------------------------
Date: Tue, 6 Jun 2006 22:29:22 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Simple GPA calculator program
Message-Id: <slrne8ci0i.nto.tadmc@magna.augustmail.com>
rmr531@gmail.com <rmr531@gmail.com> wrote:
> I have an assignment for a class
If we do your assignment for you, then you won't learn what
you are supposed to learn.
We would hate to see you short-changed like that.
You pay good money in tuition to learn stuff, so you should *learn* stuff.
> but I am still new to this and just want it to
> work.
You will fail in programming with such an attitude.
Consider changing majors.
Someone destined to become a programmer would want to
_understand_ how it works, while you appear to be looking
for cargo-cult programming...
> $A="A"; $B="B"; $C="C"; $D="D"; $Z="Z";
You can compare to strings just as you would compare to
a variable.
There is no need to copy the string into a variable before
doing a comparison.
> for($classes=0, $grade != $Z, $classes++)
^^^^^^^^^^^^
^^^^^^^^^^^^ $grade ne 'Z'
!= is for comparing numbers, ne is for comparing strings.
> {
> $grade;
Why do you include that line of code?
That is, what do you think that that line does for you?
(this is not a rhetorical question.)
> if($grade == $A)
== is for comparing numbers, eq is for comparing strings.
> {$score + 4;}
Q: Where do you store this newly computed value?
A: Nowhere!
> Any help on this one is greatly appreciated,
Uh huh.
> I know many of you out
> there are PERL experts
*none* of us are PERL experts.
Many of us are Perl experts though.
> but if you could make the solutions
Sure does sound like you want us to do your homework for you.
We are too ethical for that (and you should be too).
> I think that my
> logic is sound.
You are not thinking correctly then.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 7 Jun 2006 05:07:39 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: Simple GPA calculator program
Message-Id: <Xns97DB14CB6539castleamber@130.133.1.4>
Tad McClellan <tadmc@augustmail.com> wrote:
> rmr531@gmail.com <rmr531@gmail.com> wrote:
[..]
>> but I am still new to this and just want it to
>> work.
>
> You will fail in programming with such an attitude.
No, no, the attitude is good. Wanting the program to work is good. Better
then make it appear like it works :-D.
>> I know many of you out
>> there are PERL experts
>
>
> *none* of us are PERL experts.
>
> Many of us are Perl experts though.
And some are perl experts :-D
> Sure does sound like you want us to do your homework for you.
>
> We are too ethical for that (and you should be too).
I have made in the past homework in exchange for money and books (Perl
related ;-) ). I included also documentation. I don't think that's
unethical. It's up to the student to reread my code, and learn from it,
and ask smart questions. So far they have done so. Maybe that them paying
for the help stimulated them.
BTW, most of the times the students had already done quite some work, but
just got stuck. In one case it was not even Perl related at all.
--
John Bokma Freelance software developer
&
Experienced Perl programmer: http://castleamber.com/
------------------------------
Date: Wed, 07 Jun 2006 13:01:57 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: Simple GPA calculator program
Message-Id: <97Ahg.21077$I61.2182@clgrps13>
rmr531@gmail.com wrote:
> I have an assignment for a class that has been driving me crazy for the
> past few days. Basically I need to create a simple GPA calculator that
> takes in several letter grades (ex: A) and then calculates the GPA
> based off that A=4 B=3 C=2 D=1 F=0. Here is what I have, sorry it in
> inefficient sloppy code but I am still new to this and just want it to
> work.
>
> print "Enter the letter grade (A, B, C, D, F) for each test taken in a
> class, enter Z to quit.\n";
>
> ****************************************
> $score=0;
> $A="A"; $B="B"; $C="C"; $D="D"; $Z="Z";
> for($classes=0, $grade != $Z, $classes++)
> {
> $grade;
> print "Enter a grade: ";
> chomp($grade = <STDIN> );
>
> if($grade == $A)
> {$score + 4;}
> if($grade == $B)
> {$score + 3;}
> if($grade == $C)
> {$score + 2;}
> if($grade == $D)
> {$score + 1;}
> else {$score + 0;}
> }
>
> $gpa=$score/$classes;
> print "Your GPA is: $gpa.\n";
> *******************************************************
> Any help on this one is greatly appreciated, I know many of you out
> there are PERL experts but if you could make the solutions very basic
> that would be great, remember this is a beginner class :) I know it is
> something stupid that I did but I cannot figure it out, I think that my
> logic is sound. Thanks all.
my %lookup = (
A => sub { 4 },
B => sub { 3 },
C => sub { 2 },
D => sub { 1 },
Z => sub { print 'Your GPA is: ', $_[ 0 ] / $_[ 1 ], ".\n" and exit }
);
my ( $score, $classes );
{ print 'Enter a grade: ';
chomp( my $grade = uc <STDIN> );
$score += $lookup{ $grade }( $score, $classes++ ) and redo
}
John
--
use Perl;
program
fulfillment
------------------------------
Date: 7 Jun 2006 07:05:33 -0700
From: rmr531@gmail.com
Subject: Re: Simple GPA calculator program
Message-Id: <1149689133.883921.159010@g10g2000cwb.googlegroups.com>
Thanks all for the help. Tad, you are mean :) no I'm just kidding, I
am sure that your advice has been taken advantage of before, but
seriously take it easy on us newbies many of us are trying our best, I
am just more of a Java guy, this Perl almost makes it to simple
sometimes, putting strings and int and char all into one variable type
is just chaos on my little mind. But your advice was very helpful, and
I do appreciate it.
A couple of you seemed to think that I was asking you to do the entire
thing for me, I honestly was not, if I had I would not have done as
much as I did. Maybe I just worded the post wrong but I was only
looking for people to point our my mistakes (which there were plenty
of, but I was on the right track, you have to admit), and the only
reason that I just wanted to get it working was because it is due
today. Maybe I should have said that I just want to figure out why it
is not working, because that is what I meant.
Basically all that I needed was the "ne" and the and "eq", not to make
excuses but it is VERY hard to find that kind of stuff in the book that
I have. Also I needed to change all those ifs to elsif. But I got it
working, just need to tweak it to make it look pretty now. And
speaking of ethics I am not going to post the full working program just
because someone might use it to get out of an assignment, plus I am
sure that you all know what it looks like.
Thanks both John's for the help, John K. your program worked well and I
kind of understand it but unfortunately this is a really really
beginner class and even though it seems pretty simple it would have
stood out like a sore thumb to the instructor, plus I could not have
explained exactly how it worked (see I really am ethical).
------------------------------
Date: 7 Jun 2006 08:27:15 -0700
From: "DJ Stunks" <DJStunks@gmail.com>
Subject: Re: Simple GPA calculator program
Message-Id: <1149694035.523660.90570@i39g2000cwa.googlegroups.com>
John W. Krahn wrote:
> rmr531@gmail.com wrote:
> > print "Enter the letter grade (A, B, C, D, F) for each test taken in a
> > class, enter Z to quit.\n";
>
> my %lookup = (
> A => sub { 4 },
> B => sub { 3 },
> C => sub { 2 },
> D => sub { 1 },
> Z => sub { print 'Your GPA is: ', $_[ 0 ] / $_[ 1 ], ".\n" and exit }
> );
>
> my ( $score, $classes );
> { print 'Enter a grade: ';
> chomp( my $grade = uc <STDIN> );
>
> $score += $lookup{ $grade }( $score, $classes++ ) and redo
> }
tight! :D
-jp
------------------------------
Date: Wed, 7 Jun 2006 14:11:35 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Simple GPA calculator program
Message-Id: <slrne8e977.st4.tadmc@magna.augustmail.com>
rmr531@gmail.com <rmr531@gmail.com> wrote:
> Basically all that I needed was the "ne" and the and "eq", not to make
> excuses but it is VERY hard to find that kind of stuff in the book that
> I have.
You should not be using the book that you have as your primary reference.
(What book _do_ you have?)
You should use the documentation for the software that you are
using for your primary reference.
You need to find info on an "operator", so the place to look first is:
perldoc perlop
Scanning the section headers leads to the "Relational Operators"
section without much fuss or bother.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 7 Jun 2006 14:58:18 -0700
From: rmr531@gmail.com
Subject: Re: Simple GPA calculator program
Message-Id: <1149717498.865174.250280@f6g2000cwb.googlegroups.com>
Thanks, that should help quite a bit, I wish they showed us that kind
of stuff in class.
The book that we have is "Perl by Example" by Ellie Quigley. I
definately would not reccommend it, everyone in the class hates it,
including the instructor, but what can you do, we have to use what the
college wants us too even if they are wrong.
------------------------------
Date: Wed, 7 Jun 2006 17:53:33 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Simple GPA calculator program
Message-Id: <slrne8em7d.v1b.tadmc@magna.augustmail.com>
rmr531@gmail.com <rmr531@gmail.com> wrote:
> Thanks, that should help quite a bit,
You're welcome.
> I wish they showed us that kind
> of stuff in class.
Students in my classes get shown that kind of stuff. :-)
> The book that we have is "Perl by Example" by Ellie Quigley. I
> definately would not reccommend it, everyone in the class hates it,
Yeah, that book has a very poor reputation.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 06 Jun 2006 22:13:46 GMT
From: xhoster@gmail.com
Subject: Re: Sleep & print(f) problem
Message-Id: <20060606191850.567$CF@newsreader.com>
Frank <ppi@searchy.net> wrote:
>
> this works fine and throws as fast as it can the time to the FIFO. But
> when I activate the sleep routine, it never goes into lcd_write. (But it
> IS sleeping 1 sec at the time)
>
> I can't figure out why sleep would prevent the prints. (If I put an
> other sleep in the subroutine, I can see it doing it's sleep with strace)
>
> Can anyone figure out why the prints aren't working when using a sleep?
Buffering. Turn on autoflush on your fifo handle
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: Tue, 06 Jun 2006 16:29:46 -0700
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: Sleep & print(f) problem
Message-Id: <060620061629462440%jgibson@mail.arc.nasa.gov>
In article <4485f011$0$31650$e4fe514c@news.xs4all.nl>, Frank
<ppi@searchy.net> wrote:
> Hi,
>
> I got the following script:
>
> #!/usr/bin/perl
You should have
use strict;
use warnings;
here. Doing so will point out a bug in your program.
>
> use Time::HiRes qw( usleep ualarm gettimeofday tv_interval nanosleep );
> use POSIX;
>
> sub lcd_write {
> local $fh = shift;
my $fh = $_[0];
> $row1 = $_[1];
> $row2 = $_[2];
If you use shift above, then the string arguments are in $_[0] and
$_[1].
>
> printf($fh "%1d%1d%-8s\n",0,0,substr($row1,0,8));
> printf($fh "%1d%1d%-8s\n",1,0,substr($row2,0,8));
> print "write write";
>
> }
>
> open(FILE,"> ./fifo") || die "DOH!! $!";
It is best to use lexical file handles and the three-argument form of
open:
open(my $fh, '>', './fifo') or die "Can't open ./fifo: $!";
>
> while() {
While what? It is normal to have an expression to test here. I don't
know if the while statement has a default test or what it would be. It
appears to be *true*, but who knows.
while(1) {
> lcd_write(\*FILE,"See time",POSIX::strftime("%H:%M:%S",gmtime));
lcd_write($fh, ... );
>
> #sleep 1;
> }
>
> close(FILE);
close($fh);
>
>
>
> this works fine and throws as fast as it can the time to the FIFO. But
> when I activate the sleep routine, it never goes into lcd_write. (But it
> IS sleeping 1 sec at the time)
>
> I can't figure out why sleep would prevent the prints. (If I put an
> other sleep in the subroutine, I can see it doing it's sleep with strace)
>
> Can anyone figure out why the prints aren't working when using a sleep?
How long did you wait? You are writing output lines that don't have a
newline to a buffered file handle. You won't see any output until the
buffer fills up. On my system, putting a new line on the output coaxes
a buffer flush. You can also set the output to be unbuffered by setting
the $| variable to non-zero, which will turn off buffering for the
currently selected output file handle. So you can either unbuffer
standard output with a simple
$|++;
or unbuffer your FIFO with
my $old_fh = select(FILE);
$|++;
select($old_fh);
See 'perldoc -q buffer' for details.
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
------------------------------
Date: Tue, 6 Jun 2006 19:25:37 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Sleep & print(f) problem
Message-Id: <slrne8c781.nma.tadmc@magna.augustmail.com>
Jim Gibson <jgibson@mail.arc.nasa.gov> wrote:
> You can also set the output to be unbuffered by setting
^^^^^^^^^^
> the $| variable to non-zero, which will turn off buffering for the
^^^^^^^^^^^^^^^^^^
> currently selected output file handle.
Setting $| does NOT make output unbuffered.
Output is still buffered, but with $| true the buffer is flushed
a lot more often.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 07 Jun 2006 21:52:53 -0400
From: Frank Silvermann <invalid@invalid.net>
Subject: Re: The Nature of the =?UTF-8?B?4oCcVW5peCBQaGlsb3NvcGh54oCd?=
Message-Id: <4487822b$0$30709$ec3e2dad@news.usenetmonster.com>
Xah Lee wrote:
> The Nature of the “Unix Philosophy”
>
> Xah Lee, 2006-05
>
> In the computing industry, especially among unix community, we often
> hear that there's a “Unix Philosophy”. In this essay, i dissect the
> nature and characterization of such “unix philosophy”, as have been
> described by Brian Kernighan, Rob Pike, Dennis Ritchie, Ken Thompson,
> and Richard P Gabriel et al, and in recent years by Eric Raymond.
> Unix Philosophy.
> ----
> This article is archived at:
> http://xahlee.org/UnixResource_dir/writ/unix_phil.html
>
> Xah
> xah@xahlee.org
> ∑ http://xahlee.org/
>
Sigma may impress some, but it does not impress me until you realize
that philosophers can't count. That you have lower-case for the first
person nominative pronoun is one thing, but that you have a difference
in subject versus predicate is certainly something that Confucious
criticizes. frank
------------------
tja
------------------------------
Date: Thu, 08 Jun 2006 02:21:42 GMT
From: Keith Thompson <kst-u@mib.org>
Subject: Re: The Nature of the =?utf-8?q?=E2=80=9CUnix_Philosophy=E2=80=9D?=
Message-Id: <lnirncidzf.fsf@nuthaus.mib.org>
"Xah Lee" <xah@xahlee.org> writes:
> The Nature of the “Unix Philosophy”
>
> Xah Lee, 2006-05
___________________
/| /| | |
||__|| | Please do |
/ O O\__ NOT |
/ \ feed the |
/ \ \ trolls |
/ _ \ \ ______________|
/ |\____\ \ ||
/ | | | |\____/ ||
/ \|_|_|/ \ __||
/ / \ |____| ||
/ | | /| | --|
| | |// |____ --|
* _ | |_|_|_| | \-/
*-- _--\ _ \ // |
/ _ \\ _ // | /
* / \_ /- | - | |
* ___ c_c_c_C/ \C_c_c_c____________
(If you *must* post followups, please drop comp.lang.c from the
Newsgroups: header -- which doesn't imply that this is topical in any
of the other newsgroups to which it's posted.)
Xah: please consider creating your own newsgroup under alt.*. You can
post your long essays there and (if you absolutely insist on doing so)
post pointers to them elsewhere.
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
------------------------------
Date: 7 Jun 2006 16:42:15 -0700
From: "Sam" <saviourms@yahoo.co.in>
Subject: Unable to coonect to SQLite database file
Message-Id: <1149723735.503574.133460@g10g2000cwb.googlegroups.com>
Hello,
Perl newbie here. I am using SQLite3 for a project to learn DBI.
Getting the following error when trying to connect to the database
file: "unable to open database file(1) at dbdimp.c line 94 at tool.cgi
line
16."
-------------- The code -------------------
#!/usr/bin/perl -wT
use strict;
use warnings;
use CGI::Carp qw(fatalsToBrowser); #Output errors to browser
use DBI;
my $driver = 'SQLite';
my $database = '/path_to_database_file/data_v1.db3'; # db path
my $username = undef; # database username
my $password = undef; # database password
# Set up a connection string specific to this database
my $dsn = "DBI:$driver:database=$database";
# make the actual connection
my $dbh = DBI->connect($dsn, $username, $password) || die DBI->errstr;
# when you're done with the database, disconnect
$dbh->disconnect();
------------------ End Code ----------------------------
What could be the potential problem(s):
1. I made the Sqlite3 database file using SQLite SPY (
http://www.zeitungsjunge.de/delphi/sqlitespy/index.htm ) and then
uploaded it to the directory?
2. The path. The database directory is outside public_html from where
the CGI script executes?
The database file, and the directory where it exists have been chmoded
777.
Also, how can I find out what version of sqlite the DBD::SQLite module
is using?
------------------------------
Date: Wed, 7 Jun 2006 20:45:08 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Unable to coonect to SQLite database file
Message-Id: <slrne8f094.v9i.tadmc@magna.augustmail.com>
Sam <saviourms@yahoo.co.in> wrote:
> Perl newbie here. I am using SQLite3 for a project to learn DBI.
> use CGI::Carp qw(fatalsToBrowser); #Output errors to browser
You should get your CGI programs working from the command line
and move them to the CGI environment only after they have
been debugged.
> my $dbh = DBI->connect($dsn, $username, $password) || die DBI->errstr;
I think you should look up the precedence of = and || in perlop.pod.
> 2. The path. The database directory is outside public_html from where
> the CGI script executes?
If you can run it from the command line, then this one seems
a good candidate.
> The database file, and the directory where it exists have been chmoded
> 777.
That is a really bad idea!
You should never need wide-open permissions like that.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 7 Jun 2006 11:28:22 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Unicode statistics (uses Data::Alias)
Message-Id: <e66dbg.1ec.1@news.isolution.nl>
#!/usr/bin/perl
# Script-Id: unicount.pl.0990@ruud
# Subject: show Unicode statistics
use strict ;
use warnings ;
use Data::Alias ;
binmode STDOUT, ':utf8' ;
my @table =
# +--Name------+---qRegexp--------+-C-+-L-+-U-+
(
[ 'xdigit' , qr/[[:xdigit:]]/ , 0 , 0 , 0 ] ,
[ 'ascii' , qr/[[:ascii:]]/ , 0 , 0 , 0 ] ,
[ '\\d' , qr/\d/ , 0 , 0 , 0 ] ,
[ 'digit' , qr/[[:digit:]]/ , 0 , 0 , 0 ] ,
[ 'IsNumber' , qr/\p{IsNumber}/ , 0 , 0 , 0 ] ,
[ 'alpha' , qr/[[:alpha:]]/ , 0 , 0 , 0 ] ,
[ 'alnum' , qr/[[:alnum:]]/ , 0 , 0 , 0 ] ,
[ 'word' , qr/[[:word:]]/ , 0 , 0 , 0 ] ,
[ 'graph' , qr/[[:graph:]]/ , 0 , 0 , 0 ] ,
[ 'print' , qr/[[:print:]]/ , 0 , 0 , 0 ] ,
[ 'blank' , qr/[[:blank:]]/ , 0 , 0 , 0 ] ,
[ 'space' , qr/[[:space:]]/ , 0 , 0 , 0 ] ,
[ 'punct' , qr/[[:punct:]]/ , 0 , 0 , 0 ] ,
[ 'cntrl' , qr/[[:cntrl:]]/ , 0 , 0 , 0 ] ,
) ;
my @codepoints =
(
0x0000 .. 0xD7FF,
0xE000 .. 0xFDCF,
0xFDF0 .. 0xFFFD,
0x10000 .. 0x1FFFD,
0x20000 .. 0x2FFFD, # etc.
) ;
for my $row ( @table )
{
alias my ($name, $qrx, $count, $lower, $upper) = @$row ;
printf "\n%s\n", $name ;
my $n = 0 ;
for ( @codepoints )
{
local $_ = chr ; # int-2-char conversion
$n++ ;
if ( /$qrx/ )
{
$count++ ;
$lower++ if /[[:lower:]]/ ;
$upper++ if /[[:upper:]]/ ;
}
}
my $show_lower_upper =
($lower || $upper)
? sprintf( " (lower:%6d, upper:%6d)"
, $lower
, $upper
)
: '' ;
printf "%6d /%6d =%7.3f%%%s\n"
, $count
, $n
, 100 * $count / $n
, $show_lower_upper
}
print "\n" ;
__END__
--
Affijn, Ruud
"Gewoon is een tijger."
------------------------------
Date: 6 Jun 2006 20:15:25 -0700
From: atbusbook@aol.com
Subject: What news servers do you use
Message-Id: <1149650125.323577.62460@c74g2000cwc.googlegroups.com>
Hello i would like to configure Tbird to get some newsgrupes
------------------------------
Date: 6 Jun 2006 20:40:34 -0700
From: "David H. Cook" <David.Hubert.Cook@gmail.com>
Subject: Where might I find a 'newer' DBI.pm (source) file?
Message-Id: <1149651634.149560.118240@y43g2000cwc.googlegroups.com>
I've written perl code, and the file-type I've always created is ".pl".
But, I recently became aware that there are (source) files with the
extension
of ".pm". I encountered them this week when I downloaded, installed
and
configured a web application written entirely in Perl (CGI). When I
installed/configured it, it has its OWN copies of a whole series of
".pm"
files. But, when I run is configuration 'test' routine (to check
whether everything
is installed/configured and ready, I get an indication that one of
those
".pm" files is out-of-date...i.e. of too low a version number to
satisfy
their 'test' script.
So, my question is: What website do I go to,. to download NEWER
versions
of the needed ".pm" file? (If it matters, the only one I seem to need
is DBI.pm)
(Or, maybe I do NOT need to go outside to DOWNLOAD newer .pm files!?
Maybe my separate perl software (e.g. ActiveState Perl) contains these
source
.pm files, but just packaged inside some 'container' library or
whatever, and
that maybe I could (somehow) just extract newer version of DBI.pm from
there?)
TIA...
Dave
------------------------------
Date: 6 Jun 2006 20:56:06 -0700
From: "Owen" <xemoth@gmail.com>
Subject: Re: Where might I find a 'newer' DBI.pm (source) file?
Message-Id: <1149652566.300062.125940@f6g2000cwb.googlegroups.com>
David H. Cook wrote:
> I've written perl code, and the file-type I've always created is ".pl".
That's OK, an accepted custom to identify a script as being written in
Perl.
>
> But, I recently became aware that there are (source) files with the
> extension
> of ".pm". I encountered them this week when I downloaded, installed
> and
think of "pl" as a Perl Library and "pm"as a Perl Module which it
really is.
> So, my question is: What website do I go to,. to download NEWER
> versions
> of the needed ".pm" file? (If it matters, the only one I seem to need
> is DBI.pm)
http://search.cpan.org and place dbi in the search box
You might want to read up on CPAN
Xemoth
------------------------------
Date: Wed, 7 Jun 2006 00:41:53 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Where might I find a 'newer' DBI.pm (source) file?
Message-Id: <slrne8cpp1.ove.tadmc@magna.augustmail.com>
David H. Cook <David.Hubert.Cook@gmail.com> wrote:
>
> I've written perl code, and the file-type I've always created is ".pl".
That won't work.
Perl programs need to be a "text file" file-type.
(a filename extension is not the same as a file type.)
> But, I recently became aware that there are (source) files with the
> extension
> of ".pm".
It stands for "Perl Module" (ie. a library).
> I get an indication that one of
> those
> ".pm" files is out-of-date...i.e. of too low a version number to
> satisfy
> their 'test' script.
>
> So, my question is: What website do I go to,. to download NEWER
> versions
> of the needed ".pm" file? (If it matters, the only one I seem to need
> is DBI.pm)
perldoc -q module
What modules and extensions are available for Perl? What is CPAN?
What does CPAN/src/... mean?
How do I install a module from CPAN?
How do I keep my own module/library directory?
> Maybe my separate perl software (e.g. ActiveState Perl) contains these
> source
> .pm files, but just packaged inside some 'container' library or
> whatever, and
> that maybe I could (somehow) just extract newer version of DBI.pm from
> there?)
http://ppm.activestate.com/PPMPackages/
If you need the DBI module, then you will also need the DBD module
that corresponds to the database that you plan to use.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 7 Jun 2006 02:58:46 -0700
From: "David H. Cook" <David.Hubert.Cook@gmail.com>
Subject: Re: Where might I find a 'newer' DBI.pm (source) file?
Message-Id: <1149674326.417666.54320@i40g2000cwc.googlegroups.com>
Yes, ok, I went to 'CPAN' and entered 'DBI' in the search box
and yes, I looked all around.
I THINK I want the 'pure-perl' (which they seem to say is for people
LIKE ME), who
do NOT want the 'binary' form of DBI. But the ONLY option they seem to
offer is to
download it in a ".TAR.GZ", which would be FINE for Linux, but is NOT
ideal for Windows.
I'm running ACTIVE-STATE perl on Windows-XP Pro.
(I should have mentioned that earlier.)
One would THINK that CPAN would offer a .ZIP form (like most other
download sites do).
But, I saw no signs of that.
[Yeah, I KNOW I can go download and install a "TAR" equivalent for
Windows, and
a "GZ" unpacker or whatever for Windows.]
Is that my only solution, or did I just miss something on the CPAN
site?
TIA...
Dave
------------------------------
Date: Wed, 7 Jun 2006 12:06:49 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: Where might I find a 'newer' DBI.pm (source) file?
Message-Id: <e66fja.10k.1@news.isolution.nl>
David H. Cook schreef:
> I'm running ACTIVE-STATE perl on Windows-XP Pro.
> (I should have mentioned that earlier.)
Then you will also have a menu entry called "Perl Package Manager".
(Start / Programs / ActivePerl / ... )
Or do: Start / Run / ppm [Enter]
On the ppm-prompt, type help.
--
Affijn, Ruud
"Gewoon is een tijger."
------------------------------
Date: 7 Jun 2006 08:19:07 -0700
From: "David H. Cook" <David.Hubert.Cook@gmail.com>
Subject: Re: Where might I find a 'newer' DBI.pm (source) file?
Message-Id: <1149693547.775513.142360@j55g2000cwa.googlegroups.com>
Ok, YES, that HELPED.
With my Windows ACTIVE-STATE perl, there indeed
IS a 'package-manager'.
So, I launched it and told it to:
install DBI
and it did so.
But, now as I move further along, my 'acceptance-test'
checker goes further, but then flags that my perl is
missing a package called
DBD::mysql
So, I go back into my NEWFOUND package-manager and say:
install DBD::mysql
Sigh...this time, no luck. Package manager comes back with:
'Searching for DBD::mysql returned no results. Try a broader search
first'
Of course, THIS NEWBIE had NO CLUE what a broader-search means
or how to proceed.
Can someone please guide me thru THIS next issue??
TIA...
Dave [sigh...it always gets harder, just when you think you've solved
it.]
------------------------------
Date: Wed, 7 Jun 2006 18:38:04 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: Where might I find a 'newer' DBI.pm (source) file?
Message-Id: <e676ej.1b4.1@news.isolution.nl>
David H. Cook schreef:
> install DBD::mysql
Try DBD-mysql
See the installation section of
http://search.cpan.org/~capttofu/DBD-mysql-3.0004/lib/DBD/mysql.pm
--
Affijn, Ruud
"Gewoon is een tijger."
------------------------------
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 V10 Issue 9265
***************************************