[12803] in Perl-Users-Digest
Perl-Users Digest, Issue: 213 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jul 21 13:07:23 1999
Date: Wed, 21 Jul 1999 10:05:12 -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 Wed, 21 Jul 1999 Volume: 9 Number: 213
Today's topics:
Ab: Locking files in win95 arpith@hotmail.com
Re: Appeasing the Java and Perl naming gods <craig@patchett.com>
Re: Calling Oracle Stored Procedures from PERL (John D Groenveld)
Re: CGI:calling subroutine from a form <swiftkid@bigfoot.com>
Corba and PERL jayadev@mailcity.com
Re: email handling <swiftkid@bigfoot.com>
File Locking / FTP <upsetter@ziplink.net>
Fun with Net:NNTP <dgreer@websightsolutions.com>
Re: getting the decimal portion of a floating point num <bivey@teamdev.com>
Re: HELP: Faster alternative of substr()? (Larry Rosler)
Re: How do I do a date string (ala from strftime) conve (Larry Rosler)
Re: How should I sort by different fields? <Webdesigner@NewWebSite.com>
How to divide output paga to <1> <2> <3> ... ? <factory@factory.co.kr>
I am looking for free flat db search script <factory@factory.co.kr>
Re: I am looking for free flat db search script <cassell@mail.cor.epa.gov>
Kinda FORK <Ch1ckEn@hotmail.com>
Perl and MS Access DBs module <f.agolli@studenti.to.it>
Re: Perl binary IO question (Larry Rosler)
Perl can't do ">>filename" -- geesh! wallewek@kmsi.net
PERL, CORBA and NT jayadev@mailcity.com
Re: PGP and Mail <upsetter@ziplink.net>
Re: regular Expression <bivey@teamdev.com>
Re: regular Expression (Larry Rosler)
Re: regular Expression (John Borwick)
specific to OS/2 (David Dows)
Stipping HTML and loosing memory (Flint Slacker)
Re: Testing for the existing of a key in a hash <swiftkid@bigfoot.com>
Re: Testing for the existing of a key in a hash (John Borwick)
Re: Testing for the existing of a key in a hash <uri@sysarch.com>
Re: using MIME::* to analyze email <simon@profero.com>
Using PerlMagick in CGI programs tcooper9@my-deja.com
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 21 Jul 1999 15:58:55 GMT
From: arpith@hotmail.com
Subject: Ab: Locking files in win95
Message-Id: <7n4qnm$vum$1@nnrp1.deja.com>
Hi,
Still, staying with locking files in '95.
flock() doesn't work and the other alternative is using lock files.
Isn't there some external program like share.exe or something to take
care of this work ? Well, is there some external program like this ?
After all multinode BBSes run on '95 machines without any problems with
files.
I was also advised to shift OS, to Linux, but I am planning on using
win95, atleast for the moment... so is there anything I can do..
Thanks
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Wed, 21 Jul 1999 09:37:01 -0700
From: "Craig Patchett" <craig@patchett.com>
Subject: Re: Appeasing the Java and Perl naming gods
Message-Id: <7n4sv5$1dg@dfw-ixnews5.ix.netcom.com>
Mike Bristow <mike@fat.dotat.at> wrote in message
news:slrn7pa1ed.pl.mike@lindt.fat.dotat.at...
> And I can't see why Com.Newt.Foo.Bar shouldn't be a class name, either,
Well, here's one reason: what's Com.Newt.Bar? Is it a class or a package?
com.newt.bar is obviously a package. com.newt.Bar is obviously a class.
Craig
******************************************
Craig Patchett <craig@patchett.com>
The CGI/Perl Cookbook: http://cgi-perl.com
love \luv\ (v): See John 3:16
------------------------------
Date: 21 Jul 1999 12:10:58 -0400
From: groenvel@cse.psu.edu (John D Groenveld)
Subject: Re: Calling Oracle Stored Procedures from PERL
Message-Id: <7n4rei$nf$1@grolsch.cse.psu.edu>
In article <7n2t5e$adt$1@nnrp1.deja.com>, <billpierce@my-deja.com> wrote:
>possible? For example I want to run an oracle
>proc and provide an input that then provides an
>array as output?
As of today, scalars and cursors, but not arrays.
John
groenveld@acm.org
------------------------------
Date: Wed, 21 Jul 1999 19:50:28 +0500
From: "Faisal Nasim" <swiftkid@bigfoot.com>
Subject: Re: CGI:calling subroutine from a form
Message-Id: <7n5q1l$eva1@news.cyber.net.pk>
: Is there a way to call a subroutine from a form, like:
: <form action= &delete_record>
: Is this possible?
nope
<form action=yourfile.cgi?sub_name>
in yourfile.cgi
& { $ENV { QUERY_STRING } };
Warning: Many Security Risks !!!!
------------------------------
Date: Wed, 21 Jul 1999 16:08:47 GMT
From: jayadev@mailcity.com
Subject: Corba and PERL
Message-Id: <7n4ra5$7m$1@nnrp1.deja.com>
I would like a PERL program to call a CORBA service running on
Visibroker. The PERL is to run on NT.
Is there any way to do this??
Does ILU and COPE support NT and IIOP??
Any help would be greatly appreciated.
Thanx
Jayadev
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Wed, 21 Jul 1999 19:47:20 +0500
From: "Faisal Nasim" <swiftkid@bigfoot.com>
Subject: Re: email handling
Message-Id: <7n5prn$elf2@news.cyber.net.pk>
James Gerard Coleman <jgc5a@j2.mail.virginia.edu> wrote in message
news:Pine.A41.4.05.9907211028320.66414-100000@node8.unix.Virginia.EDU...
: does anyone know of a module that will pull a message from a POP3 and let
: me process it as a file? maybe i've been looking in the wrong places, but
: i haven't found one yet on some of the script/module archives i've looked
: in.
Mail::POP3Client
Net::POP3
------------------------------
Date: Wed, 21 Jul 1999 16:08:35 GMT
From: Scratchie <upsetter@ziplink.net>
Subject: File Locking / FTP
Message-Id: <7gml3.745$ui4.237239@news.shore.net>
This isn't really a perl question, but maybe someone here has had to deal
with a similar situation.
I remember reading on this group that the ftp daemon doesn't check for
system-level file locking, and I've confirmed for myself that this seems
to be the case (I can delete a file via ftp while my perl script still has
an exclusive lock on it).
Anybody here come up with any clever ways to deal with this situation? For
example, I may want to download a data file that's created by a perl
script on my web server, but I want to make sure that the file isn't in
the middle of being updated when I grab it. Even if I check for the
existence of a lock file or something, there's a race condition involved.
Thanks in advance,
--Art
--
--------------------------------------------------------------------------
National Ska & Reggae Calendar
http://www.agitators.com/calendar/
--------------------------------------------------------------------------
------------------------------
Date: Wed, 21 Jul 1999 11:20:24 -0500
From: Darren greer <dgreer@websightsolutions.com>
Subject: Fun with Net:NNTP
Message-Id: <3795F348.458C8CE@websightsolutions.com>
Hello all.
I have been trying for the last week to be able to post to newsgroups
using Perl and Net::NNTP.
I have been unable to find any documentation that gives me the details
that I have been looking for. Below is the code which I have pieced
together. I _know_ it does not work. And is probably completely
wrong. I would appreciate if anyone could point me in the right
direction.
-----Code------
#!/usr/bin/perl
use Net::NNTP;
use Getopt::Long;
use HTTP::Request;
use Net::Cmd;
$base = '/usr/local/home/trainor/cgi';
chdir($base) or die "Could not cd to $base\n";
my $newsptr = Net::NNTP->new('news.mixcom.com');
$newsptr->group("wi.forsale");
$Test[0] = "From: Darren Greer\n";
$Test[1] = "Newsgroups: wi.forsale\n";
$Test[2] = "Subject: Test\n";
$Test[3] = "\n";
$Test[4] = "This is a test\n";
$newsptr->post(@Test);
$newsptr->quit;
------End Code-------
Thanks,
Darren
------------------------------
Date: 21 Jul 1999 15:24:51 GMT
From: "William" <bivey@teamdev.com>
Subject: Re: getting the decimal portion of a floating point number
Message-Id: <01bed38d$4545bbc0$583c08cf@bill.jump.net>
Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote in article
<7n34f9$r5t$1@lublin.zrz.tu-berlin.de>...
> William <bivey@teamdev.com> wrote in comp.lang.perl.misc:
> >anna@water.ca.gov wrote in article <7n2n1s$7t0$1@nnrp1.deja.com>...
> >> Hi,
> >>
> >> Is there a way in Perl or in a module of getting the decimal portion
of
> >> a floating point number? I have already tried using the
format_picture
> >> method of Number::Format, but that doesn't work.
> >>
> >> For example, if I have a number, 12345.6789 and I want to be able to
> >> return the portion .6789, how do I go about that?
> >>
> >> Thanks in advance for your reply,
> >> Anna
> >
> >Try
> > $YerNumber =~ m/(\.\d+)/;
> > return $1;
>
> What's wrong with $YerNumber - int $YerNumber? It doesn't depend on
> the locale.
>
> Anno
Because on my system that operation on that number yields
0.678900000000795
which isn't exactly what the original poster had in mind,
I'm sure. (I tend to avoid math function solutions to
floating point problems if there's a string solution because
of the possibility of results like the one above.) As far as
locale goes, you could place the decimal point in a variable.
-Wm
------------------------------
Date: Wed, 21 Jul 1999 09:38:23 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: HELP: Faster alternative of substr()?
Message-Id: <MPG.11ff975c6940fea0989d0e@nntp.hpl.hp.com>
[Posted and a courtesy copy sent.]
In article <7n4ife$s5g$1@nnrp1.deja.com> on Wed, 21 Jul 1999 13:37:51
GMT, hassanov@my-deja.com <hassanov@my-deja.com> says...
> Regarding huge arrays, is there any better (faster) way to do the
> following:
> for($i=0;$i<length($SrcArray);$i++)
> {
> $ord1=ord(substr($SrcArray, $i, 1));
> $ord2=ord(substr($EncryptionArray, $i, 1));
> substr($DstArray, $i, 1)=chr( $ord1 + ord2 );
> }
There is a bareword 'ord2' in there.
The following benchmark shows how one can improve it a lot by packing
the final step, but worsen it by unpacking the first two steps.
#!/usr/local/bin/perl -w
use strict;
use Benchmark;
my $SrcArray = 'abc' x 100;
my $EncArray = "\1\2\3" x 100;
sub Substr {
my $DstArray = "";
for (my $i = 0; $i < length $SrcArray; $i++)
{
my $ord1 = ord(substr($SrcArray, $i, 1));
my $ord2 = ord(substr($EncArray, $i, 1));
substr($DstArray, $i, 1) = chr( $ord1 + $ord2 );
}
$DstArray
}
sub Pack {
pack 'C' x length $SrcArray, map {
ord(substr($SrcArray, $_, 1)) + ord(substr($EncArray, $_, 1))
} 0 .. length($SrcArray) - 1
}
sub Unpack {
my @Src = unpack 'C' x length $SrcArray, $SrcArray;
my @Enc = unpack 'C' x length $EncArray, $EncArray;
pack 'C' x @Src, map { $Src[$_] + $Enc[$_] } 0 .. $#Src
}
timethese(1 << (shift || 0), {
Pack => \&Pack,
Unpack => \&Unpack,
Substr => \&Substr,
});
__END__
Benchmark: timing 1024 iterations of Pack, Substr, Unpack...
Pack: 4 wallclock secs ( 3.84 usr + 0.00 sys = 3.84 CPU)
Substr: 10 wallclock secs ( 9.23 usr + 0.00 sys = 9.23 CPU)
Unpack: 11 wallclock secs (11.75 usr + 0.00 sys = 11.75 CPU)
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 21 Jul 1999 08:30:50 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: How do I do a date string (ala from strftime) conversion to time_t?
Message-Id: <MPG.11ff87803e8c6531989d0c@nntp.hpl.hp.com>
In article <379adbd2.151647577@news.supernews.com> on Wed, 21 Jul 1999
14:52:57 GMT, Gabriel Russell <grussell@hushmail.com> says...
> >In article <3793247c.508741461@news.supernews.com> on Mon, 19 Jul 1999
> >16:28:11 GMT, Gabriel Russell <grussell@hushmail.com> says...
> >> How do I do a date string (ala strftime) to time (ala gmtime)
> >> conversion? I would guess that this is a faq but was unable to find
> >> it.
...
> Also, just another Larry Rosler, you posted a perl specific responce
> to my qustion to comp.lang.c. Do you think they care?
If you had cross-posted to Fortran and Ada groups also, I doubt that I
would have noticed. Maybe it was up to you to point out explicitly that
you were asking the same question in both the C and Perl groups.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 21 Jul 1999 14:58:46 GMT
From: Floyd Morrissette <Webdesigner@NewWebSite.com>
Subject: Re: How should I sort by different fields?
Message-Id: <7n4n6v$u8g$1@nnrp1.deja.com>
In article <3794BDD1.28689368@mail.cor.epa.gov>,
David Cassell <cassell@mail.cor.epa.gov> wrote:
<snipped>
>
> Agreed. So sometimes the best advice is to explain how to get to the
> FAQ which should be on their hard disk. Then follow that up with
> advice on how to get a copy if they are FAQ-deficient. Or is that
> FAQ-challenged? :-)
>
> HAND,
> David
> --
> David Cassell, OAO cassell@mail.cor.epa.gov
> Senior computing specialist
> mathematical statistician
>
I think we are in agreement for the most part. One thing I would like to
add is I know there are otherways to access usenet other than an
internet connection or like you said they might bulk download. But I
believe most new users of usenet are using the internet to use usenet.
I don't mean to make assumptions. I just know that answers that are
vague are not helpful at all. I don't ask many questions here myself
because I can usually find the answer already posted here somewhere. But
I have noticed I have to sort through a bunch of answers that either are
very vague or do nothing but demean the person asking. I will usually
find one person willing to answer the question with the proper detail
and in a civilized way. Most seem put out that they even have to read
the question.
And you are right that we should put the faq on our hard drive. I have
done that now that I know such a thing exists. Newbies don't know its
there.
--
Get your web site from http://www.NewWebSite.com
Consultation is always free.
Help with cgi scripts.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Thu, 22 Jul 1999 01:13:31 +0900
From: "Yeong Mo/Director Hana co." <factory@factory.co.kr>
Subject: How to divide output paga to <1> <2> <3> ... ?
Message-Id: <7n4r1s$4ra$1@news1.kornet.net>
Dear,
First, How to divide output paga to <1> <2> <3> ... as a search result of
flat db searching ?
Second, I am looking for free flat db search script
which has $ex0, $ex1, $ex2 variables for matching by select option.
If you have this please let me get it.
Thanks in advance.
------------------------------
Date: Thu, 22 Jul 1999 01:15:32 +0900
From: "Yeong Mo/Director Hana co." <factory@factory.co.kr>
Subject: I am looking for free flat db search script
Message-Id: <7n4r5l$54c$1@news1.kornet.net>
Dear,
I am looking for free flat db search script
which has $ex0, $ex1, $ex2 variables for matching by select option,
and has divideing output paga to <1> <2> <3> ...function.
If you have this please let me get it.
Thanks in advance.
------------------------------
Date: Wed, 21 Jul 1999 10:04:39 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: I am looking for free flat db search script
Message-Id: <3795FDA7.C0160181@mail.cor.epa.gov>
Yeong Mo/Director Hana co. wrote:
>
> Dear,
Hmmpph. I don't think you know me *that* well. :-)
> I am looking for free flat db search script
> which has $ex0, $ex1, $ex2 variables for matching by select option,
> and has divideing output paga to <1> <2> <3> ...function.
Excuse me, but you have made a small error. This is a newsgroup
about programming in a particualr language. It is not a source
for free programs. If you are looking for a script, rather than
trying to write it yourself, you would have more success using
one of the many search engines on the Web. Alta Vista, Yahoo,
ad nauseam.
HAND,
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Wed, 21 Jul 1999 16:30:24 +0000
From: GiN <Ch1ckEn@hotmail.com>
Subject: Kinda FORK
Message-Id: <3795F5A0.D0C615BD@hotmail.com>
i have one question:
i opened a filehandle: <S>
the program will read a line ($line) from <S> and work with it
function($line)
so this will do: while (<S>) {
function($line);
}
but function() has to be finished to read another line.
how can i read another line and do a function($line) without waiting
for function($line) to finish?
------------------------------
Date: Wed, 21 Jul 1999 17:53:49 +0200
From: "Fredi Agolli" <f.agolli@studenti.to.it>
Subject: Perl and MS Access DBs module
Message-Id: <7n4qr3$kvp$1@menelao.polito.it>
Hi to everybody,
I'm looking for Perl modules which manage MS Access Databases. May you give
me some information about this?
Thank's in advance.
Fredi
------------------------------
Date: Wed, 21 Jul 1999 08:11:37 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Perl binary IO question
Message-Id: <MPG.11ff83049b143c2989d0b@nntp.hpl.hp.com>
[Posted and a courtesy copy sent.]
In article <3795ADD6.500892BB@aks.com> on Wed, 21 Jul 1999 13:24:06
+0200, Eyal Ben-David <eyal.ben-david@aks.com> says...
> I'd like to know how I write perl code which its effect
> is identical to the following C code.
>
> /**** C code *****/
>
> long n;
>
> /* ... */
> FILE* fp = fopen("foo", "rb");
> read( fileno(fp), &n, sizeof(n));
> fclose(fp);
>
> ++n;
>
> fp = fopen("foo", "wb");
> write(fileno(fp), &n, sizeof(n));
> fclose(fp);
>
> /**** End of C code ***/
>
> This code writes raw bytes of the number n.
>
> I'm well aware to the problems of this code but I'm
> porting some old C code to Perl.
#!/usr/local/bin/perl -w
use strict;
my $n = 41;
my $file = 'e:/test/foo';
open FP, ">$file" or die "Couldn't write '$file'. $!\n";
print FP pack 'L', $n;
close FP;
open FP, "<$file" or die "Couldn't read '$file'. $!\n";
4 == read FP, $n, 4 or die "Failed read '$file'. $!\n";
close FP;
$n = 1 + unpack 'L', $n;
open FP, ">$file" or die "Couldn't write '$file'. $!\n";
print FP pack 'L', $n;
close FP;
open FP, "<$file" or die "Couldn't read '$file'. $!\n";
4 == read FP, $n, 4 or die "Failed read '$file'. $!\n";
close FP;
$n = unpack 'L', $n;
print "$n\n";
__END__
And the answer is ...
Here it is written a bit more cleanly.
#!/usr/local/bin/perl -w
use strict;
sub write_read {
my $file = 'e:/test/foo';
open FP, ">$file" or die "Couldn't write '$file'. $!\n";
print FP pack 'L', shift;
close FP;
open FP, "<$file" or die "Couldn't read '$file'. $!\n";
4 == read FP, my $x, 4 or die "Failed read '$file'. $!\n";
close FP;
unpack 'L', $x
}
my $n = write_read(41);
print write_read(++$n), "\n";
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 21 Jul 1999 16:50:51 GMT
From: wallewek@kmsi.net
Subject: Perl can't do ">>filename" -- geesh!
Message-Id: <3798f904.248459149@news.cadvision.com>
In just about any normal Unix scripting language, not to mention DOS
Batch, it is possible to redirect and append the output of any command
to any arbitrary log file. I find this extremely useful and convenient
for logging events that occur during user logins.
From what I can see, the only way to do this with perl is clunky -- I
have to redirect the output with a separate command, and turn it off
afterward again with another separate command.
As I'm planning to have a lot of users running the same script at the
same time, appending to the same log file, there is also the concern
about simultaneous write access. Using ">>filename" is about as close
to an atomic operations as I'm likely to get.
Am I missing something, or is this something perl just doesn't do
well?
/kenw
Ken Wallewein
Calgary, Alberta
kenw@kmsi.net
------------------------------
Date: Wed, 21 Jul 1999 15:08:25 GMT
From: jayadev@mailcity.com
Subject: PERL, CORBA and NT
Message-Id: <7n4not$uhr$1@nnrp1.deja.com>
Is there an implementation of a PERL ORB that
works on NT.
I understand that COPE is an option, but the
documentation says that it does not work well with
NT.
Any help would be appreciated
Jayadev
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Wed, 21 Jul 1999 16:00:03 GMT
From: Scratchie <upsetter@ziplink.net>
Subject: Re: PGP and Mail
Message-Id: <78ml3.744$ui4.237239@news.shore.net>
brian d foy <brian@pm.org> wrote:
:> : i recommend using IPC::Open3. i recently posted an example in either
:> : this forum or comp.infosystems.www.authoring.cgi.
:>
:> Could someone explain in a nutshell what the advantages are to using
:> IPC::Open3 rather than open?
: open can't do the same things IPC::Open3 can. that's it in a nutshell.
Such as... ?
I'm trying to understand what the difference is (you know, to avoid "cargo
cult programming") but I'm afraid that I found "perldoc IPC::Open3" to be
less than enlightening.
For example, let's say I want a CGI script to send me a pgp-encrypted
message. I might write something like this:
open (PGP, '| pgpe -fatr upsetter@ziplink.net| mail upsetter@ziplink.net')
or die "Could not open PGP: $!";
print PGP $message;
close PGP;
This seems to work fine for my purposes. Am I missing something obvious by
not using Open3?
--Art
--
--------------------------------------------------------------------------
National Ska & Reggae Calendar
http://www.agitators.com/calendar/
--------------------------------------------------------------------------
------------------------------
Date: 21 Jul 1999 15:06:25 GMT
From: "William" <bivey@teamdev.com>
Subject: Re: regular Expression
Message-Id: <01bed38a$8a825f20$583c08cf@bill.jump.net>
Abigail <abigail@delanet.com> wrote in article
> I've given the "detect whether an expression has balanced parenthesis"
> so often to newbie students, and it's so trivial to do in any language,
> I wouldn't even think 'regex' if I want to solve this.
>
> for (my $i = my $c = 0; $i < length ($str); $i ++) {
> my $char = substr ($str, $i, 1);
> $c ++ if $char eq '(';
> $c -- if $char eq ')';
> die "Not balanced" if $c < 0;
> }
> die "Not balanced" if $c;
>
>
> Extracting the balanced pieces is left as an exercise to the reader.
I like one-liners myself
(($str =~ tr/\(//) == ($str =~ tr/\)//) )) or die "Not balanced";
-Wm
------------------------------
Date: Wed, 21 Jul 1999 08:39:46 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: regular Expression
Message-Id: <MPG.11ff89973c4faab0989d0d@nntp.hpl.hp.com>
In article <01bed38a$8a825f20$583c08cf@bill.jump.net> on 21 Jul 1999
15:06:25 GMT, William <bivey@teamdev.com> says...
> I like one-liners myself
> (($str =~ tr/\(//) == ($str =~ tr/\)//) )) or die "Not balanced";
^ ^
Why?
I think you may be )unbalanced(.
:-)(
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 21 Jul 1999 15:59:52 GMT
From: John.Borwick@sas.com (John Borwick)
Subject: Re: regular Expression
Message-Id: <3799ee28.186489317@newshost.unx.sas.com>
On 21 Jul 1999 15:06:25 GMT, "William" <bivey@teamdev.com> wrote:
>I like one-liners myself
>(($str =~ tr/\(//) == ($str =~ tr/\)//) )) or die "Not balanced";
>-Wm
>
$str = ")(";
oops!
--
John Borwick
------------------------------
Date: 21 Jul 1999 17:03:12 GMT
From: dows@rcf.usc.edu (David Dows)
Subject: specific to OS/2
Message-Id: <7n4ugg$den$1@usc.edu>
Will someone please point me toward information on perl
programming for OS/2? I'd like to make the necessary
little corrections so unix stuff will run on OS/2 boxes.
Thanks!
------------------------------
Date: Wed, 21 Jul 1999 19:22:09 GMT
From: flint@tcn.net (Flint Slacker)
Subject: Stipping HTML and loosing memory
Message-Id: <37961c5b.10873688@news.remarq.com>
The code below seems to strip the HTML tags out but never frees the
memory. I searched around and found that it uses a circular list, how
do I free it?
sub RemoveHTML {
my($htmlref);
$htmlref = HTML::FormatText->new;
$_[0] = $htmlref->format(parse_html($_[0]));
undef $htmlref; # Free memory ????
return($_[0]);
}
Flint
------------------------------
Date: Wed, 21 Jul 1999 19:48:29 +0500
From: "Faisal Nasim" <swiftkid@bigfoot.com>
Subject: Re: Testing for the existing of a key in a hash
Message-Id: <7n5ptt$elf3@news.cyber.net.pk>
: Is there a better way than
: if ($hash{$key} eq ".")
unless ( $hash { $key } )
unless ( defined $hash { $key } )
if ( ! defined $hash { $key } )
if ( ! exists $hash { $key } )
etc.
------------------------------
Date: Wed, 21 Jul 1999 15:28:32 GMT
From: John.Borwick@sas.com (John Borwick)
Subject: Re: Testing for the existing of a key in a hash
Message-Id: <3797e686.184535758@newshost.unx.sas.com>
On Wed, 21 Jul 1999 09:27:41 -0500, Bruno Pagis
<pagib@aur.alcatel.com> wrote:
>Is there a better way than
>if ($hash{$key} eq ".")
>to know that a key has no entry in a hash ?
>I figured out that when a key does not exist, I get a dot returned for
>the value, but I'm not even sure that it is "standard".
I would like to see code where $hash{key} returns "." when $hash{key}
undefined.
Also try perldoc -f exists
--
John Borwick
------------------------------
Date: 21 Jul 1999 11:58:11 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Testing for the existing of a key in a hash
Message-Id: <x7673ef10s.fsf@home.sysarch.com>
>>>>> "MC" == Marshall Culpepper <marshalc@americasm01.nt.com> writes:
MC> Bruno Pagis wrote:
>> Is there a better way than
>> if ($hash{$key} eq ".")
>> to know that a key has no entry in a hash ?
>> I figured out that when a key does not exist, I get a dot returned for
>> the value, but I'm not even sure that it is "standard".
>>
>> BRUNO.
MC> this may be what you're looking for:
MC> if !defined($hash{$key})
try it on this hash:
%hash = ( a => undef ) ;
is the key 'a' in that hash? what does this return?
defined( $hash{a} )
answer: there is a better function to see if a key exists.
and the name is hidden in the answer.
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
uri@sysarch.com --------------------------- Perl, Internet, UNIX Consulting
Have Perl, Will Travel ----------------------------- http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
"F**king Windows 98", said the general in South Park before shooting Bill.
------------------------------
Date: Wed, 21 Jul 1999 17:35:33 +0100
From: Simon Wistow <simon@profero.com>
Subject: Re: using MIME::* to analyze email
Message-Id: <3795F6D5.4E47D477@profero.com>
John Klassa wrote:
>
> I'm trying to use MIME::Parser, MIME::Entity and the like to emit the
> contents of an arbitrary mail message (possibly MIME encoded) in a standard
> sort of way. In particular, I'd like to get rid of quoted-printable
> encodings and so forth, and just wind up with all of the message segments
> on stdout, as plain text as can be, so that the message can bed fed into
> something else.
Have a look at the source code for Acmemail by Leon Brocard avaliable from
http://www.astray.com/acmemail/.
It's a POP3/IMAP to Web agteway and deals with Mime including nested subparts
using a recursive function.
--
Simon Wistow Development
simon@profero.com Profero Ltd
Phone : 0171 700 9960 Fax : 0171 700 9961
------------------------------
Date: Wed, 21 Jul 1999 16:24:33 GMT
From: tcooper9@my-deja.com
Subject: Using PerlMagick in CGI programs
Message-Id: <7n4s7h$kh$1@nnrp1.deja.com>
I'm trying to use PerlMagick to dynamically generate files that are
composed of several different overlays. I'm having a problem getting
it to properly output to STDOUT so I can display it without writing to
a file. It will write to a file fine, but I get malformed header
errors when using STDOUT. Here is a sample of a program that doesn't
work for me :
use CGI;
use Image::Magick;
my $cgi = new CGI;
my $image = Image::Magick->new;
$image->Read('images/base1715.gif');
print $cgi->header(-type => 'image/gif',
-expires => '-1s'
);
binmode(STDOUT);
$image->Write('gif:-');
I can do this fine when I use GD, but I want to eventually use the
ability to export images in JPEG formats that Perl Magick has. If
anyone can tell me what I'm doing wrong, I'd appreciate it.
TIA.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
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". 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 V9 Issue 213
*************************************