[13241] in Perl-Users-Digest
Perl-Users Digest, Issue: 651 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Aug 26 11:07:19 1999
Date: Thu, 26 Aug 1999 08:05:09 -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, 26 Aug 1999 Volume: 9 Number: 651
Today's topics:
<ilayer> and cgi stumper <noahNOraSPAM@salemglobal.com>
Re: A nice tough RegEx for u to solve..? (Abigail)
Re: A nice tough RegEx for u to solve..? <jpeterson@office.colt.net>
Accounts and CPAN module <bkline@rksystems.com>
Re: Accounts and CPAN module <gellyfish@gellyfish.com>
close'ing STDIN <jkuplins@rcc.com>
Collect Information in DB or text file? <info@sonique.de>
Re: Computing n.th root of a given number (Anno Siegel)
Database problem <jcorbin@apci.net>
Re: Database problem <Mark@Mark.Com>
Re: Database problem <rhrh@hotmail.com>
Re: DBD-ODBC-0.20 installing problems (Dan Wilga)
Developer: Web & SGML (Brighton, UK) <richardp@macpress.demon.co.uk>
Re: Developer: Web & SGML (Brighton, UK) <rhrh@hotmail.com>
Re: eperl v. embperl which would you suggest? <jpeterson@office.colt.net>
Re: HTML Tools for perl? <smf26@cam.ac.uk>
Images <jimmy@blackhole-designs.com>
Re: Images <jimmy@blackhole-designs.com>
Lexically scoped package vars and Apache::Registry (Bill Moseley)
Re: Programming Question.. List/Email functions <bradw@newbridge.com>
REMOTE_HOST not showing results martyg8517@my-deja.com
Re: Servers for NT <jpeterson@office.colt.net>
Re: Servers for NT <gellyfish@gellyfish.com>
Re: SSN format <cmcurtin@interhack.net>
text file reading > newfile <mgarbutt@ozland.net.au>
Re: Tough RegEx TWO - Its almost perfect BUT.. (Bill Moseley)
Re: trouble using the Perl2exe aplication (Jenda Krynicky)
Re: VERY VERY VERY weird things happening <vinger@mail.ford.com>
Re: Why use Perl when we've got Python?! <xah@weborder.com>
Re: Why use Python when we've got Perl? <davidopp@megsinet.net>
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 26 Aug 1999 07:43:54 -0700
From: noah <noahNOraSPAM@salemglobal.com>
Subject: <ilayer> and cgi stumper
Message-Id: <09920fb9.e27d814b@usw-ex0106-048.remarq.com>
Does anyone have any experience using Netscape's <ILAYER>
tag? I tried using
it in a CGI form as an SSI work-around, which seemed to
work fine, except
that a CGI global expression that I used later in the page
now doesn't
appear. Any suggestions?
Thanks,
Noah
* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!
------------------------------
Date: 26 Aug 1999 09:42:47 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: A nice tough RegEx for u to solve..?
Message-Id: <slrn7sakkq.n0r.abigail@alexandra.delanet.com>
Paul Dobbs (pdobbs@home.com) wrote on MMCLXXXVI September MCMXCIII in
<URL:news:37C52014.23F8030F@home.com>:
//
// I figured an OR operator within the replace function would
// do it;
// (I use % sign to separate my sections)
Jeopardy style and random line breaks... don't expect an answer.
Abigail
--
sub camel (^#87=i@J&&&#]u'^^s]#'#={123{#}7890t[0.9]9@+*`"'***}A&&&}n2o}00}t324i;
h[{e **###{r{+P={**{e^^^#'#i@{r'^=^{l+{#}H***i[0.9]&@a5`"':&^;&^,*&^$43##@@####;
c}^^^&&&k}&&&}#=e*****[]}'r####'`=437*{#};::'1[0.9]2@43`"'*#==[[.{{],,,1278@#@);
print+((($llama=prototype'camel')=~y|+{#}$=^*&[0-9]i@:;`"',.| |d)&&$llama."\n");
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Thu, 26 Aug 1999 15:04:16 GMT
From: Jon Peterson <jpeterson@office.colt.net>
Subject: Re: A nice tough RegEx for u to solve..?
Message-Id: <QHcx3.15$RY.383@news.colt.net>
Abigail <abigail@delanet.com> wrote:
> Paul Dobbs (pdobbs@home.com) wrote on MMCLXXXVI September MCMXCIII in
> <URL:news:37C52014.23F8030F@home.com>:
> //
> // I figured an OR operator within the replace function would
> // do it;
> // (I use % sign to separate my sections)
> Jeopardy style and random line breaks... don't expect an answer.
The above line should read:
"Jeopardy style and random line breaks... don't expect a constructive answer"
Otherwise it's a self contradiction.
------------------------------
Date: 26 Aug 1999 10:10:12 GMT
From: Bob Kline <bkline@rksystems.com>
Subject: Accounts and CPAN module
Message-Id: <7q33q4$2do$1@news.servint.com>
I've tried sending this question to the author of the CPAN module,
but mail to the address given in the online documentation bounces.
The general advice I have seen on building the CPAN modules on UNIX
systems is to run all steps except the last (the 'make install')
using an account other than root, and only su to root for the
'make install' step, since the standard UNIX perl installation
needs it. How does one do this using the CPAN shell? I've tried
looking in some of the FAQs but didn't find anything (partly
because of broken links on the perl.com pages).
Thanks!
--
Bob Kline
mailto:bkline@rksystems.com
http://www.rksystems.com
------------------------------
Date: 26 Aug 1999 15:38:04 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Accounts and CPAN module
Message-Id: <37c5514c_2@newsread3.dircon.co.uk>
Bob Kline <bkline@rksystems.com> wrote:
> I've tried sending this question to the author of the CPAN module,
> but mail to the address given in the online documentation bounces.
>
> The general advice I have seen on building the CPAN modules on UNIX
> systems is to run all steps except the last (the 'make install')
> using an account other than root, and only su to root for the
> 'make install' step, since the standard UNIX perl installation
> needs it. How does one do this using the CPAN shell? I've tried
> looking in some of the FAQs but didn't find anything (partly
> because of broken links on the perl.com pages).
>
I have been using 'sudo' - but generally you will either want to run
the CPAN installation as root (where it will install with no problem) or
run the install as a normal user - it will generally fail when it actually
goes to install the files to where they will finally live : at this point
you will have to su root and continue the install by cd'ing to .cpan/build/
<whatever> and run 'make install' ...
/J\
--
"He is marvelous at beating men and achieving real penetration" -
Alex Ferguson
------------------------------
Date: Thu, 26 Aug 1999 09:50:21 -0400
From: "Julio Kuplinsky" <jkuplins@rcc.com>
Subject: close'ing STDIN
Message-Id: <vHbx3.28$R21.674@client>
Consider this code fragment
@files = <STDIN>;
.......
chomp ($ans = <STDIN>);
If I invoke this as
grep -l foo * | <myprogram>
then @files does get the filenames, but execution does *not* stop to
read the user response into $ans. No, saying
close STDIN;
doesn't help.
Can anyone help? Thnx.
------------------------------
Date: Thu, 26 Aug 1999 16:13:42 +0200
From: "Konrad Mathieu" <info@sonique.de>
Subject: Collect Information in DB or text file?
Message-Id: <7q3i5q$lp4$1@news.netcologne.de>
Hi everybody!
I need to collect E-mail adresses submitted by an html form in either a DB
or a text file. Is this an easy task and how could I start (I'm quite a
novice)?
Many thanks, Konrad
------------------------------
Date: 26 Aug 1999 15:01:14 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Computing n.th root of a given number
Message-Id: <7q3krq$i3g$1@lublin.zrz.tu-berlin.de>
Larry Rosler <lr@hpl.hp.com> wrote in comp.lang.perl.misc:
>In article <37C32F46.C76E83FE@mail.cor.epa.gov> on Tue, 24 Aug 1999
>16:48:22 -0700, David Cassell <cassell@mail.cor.epa.gov> says...
>> marcza@my-deja.com wrote:
>...
>> > mathematically the solution should be something like
>> > roundup(ln(n)/ln(2))
>> >
>> > But what is the most efficient way to compute the solution ?
>>
>> Well, you can
>> use POSIX;
>> to get the ceil() function.
>>
>> $x = ceil( log($n)/log(2) );
>I am waiting for Steffen Beyer to tell us about the function in
>Bit::Vector that provides the desired information directly.
For sufficiently lenient values of directly:
my $l = Bit::Vector->Word_Bits();
my $vec = Bit::Vector->new( $l);
sub BitVec {
if ( $_[ 0] > 1 ) {
$vec->Word_Store( 0, shift() - 1);
( $vec->Interval_Scan_dec( $l - 1) )[ 1] + 1;
} else {
0;
}
}
Not faster, though, not for single word integers.
Anno
------------------------------
Date: Thu, 26 Aug 1999 08:17:59 -0500
From: "John Corbin" <jcorbin@apci.net>
Subject: Database problem
Message-Id: <37c53f67.0@queeg.apci.net>
have a Perl routine that grabs a some fields from a database (mySQL)
compares them with current info and if different, transfers the current data
to the history database and updates the current db. While I can update the
current db the updating of the history is failing with a parse error near
the last field, which is a mediumtext field.
heres how I get the data out in the beginning:
$dbh = DBI->connect('dbi:mysql:finger', 'root', '', { RaiseError => 1});
$cursor1 = $dbh->prepare("SELECT
users.login,users.last_update,plans.server,users.checksum,users.last_time,pl
ans.plan
FROM users
left join plans on plans.user = users.login
left join servers on servers.host = users.server
WHERE servers.company like $company
");
$cursor1->execute;
while (@row = $cursor1->fetchrow_array)
{
$userlogin = @row[0];
$last_update= @row[1];
$server = @row[2];
$old_chksum = @row[3];
$last_time = @row[4];
$t_plan = $dbh->quote(@row[5]);
Then to do the updates:
$cursor2 = $dbh->do("insert into history values
\($user,$l_server,$user,$nix,$nix,$cksum,$l_date,$l_time,$t_plan\)");
$cursor2 = $dbh->do("UPDATE users SET checksum = $cksum, last_update =
$last_date, last_time = $last_time WHERE login = $user");
The UPDATE query will work by itself, but the insert query bombs....where am
I going wrong, i think it has to do with a quoting problem?>??
--
John
jcorbin@apci.net
biggunn@stomped.com
------------------------------
Date: Thu, 26 Aug 1999 14:48:44 +0100
From: Mark <Mark@Mark.Com>
Subject: Re: Database problem
Message-Id: <37C545BC.626ACD8A@Mark.Com>
John Corbin wrote:
<paraphrase>I have problems with DBI do commands failing.</paraphrase>
A few things to try:
1: Use $DBI::errstr to find out what when wrong:
if ($cursor =$dbh->do("insert into history
values\($user,$l_server,$user,$nix,$nix,$cksum,$l_date,$l_time,$t_plan\)"))
{
# normal stuff
}
else
{
print("Insert failed: $DBI::errstr"); # Usually an excellent description
of what went wrong (at least with oracle)
}
2: Why are you escaping the () in the INSERT statement?
3: Print out the SQL and try and execute it in whatever SQL interpreter you have
(SQLPLUS in ORACLE).
Also, I use
if prepare
if execute
if commit
else commit failed
else execute failed
else prepare failed
------------------------------
Date: Thu, 26 Aug 1999 15:40:21 +0100
From: Richard H <rhrh@hotmail.com>
Subject: Re: Database problem
Message-Id: <37C551D5.19C5069C@hotmail.com>
John Corbin wrote:
> Then to do the updates:
>
> $cursor2 = $dbh->do("insert into history values
> \($user,$l_server,$user,$nix,$nix,$cksum,$l_date,$l_time,$t_plan\)");
> $cursor2 = $dbh->do("UPDATE users SET checksum = $cksum, last_update =
> $last_date, last_time = $last_time WHERE login = $user");
>
> The UPDATE query will work by itself, but the insert query bombs....where am
> I going wrong, i think it has to do with a quoting problem?>??
For the insert, the number of columns you are inserting does match the
number of columns of the table??, just a thought,
But to solve those awkward \( problems, why not use the qq( ) construct,
then there's less to go wrong and its easier to maintain
$sql = qq{
insert into history values
($user,$l_server,$user,$nix,$nix,$cksum,$l_date,$l_time,$t_plan)
};
$rc = $dbh->do($sql) || "die error checking $DBI::errstr \n";
And the above/below posting on commit is good advice,
HTH,
Richard H
------------------------------
Date: Thu, 26 Aug 1999 10:25:16 -0400
From: dwilgaREMOVE@mtholyoke.edu (Dan Wilga)
Subject: Re: DBD-ODBC-0.20 installing problems
Message-Id: <dwilgaREMOVE-2608991025160001@wilga.mtholyoke.edu>
In article <7q0uud$47p$2@menelao.polito.it>, "Fredi Agolli"
<f.agolli@studenti.to.it> wrote:
> -- Hi to everybody,
> l'm trying to install DBD-ODBC-0.20 module on a Linux machine.
> Running 'perl Makefile.PL' compares the messagge
> ' You need to indicate where your ODBC Driver Manager is installed '.
> Where can l find this Driver Manager and how could l use it ?
>
The driver manager iodbc is included with DBD-ODBC in the iodbcsrc folder.
Compile it and take the resulting iodbc*.so and move it into the same
LD_LIBRARY_PATH folder as all of the other ODBC stuff.
Dan Wilga dwilgaREMOVE@mtholyoke.edu
** Remove the REMOVE in my address address to reply reply **
------------------------------
Date: Thu, 26 Aug 1999 14:16:58 +0100
From: Richard Padley <richardp@macpress.demon.co.uk>
Subject: Developer: Web & SGML (Brighton, UK)
Message-Id: <37C53E4A.FD413777@macpress.demon.co.uk>
Here are RDP Computing (http://www.macpress.co.uk) we are currently
recruiting a new developer. Candidates should ideally have knowledge and
experience in at least 3 of the following areas;
1. SGML/XML document processing
2. Perl
3. CGI
4. SQL
5. HTML
6. JavaScript
The start date for the position is 1st September 1999, working hours are
negotiable.
If you are interested, please send your CV to
mailto:Richard.Padley@macpress.demon.co.uk
-- Richard Padley, Consultant Programmer --
-- RDP Computing, 10 Queens Park Terrace --
-- Brighton BN2 2YA, UK --
-- tel 01273 381069 / fax 01273 385049 --
------------------------------
Date: Thu, 26 Aug 1999 14:34:06 +0100
From: Richard H <rhrh@hotmail.com>
Subject: Re: Developer: Web & SGML (Brighton, UK)
Message-Id: <37C5424E.702576CB@hotmail.com>
Richard Padley wrote:
>
> Here are RDP Computing (http://www.macpress.co.uk) we are currently
doh! either he's a very fast web designer or maybe should have checked
if the Url works first!
Richard H
------------------------------
Date: Thu, 26 Aug 1999 13:18:17 GMT
From: Jon Peterson <jpeterson@office.colt.net>
Subject: Re: eperl v. embperl which would you suggest?
Message-Id: <t8bx3.12$RY.323@news.colt.net>
emarkert@pace.edu wrote:
> First, I'm not looking to start a holy war over which product is best,
> so my apologies if that is what happens...
> What I need is to be able to use my perl objects, be able to connect to
> MySQL databases, and be able to coexist on Apache.
I have done this with ePerl and am very happy with it.
ePerl has the simplest methodology. It converts everything NOT inside special
tags to print statements, and then just removes the tags, leaving you with
a perl script, which is then evaluated.
embperl is very actively supported. In fact it accounts for about half the
traffic on the mod_perl mailing list which is a blasted nuisance. Embperl
has LOTS of high level functions now, including stuff like sessions, special
tags for generating HTML tables out of SQL queries and so on.
I personally use ePerl because it does exactly what it says and no more. It
lets you embed perl in other text (be it HTML, ASCII, XML, whatever), and
nothing else. Less functionality means less to go wrong. It also comes
distributed as a proper parser, so you can incorporate its functionality
into any other program you might be writing. This also means that its easy to
write a CGI wrapper to run embedded perl scripts. IIRC embperl requires
mod_perl.
Apache::ePerl is a packaging of Parser::ePerl for the Apache mod_perl
environment. It ads some caching functionality for performance, and does a bit
of header munging. I have found the header munging can conflict with other
things, namely CGI.pm's cookie handling routines, but it's nothing that can't
be worked around.
------------------------------
Date: 26 Aug 1999 14:07:47 +0100
From: Stuart Feerick <smf26@cam.ac.uk>
Subject: Re: HTML Tools for perl?
Message-Id: <87emgq6670.fsf@pc0697.iapc.bbsrc.ac.uk>
ebohlman@netcom.com (Eric Bohlman) writes:
> Go to CPAN and look at the Text::* and HTML::* modules. There are
> several templating systems there, with varying capabilities and philosophies.
I'm currently playing with HTML::Mason, which (to me) seemed the most
functional, though certainly not as well featured or actively
developed as zope: Editing sessions/rollback, and a friendly template
system are noticibly absent.
I think there is a definate place for a PerlZope
(Pope?;-) though I simply don't have the time.
stu
--
smf26@cam.ac.uk
------------------------------
Date: Thu, 26 Aug 1999 14:55:24 GMT
From: Jimmy Humphrey <jimmy@blackhole-designs.com>
Subject: Images
Message-Id: <37C5554A.65BBA9C5@blackhole-designs.com>
I was wondering where I might find information on editing images in perl
so I can make thumbnails. I can't install any special program because
I'm on a virtual host. Also, is there anyway (via command line) to see
if a perl module exist on the system or not?
Jimmy
------------------------------
Date: Thu, 26 Aug 1999 15:02:37 GMT
From: Jimmy Humphrey <jimmy@blackhole-designs.com>
Subject: Re: Images
Message-Id: <37C556FB.6E09038F@blackhole-designs.com>
Oh yeah, I'm using the GD.pm
Jimmy
Jimmy Humphrey wrote:
> I was wondering where I might find information on editing images in perl
> so I can make thumbnails. I can't install any special program because
> I'm on a virtual host. Also, is there anyway (via command line) to see
> if a perl module exist on the system or not?
>
> Jimmy
------------------------------
Date: Thu, 26 Aug 1999 06:36:05 -0700
From: moseley@best.com (Bill Moseley)
Subject: Lexically scoped package vars and Apache::Registry
Message-Id: <MPG.122ee2a3e3eb7a079896d9@nntp1.ba.best.com>
The docs at perl.apache.org haven't helped with my confusion on this
question, yet... I need to get mod_perl installed on my PC for testing,
I guess.
In a module I have a 'private' hash declared with my at the top of the
package (in the implicit BEGIN block, I guess).
I'm unclear if this type of variable will persist from instance to
instance when run under mod_perl. I'm guessing it will.
package MyPackage;
my %hash = (
setting1 => 10,
setting2 => 2,
);
sub sub1 {
[...]
$hash{setting3} = 3;
}
In package main I use MyPackage.
Will $hash{setting3} live from instance to instance when running under
Apache::Registry? I'm guessing it will as I assume MyPackage only get's
pulled in once per child.
Is there way to use a private 'package' variable under mod_perl? Move
to an object interface in the module and put my common data structure in
the object? I guess it won't be private any more in that case.
Thanks,
--
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.
------------------------------
Date: 26 Aug 1999 09:36:44 -0400
From: bj <bradw@newbridge.com>
Subject: Re: Programming Question.. List/Email functions
Message-Id: <op1wvui64ur.fsf@newbridge.com>
abigail@delanet.com (Abigail) writes:
> And the original 7th edition of Unix, lava lamps, and UUCP for your mail
> and news?
What do you have against lava lamps... I still miss the one that got
trashed in a house move years ago... :-)
bj
------------------------------
Date: Thu, 26 Aug 1999 14:26:08 GMT
From: martyg8517@my-deja.com
Subject: REMOTE_HOST not showing results
Message-Id: <7q3ipg$pbl$1@nnrp1.deja.com>
I've written a script which needs to use the environment variable
REMOTE_HOST, eg
print "$ENV{'REMOTE_HOST'}";
this prints out a domain name on one web server I'm developing on, but
nothing on another. Both are running Apache.
Is this something that is turned on and off with Apache? If so, how?
regards
martin gittins
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Thu, 26 Aug 1999 13:21:31 GMT
From: Jon Peterson <jpeterson@office.colt.net>
Subject: Re: Servers for NT
Message-Id: <vbbx3.13$RY.323@news.colt.net>
marius_13@my-deja.com wrote:
> I browsed through the past posts can couldn't find the answer. Forgive
> me if i missed it. I am runnning NT4.0 & Win98 and downloaded the
> latest ActivePerl. What cgi server do you recommend for each OS. I'm
Hmmmm. CGI is served through an http server, and Perl doesn't really care
much one way or the other. IIS is what everyone else uses for NT, so you
may as well too - it'll be easy to get help on it. PWS (personal web server)
from Microsoft seems popular on 98 or 95. Almost any http server in existence
should be able to run CGI scripts without a problem.
However, bear in mind that this group has no interest in CGI or HTTP or the
Web or the Internet per se.
------------------------------
Date: 26 Aug 1999 15:11:59 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Servers for NT
Message-Id: <37c54b2f_2@newsread3.dircon.co.uk>
marius_13@my-deja.com wrote:
> I browsed through the past posts can couldn't find the answer. Forgive
> me if i missed it. I am runnning NT4.0 & Win98 and downloaded the
> latest ActivePerl. What cgi server do you recommend for each OS. I'm
> looking to setup on for development purposes. And any tips on setup
> would be great. I hoping to get one that's easy to setup.
>
If you look in the documentation that was installed with the Activestate
distribution you will see described how to configure various servers
to use Perl. However if you want a recommendation for an HTTP server
then you will want to ask in the newsgroup:
comp.infosystems.www.servers.ms-windows
/J\
--
"The only man in the cabinet who supported them was that fucking lunatic
Redwood" - John Major
------------------------------
Date: 26 Aug 1999 10:04:23 -0400
From: Matt Curtin <cmcurtin@interhack.net>
Subject: Re: SSN format
Message-Id: <xlxk8qivdso.fsf@gold.cis.ohio-state.edu>
>>>>> On Wed, 25 Aug 1999 16:35:44 -0400,
"Blair Chesnut" <blair_chesnut@ncsu.edu> said:
Blair> What's an "efficient" way to format an integer into an SSN
Blair> string? For example, 12345 -> "000-01-2345".
I know that you're probably the wrong person to whom to complain, but
I'm going to do it anyway, especially since I see that you've gotten
the information you need already. :-)
Unless you're the social security administration, do not use social
security numbers; you have no business doing so. Federally funded
universities that do this might even be breaking the law by using SSNs
as identifiers. (I recognize that you could be writing a program that
uses them legitimately, i.e., for handling of tax credits for
students--the IRS is really confusing this SSN-is-not-an-identifier
business, but universities are very sloppy about this in general, so
the chance that it's illegitimate use seems much greater.)
http://www.faqs.org/faqs/privacy/ssn-faq/
Don't ignore this advice because you work at a university where SSNs
are used everywhere. Complain to your management that SSNs are used
as identifiers. The university is taking a huge liability risk using
these infernal numbers. Students are getting wise to this kind of
thing and are pressuring university administrations to deal with it
and quit invading their privacy needlessly. Ohio State has a student
group trying to eliminate (to whatever extent legally possible) SSN
use at OSU: http://www.osu.edu/students/privacy/.
--
Matt Curtin cmcurtin@interhack.net http://www.interhack.net/people/cmcurtin/
------------------------------
Date: Fri, 27 Aug 1999 00:32:21 +1000
From: Malcolm Garbutt <mgarbutt@ozland.net.au>
Subject: text file reading > newfile
Message-Id: <37C54FF5.3DDF41B6@ozland.net.au>
Hi Guys, Gals and Guru's,
I have been reading the perl online doc's, newsgroups and Que's Perl 5
by example book to solve a small job I want to do, but I can't seem to
grasp the code I need to write.
If someone could write the small code for me I would appreciate it.
What I want to do is read a text file that has invoice records separate
by the word new, the next line of the record is a username, that I want
to be the name of an output file which is to contain the contents
between the new statements.
For example the text file below has 2 records in the usernames of max
and evih, I would like the data for max to be read and written to a text
file called max, then the data for evih read and written to a text file
called evih, etc.
Text File below
new
max
Invoice 37259
Chris Lanham
2/173 Ontario Ave
Mildura
Vic
3500
20/07/99 (max) Connected for 0h, 21m, 5s
22/07/99 (max) Connected for 1h, 3m, 49s
24/07/99 (max) Connected for 1h, 23m, 55s
25/07/99 (max) Connected for 0h, 34m, 14s
08/08/99 (max) Connected for 0h, 39m, 39s
10/08/99 (max) Connected for 0h, 4m, 39s
11/08/99 (max) Connected for 0h, 5m, 46s
27/08/99 (max) Service charge, 4:13:07 at $1.00/hr $ 4.22
27/08/99 (max) Rounding Benefit $ -0.02
27/08/99 Total charge $ 4.20
new
evih
Invoice 37260
Julie Hughey
PO Box SM266
South Mildura
Vic
3501
16/07/99 (evih) Connected for 0h, 8m, 43s
18/07/99 (evih) Connected for 1h, 32m, 36s
20/07/99 (evih) Connected for 3h, 19m, 21s
22/07/99 (evih) Connected for 2h, 52m, 18s
24/07/99 (evih) Connected for 2h, 26m, 29s
25/07/99 (evih) Connected for 1h, 4m, 6s
28/07/99 (evih) Connected for 0h, 21m, 58s
30/07/99 (evih) Connected for 1h, 12m, 52s
01/08/99 (evih) Connected for 7h, 13m, 8s
03/08/99 (evih) Connected for 0h, 23m, 52s
04/08/99 (evih) Connected for 0h, 27m, 38s
06/08/99 (evih) Connected for 0h, 11m, 35s
07/08/99 (evih) Connected for 5h, 22m, 26s
08/08/99 (evih) Connected for 6h, 31m, 59s
09/08/99 (evih) Connected for 3h, 13m, 5s
10/08/99 (evih) Connected for 0h, 2m, 11s
11/08/99 (evih) Connected for 0h, 12m, 50s
13/08/99 (evih) Connected for 0h, 38m, 9s
14/08/99 (evih) Connected for 0h, 17m, 37s
27/08/99 (evih) Service charge, 12:32:53 at $1.50/hr $ 18.82
27/08/99 (evih) Rounding Benefit $ -0.02
27/08/99 Total charge $ 18.80
------------------------------
Date: Thu, 26 Aug 1999 05:59:39 -0700
From: moseley@best.com (Bill Moseley)
Subject: Re: Tough RegEx TWO - Its almost perfect BUT..
Message-Id: <MPG.122eda13214d9fa9896d8@nntp1.ba.best.com>
Paul Dobbs (pdobbs@home.com) seems to say...
> s%(?<=">)(.{40})(\S+)(?=</a>)|(?<=href=")(\S{40})(\S+)(?=">)%$1$2%ig;
Paul, I often mess up my regular expressions, so I won't offer help
there. I just wanted to make sure you looked at HTML::TokeParser and
its friends to see if that wouldn't make your life much easier.
--
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.
------------------------------
Date: Thu, 26 Aug 1999 14:46:40 GMT
From: Jenda@Krynicky.cz (Jenda Krynicky)
Subject: Re: trouble using the Perl2exe aplication
Message-Id: <1103_935678800@prague_main>
On Wed, 25 Aug 1999 18:48:30 GMT, "[L] Vicious!" <baal@c2i.net> wrote:
> I'm having some trouble using the Perl2exe aplication, I know this is not
> related to Perl, but I recon some of you probably have used it.
>
> Compiling my program goes fine, with no errormessages. But when I run my
> EXE-file I get the errormessage:
>
>
> Can't locate auto/Tk/autosplit.ix in @INC at PERL2EXE_STORAGE/AutoLoader.pm
> line 127.
> at PERL2EXE_STORAGE/Tk.pm line 13
> Error: Parse exception
I believe I've seen some mails on this subject in Perl-Win32-Users.
Go to http://www.activestate.com , Support, Mailing lists
and see the archives.
The problem is that Tk contains hundreds of little snipets of code, hundreds of files, that it
loads on demand. Only when needed. And of course Perl2exe is unable to predict all this.
I think you will have to find all the pieces it wants by trial&error and include them in the call to
perl2exe.
Jenda
http://Jenda.Krynicky.cz
------------------------------
Date: Thu, 26 Aug 1999 10:24:11 -0400
From: Slav Inger <vinger@mail.ford.com>
Subject: Re: VERY VERY VERY weird things happening
Message-Id: <37C54E0B.392BA6F0@mail.ford.com>
Ilya Zakharevich wrote:
>
> [A complimentary Cc of this posting was sent to Slav Inger
> <vinger@mail.ford.com>],
> who wrote in article <37C45CFE.9991FCCC@mail.ford.com>:
> > handle tab keys. I'm using a global data structure which is a hash of
> > hashes, with the values of a hash being array elements, like so:
> > %hash = (
> > h1 => {}
> > );
>
> This creates hash of hashes.
>
> > I reference the hash values in the following way:
> > $hash{h1}->[0], $hash{h1}->[1], and so on.
>
> a) This autovivifies $hash{h1};
>
> b) You access things as a hash of arrays. Do not.
>
> Ilya
Hello and thanks for responding.
The idea was to have more than one value per key in the $hash{h1},
essentially having an array correspond to each key. Is there a way to
pre-declare a hash inside of a hash, the inner (in this case h1) one
being a hash of arrays? In the above snippet, I pre-declared a hash of
hashes.
Thanks.
- Slav Inger.
- vinger@mail.ford.com
------------------------------
Date: Thu, 26 Aug 1999 06:55:29 -0700
From: Xah Lee <xah@weborder.com>
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <37C54751.DEF3AB02@weborder.com>
Tom Christiansen wrote:
>
> [courtesy cc of this posting mailed to cited author]
>
> In comp.lang.perl.misc,
> Chad Netzer <chad@vision.arc.nasa.gov> writes:
> :PS. I find Tom's Python criticisms a bit off base, at times, but they
> :are mostly valid answers to the original question, and certainly not
> :inappropriate for c.l.perl.m.
>
> I answer the question put to me.
Answer! At what age did you lost your virginity?
Inquiring minds wants to know.
> :However, Tom also has books to sell, and
> :that end is not achieved by turning people away from Perl. Just
> :consider that when interpreting his criticisms.
>
> Fuck that noise. The day I am not technically credible is the
> day I quit.
C'mon, don't be so diffident. You will still be credible even when you retire.
Your tomes will illuminate the computing field till kingdom come.
> And you should search deja news for how often I use such language.
> I can think of nothing lower than to accuse me of selling out. I am
> extremely offended. Perhaps you're confusing me with someone else.
He probably confused you with Nigel Chapman, who tried to sell HIS book by
silently letting the book sell itself. (Too bad for him, it didn't work!)
Or perhaps he confused you with Sriram Srinivasan, guilty for the same
for his well-written Panther book.
Practicality has taught us that relying on quality does not work. The best way to sell your book is to write it for the morons, or unix morons, adding a bit of noise to it, and the selling will bootstrap itself. "Practical Moronics by morons for morons" has always been the hallmark of Perl Republic.
The best Perl book I personally liked is the Perl bible (aka camel book). This book is a printed version of the on-line pods, except it is paraphrased down for dummies at small places, making it easier for me to swallow. Besides, buying this book makes me feel that I've contributed to the Perl community, own a bible, and is psychologically satifying to actually spent money on something that's worth while.
Tommy, I also liked your $300 dollar per person one-day Perl conferenecs at linux expos. The experience of sitting-in a live preaching is suffient bang for the buck. The content and material is also perfect. It's all newbies ever needs to know about Perl. My friends showed me the handouts you gave, which I quickly recognized as articles that can be found on perl.com. I think it makes better sense to make both the camel or ram book a required text. This way, you can let newbies have the *freedom* to be able to read good books at home, and our community will be stronger because one of our leader is richer.
Sincerely,
Xah
xah@best.com
http://www.best.com/~xah/PageTwo_dir/more.html
------------------------------
Date: Thu, 26 Aug 1999 10:44:48 -0400
From: David Oppenheimer <davidopp@megsinet.net>
Subject: Re: Why use Python when we've got Perl?
Message-Id: <37C552DF.9F90BA36@megsinet.net>
I don't quite understand the relevance of this entire Perl advocacy string
here. If Xah thinks that getting mean responses to postings (especially
postings from newbies) is so very cool, then why waste time over here doing
postings to the Python newsgroup. I must say that in most newsgroups I have
found people friendly and helpful. If I were to post to a newsgroup and get
flamed for not knowing anything or given obviously incorrect information just
to piss me off, I'd never go back. It would not generate feelings of
advocacy for me. Who the hell wants to have some intellectual elitist
assholes tell you you're ignorant just for asking a question?!
That being said, are there ways to integrate Python and Perl to do things
that neither one can do alone?!
David O.
Cameron Laird wrote:
> In article <37b634a2@cs.colorado.edu>,
> Tom Christiansen <tchrist@mox.perl.com> wrote:
> .
> .
> .
> >Think back to the 80s and early 90s. The change, if it really happened,
> >came with the upty-gazillion CGI script kiddies who couldn't program
> >2+2, yet who wanted *us* to write *them* these persistent, encrypted,
> >crossplatform, multiscreen shopping carts for e-commerce, complete with
> >dynamically-generated animated vanity counters, each and every time
> >they stepped up to the feeder.
> .
> .
> .
> And e-mail address validation; don't forget that.
> No, wait, I mean, the *eight* things no one ever
> expects from the Spanish Inquisition are ...
> --
>
> Cameron Laird http://starbase.neosoft.com/~claird/home.html
> claird@NeoSoft.com +1 281 996 8546 FAX
------------------------------
Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 1 Jul 99)
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" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. 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" from
almanac@ruby.oce.orst.edu.
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 V9 Issue 651
*************************************