[13212] in Perl-Users-Digest
Perl-Users Digest, Issue: 622 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Aug 23 16:07:17 1999
Date: Mon, 23 Aug 1999 13:05:11 -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 Mon, 23 Aug 1999 Volume: 9 Number: 622
Today's topics:
Re: $5 for 1st perl script that prints out most common (Dr. Jason A. Taylor)
Re: array of objects (dererencing issue) <aqumsieh@matrox.com>
Calling Mike Guy <sian@sleitch.nildram.co.uk>
Re: calling scripts from other scripts HELP! (Michael Budash)
Cron Job limitations - help needed <sangiro@dropzone.com>
Re: Cron Job limitations - help needed (John Stanley)
Re: DBI, fetchrow_array and sorting (mysql) (Michael Budash)
email address verification <pef@tp.net>
Re: email address verification (John Stanley)
Re: fork() on the web. Missing the point here? (Sameer Siruguri)
Re: GDBM Access in Perl <jimt@netins.net>
Re: Help for the newbie <tallen@allentechconsult.com>
lists and commas (Jeff)
Re: Nastiness contrary to the spirit of perl? <spike_YYwhiteYY@YYdellYY.com>
Re: Nastiness contrary to the spirit of perl? (Jim Hutchison)
need help with login/dynamic site <jiyeung@cisco.com>
Re: need help with login/dynamic site <makkulka@cisco.com>
newbie,to loops,need simple ex. <bzhaainc@erols.com>
Re: newbie,to loops,need simple ex. <sariq@texas.net>
Parsing NES ACL files with perl? <revjack@radix.net>
Re: Perl Email With Netscape <jimmy@blackhole-designs.com>
Re: Perl Email With Netscape (elephant)
Perl on VMS? <rp5280@email.sps.mot.com>
Re: Perl script for sending email on NT <f.geiger@vol.at>
PerlMagick memory problem when using Annotate. <kmccrery@interpath.com>
Re: pushing an anonymous hash slice (Greg Bacon)
Shamefully simple question. mrbog@my-deja.com
Shamefully simple question. <samay1NOteSPAM@hotmail.com>
Re: Shamefully simple question. (Shawn O'Donnell)
Re: Shamefully simple question. <makkulka@cisco.com>
Re: Shell vs Perl <aqumsieh@matrox.com>
sorting files randomly out of a list <mmilovan@grolier.fr>
Re: String to Int (Greg Bacon)
Re: Why $|++ (was: Re: perl system()) <rick.delaney@home.com>
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 23 Aug 1999 19:51:49 GMT
From: theoblit@wam.umd.edu (Dr. Jason A. Taylor)
Subject: Re: $5 for 1st perl script that prints out most common phrases
Message-Id: <7ps8ol$nqj$1@dailyplanet.wam.umd.edu>
Winner is Kragen Sitaker! The script does not take into account
words like "the", etc., but is does work. Thanks Kragen!
Cheers,
Jason
Here is his email and script:
----------------------------------------------------------------
Subject: Re: most common phrases
From: kragen@pobox.com (Kragen Sitaker)
Hmm, I suspect that all of the most frequent phrases in your thesis
will be single-word phrases. 'the' is probably the most frequent
phrase, followed by 'of'. I'd almost be willing to bet that the most
frequent two-word phrase is "of the". (In testing on the first 5000
lines of my mailbox, "of the" with 99 occurrences handily beat out "is
a" with 56 occurrences and "in the " with 55 occurrences. Other
popular phrases included "to the", "to be", "for the", "on the", "can
be", "that the", and "will be".)
Three-word phrases seem to work better. I get (among various bits of
the current date and strings of dashes from the freshmeat newsletter)
"license: GPL category:" (from freshmeat), "Committee Report at", "be
able to", "to subscribe or", etc. (That's from a 42,375-word corpus
extracted from the top of my mailbox.)
Here's a Perl script that will print all the N-word phrases in
something, sorted by frequency. It splits lines on whitespace to get
'words'; that may not be what you want. It takes about 7-10 seconds on
the aforementioned 42,375-word corpus, with n being 1, 2, or 3.
Please don't send me $5.
#!/usr/bin/perl -w
use strict;
my $n = shift @ARGV;
die "usage: $0 nwords [input]\n" if not defined ($n) or $n == 0;
my %phrases;
my @phrase;
while (<>) {
my @line = split;
for (@line) {
push @phrase, $_; # add next word
# cut and pasted -- ick, sorry
$phrases{join ' ', @phrase} ++ if @phrase == $n;
if (@phrase == $n + 1) {
shift @phrase; # remove oldest word
$phrases{join ' ', @phrase} ++;
}
}
}
print map { sprintf ("%8d %s\n", $phrases{$_}, $_) }
sort { $phrases{$b} <=> $phrases{$a} }
keys %phrases;
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Mon Aug 23 1999
77 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Mon, 23 Aug 1999 13:27:10 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: array of objects (dererencing issue)
Message-Id: <x3yd7weo1ap.fsf@tigre.matrox.com>
Michel Combes <michel.combes@hl.siemens.de> writes:
> I'm new in writing OO code, and want to have an Array of objet
> but I can't find a easy wait to dereference it
> Any suggestion is welcomed.
> Here is the problem I'm facing...
> $i = 3;
> $v = Object->new();
> $MEM[$i]=$v;
> print $MEM[$i]->display();
> I have the error :
> Can't call method "display" without a package or object reference
It's almost surely due to your new() method of module Object. I
suspect that the new() method does not return a blessed reference. The
last line of that method should be something like:
return bless $obj, $class;
Show us your code for your Object module, and we'll able to help you
better.
BTW, all of Perl's warning/error messages are described in detail in
the perldiag perldoc.
HTH,
Ala
------------------------------
Date: 21 Aug 1999 17:56:46 +0100
From: Sian Leitch <sian@sleitch.nildram.co.uk>
Subject: Calling Mike Guy
Message-Id: <87iu69rs1d.fsf@sleitch.nildram.co.uk>
Can anybody give Mike Guy's email address?
He worked on the Algol 68C compiler with Steve Bourne many,
many years ago.
--
Sian Leitch Algol 68 specialist.
Are you one of the lucky people who has prepared for Y2K?
Or is your head still in the sand?
------------------------------
Date: Mon, 23 Aug 1999 12:53:48 -0700
From: mbudash@sonic.net (Michael Budash)
Subject: Re: calling scripts from other scripts HELP!
Message-Id: <mbudash-2308991253480001@adsl-216-103-91-123.dsl.snfc21.pacbell.net>
In article <7pr2v2$mom$1@nnrp1.deja.com>, alghazn@my-deja.com wrote:
>Can someone guide me here please?
>What I want to do is call one of my scripts (myscript.cgi) from my main
>script (mainscript.cgi) and pass it some arguments $A and $B
>Tried system("perl myscript.cgi $A $B"); from within mainscript.cgi but
>it doesn't work!
"doesn't work" is vague... where was myscript.cgi looking for the args? if
not in @ARGV, that's why...
[snip]
>Can HTTP_REFER can be faked , for example, by
>myscript.cgi?A=blah&&HTTP_REFER=mypage ,
yes
> or is it safe to use it as a
>kind of password for deeper access into a site (meaning only the browser
>can set it?
no
--
| Michael Budash Consulting | 707-252-7670 voice |
| Perl, Javascript, PHP, MySQL | 603-250-8679 fax |
| Official Extropia Developer | mbudash@sonic.net |
------------------------------
Date: Mon, 23 Aug 1999 17:54:16 GMT
From: sangiro <sangiro@dropzone.com>
Subject: Cron Job limitations - help needed
Message-Id: <7ps1s2$des$1@nnrp1.deja.com>
Heya all,
Me ISP allows me to run a single cron job on my system every night
only. I would like to know if there is a way to have this cron job run
a small cgi file that will in return kick-off or execute two or three
other small files.
Does anyone have a script to this effect?
Safe swoops
Sangiro
http://www.dropzone.com/
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 23 Aug 1999 18:21:07 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: Cron Job limitations - help needed
Message-Id: <7ps3ej$llf$1@news.NERO.NET>
In article <7ps1s2$des$1@nnrp1.deja.com>,
sangiro <sangiro@dropzone.com> wrote:
>Me ISP allows me to run a single cron job on my system every night
>only. I would like to know if there is a way to have this cron job run
>a small cgi file that will in return kick-off or execute two or three
>other small files.
And just what will this small "CGI file" common-gateway-interface to?
>Does anyone have a script to this effect?
Yes.
------------------------------
Date: Mon, 23 Aug 1999 12:48:05 -0700
From: mbudash@sonic.net (Michael Budash)
Subject: Re: DBI, fetchrow_array and sorting (mysql)
Message-Id: <mbudash-2308991248050001@adsl-216-103-91-123.dsl.snfc21.pacbell.net>
In article <37C10D3B.E9B1FD02@jbi.hioslo.no>, Michael Preminger
<michael.preminger@jbi.hioslo.no> wrote:
>Hei!
>
>I am using perl DBI against a mysql database, and fetching a set of
>record from the database ordered.
>
>I use the construct:
> $IndexedDocs=$dbh->prepare("select Document_inc_id from
>Term_indexes_Document where Term_inc_id=$old_n order by Document_inc_id
>");
> $IndexedDocs->execute;
> while (@doc_id=$IndexedDocs->fetchrow_array){
> $tmpTermEntry.="$doc_id[1] ";
> }
>
>To my surprize the list I get has lost the sorting imposed by the select
>call. Trying to run the same call directly against the base retains the
>sorting.
>
>Question:
>
>Why do I lose the sorting the way I implement it, and how do I retain
>the sorting within DBI
>
i'm surprised you get anything at all, sorted or not. here's why:
$doc_id[1] points to the second field in the result, and should be
undefined, since your query only had one field in the field list.
--
| Michael Budash Consulting | 707-252-7670 voice |
| Perl, Javascript, PHP, MySQL | 603-250-8679 fax |
| Official Extropia Developer | mbudash@sonic.net |
------------------------------
Date: Mon, 23 Aug 1999 13:30:42 -0400
From: Paul Falardeau <pef@tp.net>
Subject: email address verification
Message-Id: <37C18541.6060235@tp.net>
Hello,
I know I've seen this posted to this list before, but I just can't find
it.
Can somebody please post a snippet of code which will check the validity
of an email address? For example I want to return an error if someone
enters something like jsmith@aol rather than jsmith@aol.com
Thanks,
Paul...
------------------------------
Date: 23 Aug 1999 18:19:39 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: email address verification
Message-Id: <7ps3br$ll7$1@news.NERO.NET>
In article <37C18541.6060235@tp.net>, Paul Falardeau <pef@tp.net> wrote:
>Hello,
>
>Can somebody please post a snippet of code which will check the validity
>of an email address? For example I want to return an error if someone
>enters something like jsmith@aol rather than jsmith@aol.com
Tsk tsk. jsmith@aol can be a valid email address, so why do you want an
error returned?
------------------------------
Date: 23 Aug 1999 18:02:27 GMT
From: siruguri@cs.rice.edu (Sameer Siruguri)
Subject: Re: fork() on the web. Missing the point here?
Message-Id: <slrn7s335j.320.siruguri@waltz.cs.rice.edu>
On Mon, 23 Aug 1999 13:08:20 GMT, Richard Lawrence <ralawrence@my-deja.com> wrote:
>open (FILE, "/tmp/here.txt") || die "can't! : $!";
This should be
open(FILE, ">/tmp/here.txt") || ....;
sam.
--
Sameer Siruguri Graduate student, CS, Rice University
siruguri@cs.rice.edu 713-527-8750x2282 www.cs.rice.edu/~siruguri
------------------------------
Date: Mon, 23 Aug 1999 13:48:36 -0500
From: Jim Turner <jimt@netins.net>
Subject: Re: GDBM Access in Perl
Message-Id: <37C19784.5465A6F7@netins.net>
First off, I appreciate the help so far... I'm further now, but either I'm
missing something pretty fundamental here or I'm just not seeing the
obvious.
Ben's suggestion of :
$map = tie %my_hash,'GDBM_File',$file,&GDBM_WRCREAT,0644
works and correctly ties the file to a hash and I can loop through all the
data in the file now, but I don't believe that's the proper way of accessing
entries (seeing as it takes 3-5 minutes to pull one key... it's a large DB).
Such things like $my_hash{"$key"} will pull the correct information much
faster, but I'm very unsure if this is the correct way to change values in a
database.
perldoc GDBM_File is nothing more than a man page saying that a manpage
needs to be written. It doesn't help much with access routines. I've read
every man page that has anything to do with hashes, DBM, GDBM, and
modules. There are routines that I seen talked about, but there are never any
examples or futher discussion of them except what they are supposed to do.
FETCH, STORE, DELELE, EXISTS... how does one use these? Perl
only complains that it's undefined, no matter what type of require or package
I pull in.
Thanks again and I apologize if I'm simply not reading the right information.
_________________
Jim Turner
Systems Administration
netINS, Inc.
jimt@netins.net
Tim Potter wrote:
> snowhare@long-lake.nihongo.org (Benjamin Franz) writes:
>
> [...]
>
> > >I fully admit I may just be doing the tie() wrong, but I can't verify as
> > >there is zero documentation (from what I can find) on GDBM access in Perl.
> >
> > 'perldoc GDBM_File'
>
> Or look in the texinfo file for gdbm. There's plenty of useful
> documentation there.
>
> Tim.
>
> >
> > --
> > Benjamin Franz
> >
>
> --
> Tim Potter, System Admin/Programmer "Disco Stu doesn't advertise"
> Advanced Computational Systems CRC, RSISE Bldg Australian National University,
> Canberra 0200, AUSTRALIA Ph: +61 2 62798813 Fax: +61 2 62798602
------------------------------
Date: Mon, 23 Aug 1999 14:44:41 -0400
From: "Tim Allen" <tallen@allentechconsult.com>
Subject: Re: Help for the newbie
Message-Id: <7ps4s5$cc0$1@bgtnsc01.worldnet.att.net>
Thanks,
Tim
Dick Latshaw <latsharj@my-deja.com> wrote in message
news:7prhrg$ko$1@nnrp1.deja.com...
> In article <7pqmt7$ncj$1@bgtnsc02.worldnet.att.net>,
> "Tim Allen" <tallen@allentechconsult.com> wrote:
> > Is there a tutorial somewhere that can show me how to manipulate an
> > sql database with a perl program?
>
> perldoc -q sql
> --
> Regards,
> Dick
>
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.
------------------------------
Date: Mon, 23 Aug 1999 14:34:15 -0500
From: oshram@bells.net (Jeff)
Subject: lists and commas
Message-Id: <oshram-2308991434150001@dfwms2.conspiracy.net>
Hi All,
I'm having trouble assigning a group of numbers to a list because some of
the numbers contain formatting commas
here's an example
...
my @Items = m/\$(\d+\.\d+)/sg;
the numbers look like this
$4.00
$5.15
$1,250.17
...
the commas present a problem with my lame code above
I know this is probably simple but the answer isn't obvious to me
can anyone help?
TIA,
--
jeff
------------------------------
Date: Mon, 23 Aug 1999 12:14:27 -0500
From: "Spike White" <spike_YYwhiteYY@YYdellYY.com>
Subject: Re: Nastiness contrary to the spirit of perl?
Message-Id: <7prvbf$ibl$1@galaxy.us.dell.com>
James Meacham wrote in message ...
>
>When I first left the world of the church and academe, where I had spent my
last 15 or so years, to follow my interest in computers, the attitude of
humanity embodied in the Camel Book attracted me. Larry Wall is clearly a
spiritual and humanistic person, and the fact that the language embodies the
desire to meet people how they think rather than forcing them into
reductionistic computerisms was, and remains, among the main reasons I use
perl rather than the other languages out there. So while the creator of the
language and really the language itself manifest an attitude of humanistic
synthesis, the overwhelming tone of this newsgroup is one of nastiness,
condescension, and intolerance.
>
>Perhaps this is due only to a couple of prodigious posters with bad
attitudes, and also to the disembodiment inherent in the Usenet medium, but
I'd be interested to know what others thought about this apparent
contradiction, or at least inconsistency. I've been programming and working
with computers for a long time now, and I could probably be a useful member
of the perl community, but the tone of this newsgroup has discouraged me
from posting lest I make a mistake, or be guilt of not having read the FAQ
recently or carefully enough. Just curious if I'm the only one, and if I'm
the only one who has noticed this disparity between the creator and the
language in contradistinction to the Usenet groups devoted to the language.
Yeah, kinda reminds me of all the intrigues and fights in the 1st century
church after Jesus left.
Hmm...maybe this is just basic human nature at work.
Spike
------------------------------
Date: Mon, 23 Aug 1999 18:35:47 GMT
From: jimhutchison@metronet.ca (Jim Hutchison)
Subject: Re: Nastiness contrary to the spirit of perl?
Message-Id: <37c1903d.244341093@news1.cal.metronet.ca>
On Mon, 23 Aug 1999 12:14:27 -0500, "Spike White"
<spike_YYwhiteYY@YYdellYY.com> wrote:
>
>James Meacham wrote in message ...
>>
>>When I first left the world of the church and academe, where I had spent my
>last 15 or so years, to follow my interest in computers, the attitude of
>humanity embodied in the Camel Book attracted me. Larry Wall is clearly a
>spiritual and humanistic person, and the fact that the language embodies the
>desire to meet people how they think rather than forcing them into
>reductionistic computerisms was, and remains, among the main reasons I use
>perl rather than the other languages out there. So while the creator of the
>language and really the language itself manifest an attitude of humanistic
>synthesis, the overwhelming tone of this newsgroup is one of nastiness,
>condescension, and intolerance.
>>
>>Perhaps this is due only to a couple of prodigious posters with bad
>attitudes, and also to the disembodiment inherent in the Usenet medium, but
>I'd be interested to know what others thought about this apparent
>contradiction, or at least inconsistency. I've been programming and working
>with computers for a long time now, and I could probably be a useful member
>of the perl community, but the tone of this newsgroup has discouraged me
>from posting lest I make a mistake, or be guilt of not having read the FAQ
>recently or carefully enough. Just curious if I'm the only one, and if I'm
>the only one who has noticed this disparity between the creator and the
>language in contradistinction to the Usenet groups devoted to the language.
>
>
>Yeah, kinda reminds me of all the intrigues and fights in the 1st century
>church after Jesus left.
>Hmm...maybe this is just basic human nature at work.
>
>Spike
>
Quite well said. I too have seen the same attitude, much to my
surprise...especially having been in the business for as long as I
have, witnessing the sharing nature of the Unix community. No
question too complex or simple; answers were (are) always there -
always a friendly "smile".
I've asked stupid questions, but have also answered them respectfully.
------------------------------
Date: Mon, 23 Aug 1999 11:08:08 -0500
From: Jimmy Yeung <jiyeung@cisco.com>
Subject: need help with login/dynamic site
Message-Id: <37C171E8.386D2F65@cisco.com>
Hi everyone,
Recently the need for a site that allows certain users to view certain
things on a website has come up here at work.
For example, a user would login with his/her password, and depending on
who or she is, certain topics or links on a site may or may not show up.
Does anyone have any ideas for this project? Im at a lost as to where
to start, or how to start . . thanks all . .
-Jimmy
------------------------------
Date: Mon, 23 Aug 1999 11:29:57 -0700
From: Makarand Kulkarni <makkulka@cisco.com>
Subject: Re: need help with login/dynamic site
Message-Id: <37C19325.616D708@cisco.com>
[ Jimmy Yeung wrote:
> Im at a lost as to whereto start, or how to start ...
Start with this URL on webmonkey.
http://www.hotwired.com/webmonkey/html/97/08/index2a.html?tw=backend
This is a primer on authentication mechanisms.
--
------------------------------
Date: Mon, 23 Aug 1999 13:59:15 -0400
From: "Ben Horowitz" <bzhaainc@erols.com>
Subject: newbie,to loops,need simple ex.
Message-Id: <7ps29t$aa9$1@autumn.news.rcn.net>
need simple explanation,about loops
------------------------------
Date: Mon, 23 Aug 1999 13:23:00 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: newbie,to loops,need simple ex.
Message-Id: <37C19184.6461B5F9@texas.net>
Ben Horowitz wrote:
>
> need simple explanation,about loops
Take a look at 'perldoc perlsyn'; however, if you need to ask a question
that is this basic, you need a good beginner's Perl book. I'd suggest
'Learning Perl'.
When you're done with that, read all of the online docs.
- Tom
------------------------------
Date: 23 Aug 1999 18:50:17 GMT
From: revjack <revjack@radix.net>
Subject: Parsing NES ACL files with perl?
Message-Id: <7ps559$shb$1@news1.Radix.Net>
Keywords: Hexapodia as the key insight
Shot in the dark: has anyone here ever used perl to work with Netscape
Enterprise Server ACL files? I need to write something to manage the ACL
files, and I was wondering if someone has already made headway on this. I
don't see any modules for it on CPAN.
Any advice would be appreciated.
------------------------------
Date: Mon, 23 Aug 1999 17:57:15 GMT
From: Jimmy Humphrey <jimmy@blackhole-designs.com>
Subject: Re: Perl Email With Netscape
Message-Id: <37C18C21.81E58333@blackhole-designs.com>
I did not put the > > [improperly-located quote moved to *before* reply] in
my e-mail, it came like that when I replied.
Jimmy
"Alan J. Flavell" wrote:
> On Mon, 23 Aug 1999, Jimmy Humphrey wrote:
>
> > Was not expecting that at all
>
> and then quotes, apparently unread or disregarded:
>
> > > [improperly-located quote moved to *before* reply]
>
> and proceeds to improperly quote again.
>
> Are you really so thick, or is it just an act?
>
> news.announce.newusers could help you to avoid embarrassing yourself in
> public yet again.
------------------------------
Date: Tue, 24 Aug 1999 04:40:06 +1000
From: elephant@squirrelgroup.com (elephant)
Subject: Re: Perl Email With Netscape
Message-Id: <MPG.122c4092eb68c5b0989c74@news-server>
Jimmy Humphrey writes ..
>I did not put the > > [improperly-located quote moved to *before* reply] in
>my e-mail, it came like that when I replied.
>
>Jimmy
>
>"Alan J. Flavell" wrote:
>
>> On Mon, 23 Aug 1999, Jimmy Humphrey wrote:
>>
>> > Was not expecting that at all
>>
>> and then quotes, apparently unread or disregarded:
>>
>> > > [improperly-located quote moved to *before* reply]
>>
>> and proceeds to improperly quote again.
>>
>> Are you really so thick, or is it just an act?
>>
>> news.announce.newusers could help you to avoid embarrassing yourself in
>> public yet again.
pleeeaaase - saaave me
plonk
--
jason - elephant@squirrelgroup.com -
------------------------------
Date: Mon, 23 Aug 1999 11:57:01 -0700
From: Mike Garcia <rp5280@email.sps.mot.com>
Subject: Perl on VMS?
Message-Id: <37C1997D.E9177971@email.sps.mot.com>
Hello,
Does anyone have any experience with Perl running on VMS?
I'd like to know if there are any major difference from Perl that runs
on Unix.
We are running Perl 5.004, is it available for VMS?
If we develop a script on the VMS version, would it be portable
to the Unix version?
Thank you for your comments.
Mike
------------------------------
Date: Mon, 23 Aug 1999 12:39:48 +0200
From: "Franz GEIGER" <f.geiger@vol.at>
Subject: Re: Perl script for sending email on NT
Message-Id: <7pr803$kcu$1@news.swissonline.ch>
You can use BLAT.
Regards
Franz GEIGER
mc wrote in message ...
> Does anyone know how to write Perl script to send email on NT?
>
> on UNIX, it is like:
> open(MAIL, "|sendmail......)
>
>Thanks in advance.
>
>mc
>
>
>
------------------------------
Date: Mon, 23 Aug 1999 14:38:49 -0400
From: "Ken McCrery" <kmccrery@interpath.com>
Subject: PerlMagick memory problem when using Annotate.
Message-Id: <7ps4g0$8lf$1@gaddy.interpath.net>
I am having trouble with PerlMagick's Annotate increasing memory useage. My
program uses PerlMagick to update webcam images. When a new image arrives,
the program creates a new image object, sizes the image, stamps a logo on
the image, timestamps the image, writes the image, destroys the object.
Over time my program starts to consume more and more memory. If I take out
Annotate, the program runs smoothly with no increase in memory use. Any
ideas? Below is an example of the code I am using.
while (1) {
if ($new_image) {
$image = new Image::Magick();
$image->Read("$source");
$image->Scale(geometry => "320x240!");
$bug = new Image::Magick();
$bug->Read("$bug_source");
$image->Composite(compose => 'over', geometry => "+235+0", image =>
$bug);
undef $bug;
# Here's the troubled section
$image->Annotate(font => '@/usr/local/lib/ttf/cour.ttf',
pointsize => '9',
pen => '#000000',
x => 6, y => 5,
text => "$timestamp");
# End troubled section
$image->Write("$destination");
undef $image;
}
}
Ken McCrery
------------------------------
Date: 23 Aug 1999 18:29:11 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: pushing an anonymous hash slice
Message-Id: <7ps3tn$fap$11@info2.uah.edu>
In article <slrn7rpg81.ath.abigail@alexandra.delanet.com>,
abigail@delanet.com (Abigail) writes:
: Greg Bacon (gbacon@itsc.uah.edu) wrote on MMCLXXVIII September MCMXCIII
: in <URL:news:7pfa9t$nj0$1@info2.uah.edu>:
:
: \\ I disagree. The real question when it comes to interleaving is "how
: \\ should I interleave the objects?". Do I take three of one and two of
: \\ the other? I'm still waiting for mjd (or Abigail?) to chime in with a
: \\ way to interleave an aribitrary number of arrays by arbitrary rules. :-)
[snip cool code]
Let's see if this works... I'm still waiting for mjd (or Abigail?) to
send me a money order for US$1e6. :-)
Greg
--
Norm: I'm in a gambling mood, Sammy. I'll take a glass of whatever comes out
of that tap.
Sam: Oh, looks like beer, Norm.
Norm: Call me Mister Lucky.
------------------------------
Date: Mon, 23 Aug 1999 17:42:49 GMT
From: mrbog@my-deja.com
Subject: Shamefully simple question.
Message-Id: <7ps16m$cv3$1@nnrp1.deja.com>
Alright I'm ashamed to ask this, because I'm a somewhat experienced
perl programmer, but I couldn't find this in the camel book (or the
cookbook, or the advanced perl book, etc etc see I TOLD you I was
fairly experienced!)
All I want to do is, instead of a cgi constructing and returning a page
to the user, I want it to push the user to a URL.
That's it!
Up to now whenever I'd need to do that, I'd like give them a page that
either had a meta tag that pushed them where I wanted them to go, or
I'd have something like <body onload="document.href='http:sfdsdf'">
hehe! I'm so ashamed..
-Mike
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Mon, 23 Aug 1999 11:15:10 -0700
From: Samay <samay1NOteSPAM@hotmail.com>
Subject: Shamefully simple question.
Message-Id: <0a0133f8.c8c3fcaa@usw-ex0102-010.remarq.com>
post to CGI Newsgroups..
What you want can be done.. easily..
* 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: Mon, 23 Aug 1999 15:00:23 -0400
From: shawn@ultranet.com (Shawn O'Donnell)
Subject: Re: Shamefully simple question.
Message-Id: <shawn-2308991500240001@d137.dial-5.cmb.ma.ultra.net>
In article <7ps16m$cv3$1@nnrp1.deja.com>, mrbog@my-deja.com wrote:
> All I want to do is, instead of a cgi constructing and returning a page
> to the user, I want it to push the user to a URL.
A camel or a panther would have nothing to say on this because it's not
specifically a Perl question. Ask a rat or a koala or someone on
comp.infosystems.www.authoring.cgi
Since I've been called a rat, let me suggest you try this as your cgi:
#!/usr/bin/perl
print "Location: http://www.somewhere_else.com/yada/yada.html\n\n";
I think you're supposed to use URI: now. Location may be deprecated. I
don't know the details.
--Shawn
------------------------------
Date: Mon, 23 Aug 1999 12:42:52 -0700
From: Makarand Kulkarni <makkulka@cisco.com>
Subject: Re: Shamefully simple question.
Message-Id: <37C1A43C.5BB31DAB@cisco.com>
[ mrbog@my-deja.com wrote:
> All I want to do is, instead of a cgi constructing and returning a page
> to the user, I want it to push the user to a URL.
This is an appropriate post for a newgroup dealing with HTTP protocol.
Anyway you need to send back the appropriate 300 series HTTP status
and the redirect URL:
eg.
print "HTTP/1.0 302 Found\n"; # use the correct 300 series status code
here..
print "location: http://whatever/../../something.html\n";
--
------------------------------
Date: Mon, 23 Aug 1999 11:06:21 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Shell vs Perl
Message-Id: <x3yemguo7tf.fsf@tigre.matrox.com>
kcounts@my-deja.com writes:
> !#/usr/bin/ksh
>
> if [ "$1" = "" ]
> then sort -t: +2n -3 /etc/passwd
> else
> grep "[:/]$1[:/]" /etc/passwd | sort -t: +2n -3
> fi
>
>
> He says it took him a page and a half in Perl.
> I know it can be more efficient.
#!/usr/bin/perl -w
if (@ARGV) {
system qq!grep "[:/]$ARGV[0]\[:/]" /etc/passwd | sort -t: +2n -3!;
} else {
system qq!sort -t: +2n -3 /etc/passwd!;
}
HTH,
Ala
------------------------------
Date: Mon, 23 Aug 1999 20:58:08 +0200
From: "m m m" <mmilovan@grolier.fr>
Subject: sorting files randomly out of a list
Message-Id: <7ps5kr$8db$1@front6m.grolier.fr>
Hi everyone
I'm trying to find a way to pick up say 30 different files randomly out of
the same list/table containing 100 files.
these 30 files should be different everytime I try to access them.
is there an easy way to do that?
thanks
------------------------------
Date: 23 Aug 1999 18:24:37 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: String to Int
Message-Id: <7ps3l5$fap$10@info2.uah.edu>
In article <F37w3.224$u07.1770@news.colt.net>,
Jon Peterson <jpeterson@office.colt.net> writes:
: Abigail <abigail@delanet.com> wrote:
:
: > You'd write an XS module that calls 'atoi' for you, and you link
: > in the resulting library.
:
: I think that would be more overhead than is really necessary. Generally
: speaking Perl will do the conversion implicitly where it makes sense.
You're new around here, aren't you? :-)
Greg
--
UNIX should be used as an adjective.
-- AT&T
------------------------------
Date: Mon, 23 Aug 1999 18:05:27 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Why $|++ (was: Re: perl system())
Message-Id: <37C18D50.8F289320@home.com>
[posted & mailed]
Abigail wrote:
>
> That's scary. Did Randal explain his use of $| ++ over $| = 1? Or did
> an explained construct by a well known person just became idiomatic?
^^^^^^^^^
unexplained?
I don't know where it started, but after typing
$|+1;
enough times I thought maybe that's why people were using it. For some
reason (I guess because they're adjacent), I can't seem to get my hand
off the shift key when typing = after |.
So $|++ is easier to type--for me. I wouldn't be surprised if poor
typing was the motivation for the originator of this "gem".
> That's cargo cult programming, that's far, far worse than script
> kiddes copying Matt's stuff. It's scary.
Yes, using an idiom because some expert is using it is not a good
reason, unless the expert has given a logical explanation for it. If
they haven't explained it, you should have good reasons of your own for
using it.
For the record, poor typing is not a good reason, especially when
properly spaced equal signs magically fix the problem.
$| = 1;
--
Rick Delaney
rick.delaney@home.com
------------------------------
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 622
*************************************