[9205] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2800 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jun 6 12:07:33 1998

Date: Sat, 6 Jun 98 09:00:25 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sat, 6 Jun 1998     Volume: 8 Number: 2800

Today's topics:
    Re: -d ? 3 : 7 is ambiguous, how comes? <tchrist@mox.perl.com>
    Re: -d ? 3 : 7 is ambiguous, how comes? (Xuming Wang)
    Re: -d ? 3 : 7 is ambiguous, how comes? (Xuming Wang)
        ANNOUNCE: Data::Locations 4.1 (Steffen Beyer)
        Class browser for Perl marionX@my-dejanews.com
        Existing Perl Scripts for reading emailed forms through <Darwin@info-evolution.com>
    Re: How to make a list of combinations? (Jonathan Stowe)
    Re: how to pass user name and password to unix? <webmaster@fccjmail.fccj.org>
        Looking for upload.pl <jimfritz@softhouse.com>
    Re: perl cgi generated html with java app dont run (Jonathan Stowe)
    Re: perl cgi generated html with java app dont run Eadmundp@my-dejanews.com
    Re: perl cgi generated html with java app dont run (Jonathan Stowe)
    Re: Perl Search Engine <garyg@gator.net>
        Problems reading tied hash database records <rrichey@ishway.com>
    Re: Reading a file from the bottom up (Jonathan Stowe)
    Re: reading param values (Jonathan Stowe)
    Re: striphtml program (Jonathan Stowe)
    Re: thumbnails (Jonathan Stowe)
        Tutor? (Linda Watson)
    Re: Tutor? (Andrew E Page)
    Re: Tutor? <ngouah@erols.com>
    Re: Tutor? <garyg@gator.net>
        Where is WIN32::API? (J. Probert)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 6 Jun 1998 13:48:18 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: -d ? 3 : 7 is ambiguous, how comes?
Message-Id: <6lbhb2$j3p$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    lr@hpl.hp.com (Larry Rosler) writes:
:perl -ew 'print "hi\n"'

That's wrong.  Please try it.

:works just fine for me.  Does it fail for you?  The order of agglomerated 
:options is irrelevant.

Not when they take options.

--tom
-- 
"Espousing the eponymous /cgi-bin/perl.exe?FMH.pl execution model is like 
reading a suicide note -- three days too late."
	    --Tom Christiansen <tchrist@mox.perl.com>


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

Date: Sat, 06 Jun 1998 14:00:51 GMT
From: xuming@email.unc.edu (Xuming Wang)
Subject: Re: -d ? 3 : 7 is ambiguous, how comes?
Message-Id: <357b4a8b.132484439@152.2.25.74>

xuming@email.unc.edu (Xuming Wang) wrote:

>lr@hpl.hp.com (Larry Rosler) wrote:
>
>>In article <6l8lo6$7q2$1@lyra.csx.cam.ac.uk>, mjtg@cus.cam.ac.uk says...
>
>>> Only if you really wanted to execute the script 'w'.    Try 'perl -we'
>>> instead.
>>...
>>
>>perl -ew 'print "hi\n"'
>>
>>works just fine for me.  Does it fail for you?  The order of agglomerated 
>>options is irrelevant.
>
>C:\>perl -ew "print 'hi';"
>
>C:\>perl -we "print 'hi';"
>hi
>C:\>perl -e w "print 'hi';"
>
>C:\>perl -v
>
>This is perl, version 5.004_02
>
>standard version for WIN32.

on Linux:

xuming> perl -ew 'print "hi\n";'
xuming> perl -we 'print "hi\n";'
hi
xuming> perl -e w 'print "hi\n";'
xuming> perl -v

This is perl, version 5.004_04 built for i586-linux

--
Xuming Wang


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

Date: Sat, 06 Jun 1998 13:42:02 GMT
From: xuming@email.unc.edu (Xuming Wang)
Subject: Re: -d ? 3 : 7 is ambiguous, how comes?
Message-Id: <357a46a2.131483804@152.2.25.74>

lr@hpl.hp.com (Larry Rosler) wrote:

>In article <6l8lo6$7q2$1@lyra.csx.cam.ac.uk>, mjtg@cus.cam.ac.uk says...

