[16837] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4249 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Sep 7 14:06:32 2000

Date: Thu, 7 Sep 2000 11: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)
Message-Id: <968349912-v9-i4249@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 7 Sep 2000     Volume: 9 Number: 4249

Today's topics:
        Alta-Vista Remarq Access? Now costs 13.95 a Month? sysnovice@my-deja.com
    Re: Alta-Vista Remarq Access? Now costs 13.95 a Month? nobull@mail.com
    Re: Alta-Vista Remarq Access? Now costs 13.95 a Month? agrgurich@my-deja.com
    Re: Backslash usage? <bart.lateur@skynet.be>
        calling javac from perl and capturing system output smehta60@my-deja.com
    Re: CGI/perl    "open" nobull@mail.com
    Re: Date Related Issue Gordon.Haverland@agric.gov.ab.ca
        fgrep -i  "greek_word" DOES NOT WORK <thestas@dolnet.gr>
    Re: fgrep -i  "greek_word" DOES NOT WORK (David H. Adler)
    Re: fgrep -i  "greek_word" DOES NOT WORK (Abigail)
        flock() and waiting for the FILEHANDLE <nic.alagna@tiscalinet.it>
    Re: Font Color in CGI w/OOP (Mark-Jason Dominus)
    Re: Font Color in CGI w/OOP <brian+usenet@smithrenaud.com>
    Re: golf: remove .txt from filenames <jcook@strobedata.com>
    Re: how could I convert a string to a hex ASCII <lr@hpl.hp.com>
    Re: how to  encrypt source code? <dsa@dassda.com>
    Re: how to  encrypt source code? (Abigail)
        How to find unused variables? <thomas2@dalnet.se>
        how to restart apache <kwythers@forestry.umn.edu>
    Re: how to restart apache (Rafael Garcia-Suarez)
    Re: how to restart apache <Vulch@kernow.demon.co.uk>
    Re: how to restart apache <sysnovice@my-deja.com>
        IBM Perl Resources jeff_condon@my-deja.com
    Re: INTERNATIONAL PERL TELECOMMUTING (David H. Adler)
    Re: Is this a bug or a feature? <lr@hpl.hp.com>
    Re: memory leak with subroutine references nobull@mail.com
    Re: newbie: redirect problem <flavell@mail.cern.ch>
    Re: newbie: redirect problem <brian+usenet@smithrenaud.com>
    Re: newbie: redirect problem <flavell@mail.cern.ch>
    Re: RegEx:  I'm stumped <magdalip@pprd.abbott.com>
    Re: Small golf problem (Sean McAfee)
    Re: Sorting again. (Abigail)
    Re: Stable sorting (Abigail)
    Re: Unlink with NT <newsposter@cthulhu.demon.nl>
        web and site searching wetstein@my-deja.com
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Thu, 07 Sep 2000 15:00:01 GMT
From: sysnovice@my-deja.com
Subject: Alta-Vista Remarq Access? Now costs 13.95 a Month?
Message-Id: <8p8ah2$ngm$1@nnrp1.deja.com>

I was wondering if anyone can tell me why the Alta-Vista Discussion groups
hosted by Remarq are now a paid service? I'm new to discussion groups and
thought you could post and read to this group from many places. What would be
the advantage to charging for this access? I am now using deja.com, will they
be charging soon? What other sites can I use to access this group? Thanks for
your help. G.Donovan


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 07 Sep 2000 18:04:29 +0100
From: nobull@mail.com
Subject: Re: Alta-Vista Remarq Access? Now costs 13.95 a Month?
Message-Id: <u9g0nc2kwy.fsf@wcl-l.bham.ac.uk>

sysnovice@my-deja.com writes something that has absolutely nothing
whatever to do with Perl:

> I was wondering if anyone can tell me why the Alta-Vista Discussion groups
> hosted by Remarq are now a paid service?

Probably they can.

> I'm new to discussion groups and thought you could post and read to
> this group from many places.

Er, yes, just about anywhere. That's the point of Usenet. Just about
every ISP has a news server.

> What would be the advantage to charging for this access?

They get more money.  They have personal information on users so that
they can prevent abusers re-subscribing.

> I am now using deja.com, will they be charging soon?

Ask them.

> What other sites can I use to access this group?

You want a full list of Usenet <=> Web gateways?

I don't have one.  

Of course you can also just use your ISP's NNTP server (although this
isn't so good for searches).

You could take a look at the Yahoo category Computers and Internet >
Internet > Chats and Forums > Usenet 

Please do not ask non-Perl relates question in Perl newsgroups.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Thu, 07 Sep 2000 17:09:02 GMT
From: agrgurich@my-deja.com
Subject: Re: Alta-Vista Remarq Access? Now costs 13.95 a Month?
Message-Id: <8p8i2q$1d3$1@nnrp1.deja.com>

