[24244] in Perl-Users-Digest
Perl-Users Digest, Issue: 6435 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Apr 20 21:05:39 2004
Date: Tue, 20 Apr 2004 18:05: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 Tue, 20 Apr 2004 Volume: 10 Number: 6435
Today's topics:
Re: "cloning" perl / CPAN install (Walter Roberson)
ANNOUNCE: CGI::Session::ExpireSessions V 1.00 <ron@savage.net.au>
ANNOUNCE: CGI::Session::MembersArea V 2.00 <ron@savage.net.au>
ANNOUNCE: DBIx::MSAccess::Convert2Db V 1.03 <ron@savage.net.au>
Re: Bundle::Apache compilation errors <matthew.garrish@sympatico.ca>
Re: One question <jurgenex@hotmail.com>
Re: regular expression module? <jtc@shell.dimensional.com>
Re: regular expression module? (Walter Roberson)
Re: regular expression module? <uri.guttman@fmr.com>
Re: slurp not working? ideas please! <tadmc@augustmail.com>
Re: slurp not working? ideas please! <tadmc@augustmail.com>
Re: slurp not working? ideas please! <geoffacox@dontspamblueyonder.co.uk>
Re: slurp not working? ideas please! <geoffacox@dontspamblueyonder.co.uk>
sort numeric lists <King@ask.for.email.invalid>
Re: Upgrading perl from 5.02 to 5.8? (Mike Dross)
Re: Upgrading perl from 5.02 to 5.8? (Mike Dross)
Re: Upgrading perl from 5.02 to 5.8? <mgjv@tradingpost.com.au>
Re: Writing fast(er) performing parsers in Perl <clint@0lsen.net>
Re: Writing fast(er) performing parsers in Perl <uri@stemsystems.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 21 Apr 2004 00:31:44 GMT
From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Subject: Re: "cloning" perl / CPAN install
Message-Id: <c64fdg$doq$1@canopus.cc.umanitoba.ca>
In article <8ZGdnbKwNf6wDBjdRVn-gw@adelphia.com>,
Sherm Pendley <spamtrap@dot-app.org> wrote:
:Walter Roberson wrote:
:> cpan itself must have a way of doing this
:The "autobundle" command in the CPAN shell.
Thanks, I'll have a look at that.
:> I'd perfer not to have to dig through cpan source
:Did you also prefer not to have to dig through the "help" command?
It so happens that I'd scrolled through the entire cpan source already
once today, just a short time before, in order to answer another
poster's question about where exactly perl -MCPAN -e shell was
documented. I saw at that time that the cpan source was long and involved,
and would require hours of careful study in order to figure out
a clean way to do it from the cpan source. The remark was not one
of laziness: it was based upon having -already- looked and having seen
that the matter would be complex to work out.
As for your reference to the "help" command: here is what the help
menu says about autobundle as of perl 5.8.3:
[...]
autobundle Snapshot force cmd unconditionally do cmd
cpan> help autobundle
Detailed help not yet implemented
A remark: I "hang out" in a diverse set of technical newsgroups, and I
spend a fair bit of time contributing to those newsgroups, in
accordance to my knowledge, skills, and strengths. Even in this
newsgroup itself, before posting my question, I answered several
questions, and did a longish piece about parsing efficiency and finite
automata -- time spent trying to incrase people's understandings of
both the issue and the potential technical solutions. I "give" what I
can, and I have done so for many years. It thus seems to me not unfair
for me to occasionally recognize that some questions do not lie within
my strengths, and to pose the questions publically to be [if I am
fortunate] answered by someone who already knows the answer. The
person who answers does so based upon -their- strengths, and I'm left
more time to answer questions that fit in with -my- strengths.
Is my thinking on this matter wrong? Is that the true meaning of
Open Source -- that because one -can- read the source, that one
has a moral obligation to answer every question by oneself, no matter
how long it is likely to take, and no matter how much doing so is likely
to diminish one's time available for volunteering to help others?
--
Cottleston, Cottleston, Cottleston pie.
A bird can't whistle and neither can I. -- Pooh
------------------------------
Date: Mon, 19 Apr 2004 10:24:48 GMT
From: Ron Savage <ron@savage.net.au>
Subject: ANNOUNCE: CGI::Session::ExpireSessions V 1.00
Message-Id: <HwHuJH.1CoF@zorch.sf-bay.org>
The pure Perl module CGI::Session::ExpireSessions V 1.00
is available immediately from CPAN,
and from http://savage.net.au/Perl-modules.html.
On-line docs, and a *.ppd for ActivePerl are also
available from the latter site.
An extract from the docs:
1.00 Mon Apr 19 12:37:29 2004
- Original version
--
Cheers
Ron Savage, ron@savage.net.au on 19/04/2004
http://savage.net.au/index.html
------------------------------
Date: Sun, 18 Apr 2004 03:05:48 GMT
From: Ron Savage <ron@savage.net.au>
Subject: ANNOUNCE: CGI::Session::MembersArea V 2.00
Message-Id: <HwHuIx.233D@zorch.sf-bay.org>
The pure Perl module CGI::Session::MembersArea V 2.00
is available immediately from CPAN,
and from http://savage.net.au/Perl-modules.html.
On-line docs, and a *.ppd for ActivePerl are also
available from the latter site.
An extract from the docs:
2.00 Fri Apr 16 13:43:00 2004
- Chop all references to CGI::Session. Putting this module into production exposed the
reality that it was way too complex, so I've refactored it on the assumption that
the code using this module will also use CGI::Session. Hence, the code to save the
user's profile into a database via CGI::Session is assumed to be elsewhere in your
program and not in this module
- Chop object attributes with these names:
o session_attributes
o session_driver
o session_id_name
o session_timeout
- Chop parameter to sub new() with this name:
o session_driver
- Chop sub id()
- Chop sub param()
- Change the return values for sub init() to now be one of:
o $profile, a hash ref
o undef
- Add to docs a note on how to handle the case where you do not wish to have an
input field for 'resource'
- Various clean up within the docs
The demo program, myadmin.cgi V 2.01, at
http://savage.net.au/Perl-tutorials.html
(# 41) has been updated to match.
--
Cheers
Ron Savage, ron@savage.net.au on 18/04/2004
http://savage.net.au/index.html
------------------------------
Date: Sun, 18 Apr 2004 03:07:02 GMT
From: Ron Savage <ron@savage.net.au>
Subject: ANNOUNCE: DBIx::MSAccess::Convert2Db V 1.03
Message-Id: <HwHuJ5.23HD@zorch.sf-bay.org>
1.03 Fri Apr 16 11:09:36 2004
- There are no code changes in this version
- Stop shipping Makefile.PL. Encourage users to install Module::Build, and to
then install this module via the mantra:
perl Build.PL
perl Build
perl Build test
perl Build install
Thanx to Mike Castle for reporting an error with Makefile.PL
- Fix a cut-and-paste error in the POD where DBIx::MSAccess::Convert2Db had the
last colon missing in 7 lines. Thanx to Mike Castle for reporting this
--
Cheers
Ron Savage, ron@savage.net.au on 18/04/2004
http://savage.net.au/index.html
------------------------------
Date: Tue, 20 Apr 2004 20:39:09 -0400
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: Bundle::Apache compilation errors
Message-Id: <Kojhc.49624$Gp4.1038137@news20.bellglobal.com>
"gunzip" <none@none.com> wrote in message
news:hNfhc.34990$Y%6.4546270@wards.force9.net...
> A. Sinan Unur wrote:
>
> > You can read, can't you?
>
> >
> > This issue relates to your lack of knowledge of basic system
administration
> > skills.
> >
>
> Look, shitface, if I wanted a complete idiot to answer my post, I'd have
> asked for one. Go back to your burrow.
>
What a mature attitude. Maybe you should put back on the training wheels and
use PHP. Your contribution here certainly won't be missed.
Matt
------------------------------
Date: Tue, 20 Apr 2004 22:22:33 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: One question
Message-Id: <Johhc.30872$L31.23659@nwrddc01.gnilink.net>
edgrsprj wrote:
> [...] Most of the trouble I have
> encountered lately has been with all of the complex data manipulation
> operations the program performs. And you
> would have those types of problems no matter what language was used.
Then why on earth do you continue to post to a Perl NG? Take your stuff to a
NG that either cares about your subject matter or about data structures and
algorithms.
Earthquake prediction is about as off topic in a Perl NG as a question about
how to deduct my home office on my tax return would be in a NG about C
(after all, my Tax program is written in C).
jue
------------------------------
Date: 20 Apr 2004 18:16:12 -0600
From: Jim Cochrane <jtc@shell.dimensional.com>
Subject: Re: regular expression module?
Message-Id: <slrnc8bfac.cph.jtc@shell.dimensional.com>
In article <c640tf$nn9$1@canopus.cc.umanitoba.ca>, Walter Roberson wrote:
> In article <pkent77tea-9AB303.20023020042004@pth-usenet-02.plus.net>,
> pkent <pkent77tea@yahoo.com.tea> wrote:
>:In article <c63ivi$5il$1@canopus.cc.umanitoba.ca>,
>: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson) wrote:
>
>:<snip interesting stuff about regexes>
>
>:> 'yacc' is a well known program that does all the work of building
>:> up compiled DFA, complete with some kind of state-table compression
>:> so that the result is both space and time efficient. But yacc produces
>:> C code. I seem to recall hearing of a yacc implimentation that
>:> had an option for spitting out perl. Or was that a 'lex' program?
>:> I do not remember clearly.
>
>:Would you be thinking of yapp? As in:
>
>:http://search.cpan.org/~fdesar/Parse-Yapp-1.05/lib/Parse/Yapp.pm
>
> I was not, but thank you for the reference. I seem to recall seeing
> [years ago] a version of yacc with an explicit perl option. I might
> be able to find it again if I looked around.
>
> But getting back to my original question: although Yapp does appear to
> have a lot of functionality useful for my purposes, the module that
> I am remembering as having seen mentioned, was, as best I recall,
> just an RE (as opposed to regex) compiler and FSM driver, without the
> full LALR parsing facilities of yacc/yapp. Useful if, for example,
> one had a large number of simple RE's (or just plain strings) to match
> against. join('|', @wordlist) is not very efficient to match against
> in perl, even if one qr's it, as perl backtracks because it assumes
> later portions of the expression might require the full regexp power.
>
> Maybe I should be looking more closely at the regexp optimizer... but
> boy does it produce ugly expressions! ;-)
Sorry to ask the obvious, but did you try some carefully-worded google
searches?
--
Jim Cochrane; jtc@dimensional.com
[When responding by email, include the term non-spam in the subject line to
get through my spam filter.]
------------------------------
Date: 21 Apr 2004 00:42:59 GMT
From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Subject: Re: regular expression module?
Message-Id: <c64g2j$eis$1@canopus.cc.umanitoba.ca>
In article <slrnc8bfac.cph.jtc@shell.dimensional.com>,
Jim Cochrane <jtc@shell.dimensional.com> wrote:
:In article <c640tf$nn9$1@canopus.cc.umanitoba.ca>, Walter Roberson wrote:
:> But getting back to my original question: although Yapp does appear to
:> have a lot of functionality useful for my purposes, the module that
:> I am remembering as having seen mentioned, was, as best I recall,
:> just an RE (as opposed to regex) compiler and FSM driver, without the
:> full LALR parsing facilities of yacc/yapp.
:Sorry to ask the obvious, but did you try some carefully-worded google
:searches?
Yes, I spent a couple of hours looking for what I thought I remembered
existing, including examining the thread topic of everything in the
time range that I thought I had seen the particular message in.
It is possible that I did not happen upon the right keywords when I
did the search, but I did try a variety of approaches, and my ability
to elicit useful information from google is usually quite good.
--
"[...] it's all part of one's right to be publicly stupid." -- Dave Smey
------------------------------
Date: 20 Apr 2004 13:58:47 -0400
From: Uri Guttman <uri.guttman@fmr.com>
Subject: Re: regular expression module?
Message-Id: <sisczn965y5k.fsf@tripoli.fmr.com>
>>>>> "WR" == Walter Roberson <roberson@ibd.nrc-cnrc.gc.ca> writes:
WR> 'yacc' is a well known program that does all the work of building
WR> up compiled DFA, complete with some kind of state-table compression
WR> so that the result is both space and time efficient. But yacc produces
WR> C code. I seem to recall hearing of a yacc implimentation that
WR> had an option for spitting out perl. Or was that a 'lex' program?
WR> I do not remember clearly.
search google for perl-byacc
uri
------------------------------
Date: Tue, 20 Apr 2004 18:55:29 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: slurp not working? ideas please!
Message-Id: <slrnc8be3h.9va.tadmc@magna.augustmail.com>
Geoff Cox <geoffacox@dontspamblueyonder.co.uk> wrote:
> On Tue, 20 Apr 2004 08:19:32 -0500, Tad McClellan
><tadmc@augustmail.com> wrote:
Please don't say I wrote stuff and then supply nothing that I wrote!
[ snip 180 lines that Tad *did not* write ]
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 20 Apr 2004 19:01:06 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: slurp not working? ideas please!
Message-Id: <slrnc8bee2.9va.tadmc@magna.augustmail.com>
Geoff Cox <geoffacox@dontspamblueyonder.co.uk> wrote:
> I have used perltody programme so hoep this looks OK?
Is there anybody in there?
Just nod if you can hear me.
> open (OUT, ">>d:/a-keep9/short-nondb/short/members2/test.htm");
<broken-record>
You should always, yes *always*, check the return value from open().
This has been pointed out to you before.
Do you actually read the followups to your posts?
</broken-record>
Once you know that you should check the return value from open()
we kinda expect that you _will_ check the return value from open().
I get the feeling I am "talking to the hand".
I'm giving up on you.
> my ($curr, $next1, $next2, $next3) = <INNN>;
> print ("$curr - $next1 - $next2 - $next3 \n");
I doubt that perltidy indents like that...
> for ($c=1;$c<$nn;$c++) {
foreach my $c ( 1 .. $nn ) {
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 21 Apr 2004 00:24:11 GMT
From: Geoff Cox <geoffacox@dontspamblueyonder.co.uk>
Subject: Re: slurp not working? ideas please!
Message-Id: <b0fb805is02s8itbeptkvbsfj4m2u5rc1r@4ax.com>
On 20 Apr 2004 21:29:05 GMT, "Tassilo v. Parseval"
<tassilo.parseval@rwth-aachen.de> wrote:
>I am quite sure your program will magically start working once you
>change it accordingly to what I've written.
Tassilo,
Not quite there yet - although a million thanks for the care you have
taken to explain how wrong I was. The light is beginning to dawn!
The code below brings up 2 warnings
1. use of inherited AUTOLOAD for non-method MyParser::choice() is
deprecated at line 26 - ie
choice( $attr->{ value } );
2. can't locate auto /yParser/choice.al in @INC (@INC contains:
D:/perl/lib D:/perl/site/lib .) at line 24 - ie
if ( $tagname eq 'option' ) {
As warning 1 says "deprecated" I am guessing that this is not stopping
the script? How about warning 2?
Also, how do I deal with the print OUT in sub text?
sub text {
my ( $self, $origtext ) = @_;
print OUT ("<h2>$origtext</h2> \n") if $in_heading;
print OUT ("<p>$origtext</p> \n") if $in_p;
At this point the file has not been opened ...?
Cheers
Geoff
package MyParser;
use base qw(HTML::Parser);
use strict;
use diagnostics;
my ($in_heading,$in_p);
sub reset { ($in_heading,$in_p)=(0,0)}
sub start {
my ( $self, $tagname, $attr, undef, $origtext ) = @_;
if ( $tagname eq 'h2' ) {
$in_heading = 1;
return;
}
if ( $tagname eq 'p' ) {
$in_p = 1;
return;
}
if ( $tagname eq 'option' ) {
choice( $attr->{ value } );
}
}
sub end {
my ( $self, $tagname, $origtext ) = @_;
if ( $tagname eq 'h2' ) {
$in_heading = 0;
return;
}
if ( $tagname eq 'p' ) {
$in_p = 0;
return;
}
}
sub text {
my ( $self, $origtext ) = @_;
print OUT ("<h2>$origtext</h2> \n") if $in_heading;
print OUT ("<p>$origtext</p> \n") if $in_p;
}
package main;
use File::Find;
my $dir = "d:/a-keep9/short-nondb/oldshort2";
my $parser = MyParser->new;
find sub {
my $name = $_;
open( OUT, ">>d:/a-keep9/short-nondb/short/members2/$name" );
|| die "can't open d:/a-keep9/short-nondb/short/members2/$name:
$!";
print OUT ("<html><head><title>test</title></head><body> \n");
print OUT ("<table width='100%' border='1'> \n");
undef $/;
$parser->parse_file($_);
$parser->reset;
}, $dir;
sub choice {
my ($path) = @_;
if ( $path =~ /docs\/btec-first/ ) {
intro($path);
btecfirst($path);
}
elsif ( $path =~ /docs\/aslevel\/classroom-notes/ ) {
intro($path);
aslevelclassroomnotes($path);
}
elsif ( $path =~ /docs\/avce\/assignments/ ) {
intro($path);
avceassignments($path);
}
elsif ( $path =~
/docs\/aslevel\/simulations\/second-severn-bridge/ ) {
intro($path);
aslevelsimulationssevern($path);
}
elsif ( $path =~ /docs\/aslevel\/debates\/wind-farm-debate/ ) {
intro($path);
asleveldebateswindfarm($path);
}
elsif ( $path =~ /docs\/economics\/section1/ ) {
intro($path);
economicssection1($path);
}
elsif ( $path =~ /docs\/economics\/section2/ ) {
intro($path);
economicssection2($path);
}
elsif ( $path =~ /docs\/economics\/section3/ ) {
intro($path);
economicssection3($path);
}
elsif ( $path =~ /docs\/gcse\/classroom-notes/ ) {
intro($path);
gcseclassroomnotes($path);
}
elsif ( $path =~
/docs\/gcse\/student-activities\/games\/ice-lolly/ ) {
intro($path);
gcsegamesicelolly($path);
}
elsif ( ( $path =~ /docs\/gnvq-int\/assignments/ )
&& ( $path !~
/gnvq-int\/assignments\/gnvq-int-write-assignment/ ) )
{
intro($path);
gnvqintassignments($path);
}
elsif ( $path =~ /docs\/vgcse\/course-units/ ) {
intro($path);
vgcsecourseunits($path);
}
elsif ( $path =~
/docs\/gcse\/student-activities\/business-location/ ) {
intro($path);
gcsestudentactivitiesbusinesslocation($path);
}
elsif ( $path =~
/docs\/gcse\/student-activities\/business-structure-decisions/ )
{
intro($path);
gcsestudentactivitiesbusinessstructuredecisions($path);
}
elsif ( $path =~ /docs\/gcse\/student-activities\/finance/ ) {
intro($path);
gcsestudentactivitiesfinance($path);
}
elsif ( $path =~ /docs\/gcse\/student-activities\/marketing/ ) {
intro($path);
gcsestudentactivitiesmarketing($path);
}
elsif ( $path =~ /docs\/gcse\/student-activities\/people-at-work/
) {
intro($path);
gcsestudentactivitiespeopleatwork($path);
}
elsif ( $path =~ /docs\/gcse\/student-activities\/production/ ) {
intro($path);
gcsestudentactivitiesproduction($path);
}
else {
intro($path);
other($path);
}
}
sub intro {
my ($pathhere) = @_;
open( INN, "d:/a-keep9/short-nondb/db/total-160404.txt" );
my $lineintro;
while ( defined( $lineintro = <INN> ) ) {
if ( $lineintro =~ /$pathhere','(.*?)'\)\;/ ) {
print OUT ("<tr><td>$1 <p> </td>\n");
}
}
}
sub btecfirst {
my ($pattern) = @_;
my $linee = $pattern;
my $c = 0;
$linee =~ /.*unit(\d).*?chap(\d)/;
my $u = $1;
my $chap = $2;
open( INNN, "d:/a-keep9/short-nondb/allphp/allphp2.php" );
while (<INNN>) {
last if /$pattern/;
}
my ( $curr, $next1, $next2, $next3 ) = <INNN>;
close(INNN);
if ( $next3 =~ /\$i\<(\d);/ ) {
my $nn = $1;
print OUT ("<td valign='top'>\n");
for ( my $c = 1 ; $c < $nn ; $c++ ) {
print OUT (
'<a href="' . $pattern . "/unit" . $u . "-chap" .
$chap . "-doc"
. $c . ".zip" . '">'
. "Document$c"
. "</a><br>"
. "\n" );
}
print OUT ("</td></tr>\n");
}
}
sub aslevelclassroomnotes {
my ($pattern) = @_;
my $c;
print("\$pattern = $pattern \n");
open( INNN, "d:/a-keep9/short-nondb/allphp/allphp2.php" );
my $line = <INNN>;
while (<INNN>) {
last if /$pattern/;
}
my ( $curr, $next1, $next2, $next3 ) = <INNN>;
print("$curr - $next1 - $next2 - $next3 \n");
close(INNN);
if ( $next3 =~ /\$i\<(\d+);/ ) {
my $nn = $1;
print("\$nn = $nn \n");
print OUT ("<td valign='top'> \n");
for ( $c = 1 ; $c < $nn ; $c++ ) {
print OUT ( '<a href="' . $pattern . "-doc" . $c .
".zip" . '">'
. "Document$c"
. "</a><br>"
. "\n" );
}
print OUT ("</td></tr>\n");
}
}
sub other {
my ($pattern) = @_;
print OUT ("<td valign='top'> \n");
print OUT ( '<a href="' . $pattern . ".zip" . '">'
. "Document"
. "</a><br>"
. "\n" );
print OUT ("</td></tr>\n");
}
sub avceassignments {
my ($pattern) = @_;
print OUT ("<td valign='top'> \n");
print OUT ( '<a href="' . $pattern . ".zip" . '">'
. "Document"
. "</a><br>"
. "\n" );
print OUT ( '<a href="' . $pattern . "-grid" . ".zip" . '">' .
"Grid"
. "</a><br>"
. "\n" );
print OUT ("</td></tr>\n");
}
sub aslevelsimulationssevern {
my ($pattern) = @_;
print OUT ("<td valign='top'> \n");
print OUT ( '<a href="' . $pattern . ".zip" . '">'
. "Teacher's pack"
. "</a><br>"
. "\n" );
print OUT ( '<a href="' . $pattern . "-sp" . ".zip" . '">'
. "Student's Pack"
. "</a><br>"
. "\n" );
print OUT ( '<a href="' . $pattern . "-swb" . ".zip" . '">'
. "Student's Workbook"
. "</a><br>"
. "\n" );
print OUT ( '<a href="' . $pattern . "-dbp" . ".zip" . '">'
. "Debriefing Pack"
. "</a><br>"
. "\n" );
print OUT ("</td></tr>\n");
}
sub asleveldebateswindfarm {
my ($pattern) = @_;
print OUT ("<td valign='top'> \n");
print OUT ( '<a href="' . $pattern . ".zip" . '">'
. "Teacher's pack"
. "</a><br>"
. "\n" );
print OUT ( '<a href="' . $pattern
. "-a-company" . ".zip" . '">'
. "Adviser's Pack - Company"
. "</a><br>"
. "\n" );
print OUT ( '<a href="' . $pattern
. "-a-council" . ".zip" . '">'
. "Adviser's Pack - Council"
. "</a><br>"
. "\n" );
print OUT ( '<a href="' . $pattern
. "-s-company" . ".zip" . '">'
. "Student's Pack - Company"
. "</a><br>"
. "\n" );
print OUT ( '<a href="' . $pattern
. "-s-council" . ".zip" . '">'
. "Student's Pack - Council"
. "</a><br>"
. "\n" );
print OUT ( '<a href="' . $pattern
. "-s-workbook" . ".zip" . '">'
. "Student's Workbook"
. "</a><br>"
. "\n" );
print OUT ( '<a href="' . $pattern
. "-arbitrator" . ".zip" . '">'
. "Arbitrator's Pack"
. "</a><br>"
. "\n" );
print OUT ("</td></tr>\n");
}
sub economicssection1 {
my ($pattern) = @_;
my $c = 0;
open( INNN, "d:/a-keep9/short-nondb/allphp/allphp2.php" );
while (<INNN>) {
last if /$pattern/;
}
my ( $curr, $next1, $next2, $next3 ) = <INNN>;
close(INNN);
if ( $next3 =~ /\$i\<(\d+);/ ) {
my $nn = $1;
print OUT ("<td valign='top'> \n");
for ( $c = 1 ; $c < $nn ; $c++ ) {
print OUT ( '<a href="' . $pattern
. "/section1-doc"
. $c . ".zip" . '">'
. "Document$c"
. "</a><br>"
. "\n" );
}
print OUT ("</td></tr>\n");
}
}
sub economicssection2 {
my ($pattern) = @_;
my $c = 0;
open( INNN, "d:/a-keep9/short-nondb/allphp/allphp2.php" );
while (<INNN>) {
last if /$pattern/;
}
my ( $curr, $next1, $next2, $next3 ) = <INNN>;
close(INNN);
if ( $next3 =~ /\$i\<(\d+);/ ) {
my $nn = $1;
print OUT ("<td valign='top'> \n");
for ( $c = 1 ; $c < $nn ; $c++ ) {
print OUT ( '<a href="' . $pattern
. "/section2-doc"
. $c . ".zip" . '">'
. "Document$c"
. "</a><br>"
. "\n" );
}
print OUT ("</td></tr>\n");
}
}
sub economicssection3 {
my ($pattern) = @_;
my $c = 0;
open( INNN, "d:/a-keep9/short-nondb/allphp/allphp2.php" );
while (<INNN>) {
last if /$pattern/;
}
my ( $curr, $next1, $next2, $next3 ) = <INNN>;
close(INNN);
if ( $next3 =~ /\$i\<(\d+);/ ) {
my $nn = $1;
print OUT ("<td valign='top'> \n");
for ( $c = 1 ; $c < $nn ; $c++ ) {
print OUT ( '<a href="' . $pattern
. "/section3-doc"
. $c . ".zip" . '">'
. "Document$c"
. "</a><br>"
. "\n" );
}
print OUT ("</td></tr>\n");
}
}
sub gcseclassroomnotes {
my ($pattern) = @_;
my $c = 0;
open( INNN, "d:/a-keep9/short-nondb/allphp/allphp2.php" );
while (<INNN>) {
last if /$pattern/;
}
my ( $curr, $next1, $next2, $next3 ) = <INNN>;
close(INNN);
if ( $next3 =~ /\$i\<(\d+);/ ) {
my $nn = $1;
print OUT ("<td valign='top'> \n");
for ( $c = 1 ; $c < $nn ; $c++ ) {
print OUT ( '<a href="' . $pattern . "-doc" . $c .
".zip" . '">'
. "Document$c"
. "</a><br>"
. "\n" );
}
print OUT ("</td></tr>\n");
}
}
sub gcsegamesicelolly {
my ($pattern) = @_;
print OUT ("<td valign='top'> \n");
print OUT ( '<a href="' . $pattern . ".zip" . '">'
. "Teacher's Pack"
. "</a><br>"
. "\n" );
print OUT ( '<a href="' . $pattern
. "-runners" . ".zip" . '">'
. "Runner's Pack"
. "</a><br>"
. "\n" );
print OUT ( '<a href="' . $pattern
. "-adjudicators" . ".zip" . '">'
. "Adjudicator's Pack"
. "</a><br>"
. "\n" );
print OUT ("</td></tr>\n");
}
sub gnvqintassignments {
my ($pattern) = @_;
print OUT ("<td valign='top'> \n");
print OUT ( '<a href="' . $pattern . ".zip" . '">'
. "Document"
. "</a><br>"
. "\n" );
print OUT ( '<a href="' . $pattern . "-grid" . ".zip" . '">' .
"Grid"
. "</a><br>"
. "\n" );
print OUT ("</td></tr>\n");
}
sub vgcsecourseunits {
my ($pattern) = @_;
my $c = 0;
open( INNN, "d:/a-keep9/short-nondb/allphp/allphp2.php" );
while (<INNN>) {
last if /$pattern/;
}
my ( $curr, $next1, $next2, $next3 ) = <INNN>;
close(INNN);
if ( $next3 =~ /\$i\<(\d+);/ ) {
my $nn = $1;
print OUT ("<td valign='top'> \n");
for ( $c = 1 ; $c < $nn ; $c++ ) {
print OUT ( '<a href="' . $pattern . "-chap" . $c .
".zip" . '">'
. "Document$c"
. "</a><br>"
. "\n" );
}
print OUT ("</td></tr>\n");
}
}
sub para {
my ($name) = @_;
my $line;
open( INPARA, "d:/a-keep9/short-nondb/progs/para2/$name" );
undef $/;
$line = <INPARA>;
print OUT ("<tr><td colspan='2'> \n");
print OUT $line;
print OUT ("</td></tr> \n");
$/ = "\n";
}
sub getpara {
local $/ = "\0d\0a";
my ($name) = @_;
my $line;
open( GETPARA, "d:/a-keep9/short-nondb/old-short/$name" );
open( OUTPARA, ">>d:/a-keep9/short-nondb/progs/para2/$name" );
while ( defined( $line = <GETPARA> ) ) {
if ( $line =~ /<p>(.*?)<\/p>/s ) {
print OUTPARA ("$1 \n");
}
}
#close(GETPARA);
#close(OUTPARA);
}
sub gcsestudentactivitiesbusinesslocation {
my ($pattern) = @_;
my $c = 0;
open( INNN, "d:/a-keep9/short-nondb/allphp/allphp2.php" );
while (<INNN>) {
last if /$pattern/;
}
my ( $curr, $next1, $next2, $next3 ) = <INNN>;
close(INNN);
if ( $next3 =~ /\$i\<(\d+);/ ) {
my $nn = $1;
print OUT ("<td valign='top'> \n");
for ( $c = 1 ; $c < $nn ; $c++ ) {
print OUT ( '<a href="' . $pattern
. "/location-doc"
. $c . ".zip" . '">'
. "Document$c"
. "</a><br>"
. "\n" );
}
print OUT ("</td></tr>\n");
}
}
sub gcsestudentactivitiesbusinessstructuredecisions {
my ($pattern) = @_;
my $c = 0;
open( INNN, "d:/a-keep9/short-nondb/allphp/allphp2.php" );
while (<INNN>) {
last if /$pattern/;
}
my ( $curr, $next1, $next2, $next3 ) = <INNN>;
close(INNN);
if ( $next3 =~ /\$i\<(\d+);/ ) {
my $nn = $1;
print OUT ("<td valign='top'> \n");
for ( $c = 1 ; $c < $nn ; $c++ ) {
print OUT ( '<a href="' . $pattern
. "/bsd-doc"
. $c . ".zip" . '">'
. "Document$c"
. "</a><br>"
. "\n" );
}
print OUT ("</td></tr>\n");
}
}
sub gcsestudentactivitiesfinance {
my ($pattern) = @_;
my $c = 0;
open( INNN, "d:/a-keep9/short-nondb/allphp/allphp2.php" );
while (<INNN>) {
last if /$pattern/;
}
my ( $curr, $next1, $next2, $next3 ) = <INNN>;
close(INNN);
if ( $next3 =~ /\$i\<(\d+);/ ) {
my $nn = $1;
print OUT ("<td valign='top'> \n");
for ( $c = 1 ; $c < $nn ; $c++ ) {
print OUT ( '<a href="' . $pattern
. "/finance-doc"
. $c . ".zip" . '">'
. "Document$c"
. "</a><br>"
. "\n" );
}
print OUT ("</td></tr>\n");
}
}
sub gcsestudentactivitiesmarketing {
my ($pattern) = @_;
my $c = 0;
open( INNN, "d:/a-keep9/short-nondb/allphp/allphp2.php" );
while (<INNN>) {
last if /$pattern/;
}
my ( $curr, $next1, $next2, $next3 ) = <INNN>;
close(INNN);
if ( $next3 =~ /\$i\<(\d+);/ ) {
my $nn = $1;
print OUT ("<td valign='top'> \n");
for ( $c = 1 ; $c < $nn ; $c++ ) {
print OUT ( '<a href="' . $pattern
. "/marketing-doc"
. $c . ".zip" . '">'
. "Document$c"
. "</a><br>"
. "\n" );
}
print OUT ("</td></tr>\n");
}
}
sub gcsestudentactivitiespeopleatwork {
my ($pattern) = @_;
my $c = 0;
open( INNN, "d:/a-keep9/short-nondb/allphp/allphp2.php" );
while (<INNN>) {
last if /$pattern/;
}
my ( $curr, $next1, $next2, $next3 ) = <INNN>;
close(INNN);
if ( $next3 =~ /\$i\<(\d+);/ ) {
my $nn = $1;
print OUT ("<td valign='top'> \n");
for ( $c = 1 ; $c < $nn ; $c++ ) {
print OUT ( '<a href="' . $pattern
. "/people-doc"
. $c . ".zip" . '">'
. "Document$c"
. "</a><br>"
. "\n" );
}
print OUT ("</td></tr>\n");
}
}
sub gcsestudentactivitiesproduction {
my ($pattern) = @_;
my $c = 0;
open( INNN, "d:/a-keep9/short-nondb/allphp/allphp2.php" );
while (<INNN>) {
last if /$pattern/;
}
my ( $curr, $next1, $next2, $next3 ) = <INNN>;
close(INNN);
if ( $next3 =~ /\$i\<(\d+);/ ) {
my $nn = $1;
print OUT ("<td valign='top'> \n");
for ( $c = 1 ; $c < $nn ; $c++ ) {
print OUT ( '<a href="' . $pattern
. "/production-doc"
. $c . ".zip" . '">'
. "Document$c"
. "</a><br>"
. "\n" );
}
print OUT ("</td></tr>\n");
}
}
------------------------------
Date: Wed, 21 Apr 2004 00:33:08 GMT
From: Geoff Cox <geoffacox@dontspamblueyonder.co.uk>
Subject: Re: slurp not working? ideas please!
Message-Id: <crfb80p35f9n6v2uv38gg7asfal5lojrfq@4ax.com>
On Tue, 20 Apr 2004 19:01:06 -0500, Tad McClellan
<tadmc@augustmail.com> wrote:
>I doubt that perltidy indents like that...
Tad,
Correct - I did post the wrong layout - apologies. I did correct this
with a second post.
My code was badly wrong re the OOP. Tassilo has really helped by
making clear how this works. My reply to his posting shows my "best"
so far.
Do hope you can hang on just a little longer as I am starting to get
the hang of this !
Re the checking with die etc. I am using this but it seems that my
code is wrong in that it does not get a file to parse the first time
round but does after that...so to be able to continue I either # the
line or remove it....bad I know but only able to attempt to solve one
problem at a time..
Thanks
Geoff
------------------------------
Date: Wed, 21 Apr 2004 00:26:51 GMT
From: The King of Pots and Pans <King@ask.for.email.invalid>
Subject: sort numeric lists
Message-Id: <fdjhc.65339$U83.9813@fed1read03>
On disk I have a 2d table of numbers. Something like this:
9 8 6
4 5 6
I read it in so that I have a list of references to lists. In other
words, a list of the rows.
I want to first sort by column 2, then column 3. When I sort by column
2 I get:
4 5 6
9 8 6
As expected because 5 < 8. When I sort by column 3 I get:
9 8 6
4 5 6
This is unexpected. Since 6 = 6, I don't want it to perform the
sort. See how it was already sorted by column 2 when column 3 elements
were equal, but now column 2 is unsorted again.
--
The King of Pots and Pans
------------------------------
Date: 20 Apr 2004 16:14:31 -0700
From: supercell@carolina.rr.com (Mike Dross)
Subject: Re: Upgrading perl from 5.02 to 5.8?
Message-Id: <45277b3.0404201514.516f17b4@posting.google.com>
Sherm Pendley <spamtrap@dot-app.org> wrote in message news:<odadnX0iduflHRndRVn-sA@adelphia.com>...
> Mike Dross wrote:
>
> > I have Mandrake 7.1 which installed Perl 5.02.
>
> Are you certain? 5.002 is from 1996 - 7.1 is old, but I don't think it's
> *that* old. What version number does 'perl -v' report?
[wxp@wxserver4 wxp]$ perl -v
This is perl, version 5.005_03 built for i386-linux
>
> > have ftp'd a perl 5.8 rpm for Red Hat. If I install this will it work or
> > will it break the perl?
>
> I wouldn't expect it to work. You'd probably need a Mandrake RPM. I'm not a
> Linux expert, though.
I have searched and have not been able to find a Mandrake Perl RPM.
Thanks for your help.
Mike
>
> sherm--
------------------------------
Date: 20 Apr 2004 16:15:56 -0700
From: supercell@carolina.rr.com (Mike Dross)
Subject: Re: Upgrading perl from 5.02 to 5.8?
Message-Id: <45277b3.0404201515.3e81f253@posting.google.com>
Tad McClellan <tadmc@augustmail.com> wrote in message news:<slrnc89409.5cs.tadmc@magna.augustmail.com>...
> Mike Dross <supercell@carolina.rr.com> wrote:
>
> > Is there anyway to upgrade perl 5.02 to 5.8 without installing a new OS?
>
>
> Yes. That is in fact the _normal_ situation.
>
> What makes you think that a new OS is involved?
>
> I see a "new perl" but what does that have to do with chaning the OS?
The thing is I don't know how to upgrade the perl, without an RPM. I am sure
there is a way, but I don't know how. Can you point me to some instructions?
Thanks for your help.
Mike
------------------------------
Date: 20 Apr 2004 23:50:46 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: Upgrading perl from 5.02 to 5.8?
Message-Id: <slrnc8bdql.uev.mgjv@verbruggen.comdyn.com.au>
On 20 Apr 2004 16:15:56 -0700,
Mike Dross <supercell@carolina.rr.com> wrote:
> Tad McClellan <tadmc@augustmail.com> wrote in message news:<slrnc89409.5cs.tadmc@magna.augustmail.com>...
>> Mike Dross <supercell@carolina.rr.com> wrote:
>>
>> > Is there anyway to upgrade perl 5.02 to 5.8 without installing a new OS?
>>
>>
>> Yes. That is in fact the _normal_ situation.
>>
>> What makes you think that a new OS is involved?
>>
>> I see a "new perl" but what does that have to do with chaning the OS?
>
> The thing is I don't know how to upgrade the perl, without an RPM. I am sure
> there is a way, but I don't know how. Can you point me to some instructions?
Don't upgrade. Leave that Perl as-is, and install another one
somewhere else.
Download the sources for Perl (www.cpan.org), unpack the archive, open
up the INSTALL file, and do something like:
$ sh Configure -Dprefix=/opt/perl-5.8.3 -Uinstallusrbinperl -des
[wait for a while]
$ make
[wait again]
$ make test
[wait, and check it all went ok]
Then become root, and:
# make install
Then add /opt/perl-5.8.3/bin to people's paths, or install some
appropriate symlinks.
Alternatively, you install the whole of perl in /usr/local, for which
the appropriate bits maybe are alreay in your user's path.
If you are sure you want to replace /usr/bin/perl with the new one,
then you might need to leave off the -Uinstallusrbinperl.
If you don't know how to do any of this, your ONLY chance is to find a
OS package that upgrades your Perl package. You can't just get a
package for another OS and expect it to be all hunky-dory. If your
current OS version doesn't have up-to-date packages, either upgrade
the OS to a version that has newer versions of Perl packaged up for
you. rpmfind.net seems to have Perl 5.8.2 packages for Mandrake (that
was what you were using, right?) Whether they install on your version
of the OS I can't tell you.
Martien
--
|
Martien Verbruggen | Think of the average person. Approximately
Trading Post Australia | half of the people out there are dumber.
|
------------------------------
Date: Tue, 20 Apr 2004 23:28:49 GMT
From: Clint Olsen <clint@0lsen.net>
Subject: Re: Writing fast(er) performing parsers in Perl
Message-Id: <slrnc8bchh.rg7.clint@poly.0lsen.net>
On 2004-04-20, Uri Guttman <uri.guttman@fmr.com> wrote:
> read is faster since it doesn't have to check for EOF in a loop like the
> slurp does. and sysread is even faster than read. and you can get that
> speed with cleaner code by using File::Slurp which does fast sysread
> under the hood and has many useful options.
>
> s/// is faster than m//g because it stays inside perl guts (c code) all
> the time while m// has to be wrapped in a slower perl level loop.
>
> also the /o is almost never needed anymore. perl will only recompile a
> regex when it sees that an interpolated variable has changed since the
> last time it was compiled.
>
> try the file::slurp module and you should get even more speedup.
I tried slurp, and while it was faster reading the entire file than
reassigning $/ to undef and doing $data = <FILE>, it's still far slower
than my buffered reads using read(). I'm still twice as fast as slurp. I
assume you wanted me to slurp the entire file into memory as I had done
originally.
It's possible that this performance behavior is a peculiarity on Linux
only, but historically doing reads into a finite buffer has been the most
time/space efficient way to read a file.
Thanks for your explanation on substitution vs. match. That answers quite
a bit.
-Clint
------------------------------
Date: Wed, 21 Apr 2004 00:06:29 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Writing fast(er) performing parsers in Perl
Message-Id: <x77jwap52y.fsf@mail.sysarch.com>
>>>>> "CO" == Clint Olsen <clint@0lsen.net> writes:
CO> On 2004-04-20, Uri Guttman <uri.guttman@fmr.com> wrote:
>>
>> try the file::slurp module and you should get even more speedup.
CO> I tried slurp, and while it was faster reading the entire file
CO> than reassigning $/ to undef and doing $data = <FILE>, it's still
CO> far slower than my buffered reads using read(). I'm still twice
CO> as fast as slurp. I assume you wanted me to slurp the entire file
CO> into memory as I had done originally.
canyou show your benchmarks? and i didn't see (skipped much of the
thread) your code that does a read() loop. that isn't true slurping and
it could be faster as it doesn't have to allocate (or reallocate) a very
large buffer. file slurping is not good for very large files (for some
definitions of large - today slurping in megabytes is easy, not so too
long ago).
CO> It's possible that this performance behavior is a peculiarity on
CO> Linux only, but historically doing reads into a finite buffer has
CO> been the most time/space efficient way to read a file.
that is a different beast. when you need to process the entire file, a
true slurp is faster. sequential reads into a fixed buffer is totally
different.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
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 6435
***************************************