>> Only if you really wanted to execute the script 'w'.    Try 'perl -we'
>> instead.
>...
>
>perl -ew 'print "hi\n"'
>
>works just fine for me.  Does it fail for you?  The order of agglomerated 
>options is irrelevant.

C:\>perl -ew "print 'hi';"

C:\>perl -we "print 'hi';"
hi
C:\>perl -e w "print 'hi';"

C:\>perl -v

This is perl, version 5.004_02

standard version for WIN32.


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

Date: 6 Jun 1998 09:05:28 GMT
From: sb@engelschall.com (Steffen Beyer)
Subject: ANNOUNCE: Data::Locations 4.1
Message-Id: <6lb0oo$5p4$1@en1.engelschall.com>

I am pleased to announce version 4.1 of the "Data::Locations" module:


The package is available for download either from my web site at

                  http://www.engelschall.com/u/sb/download/

or from any CPAN (= "Comprehensive Perl Archive Network") mirror server:
(allow a few days for propagation if necessary)

                  http://www.perl.com/CPAN/authors/id/STBEY/


Prerequisites:
--------------

Perl version 5.004 (subversion 0) or higher.


What does it do:
----------------

Did you already encounter the problem that you had to produce some
data in a particular order, but that some piece of the data was still
unavailable at the point in the sequence where it belonged and where
it should have been produced?

Did you also have to resort to cumbersome and tedious measures such
as storing the first and the last part of your data separately, then
producing the missing middle part, and finally putting it all together?

In this simple case, involving only one later-on-insertion, you might
still put up with this solution.

But if there is more than one later-on-insertion, requiring the handling
of many fragments of data, you will probably get annoyed and frustrated.

You might even have to struggle with limitations of the file system of
your operating system, or handling so many files might considerably slow
down your application due to excessive file input/output.

And if you don't know exactly beforehand how many later-on-insertions
there will be (if this depends dynamically on the data being processed),
and/or if the pieces of data you need to insert need additional (nested)
insertions themselves, things will get really tricky, messy and troublesome.

In such a case you might wonder if there wasn't an elegant solution to
this problem.

This is where the "Data::Locations" module comes in: It handles such
insertion points automatically for you, no matter how many and how deeply
nested, purely in memory, requiring no (inherently slower) file input/output
operations.

(The underlying operating system will automatically take care if the amount
of data becomes too large to be handled fully in memory, though, by swapping
out unneeded parts.)

Moreover, it also allows you to insert the same fragment of data into
SEVERAL different places.

This increases space efficiency because the same data is stored in
memory only once, but used multiple times.

Potential infinite recursion loops are detected automatically and
refused.

In order to better understand the underlying concept, think of
"Data::Locations" as virtual files with almost random access:
You can write data to them, you can say "reserve some space here
which I will fill in later", and continue writing data.

And you can of course also read from these virtual files, at any time,
in order to see the data that a given virtual file currently contains.

When you are finished filling in all the different parts of your virtual
file, you can write its contents to a physical, real file this time, or
process it otherwise (purely in memory, if you wish).

Note that this module handles your data completely transparent, which
means that you can use it equally well for text AND binary data.

You might also be interested to know that this module and its concept
has already heavily been put to use in the automatic code generation
of large software projects.


Changes in version 4.1:
-----------------------

 +  Fixed "delete()" to clear the self-references which prevented the eventual
    garbage-collection.
 +  Also fixed "delete()" to free the occupied memory at the time of the call
    of this method rather than at shutdown time of the Perl interpreter.
 +  Removed the unnecessary calls of the "FETCH()" method, resulting in an
    improved performance.
 +  Minor changes to make the code clearer and cleaner.
 +  "Bug fixes" and additions in the documentation.


Legal issues:
-------------

Copyright (c) 1997, 1998 by Steffen Beyer.
All rights reserved.

This package is free software; you can redistribute it and/or
modify it under the same terms as Perl itself, i.e., under the
terms of the "Artistic License" or the "GNU General Public License".


Credits:
--------

Many thanks go to Mr. Gero Scholz (now Head of Department for Core Business
IT-Components at the Dresdner Bank in Frankfurt, Germany) for his personal
support and for writing the "ProMAC" macro processor (some sort of a precursor
to Perl, in spirit) and for implementing the concept of "locations" in it,
which inspired me to write this Perl module!