In article <8p8ah2$ngm$1@nnrp1.deja.com>,
  sysnovice@my-deja.com wrote:
> I was wondering if anyone can tell me why the Alta-Vista Discussion
groups
> hosted by Remarq are now a paid service? I'm new to discussion groups
and
> thought you could post and read to this group from many places. What
would be
> the advantage to charging for this access? I am now using deja.com,
will they
> be charging soon? What other sites can I use to access this group?
Thanks for
> your help. G.Donovan
>   Try novell.remarq.com

    Andrew J. Grgurich
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Thu, 07 Sep 2000 15:21:18 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Backslash usage?
Message-Id: <3hcfrs4ds1ol63aqv1ckpohia5asgtranb@4ax.com>

Ilmari Karonen wrote:

>>my %gh;
>>
>>\%gh = $foo;
>
>I don't think that does what you think it does.

There have been proposals (even Larry Wall himself has mentioned the
syntax!) to make this syntax legal. But I think it would still have to
look like:

	my \%gh = $foo;  # ($foo containing a hash ref)

-- 
	Bart.


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

Date: Thu, 07 Sep 2000 16:23:26 GMT
From: smehta60@my-deja.com
Subject: calling javac from perl and capturing system output
Message-Id: <8p8fd2$tod$1@nnrp1.deja.com>

Hello all:

I am using a dinosaur version of perl (5.004 on NT) and am trying  to
do the following in my perl script:

@myArray = `javac Test.java`;

My Test.java (a hello world app) has some compile errors and I want to
capture that output(i.e the java compile errors) in myArray so that I
have access to it in my perl code. I know the special variable $? gets
set with the return status, but I need to capture the actual compile
errors.
I have tried, using system, backticks, ..etc but havent got anywhere.

Is there anyway I can do this?

TIA

smehta60



Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 07 Sep 2000 17:40:29 +0100
From: nobull@mail.com
Subject: Re: CGI/perl    "open"
Message-Id: <u9its82m0y.fsf@wcl-l.bham.ac.uk>

ginola@mailcity.com (Ivan Lee) writes:

> I have a line like below
> open(GUESTBOOK_IN, "../view.html");
> because the server of cgi is automatic link to the server only for
> cgi, so is that possible to  do the
> "http://hostname/~username/view.html"
> instead of ../view.html

Please see the last couple of dozen threads asking the question "Can I
open a URL with open()?".  You shouldn't have to go back more than a
week or two.

Note: It is considered rude to come to a Usenet group and ask a
question that has been dicussed recently.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Thu, 07 Sep 2000 15:23:03 GMT
From: Gordon.Haverland@agric.gov.ab.ca
Subject: Re: Date Related Issue
Message-Id: <39b7b28b.874621921@news.gov.ab.ca>

On Thu, 7 Sep 2000 11:24:00 +1000, "GEOFF" <lbg-goeff@powerup.com.au>
wrote:

>I am having some problems with a little date related issue.  I know how to
>get the date in perl using localtime but I am looking to do something fancy
>with it.
>
>I need to compare a date string retrieved from a microsoft access DB via the
>DBI modual DBD::ODBC with a current date string retirieved from the
>localtime modual.  I must then check if the date string from the database is
>7 days older than the current localtime date string I get from localtime. I
>can write code to format the strings in the same way and the make a
>comparison but I know that would be too sloppy.
>
>Is there some Perl code or OO Perl modual written to take a date comparision
>argument and return a yes/no string? or something like that?

This isn't perfect, but:

$answer = ($date1 < $date2) ? "yes" : "no";

Gord



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

Date: Thu, 7 Sep 2000 19:44:00 +0300
From: "Theodore Stassinos" <thestas@dolnet.gr>
Subject: fgrep -i  "greek_word" DOES NOT WORK
Message-Id: <8p8guf$1823$1@ulysses.noc.ntua.gr>

Hi.
I've developed a small search engine using Perl, for an ads newspaper.

Although it works fine when it is for English words I have problem when the
user inputs greek words in the search area.

As a matter of fact the unix instruction "fgrep" does work properly only
with english words.
When i give "fgrep -i "greek_word" it returns the ads which contain the
exact greek word. The -i does not word.

I am using the POST method to fetch the data, and for each word i receive in
the search area, i give the instruction fgrep -i  -n "word_to_find" .

I wonder if you could suggest me a way to avoid this problem .

Thank you in advance






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

Date: 7 Sep 2000 17:31:50 GMT
From: dha@panix.com (David H. Adler)
Subject: Re: fgrep -i  "greek_word" DOES NOT WORK
Message-Id: <slrn8rfk86.2og.dha@panix6.panix.com>