Mr. Scholz owes his own inspiration to the "DELTA" macro processor (a tool
widely used during the seventies, as it seems), where a rudimentary version
of the concept of "locations" was implemented and where its name ("locations")
seems to originate from.


Author's note:
--------------

If you have any questions, suggestions or need any assistance, please
let me know!

I would in fact be glad to receive any kind of feedback from you!

I hope you will find this module beneficial.

Yours,
--
  Steffen Beyer <sb@engelschall.com> http://www.engelschall.com/u/sb/
       "There is enough for the need of everyone in this world,
         but not for the greed of everyone." - Mahatma Gandhi


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

Date: Sat, 06 Jun 1998 13:23:57 GMT
From: marionX@my-dejanews.com
Subject: Class browser for Perl
Message-Id: <6lbftc$4gl$1@nnrp1.dejanews.com>

Hi,

I am currently programming a Web-based calendar for my company using
Perl with objects.
As the number of my classes increased I thought it would be cool to
have a class bowser. I think it would be easy to build one in Smalltalk
or Java but before I start I'd like to know whether someone has already
done that - I didn't found anything in the web.

Looking forward to a productive discussion on this topic...

Malte Ubl

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Sat, 06 Jun 1998 13:07:16 GMT
From: "Darwin J. Sanoy" <Darwin@info-evolution.com>
Subject: Existing Perl Scripts for reading emailed forms through POP3
Message-Id: <35793EF1.E029093C@info-evolution.com>

Does anyone know of or have existing debugged scripts for reading forms
sent through email.  By forms I mean a text formatted form.  I am also
interested in a script for reading a bounced email and determining that
it has bounced.  I know there are many different ways a message is
bounced, many different messages that can appear in the header and text
to indicate a bounce - does anyone have a fairly comprehensive script to

determine that a message has bounced?

If it's not too much trouble, a copy to email of any responses to this
post would be helpful.
Thanks,
djs.

--

__________________________________
Darwin J. Sanoy
Principal Consultant, MCSE
CoreTech Consulting Group
Darwin@Info-Evolution.com




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

Date: Sat, 06 Jun 1998 14:08:51 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: How to make a list of combinations?
Message-Id: <35794a96.59122752@news.btinternet.com>

On Sat, 06 Jun 1998 03:43:21 GMT, mccaskey@my-dejanews.com wrote :

>Given a list of n elements, such as qw(A B C D), I need to iterate
>
>through all possible combinations, starting with the full combination
>
>of n elements (A B C D), then (in any order) all combinations with
>
>n-1 elements, such as (A B C), (A B D), (B C D), etc., then all
>
>combinations with n-2 elements, and so on.
>
>

I seem to recall a recent discussion of this (or similar) here but
cannot remember the subject line.

However there is an item in perlfaq4 about permutation with an example
that might be helpful.

/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: Sat, 06 Jun 1998 14:04:49 GMT
From: Bill 'Sneex' Jones <webmaster@fccjmail.fccj.org>
Subject: Re: how to pass user name and password to unix?
Message-Id: <35794A74.E60EA9BB@fccjmail.fccj.org>

Tom Phoenix wrote:
> 
> On Thu, 4 Jun 1998, Simon wrote:
> 
> > is there a PERL command to access files in a protected UNIX directory by
> > passing the login name and password?
> 
> You could write one, if there isn't such a program.
> 
> > or maybe sending them with a HTTP command with parameters.
> > something like:
> >
> > http://www.somedomain.com/protected/myfile.zip?name=john+password=xxxx
> 
> Don't send a password unencrypted over HTTP without first posting the
> password to Usenet. :-)
> 
> If you wish to write a program which would be able to access any user's
> files, it would (almost certainly) need to be set-id to root. See the
> perlsec manpage for more information. Also, since there are (many!)
> potential security holes involved with this, see the WWW Security FAQ.


As Tom said, it isn't really secure.  However, if it doesn't need to be
set up like NSA, then you could do something like (as root):

chown userid:nobody somefile.zip
chmod 0640 somefile.zip   (which looks like: -rw-r----- ...)

Then use .htaccess (or roll your own.)  But leave out the index.html file
and viola, you have access.  Not 100% secure, but not C2-like pain-n-the-
neck to keep configured either.

The above will display, after authentication, the directory structure (as
long as you left out the index.html or equivilent) and will allow basic
authentication for files which the WWW userID can access, but keep others on
your server from accessing...

HTH,
-Sneex-  :-)
____________________________________________________________________________
Bill Jones | FCCJ Webmaster | Voice 1-904-632-3089 | Fax 1-904-632-3007
Florida Community College at Jacksonville | 501 W. State St. | Jax, FL 32202
mailto:webmaster@fccjmail.fccj.org | http://webmaster.fccj.org/Webmaster


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

Date: Sat, 06 Jun 1998 14:34:55 +0000
From: Jim Fritz <jimfritz@softhouse.com>
Subject: Looking for upload.pl
Message-Id: <3579538F.50E134C4@softhouse.com>

I am looking for a perl script to allow users to upload small text files
from their browsers.  I have seen mention of a script called upload.pl;
but I am sure there are many more out there.  However I haven't as of
yet been able to find any.  If anyone could point me in the right
direction I would really appreciate it.

Jim Fritz
-- 
 F&H SoftHouse, Inc.   jimfritz@softhouse.com
 39 West 32nd Street   Holland, MI 49423-5061
 Phone: (616) 395-9556    Fax: (616) 395-9557
         http://www.SoftHouse.com/


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

Date: Sat, 06 Jun 1998 14:08:44 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: perl cgi generated html with java app dont run
Message-Id: <35793fcd.56840564@news.btinternet.com>

On Fri, 05 Jun 1998 16:49:11 GMT, Eadmund@writeme.com wrote :

>Hi all,
>
>I have a perl script which generates a page of HTML with a simple java cookie
>function embeded.
>
>When I run the script it generates the code ok, the html part is fine but the
>java func just crashes out.
>

If your Perl program runs OK and produces the correct output then this
almost certainly not a Perl problem

>Here's the really odd bit: if I view-source the page that has just been
>generated and has crashed, save it as a local htm file, then load it back it
>to my browser directly, it all works fine - including the java?~?~?##/??
>

This would seem to indicate that this is definitely not a Perl
problem.  You might try running the program at the command line and
saving that output to see if it has the same problem.

>It seams that when perl generates the script, it won't run the java component
>- why??????
>

Because perl wont run a "java component" 

>I'm running this under ms-frontpage 98 under windows NT4.0 server - internet
>server.
>

Microsoft were kind enough to give you the FORMAT command in order to
rid yourself of that problem.

/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: Sat, 06 Jun 1998 14:23:17 GMT
From: Eadmundp@my-dejanews.com
Subject: Re: perl cgi generated html with java app dont run
Message-Id: <6lbjcl$8d8$1@nnrp1.dejanews.com>

Opps,  Sorry Scott, I'll try to post more meaningfull descriptions in the
future. Thanks for replying even so. I'll check out what you've sugested.

TTFN

Eadmund

EOF



In article <6l97lp$nj2$2@mainsrv.main.nc.us>,
  scott@softbase.com wrote:
>
> I hate it when people say things like "crashes out", it makes
> absolutely no sense. If you are experiencing a problem, DESCRIBE THE
> PROBLEM! No one can read your mind! You won't get good help by posting
> vague and meaningless descriptions.  If you get a "Java runtime
> #1234-A" error, tell us. If nothing happens and something should, tell
> us. Just describe the problem with some detail.
>
> Eadmund@writeme.com wrote:
> > It seams that when perl generates the script, it won't run the java
component
> > - why??????
>
> You *ARE* giving the *FULL* URL to the applet, right? CGI output HTML
> is relative to the CGI directory, whatever that is, not the main page
> of the site or the HTML page from which the form originally came. I
> imagine your Java program can't be found.
>
> (If you save it in Notepad, you're probably saving it in the
> directory with the applet.)
>
> > I'm running this under ms-frontpage 98 under windows NT4.0 server - internet
> > server.
>
> Try running it under a web browser instead of FrontPage. FrontPage is
> okay for a "print preview", but I would never use it for live page
> testing. Frankly, I'd be shocked if it even ran Java applets.
>
> Scott
> --
> Look at Softbase Systems' client/server tools, www.softbase.com
> Check out the Essential 97 package for Windows 95 www.skwc.com/essent
> All my other cool web pages are available from that site too!
> My demo tape, artwork, poetry, The Windows 95 Book FAQ, and more.
>
>