On Thu, 7 Sep 2000 19:44:00 +0300, Theodore Stassinos
<thestas@dolnet.gr> wrote:

>I've developed a small search engine using Perl, for an ads newspaper.
>
>Although it works fine when it is for English words I have problem when the
>user inputs greek words in the search area.
>
>As a matter of fact the unix instruction "fgrep" does work properly only
>with english words.

>I wonder if you could suggest me a way to avoid this problem .

Perhaps by asking in an appropriate forum?  This seems an issue with
fgrep, rather than with perl...

dha

-- 
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
"We are the Borg. You will be assimilated! Nah, only kidding. We're
just the Sontarans. Care to take part in some 'medical research'?"


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

Date: 07 Sep 2000 17:49:26 GMT
From: abigail@foad.org (Abigail)
Subject: Re: fgrep -i  "greek_word" DOES NOT WORK
Message-Id: <slrn8rfl7c.vlt.abigail@alexandra.foad.org>

Theodore Stassinos (thestas@dolnet.gr) wrote on MMDLXIV September
MCMXCIII in <URL:news:8p8guf$1823$1@ulysses.noc.ntua.gr>:
&& Hi.
&& I've developed a small search engine using Perl, for an ads newspaper.
&& 
&& Although it works fine when it is for English words I have problem when the
&& user inputs greek words in the search area.
&& 
&& As a matter of fact the unix instruction "fgrep" does work properly only
&& with english words.
&& When i give "fgrep -i "greek_word" it returns the ads which contain the
&& exact greek word. The -i does not word.
&& 
&& I am using the POST method to fetch the data, and for each word i receive in
&& the search area, i give the instruction fgrep -i  -n "word_to_find" .
&& 
&& I wonder if you could suggest me a way to avoid this problem .


Sure. Don't use fgrep. Or, alternatively, only search for words in an
empty file, and you'll find a same success rate for English and Greek
words.

Is there any relevance of your posting to this newsgroup?