-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Sat, 06 Jun 1998 14:49:22 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: perl cgi generated html with java app dont run
Message-Id: <3579559f.61738116@news.btinternet.com>

On 5 Jun 1998 16:51:05 GMT, scott@softbase.com wrote :

<snip>

>If you get a "Java runtime  #1234-A" error, tell us. 

<snip>

No dont do that.  If you get a Java runtime anything please take it up
with a group that is concerned with Java.  If of course you get a Perl
error and you dont understand what it says in perldiag then please
feel free to ask us about it.

/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: Sat, 06 Jun 1998 15:14:48 GMT
From: "Gary M. Greenberg" <garyg@gator.net>
Subject: Re: Perl Search Engine
Message-Id: <35795C22.338EC97@gator.net>

This holds one of the keys to why there are soooo many posts here.

What stage is the cvf wrt c.l.p.moderated?

Martien Verbruggen wrote:

> > Please help me with this, I don't know any PERL.
                                               ^^^^ Perl.
> 
> Then, seriously, you shouldn't be trying to program in it. Not unless
> you are willing to learn it.

Exactly!


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

Date: Sat, 06 Jun 1998 13:16:08 GMT
From: Ron Richey <rrichey@ishway.com>
Subject: Problems reading tied hash database records
Message-Id: <6lbfeo$435$1@nnrp1.dejanews.com>

I am having problems reading from a moderately large Berkeley DB database
file that is "tied" to a Perl hash.  My my Perl is version 5.004_04, and my
OS is BSDI 3.1 on a pentium platform with ???MB memory (but most likely a
lot!).	The OS has some kernel modifications done by the virtual hosting
provider I use--and yes, I have a pending inquiry into them to see if they
have incorporated some funky memory limitations into these "modifications"
that could be causing my problems....

I am seeing several manifestations of what I believe is a single memory
problem.  The most obvious manifestation of the problem shows up when I run a
test routine (see the code snippet at the bottom of this message) which
parses through my database and prints out the key for each record as well as
a running count of records and the size of each record.  The current
composition of the database is 1118 records, with a typical size of
approximately 280 characters. Only 4 or 5 records are over 1k, with the
largest being 5173 characters.	I mention this primarily because my first
thought was to make sure that I was not having problems associated with the
well-documented record size problems in some dbm implementations.  I am using
Berkeley DB, so my understanding is that I can rule this out as the source of
the problem.

(I'm correct in ruling this out...aren't I?  In this context, one other piece
of information that may or may not be pertinent, is the fact that the
database I am working with here was originally created with the old Perl4
"dbmopen".  But since I am on BSDI, I am assuming that the dbmopen was in
fact implemented with Berkeley DB.  Aside from a filename issue wherein
dbmopen appends a .db to the filenames I specify, the files created with
dbmopen seem to be compatible with the Perl5 "tie DB_FILE" method--hence my
assumption that the dbmopen on my system uses Berkeley DB.)

Anyway, what happens, is that when I use the

	foreach $rec_key (keys %items)

method (commented out in the code snippet below) to loop through the
database, I am able to parse through all 1118 records successfully.  However,
when I use the

	while(($rec_key, $rec_value) = each %items)

method, I get an "Out of memory!" error and Perl aborts after processing only
596 records.  I am doing this on the command line, so I can see it all
happening.  This failure actually seems counter intuitive to me, since the
"while-each" method is supposed to be less memory hungry than is the
"foreach-keys" method.

I am well aware of the fact that Perl uses a single iterator for all each,
keys, functions, etc., and yes, I only have this one instance of the iterator
that is being used, so that is decidedly *not* the problem.

I have seen different variations of this same problem (i.e. foreach-keys
works and while-each does not) when accessing this database, and have now
completely abandoned the while-each method in favor of the foreach-keys
method as a work around.  In summary, the while-each method of parsing
through my tied db hash pukes after only parsing through part of my
database--never making it to the remaining records.  (I have seen quite a
number of posts to comp.lang.perl.misc describing similar problems with the
while-each method, but as yet, I have *NEVER* seen a satisfactory
explanation/work around.)

The fact that the while-each method does not work reliably for me, however,
is only one manifestation of what I believe to be a more fundamental problem.
 In working on my core production scripts, I have found that when I get the
total size of my compiled script (including included modules) over a certain
size, then even the foreach-keys method will puke after reading less that the
entire database.  Again, it appears to be a memory problem, but since I have
only seen this while running via CGI, I don't see the actual error messages
written to <STDERR>.  (Any help here from the old timers?  It would be nice
to see that error message somehow even though I'm running via CGI.)

Yet another manifestation of the core problem appeared when I was trying to
copy all of the records from one database to another.  Again, I was using the
foreach-keys method (because, of course, it seems to work most reliably) to
parse through each record in the source database, grab the record in a
scalar, and then turn around and store the record back in a target database
using the same key that I was using to iterate over the source database. 
However, I found that this would not work.  Again, Perl would die after only
copying a portion of the records.  I found that the only way I could
successfully make the copy was that I first placed each database key and
record into a temporary holding list of lists (to hold both the key and value
separately--a hash had the same problem as the hash tied to the target
database had, as I recall).  Then once I had completely iterated over the
source database, I untied it, and then tied to the target database, iterated
over the temporary holding list, and placed the database records into the
target database.  Again, this feels like the same problem to me, though I was
in CGI and couldn't see the message written to <STDERR> at the point of
failure.

Anyone who has some insights into this problem--either specifics or general--
please post them.  I get the feeling that this is a problem that many people
are experiencing in one form or another.  And if you wouldn't mind, please CC
me privately, since I sometimes have difficulty getting a reliable news feed.

To the old timers/Perl elite out there, let's see if we can get to the bottom
of this one.  I've seen enough posts on this and related issues to convince
me that something systemic is at work here.  If it turns out that this is a
bona-fide "perl bug," where exactly does one report such things to the
"powers that be?" Am I naive in thinking that something like this could
actually get fixed for the next release??

Now, here's the code snippet:

sub printdbase {
    my $database = ($_[0]);

    if (!tie(%items,  "DB_File", $database, O_RDWR|O_CREAT, 0644, $DB_HASH)) {
       print("Could not open $database: $!\n");
       exit;
    }
    print("successfully opened\n");

    my $count = 1;
    while(($rec_key, $rec_value) = each %items) {
        $this_record = $items{$rec_key};
        my $num_chars = split(/ */, $this_record);
        print("$count: $rec_key: contains $num_chars characters\n");
        ++$count;
    }

#    foreach $rec_key (keys %items) {
#        $this_record = $items{$rec_key};
#        my $num_chars = split(/ */, $this_record);
#        print("$count: $rec_key: contains $num_chars characters\n");
#
#        ++$count;
#    }

    untie(%items);
}

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Sat, 06 Jun 1998 14:08:52 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Reading a file from the bottom up
Message-Id: <35794b28.59268743@news.btinternet.com>

On Sat, 6 Jun 1998 09:38:24 +0100, Tan wrote :

>Hi,
>
>Is there a way to read files starting from the end?
>
>Data coming in from a switch appends to a file so that the most recent
>records are at the end of the file. To reduce processing time I would like
>to start searching for the most recent data and so would like to start
>reading from the end of the file to the beginning in order to cut processing
>time down.
>

There is no way I know of doing this that doesnt require reading the
whole file - however there may still be some advantage if the
processing for each row is fairly intensive.

You can read the whole file into an array and process from the end
backward or alternatively reverse the input thus:

#!perl

@array = reverse <> ; 

print @array;

Of course if you have a very large file then this will probably create
more overhead than you were trying to overcome.

/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: Sat, 06 Jun 1998 14:08:47 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: reading param values
Message-Id: <35794268.57470334@news.btinternet.com>

On 5 Jun 1998 18:04:06 GMT, Dan Nguyen wrote :

>Gopinath Venkataramanan <vgopinat@cisco.com> wrote:
>>Hi
>
>>i hv a url with http:.....?x1=1.2&x2=3.0&x3=4 and so on
>
>>I know how many x's are  coming, ie the count,
>
>>how to i get them in the perl script
>>thro
>>for ($i=0;$i<=10;$i++)
>>{
>>$x{$i} = $q->param('x1');    -- here i want to generate x1 by x$i
>>}
>>can you tell me how to do this
>>regds.
>
>Try using the CGI module.
>

Actually it looks very much to me like he is using CGI.pm: that
$q->param('x1') thing is a bit of a clue.

I think the question was more like "How do I create a variable who's
name is contained in a a variable ?".

The answer is contained in depth in the perlref document.

However a quick exmple might be something like:

for ($i=0;$i<=10;$i++)
{
$varname = "x" . $i;
${$varname} = $q->param('x1');   
} 

# now you have $x0 .. $x9

An alternative that is available with CGI.pm which will insulate you
from a change in the number of parameters could go like this:

@the_params = $q->param;

foreach $param_name (@the_params)
{
   ${$param_name} = $q->param($param_name};
}

with the same result.

/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: Sat, 06 Jun 1998 14:08:42 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: striphtml program
Message-Id: <35793d47.56194481@news.btinternet.com>

On Fri, 05 Jun 98 11:36:32 EST, palincsars.isc@gao.gov wrote :


>Perlfaq9 mentions Tom's striphtml.gz program, and the html version of
>perlfaq9 provides a download link to it in CPAN.
>
>I've been using this program successfully on a Solaris box with perl
>5.003, but when I attempt to run it with either the Laszlo Molnar
>djgpp port of perl 5.004 for Win16 or the GSAR port for Win32, I
>get the following error:
>
> <                      # opening angle bracket
>
>    (?:                 # Non-backreffing grouping paren
>         [^>'"] *       # /: regexp *+ operand could be empty at line 6
>
>

This snippet contains a modified version of the regular expression in
question that does work:

#!perl 
while(<>)
{
s/(?:<[^>'"]*|".*?"|'.*?')+>//gs;
print;
}

>Does anybody have any idea what has changed between 5.002 (called for
>in the program) and perl 5.004 to cause this error?  
>  

I'm not sure.  It is apparently not mentioned in perldelta nor is the
message in perldiag.

/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: Sat, 06 Jun 1998 14:08:49 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: thumbnails
Message-Id: <35794804.58464312@news.btinternet.com>

On Fri, 5 Jun 1998 16:14:36 -0400, Kelby Valenti wrote :

>I'm looking for a program that will create thumbnails from a directory of
>images.  I would like this to be a cgi program.  If you can help me in my
>search I'd appreciate it.
>

Thumbnails? - This some kind of Voodoo thing right?

I think you want to use the  Magic::Voodoo module available from CPAN.

/J\ 
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: Sat, 06 Jun 1998 13:55:04 GMT
From: watsons@teleport.com (Linda Watson)
Subject: Tutor?
Message-Id: <watsons-0606980656460001@sle02-pm3-14.teleport.com>

I have been dabbling in Perl for about a year, but I am _not_ a computer
guru and am having lots of trouble trying to learn this "on my own" from a
book. I've decided my mind just doesn't seem to "think" like a
programmer's, but I really want to learn. 

Does anyone know of someone in the Salem, Oregon, area who might be
willing to do a little tutoring in both Perl and CGI? Or do you have
another idea? So far I haven't found any perl classes around here and the
"techies" associated with my job use REXX.

Linda


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

Date: Sat, 6 Jun 1998 14:47:33 GMT
From: aep@world.std.com (Andrew E Page)
Subject: Re: Tutor?
Message-Id: <Eu4x39.GHr@world.std.com>


    By far the best tutor is experience.  Unfortunately working the
examples out of a book can only take you so far.

    The best advice that I can give you is to find a project to do for
yourself.  An internal web page at your company or on your local ISP,
if they allow you to run your own CGI scripts.  It needn't be anything
comercial.  It can be some kind of a game, survey or whatever.  Just
so long as it's something where you can create and solve problems,
refine solutions and develop your skills.  Surround yourself with
books, don't hesitate to post questions, dig in and don't give up.
-- 
Andrew E. Page   (Warrior Poet) |   Decision and Effort The Archer and Arrow
Mac Consultant                  |     The difference between what we are
Macintosh and DSP Technology    |           and what we want to be.


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

Date: Sat, 06 Jun 1998 10:46:51 -0400
From: Birgitt Funk <ngouah@erols.com>
Subject: Re: Tutor?
Message-Id: <3579565B.7385@erols.com>

Linda Watson wrote:
> 
> I have been dabbling in Perl for about a year, but I am _not_ a computer
> guru and am having lots of trouble trying to learn this "on my own" from a
> book. I've decided my mind just doesn't seem to "think" like a
> programmer's, but I really want to learn.
> 
> Does anyone know of someone in the Salem, Oregon, area who might be
> willing to do a little tutoring in both Perl and CGI? Or do you have
> another idea? So far I haven't found any perl classes around here and the
> "techies" associated with my job use REXX.
> 
> Linda

I know the feeling 8-). 
But I doubt that one can be tutored. 

It's one of those things one has to be honest with.
There is much more to it than it seems at first glance. 

You either learn it professionally and learn to become a 
programmer or you don't.

If you can pay for a tutor, you can pay to let professionals do
the whole job. If you can pay for classes, you can go through a
conputer science program. After that your mind will think
like a programmer's mind.  

Just don't get fooled into believing that this is something
you learn at the side with a little help from someone. It's
not.

And don't be discouraged. It's much more fun to go through
hell and out of it by yourself.

And BTW who knows what *your* mind will come up with. 

Good luck.

Birgitt Funk


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

Date: Sat, 06 Jun 1998 15:49:28 GMT
From: "Gary M. Greenberg" <garyg@gator.net>
Subject: Re: Tutor?
Message-Id: <357963FB.9CADDB@gator.net>

Linda,

You don't say a few things that may be helpful:
1. What book(s) you're using.
2. What other, if any, programming background you have.
3. What OS(es) you're familiar with.
4. How much time you've actually been able to spend learning.

I've been teaching myself Perl for a very short time (about a month).
I started learning Perl about 18 months ago, but my work load was so
heavy, I couldn't spend any time with it. Last month, I forced Perl
to fit into my schedule; now, I spend a least 30 minutes a day with
it--it isn't really enough, but I'm doing more and more with it.

I taught myself C using several books && usenet.
It took me several years to become pretty good, but I've still got
a lot to learn.
I believe almost anyone can learn to program, if they really want to.
One of the keys is structuring your learning process.

Looking at the questions above:
<Caveat>
   These are my thoughts on the matter and not necessarily widely held.
FWIW.
1. If you're not using the Camel and Llama, they are imho required
reading.
2. It does help to know another programming language, particularly C AND
   it does help to know many of the Unix utilities like awk, sed, and
grep.
   Plus, understanding regexps is an invaluable tool.
3. Therefore, if you know none of these, you may need to do a little
studying in
   the Unix OS area as well; there are wonderful free ports of many Unix
tools
   which run on Windoze available for download (e.g., the gcc
collection) and there
   is also MKS Toolkit for those of us who must suffer under WinOSes.
4. Hours are probably a better indicator than days or years; don't be
harsh with
   yourself because it's taking a "year" to learn. Measure your progress
against the
   hours invested; are you making progress or does none of it make
sense?
   I'd pick _one thing_ to learn && learn it well. Then, I'd use that
skill to expand
   into handling other things, or solving other problems.
</Caveat>

Hope that's useful. Good luck,


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

Date: Sat, 06 Jun 1998 15:39:10 GMT
From: probe@hotmail.com (J. Probert)
Subject: Where is WIN32::API?
Message-Id: <35796296.11044274@news.saix.net>

I have seen mention of an interface to the Win32 API module called
Win32::API  in this newsgroup, but I can't find it on CPAN. Can anyone
tell me if this module still exists? And where can I find it?

Will it be possible to use this module to make use of Windows' GUI to
interface to PERL? I want to write a couple of scripts to manage flat
file text databases using PERL, but, its a little user 'unfriendly'
doing this from the command line.

I have done this using MS Personal WebServer, a browser, HTML forms
and CGI scripts on my local computer. This is fine for me, but my
partners don't want to have to install and configure a server on their
computers just to add/edit database entries.

TIA for your help.

PS. If you're interested in South African Business or Tourism at all,
please go to:

http://www.sabtin.co.za

This is our brand new site full of info. And, before you flame me for
advertising in this newsgroup: 
All the database search functions, aswell as the feedback function and
random banners on the site are written in PERL!


SABTIN - South African Business and Torism
Visit our PERL based site at:
http://www.sabtin.co.za


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

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 2800
**************************************

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