Abigail
-- 
perl -MTime::JulianDay -lwe'@r=reverse(M=>(0)x99=>CM=>(0)x399=>D=>(0)x99=>CD=>(
0)x299=>C=>(0)x9=>XC=>(0)x39=>L=>(0)x9=>XL=>(0)x29=>X=>IX=>0=>0=>0=>V=>IV=>0=>0
=>I=>$==-2449231+gm_julian_day+time);do{until($=<$#r){$_.=$r[$#r];$=-=$#r}for(;
!$r[--$#r];){}}while$=;$,="\x20";print+$_=>September=>MCMXCIII=>=>=>=>=>=>=>=>'


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

Date: Thu, 07 Sep 2000 18:11:32 +0200
From: nik <nic.alagna@tiscalinet.it>
Subject: flock() and waiting for the FILEHANDLE
Message-Id: <39B7BE33.E6248A4A@tiscalinet.it>

Hi to all,
    I'm using the flock() function to access files. I'd like to know I
can I setup a timeout for waiting
the FILEHANDLE from another. Infact, if a second process try to access
the same file it waits until the first
process unlok the file. But how can I force the second process to wait
for n seconds and not forever ?


Can you help me ?

Thanks.

This is the script:
--------------------------------------------------------------------------------------------

#!c:/perl/bin/perl

$logFile="foo.txt";
print "logfile = $logFile\n";

#------------------------------------------------------------------------

 # lock/unlock a file (from Perl info on the net)

sub lock
{
   local($LOCK_SH = 1, $LOCK_EX = 2, $LOCK_NB = 4, $LOCK_UN = 8);
   print "Lock 1\n";

   flock($_[0], $LOCK_EX);   # always exclusive (at least for now)
   print "Lock 2\n";

   seek($_[0], 0, 2);   # in case someone appended while we were
waiting...
   print "Lock 3\n";
}

sub unlock
{
   local($LOCK_SH = 1, $LOCK_EX = 2, $LOCK_NB = 4, $LOCK_UN = 8);
   print "Unock 1\n";

   flock($_[0], $LOCK_UN);
   print "Unock 2\n";
}

#------------------------------------------------------------------------

#                           M A I N
#------------------------------------------------------------------------

$pippo="true";

while ( $pippo ) {

open(LOGFILE, ">>$logFile") || die("Error opening $logFile:  $!");
lock(LOGFILE);

# make updates
print LOGFILE "$ARGV[0]\n";


close(LOGFILE) || die("Error closing $logFile:  $!");
unlock(LOGFILE);

}

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

Thank you.



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

Date: Thu, 07 Sep 2000 15:14:38 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: Font Color in CGI w/OOP
Message-Id: <39b7b0dd.3ad4$48@news.op.net>

In article <8p84oa$gbr$1@nnrp1.deja.com>,
kliquori  <kliquori@my-deja.com> wrote:
>I am trying to set the font color in a CGI script. Currently I'm using:
>print "<font color=\"#ff0000\">MY TEXT</font>";
>
>But I would like to use objects. For example, for a new line I'm using:
>print $q->br;

        print $q->font({color => "#ff0000"}, "MY TEXT");

>Is there a way to do this with objects? I couldn't find the answer in
>O'Reilly's _CGI Programming with Perl_.

You may want to print out the CGI.pm manual and browse through it.
There are all sorts of goodies there.


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

Date: Thu, 07 Sep 2000 11:39:16 -0400
From: brian d foy <brian+usenet@smithrenaud.com>
Subject: Re: Font Color in CGI w/OOP
Message-Id: <brian+usenet-25DD1F.11391607092000@news.panix.com>

In article <8p84oa$gbr$1@nnrp1.deja.com>, kliquori 
<kliquori@my-deja.com> wrote:

> I am trying to set the font color in a CGI script. Currently I'm using:
> 
> print "<font color=\"#ff0000\">MY TEXT</font>";
> 
> But I would like to use objects. For example, for a new line I'm using:
> 
> print $q->br;

did you try 

   print $input->font( { color=>"red" }, 'Hello!' );

the module documentation [1] has this dubious suggestion:

   To see the list of HTML tags that are supported, 
   open up the CGI.pm file and look at the functions 
   defined in the %EXPORT_TAGS array. 


[1]http://stein.cshl.org/WWW/software/CGI/cgi_docs.html#html

-- 
brian d foy
Perl Mongers <URL:http://www.perl.org>
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>


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

Date: Thu, 07 Sep 2000 08:51:11 -0700
From: Jim Cook <jcook@strobedata.com>
Subject: Re: golf: remove .txt from filenames
Message-Id: <39B7B96F.2D60C732@strobedata.com>

> > (Note that none of the solutions so far has managed to handle
> ".foo.txt"
> >  correctly, or "foo.txt\n" for that matter. Also, the files "..txt"
> and
> >  "...txt" cannot be dealt with at all)

> The only one of those which is a legal filename under Windoze is
> ".foo.txt".  The rest are not 'creatable' without extreme contortions.

Um, I typed "dir > ..txt" and "dir > ...txt" and they worked just fine.
Meaning, I got files names ..txt and ...txt. I'd hardly call that
extreme contortions. "foo.txt\n" is harder.

--
jcook@strobedata.com  Live Honourably    4/1 - 4/3 + 4/5 - 4/7 + . . .
2000 Tuesdays: Feb/last 4/4 6/6 8/8/ 10/10 12/12 9/5 5/9 7/11 11/7 3/14
Strobe Data Inc. home page   http://www.strobedata.com
My home page    O-           http://jcook.net


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

Date: Thu, 7 Sep 2000 10:14:26 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: how could I convert a string to a hex ASCII
Message-Id: <MPG.14216ccec2e766f898ad33@nntp.hpl.hp.com>

In article <8p7g7m$1c1@intranews.bank.dresdner.net> on Thu, 7 Sep 2000 
09:30:54 +0200, Dr. Peter Dintelmann <Peter.Dintelmann@dresdner-
bank.com> says...
> Lucas Tsoi schrieb in Nachricht <8p7100$8b845@imsp212.netvigator.com>...
> >how could I convert a string to a hex ASCII?
> 
>     it is not quite clear to me what you want to do.
>     Assuming you want to turn 'ABC' into '414243'
> 
>         print join '', unpack 'H*', 'ABC';
> 
>     will do the job.

The join() operation is unnecessary.  The print() can handle the list 
output of the unpack() handily.  And in scalar context the join() is 
implicit.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Thu, 7 Sep 2000 23:25:56 +0800
From: DT <dsa@dassda.com>
Subject: Re: how to  encrypt source code?
Message-Id: <MPG.142234608d07ecd2989687@news.cyberway.com.sg>

 Ilmari,

I tried but all encrypted source code read:  Vyznev vf n n zbgure shpxre


In article <968242076.11316@itz.pp.sci.fi>, iltzu@sci.invalid says...
> In article <MPG.14192197ddf92e989682@news.cyberway.com.sg>, DT wrote:
> >how to  encrypt source code?  thanks!
> 
>   perl -pey+a-zA-Z+n-za-mN-ZA-M+ <source_file >encrypted_file
> 
> For even better encryption, repeat the process.
> 
> 


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

Date: 07 Sep 2000 17:56:06 GMT
From: abigail@foad.org (Abigail)
Subject: Re: how to  encrypt source code?
Message-Id: <slrn8rfljr.vlt.abigail@alexandra.foad.org>

DT (dsa@dassda.com) wrote on MMDLXIV September MCMXCIII in
<URL:news:MPG.14222cb98a60f9a8989686@news.cyberway.com.sg>:
)) Thank for your ideas and suggestions. You people are nice!

I use the following for encryption:

    $ cat encrypt.pl
    #!/opt/perl/bin/perl -i -wp
    $_ = $,;
    __END__
    $

Now. if some reason I want to be able to decrypt the source as well,
I use:

    $ cat weak_encrypt.pl -i -wp
    $_ = reverse;
    __END__
    $

Or, if it has to be exportable:

    $ cat super_weak_encrypt.pl -i -wp
    y/a-zA-Z/N-ZA-Mn-za-m/;
    __END__
    $

But you can make the above stronger by encrypting three times. (But that
isn't legal in France).

I also have a strong_encrypt.pl, but I won't show that here because
it's encrypted!


Abigail
-- 
:$:=~s:$":Just$&another$&:;$:=~s:
:Perl$"Hacker$&:;chop$:;print$:#:


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

Date: Thu, 07 Sep 2000 16:51:06 GMT
From: "Thomas Åhlen" <thomas2@dalnet.se>
Subject: How to find unused variables?
Message-Id: <_HPt5.252$pz5.129366@news.bahnhof.se>

Hi!

I always use "use strict" and always declare my variables at the top of the
script code.
But as development goes on the code change, variables change names and
disapears from the code. When i have finished a script there is always 1 or
more variables declared that is not used.

I want to get warning when variables are declared but not used so i can
eliminate them.
How can i get that info?

Thomas Åhlen




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

Date: Thu, 07 Sep 2000 10:50:58 -0500
From: "Kirk R. Wythers" <kwythers@forestry.umn.edu>
Subject: how to restart apache
Message-Id: <39B7B962.E97876EC@forestry.umn.edu>

Where does red hat put apachectl in a standard install? I know it's
installed but I can't seem to find and apache/sbin dir.

Thanks,

Kirk

--
Kirk R. Wythers                                  University of Minnesota
Email: kwythers@forestry.umn.edu                 Department of Forest Resources
Tel: 612.625.22611530                            Cleveland Ave. N.
Fax: 612 625.5212                                Saint Paul,  MN 55108





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

Date: Thu, 07 Sep 2000 15:59:41 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: how to restart apache
Message-Id: <slrn8rff6v.5af.rgarciasuarez@rafael.kazibao.net>

Kirk R. Wythers wrote in comp.lang.perl.misc:
>Where does red hat put apachectl in a standard install? I know it's
>installed but I can't seem to find and apache/sbin dir.

perl -MFile::Find -e 'find(sub{/^apachectl$/&&print"$File::Find::name\n"},"/")'

-- 
Rafael Garcia-Suarez | http://rgarciasuarez.free.fr/


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

Date: Thu, 07 Sep 2000 17:31:48 +0100
From: Anthony Frost <Vulch@kernow.demon.co.uk>
Subject: Re: how to restart apache
Message-Id: <b29161fa49%Vulch@kerrier.vulch.org>

In message <slrn8rff6v.5af.rgarciasuarez@rafael.kazibao.net>
          rgarciasuarez@free.fr (Rafael Garcia-Suarez) wrote:

 > Kirk R. Wythers wrote in comp.lang.perl.misc:
 > >Where does red hat put apachectl in a standard install? I know it's
 > >installed but I can't seem to find and apache/sbin dir.
 > 
 > perl -MFile::Find -e 'find(sub{/^apachectl$/&&print"$File::Find::name\n"},"/")'
 >

Or...

locate apachectl

:-)

I seem to have copies in /usr/bin and /usr/sbin

       Anthony

-- 
    |       99% of accidents occur in the home....                |
    |                                                             |
    |                             ...Stay safe, go out lots.      |


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

Date: Thu, 07 Sep 2000 16:46:11 GMT
From: Greg Donovan <sysnovice@my-deja.com>
Subject: Re: how to restart apache
Message-Id: <8p8gob$vic$1@nnrp1.deja.com>

In article <39B7B962.E97876EC@forestry.umn.edu>,
  "Kirk R. Wythers" <kwythers@forestry.umn.edu> wrote:
> Where does red hat put apachectl in a standard install? I know it's
> installed but I can't seem to find and apache/sbin dir.
>
> Type in Whereis apache and you should get
> $ /usr/lib/apache
  To restart apache /etc/rc.d/init.d/httpd restart

G.Donovan


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Thu, 07 Sep 2000 15:10:20 GMT
From: jeff_condon@my-deja.com
Subject: IBM Perl Resources
Message-Id: <8p8b48$o92$1@nnrp1.deja.com>

Here are a few IBM Perl Resources posted on developerWorks

Writing Perl programs that speak English
-----------------------------------------------------
Using Parse::RecDescent to create a simple and efficient command-line
user interface
http://www-4.ibm.com/software/developer/library/perl-speak.html?
open&l=539,t=gr,p=p.engl

Dare to script tree-based XML with Perl
-----------------------------------------------------
Find out how to work with tree-based document models
http://www-4.ibm.com/software/developer/library/xml-perl2/index.html?
open&l=539,t=gr,p=p.xml

Perl: Small observations about the big picture
-----------------------------------------------------
Simple techniques to increase reliability and maintainability in Perl
code
http://www-4.ibm.com/software/developer/library/perl1/?
open&l=539,t=gr,p=p.smal

Cultured Perl: Save it with Perl
-----------------------------------------------------
A CPAN solution to data persistence
http://www-4.ibm.com/software/developer/library/perl2/index.html?
open&l=539,t=gr,p=p.save

Review of Programming Perl, Third Edition
-----------------------------------------------------
Time to upgrade your library: book review
http://www-4.ibm.com/software/developer/library/l-perl5.html?
open&l=539,t=gr,p=p.book


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 7 Sep 2000 17:36:47 GMT
From: dha@panix.com (David H. Adler)
Subject: Re: INTERNATIONAL PERL TELECOMMUTING
Message-Id: <slrn8rfkhf.2og.dha@panix6.panix.com>

On 6 Sep 2000 18:02:08 -0500, TelecommutePERL@GlobalWorkInt.com
<TelecommutePERL@GlobalWorkInt.com> wrote:

>         *** TELE COMMUTE ONLY  ****  
>      
>             WEB PAGE PROGRAMMER

[Ridiculous amount of capital letters snipped]

You have posted a job posting or a resume in a technical group.

Longstanding Usenet tradition dictates that such postings go into
groups with names that contain "jobs", like "misc.jobs.offered", not
technical discussion groups like the ones to which you posted.

Had you read and understood the Usenet user manual posted frequently
to "news.announce.newusers", you might have already known this. :)

Please do not explain your posting by saying "but I saw other job
postings here".  Just because one person jumps off a bridge, doesn't
mean everyone does.  Those postings are also in error, and I've
probably already notified them as well.

If you have questions about this policy, take it up with the news
administrators in the newsgroup news.admin.misc.

There is a Perl Jobs Announce list that may be more helpful to you.  See
<http://www.pm.org/mailing_lists.shtml> for details.

Yours for a better usenet,

dha


-- 
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
Sometimes these hairstyles are exaggerated beyond the laws of physics
	  - Unknown narrator speaking about Anime


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

Date: Thu, 7 Sep 2000 10:22:36 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Is this a bug or a feature?
Message-Id: <MPG.14216eb79a230ee398ad34@nntp.hpl.hp.com>

In article <UeHt5.2039$Ok5.435074@news.uswest.net> on Thu, 7 Sep 2000 
00:14:04 -0700, Christopher M. Jones <christopher_j@uswest.net> says...

 ...

> or, I could try cleaning up your code (ugh!)
> 
> 
> #!/usr/bin/perl -w
> 
> use strict;
> 
> main();
> exit;
> 
> sub main
>     {
>     my $v = 10;
> 
>     while($v > 0)
>         {
>         if ($v > 5)
>             { print "One\n"; }
>         elsif ($v > 0)
>             { print "Two\n"; }
>         $v--;
>         }
>     }

If you're going to clean it up, do it all the way.

#!/usr/bin/perl -w
use strict;

main();

sub main {
    for (my $v = 10; $v > 0; --$v) {
        print $v > 5 ? "One\n" : "Two\n"
    }
}

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 07 Sep 2000 17:52:59 +0100
From: nobull@mail.com
Subject: Re: memory leak with subroutine references
Message-Id: <u9hf7s2lg4.fsf@wcl-l.bham.ac.uk>

Oliver Ebenhöh <oliver.ebenhoeh@rz.hu-berlin.de> writes:

>   my $rs;
>   eval "\$rs = sub \{ ".$code."\}";

That is more tidily written as:

   my $rs = eval "sub { $code }";

> This works fine but somehow dereferencing does not seem to work.

I don't think you mean dereferencing, I think you mean garbage
collection.

> When I enter something like (in my little shell):
> 
> for($i=0;$i<1000;$i++){$f = $foo->to_sub}
> 
> the memory used by the program increases by 4MB!

> Does someone know how to avoid this memory leak?

Are you running Perl with the -d switch?  This is a known bug in the
debugger.  And no, short of not using the -d switch I don't know how
to avoid it.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Thu, 7 Sep 2000 17:01:41 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: newbie: redirect problem
Message-Id: <Pine.GHP.4.21.0009071655040.18864-100000@hpplus03.cern.ch>

On Thu, 7 Sep 2000, Bart Lateur wrote:

> >> >print "Location: http://www.newlocation.com\n\n";
> >
> >> Or even better:
> >> 
> >> print "Location: http://www.newlocation.com/\n\n";
> >
> >Why do you suppose so?  
> 
> Because otherwise there is one more runaround to be made.

This is the problem with off-topic answers.  They attact ill-informed 
responses which then rebound into further off-topic discussions.

> You make the
> slashless request, the server replies, "no, you need to go to this
> address" (with a slash), and then the browser goes there.

Different issue, sorry.  In the unlikely event that anything goes
wrong with _that_ URL, somebody is not behaving "to spec".  The
leading slash of the URLpath is genuinely optional when the URLpath is
otherwise null.

You appear to be confusing it with the case of non-null URLpaths with
trailing '/', where the omission of the trailing slash results in a 
different URL (which is often invalid and then gets redirected to the
correct one).

f'ups set, as off-topic.

all the best.



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

Date: Thu, 07 Sep 2000 11:26:04 -0400
From: brian d foy <brian+usenet@smithrenaud.com>
Subject: Re: newbie: redirect problem
Message-Id: <brian+usenet-F1035B.11260407092000@news.panix.com>

In article <co7frsgb84q8qee2uf8micpe5evs213jd5@4ax.com>, Bart Lateur 
<bart.lateur@skynet.be> wrote:

> macdo wrote:
> 
> >No - I'm afraid all this does is display in my browser the string
> >"Location: http://www.somewhere.com\n\n"
> 
> You must have printed a content-type header first, such as "text/html".
> Don't. The location header (plus an empty line) is all you need.

not according to the HTTP specification.  there is nothing wrong
with including a content-type header.  however, you have to
output only one header.

-- 
brian d foy
Perl Mongers <URL:http://www.perl.org>
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>


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

Date: Thu, 7 Sep 2000 17:37:20 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: newbie: redirect problem
Message-Id: <Pine.GHP.4.21.0009071731080.18864-100000@hpplus03.cern.ch>

On Thu, 7 Sep 2000, brian d foy wrote:

> In article <co7frsgb84q8qee2uf8micpe5evs213jd5@4ax.com>, Bart Lateur 
> <bart.lateur@skynet.be> wrote:
> 
> > You must have printed a content-type header first, such as "text/html".
> > Don't. The location header (plus an empty line) is all you need.

As a CGI response, the Location: header (line) is indeed all you
_need_. But a Content-type header (line) isn't necessarily harmful.  
What _is_ certaitnly harmful is the null line that terminates the
header part. Anything further is then body content (which is what the
hon Usenaut's would-be location "header" seems to have been).

> not according to the HTTP specification. 

CGI responses aren't governed by the HTTP specification - unless it's
a non-parsed-headers script.  And if it _is_ a non-parsed-headers
script, then a Location: header alone will certainly not be
sufficient: the specification calls for a complete and valid HTTP
transaction response.

Again, this should all be fought out on the CGI authoring group.  
f'ups set.



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

Date: Thu, 07 Sep 2000 12:56:14 -0500
From: Peter Magdalinos <magdalip@pprd.abbott.com>
Subject: Re: RegEx:  I'm stumped
Message-Id: <39B7D6BE.8A4076F8@pprd.abbott.com>

I don't think you're doing anything wrong, I think the '&' character is
messing up the line.  I just tried doing a substitution on the string
&Amp; in vi, and it allows me to change it to something like "ZZZ" but
not to a '&'
In vi, & can be used as a delimeter
s/freind/friend/g
is equivalent to
s^freind^friend^g
That's how you're able to substitute strings with a "/" in them, without
messing everything up.

Hope this helps.

PETE


> I'm writing a script that processes some html code.  Among other
> things it must do is convert this bit of html  &Amp; to a simple &.  I
> first started with
>
>      s/&Amp;/&/
>
> this did nothing.  I admit RegExs are one of my weak points.  What am
> I doing wrong?
>
> jar@mminternet.com
> James A Roush





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

Date: Thu, 07 Sep 2000 16:34:22 GMT
From: mcafee@waits.facilities.med.umich.edu (Sean McAfee)
Subject: Re: Small golf problem
Message-Id: <isPt5.2552$O5.50190@news.itd.umich.edu>

In article <slrn8rf29t.3rf.rgarciasuarez@rafael.kazibao.net>,
Rafael Garcia-Suarez <rgarciasuarez@free.fr> wrote:
>Here's the problem :
>I've an hash %foo, assocating keys to values that are either 0 or 1.
>I want to construct a string 'key1,key2;key3,key4' from this hash,
>where key1 and key2 are the keys associated to 1, and key3 and key4
>the keys associated to 0.

>I came up with this code :
>  %foo = (key1 => 1, key2 => 1, key3 => 0, key4 => 0);
>  print ((join ',' => grep {   $foo{$_} } keys %foo) . ';' .
>         (join ',' => grep { ! $foo{$_} } keys %foo));
>but I wonder if there is are shorter / smarter way to do it.
>(besides the obvious removal of whitespaces...)

Yeah, the double grep bugs me too.  How about this:

push @{ $a[1-$foo{$_}] }, $_ for keys %foo;
print join(';', map(join(',', @$_), @a));

-- 
Sean McAfee                                                mcafee@umich.edu
print eval eval eval eval eval eval eval eval eval eval eval eval eval eval
q!q@q#q$q%q^q&q*q-q=q+q|q~q:q? Just Another Perl Hacker ?:~|+=-*&^%$#@!


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

Date: 07 Sep 2000 15:05:04 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Sorting again.
Message-Id: <slrn8rfbj6.pkg.abigail@alexandra.foad.org>

Brendon Caligari (bcaligari@my-deja.com) wrote on MMDLXIV September
MCMXCIII in <URL:news:8p7mha$uf$1@nnrp1.deja.com>:
][ In article <slrn8raabo.tjm.abigail@alexandra.foad.org>,
][   abigail@foad.org wrote:
][ >
][ > Recently, I posted a benchmark comparing how well Perls sort does on
][ > various inputs. But now, perl 5.7.0 uses merge sort instead of quick
][ sort.
][ > (Thanks to the work of John Linderman and Peter McIlroy).
][ >
][ > A comparison is in order.
][ >
][ 
][ I'm probably talking rubbish....but does this mean that sorting a
][ massivish array will result in heavy memory depletion?


It already does so with quicksort. Mergesort does use more memory than
quicksort, but throwing memory at a problem is a typical Perl thing to do.



Abigail
-- 
$" = "/"; split // => eval join "+" => 1 .. 7;
*{"@_"} = sub {foreach (sort keys %_) {print "$_ $_{$_} "}};
%_ = (Just => another => Perl => Hacker); &{%_};


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

Date: 07 Sep 2000 15:06:12 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Stable sorting
Message-Id: <slrn8rfblb.pkg.abigail@alexandra.foad.org>

Bart Lateur (bart.lateur@skynet.be) wrote on MMDLXIV September MCMXCIII
in <URL:news:1c7frssd63dg2qs3vpk0ft8nqflh7d4vgp@4ax.com>:
-: Abigail wrote:
-: 
-: >Then why do you want the ability to turn off stability?
-: 
-: I think he wants an option for a faster algorithm, that isn't
-: necessarily stable.
-: 
-: Or is merge sort the fastest sort around?


That depends on what you sort. See my recent benchmark.



Abigail
-- 
$_ = "\nrekcaH lreP rehtona tsuJ"; my $chop; $chop = sub {print chop; $chop};
$chop -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> ()
-> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> ()


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

Date: 7 Sep 2000 16:17:44 GMT
From: Erik van Roode <newsposter@cthulhu.demon.nl>
Subject: Re: Unlink with NT
Message-Id: <8p8f38$354$1@internal-news.uu.net>

Andy <andrew.edmunds@virgin.net> wrote:

> The commands used are :

> open (STUFF,"/path/linkl.txt");
> close (STUFF);

> to create the file, and :

> unlink ("/path/linkl.txt");

> to remove the file.  The creating part works fine, but I can't unlink
> it.  Is there something about this command that NT doesn't like ?  I'm
> assured by my provider that i've got rwed privalages for this
> subdirectory, and i've tried absolute paths as well, but that doesn't
> work either.

I knew Windows was weird, but opening a file for reading creates it?

Check the result of unlink and print error message:

   unlink ("/path/linkl.txt") || print "unlink failed: $!";

Erik



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

Date: Thu, 07 Sep 2000 15:12:17 GMT
From: wetstein@my-deja.com
Subject: web and site searching
Message-Id: <8p8b7s$obp$1@nnrp1.deja.com>

Does anyone have or know of a script in perl that will
allow me to go to a web site, say for example, cnn.com,
and do a keyword search (deep) on any and all articles
that will meet certain criteria, like, for example:
today's date, and keywords present?

I am trying to automate my news reading with perl.

 Thanks!



Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 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.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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

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

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V9 Issue 4249
**************************************


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