[8840] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2457 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Apr 29 20:04:46 1998

Date: Wed, 29 Apr 98 17:00:34 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 29 Apr 1998     Volume: 8 Number: 2457

Today's topics:
    Re: 1701 days hath September (was: Re: rename funciton) (I R A Aggie)
    Re: ANSI Colour in Perl <zenin@archive.rhps.org>
    Re: ANSI Colour in Perl <sowmaster@juicepigs.com>
    Re: Bible References converted into Text (brian d foy)
    Re: Credit Card Verification scripts? <jamesr@aethos.co.uk.nospam>
        e-mail notifier that will notify by e-mail (Phillip)
    Re: e-mail notifier that will notify by e-mail (brian d foy)
    Re: e-mail notifier that will notify by e-mail <brianm@kodak.com>
    Re: formatting output <rootbeer@teleport.com>
    Re: formatting output <ebohlman@netcom.com>
    Re: formatting output (Martien Verbruggen)
    Re: Help to a very beginner (Craig Berry)
    Re: Help to a very beginner <jdf@pobox.com>
        Help using fileevent with readline in PerlTk (John L. Daschbach)
    Re: How Can I Check Return Codes on Net::FTP calls? (Jeffrey Drumm)
    Re: How to find the number of matches in a string (Craig Berry)
    Re: Is there a distance calculator scrip? <jamesr@aethos.co.uk.nospam>
        List of values for DBstatus? jase@cadence.com
    Re: Matts Script Archive-WWWBoard-FrontPage-Suddenly No (brian d foy)
        NEED HELP WITH SYNTAX <tcipress@niu.edu>
        NY.pm hosts Dancing Chihuahuas at Perl Jam, April 30th (brian d foy)
    Re: o-modifier <vallon@pearl.fi.bear.com>
    Re: Pack and Unpack problem!! (Jason Gloudon)
        performance hit ? <prl2@lehigh.edu>
    Re: performance hit ? <ebohlman@netcom.com>
    Re: Perl for Win32 not writing to file <gilberto@locaweb.com.br>
    Re: Perl for Win32 not writing to file <gilberto@locaweb.com.br>
    Re: Perl for Win32 not writing to file <sowmaster@juicepigs.com>
    Re: QRe: == vs. eq <upsetter@shore.net>
    Re: Sys::syslog not working? SOLVED! (Marc Haber)
    Re: System call in Perl not working (Craig Berry)
    Re: web_store.cgi "locked" <rootbeer@teleport.com>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Wed, 29 Apr 1998 13:48:05 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: 1701 days hath September (was: Re: rename funciton)
Message-Id: <fl_aggie-2904981348050001@aggie.coaps.fsu.edu>

In article <354740A4.573B@juicepigs.com>, Bob Trieger
<sowmaster@juicepigs.com> wrote:

+ Change happens and all you can do is enjoy it.

Even if the change is NOT beneficial?

I think you _really_ need to contemplate your statement, and its pratical
implications in your daily life.

Some change is good, and it needs to be fostered.
Some change is bad, and it needs to be opposed.

The constant September, and the providers that just dump their users
out on the net without proper instruction, needs to be opposed. It improves
things for everyone.

James

-- 
Consulting Minister for Consultants, DNRC
The Bill of Rights is paid in Responsibilities - Jean McGuire
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/CPAN-local/doc/FAQs/cgi/idiots-guide.html>


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

Date: 29 Apr 1998 18:14:50 GMT
From: Zenin <zenin@archive.rhps.org>
Subject: Re: ANSI Colour in Perl
Message-Id: <893874119.982509@thrush.omix.com>

Shawn <sweiner@usa.net> wrote:
: There is at least 1 module in CPAN that I know of, located I believe
: in the user interfaces area.
: The name of the module is: ANSIColor-1_01.tar.gz

	Term::ANSIColor actually.  If one scans for either 'ANSI' or
	the correct spelling of "color" on the WAIT it should be at
	the top of the list.

-- 
-Zenin
 zenin@archive.rhps.org


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

Date: Wed, 29 Apr 1998 19:36:17 -0400
From: Bob Trieger <sowmaster@juicepigs.com>
Subject: Re: ANSI Colour in Perl
Message-Id: <3547B971.35B6@juicepigs.com>

Jonathan Stowe wrote:
> 
> On 29 Apr 1998 18:14:50 GMT, Zenin wrote :
> 
> >
> >       the correct spelling of "color" on the WAIT it should be at
> >
> Ey,ey.
> 
> That will be the North American spelling rather than the *correct*
> spelling I would suggest.

I beer guzzling hockey fans in nothern North America spell it "wrong"
too.

-- 
Bob Trieger               |  Titanic: big boat, bigger
sowmaster@juicepigs.com   |           iceberg, big deal


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

Date: Wed, 29 Apr 1998 19:14:41 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Bible References converted into Text
Message-Id: <comdog-ya02408000R2904981914410001@news.panix.com>
Keywords: from just another new york perl hacker

In article <35479759.0@news1.ibm.net>, "Arthur Gibbs" <nospam@aol.com>>really Gibbs at Cheerful.com> posted:

>Anyone know of a perl program that easily translates Bible references into
>texts from a flat file text database?
>
>1 John 3:16-20,22 into the Bible text itself?
>or 1 John 3:16-17;4:1-2
>or 1 John 3:16,19,20

how is the Bible stored in flat text?

also, wouldn't it be infinitely easier to store this in some sort of
hashing thingy for quick look-up?  the data is not going to change (well,
if you're changing it, God help you), so you should be able to do all
manner of look-up optimization.

or perhaps your problem is converting the reference to the record that
it needs to return?

curious problem... 

good luck :)

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers <URL:http://www.pm.org>


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

Date: 29 Apr 98 12:53:29 GMT
From: "James Richardson" <jamesr@aethos.co.uk.nospam>
Subject: Re: Credit Card Verification scripts?
Message-Id: <01bd736f$47a4f900$26c0a4c1@kitkat.aethos.co.uk>

Tom Phoenix <rootbeer@teleport.com> wrote in article <Pine.GSO.3.96.980428094649.15049H-100000@user2.teleport.com>...
> Being 12 is neither a crime nor an excuse; it's merely irrelevant. On
> Usenet, no one knows you're a dog. :-)

Bit harsh?

> 
> In any case, c.l.p.misc is not a help desk. If no one answers your
> questions, that's more likely to be your fault than ours! :-)
> 

So what is it then? I was under the impression that that was exactly what it was....

James



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

Date: Wed, 29 Apr 1998 13:44:14 -0400
From: phillip@javanet.com (Phillip)
Subject: e-mail notifier that will notify by e-mail
Message-Id: <MPG.fb130fca40bcb78989680@news.javanet.com>

Could Anyone tell me if there is software that will monitor an e-mail 
address by poping it or just downloading the headers. and then every so 
often like every 3 hours or at specified times have the program send an 
e-mail message with the message something like this "You currently have # 
messages in your mailbox." That target e-mail address would be a pager's 
email address.

Thank you to all that can help
Phillip
Phillip@javanet.com


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

Date: Wed, 29 Apr 1998 14:31:32 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: e-mail notifier that will notify by e-mail
Message-Id: <comdog-ya02408000R2904981431320001@news.panix.com>
Keywords: from just another new york perl hacker

In article <MPG.fb130fca40bcb78989680@news.javanet.com>, phillip@javanet.com (Phillip) posted:

>Could Anyone tell me if there is software that will monitor an e-mail 
>address by poping it or just downloading the headers. and then every so 
>often like every 3 hours or at specified times have the program send an 
>e-mail message with the message something like this "You currently have # 
>messages in your mailbox." That target e-mail address would be a pager's 
>email address.

you could use the Mail::* modules.  see my reply to the same question
from earlier this week.

good luck :)

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers <URL:http://www.pm.org>


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

Date: Wed, 29 Apr 1998 14:28:06 -0400
From: Brian Mathis <brianm@kodak.com>
To: Phillip <phillip@javanet.com>
Subject: Re: e-mail notifier that will notify by e-mail
Message-Id: <35477136.CF0DA17F@kodak.com>

Phillip wrote:
> 
> Could Anyone tell me if there is software that will monitor an e-mail
> address by poping it or just downloading the headers. and then every so
> often like every 3 hours or at specified times have the program send an
> e-mail message with the message something like this "You currently have #
> messages in your mailbox." That target e-mail address would be a pager's
> email address.
> 
> Thank you to all that can help
> Phillip
> Phillip@javanet.com

Yes, there is.  There are modules available for perl that can do this
with ease.  This is the second time you've asked this question this
week, and the second time you have gotten the same answer.  If you are
looking for someone to write it for you, contact me for an hourly rate.

Brian Mathis


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

Date: Wed, 29 Apr 1998 18:28:59 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Jeff McCreary <jeffmcc@mindspring.com>
Subject: Re: formatting output
Message-Id: <Pine.GSO.3.96.980429112817.19984F-100000@user2.teleport.com>

On Wed, 29 Apr 1998, Jeff McCreary wrote:

> I want to take an element out of an array and print it in a currency
> format.  How can I do this?

The methods in the docs and FAQs should be helpful. If they're not
sufficient, please post again and explain in what way they're lacking.
Thanks!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Wed, 29 Apr 1998 18:30:35 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: formatting output
Message-Id: <ebohlmanEs6u2z.AFv@netcom.com>

Jeff McCreary <jeffmcc@mindspring.com> wrote:
: I want to take an element out of an array and print it in a currency
: format.  How can I do this?

You probably want to use the Number::Format module available on CPAN.



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

Date: 29 Apr 1998 23:38:26 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: formatting output
Message-Id: <6i8dli$s36$1@comdyn.comdyn.com.au>

In article <3547737A.C1AACC0C@vancpower.com>,
	Richard Tan <tanr@vancpower.com> writes:
> Jeff McCreary wrote:
> 
>> I want to take an element out of an array and print it in a currency
>> format.  How can I do this?
>>
>> thanks
> 
> I post a simular message a few days ago but didn't get any good solution.  I end up writing a sub
> myself.  You're welcome to use it or modify to fit your needs.
> 
> sub FormatCurrency {
>     $Num = shift(@_);
>     $Dollar = int($Num);
>     $Cent = int(($Num - $Dollar + 0.005) * 100);            # also roundup the cents

Use sprintf.

# perldoc perlfaq4
/Does perl have a round function?

#    $I = length($Dollar);
#    for ( $I; $I > 0; $I -= 1) {
#        if ( ($I % 3) eq 0 ) { $Return .=  ","; }
#        $Return .= substr($Dollar, length($Dollar) - $I, 1);
#    }
#    $Return =~ s/^,//;

# perldoc perlfaq5
/How can I output my numbers with commas added?
    sub commify {
         local $_  = shift;
         1 while s/^(-?\d+)(\d{3})/$1,$2/;
         return $_;
     }

Martien

PS. Try www.dejanews.com some time. You could have done something like:

~g comp.lang.perl.misc & ~s currency
-- 
Martien Verbruggen                      |
Webmaster www.tradingpost.com.au        | "In a world without fences,
Commercial Dynamics Pty. Ltd.           |  who needs Gates?"
NSW, Australia                          |


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

Date: 29 Apr 1998 18:23:29 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Help to a very beginner
Message-Id: <6i7r71$6ul$2@marina.cinenet.net>

Katalin Nadassy (nadassy@ebi.ac.uk) wrote:
: I am new to Perl and would like to ask your help in solving the
: following problem.
: I have a large text file of which I would like to access only parts at a
: time (say from section 1 to section2...etc). I'd like to use regular
: expression to search for Pattern A and from Pattern A manipulate the
: data until Pattern B is found. I read the file with 'while
: ($line=<FILE>)' and would try to match something like ' if
: $line=~/patternA/ ...do various manipulations but I don't know how I can
: search to say that when $line=~/patternB/ then exit from here and
: begin  something different.
: Could you please help me on this problem? Any help and advice is greatly
: appreciated.

You want the range-toggle operator.  Here's an example:

#!/usr/bin/perl -w
# range: demo of file range processing

use strict;

while (<DATA>) {
  chomp;

  if (/START_MARK/ .. /END_MARK/) {
    print "In-range processing: $_\n";
  }
  else {
    print "Out-of-range processing: $_\n";
  }
}

__DATA__
Line one
Line two
START_MARK
In the block
Still in the block
END_MARK
Penultimate line
Last line


which outputs:

Out-of-range processing: Line one        
Out-of-range processing: Line two        
In-range processing: START_MARK          
In-range processing: In the block        
In-range processing: Still in the block  
In-range processing: END_MARK            
Out-of-range processing: Penultimate line
Out-of-range processing: Last line       


Hope this helps!

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


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

Date: 29 Apr 1998 14:00:31 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: Katalin Nadassy <nadassy@ebi.ac.uk>
Subject: Re: Help to a very beginner
Message-Id: <ra2gjvw0.fsf@mailhost.panix.com>

[posted and mailed]
Katalin Nadassy <nadassy@ebi.ac.uk> writes:

> I have a large text file of which I would like to access only parts at a
> time (say from section 1 to section2...etc). 

There is an operator that does just what you want.  Read the perlop
document and search for the scalar .. operator.  It looks like this in
practice:

   while(<SOMEFILE>) {
      if (/start_pattern/ .. /end_pattern/) {
         # do something
      }
   }

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY


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

Date: 29 Apr 1998 15:30:59 -0700
From: d3h486@emsl.pnl.gov (John L. Daschbach)
Subject: Help using fileevent with readline in PerlTk
Message-Id: <m3lnsos1jw.fsf@wd19518.emsl.pnl.gov>


I need help (an example would be great) using readline for input in
PerlTk.  I'd like to have a shell type window in a PerlTk
application.  I have done many readline tools, and many PerlTk tools,
but I haven't mastered.

-John


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

Date: Wed, 29 Apr 1998 23:49:18 GMT
From: drummj@mail.mmc.org (Jeffrey Drumm)
Subject: Re: How Can I Check Return Codes on Net::FTP calls?
Message-Id: <3547b5e7.173930087@news.mmc.org>

[posted and mailed]

On Wed, 29 Apr 1998 09:22:07 -0500, James Zahrndt <zahrndtj@agcs.com>
wrote:

Jim, your newsreader's word wrapping sucks. Nothing personal. :-)

>I'm writing an automated script to send files to vendors using the
>Net::FTP module.
>I works well, but I can't seem to find information on how to check if a
>particular command (i.e., $FTP->new("somehost")) actually can connect to

Um, don't you mean:

$ftp = Net::FTP->new("somehost");

>a host.  I need
>to trap errors on this.

Check to see if $ftp is defined . . . if Net::FTP can't connect, it won't
be.

>The CPAN docs helped me use the module, but really didn't cover this
>topic.

Well, actually, it did . . .

METHODS
    Unless otherwise stated all methods return either a *true* or
    *false* value, with *true* meaning that the operation was a
    success. When a method states that it returns a value, failure
    will be returned as *undef* or an empty list.

Or didn't you think new() was a method? :-)

>Thanks for any/all pointers!

You're welcome. Do something about that word wrapping now, y'hear?

Good luck.

-- 
                           Jeffrey R. Drumm, Systems Integration Specialist
                                  Maine Medical Center Information Services
                                     420 Cumberland Ave, Portland, ME 04101
                                                        drummj@mail.mmc.org
"Broken? Hell no! Uniquely implemented." -me


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

Date: 29 Apr 1998 18:16:00 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: How to find the number of matches in a string
Message-Id: <6i7qp0$6ul$1@marina.cinenet.net>

Jonathan Feinberg (jdf@pobox.com) wrote:
: cberry@cinenet.net (Craig Berry) writes:
: 
: > Mark-Jason Dominus (mjd@op.net) wrote:
: > : 	$count++ while $string =~ m/pattern/g;
: > 
: > Easier: $count = () = $string =~ m/pattern/g;
: 
: "Easier?"  By what metric?  It's one character shorter, I'll grant you
: that.  But MJD's has the advantage of not building a temporary list.

"Easier" by the well-known Craig metric. :-) Actually, it appeals to me
because it avoids a (visible) loop.  Loops make me think more than
assignments do when eyeball-parsing code.

: Hey, let's benchmark!

I hate it when people inject ugly facts into a lovely theoretical 
discussion...

: Can anyone say definitively why MJD's method is faster?

I'm curious about this, too.

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


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

Date: 29 Apr 98 12:47:21 GMT
From: "James Richardson" <jamesr@aethos.co.uk.nospam>
Subject: Re: Is there a distance calculator scrip?
Message-Id: <01bd736e$6b493ac0$26c0a4c1@kitkat.aethos.co.uk>

Chocolate <poohba@io.com> wrote in article <Pine.BSI.3.96.980428095309.15004A-100000@pentagon.io.com>...
> I am trying to fond a distance calculator script.  Does anyone know of
> any?  I would like to calculate the distance between one city and another
> or one zip code and another.  How would I do that?
> 
There was a post I recall from this newsgroup some months ago which I believe does the sort of thing you are after.
I can't be very specific (memory's not too good these days :)), but maybe deja news can help you out.

James



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

Date: Wed, 29 Apr 1998 13:27:21 -0600
From: jase@cadence.com
Subject: List of values for DBstatus?
Message-Id: <6i7re9$dhp$1@nnrp1.dejanews.com>

I'm have a SybPerl script that very infrequently runs into problems where its
query is chosen as a deadlock victim by the SQL Server. I want to check the
status of each SQL statement, and if an error like that happens, I can then
have the script re-run the query. It seems like I should be able to determine
if an error occurred using $dbh->{'Dbstatus'}, but I don't know what any of
the returned values mean. Can somebody point me to a reference which lists
the valid status values and their meanings?

FYI, here's the subroutine I use to submit an SQL statement. (Note that it's
intended to only return the last row of results, if there are any. $dbh is a
global variable, and the argument to &sql is the SQL query text.)

sub sql {
   my ($text) = @_;
   my @row = ();
   my $lastresult = "";
   @dbresult = ();
   $dbh->dbcmd("$text\n");
   $dbh->dbsqlexec;
   $dbh->dbresults;
   while (@row = $dbh->dbnextrow) {
      push(@dbresult, join("\t", @row));
      $lastresult = $row[0];
   }
   $dbh->dbcancel;              ## clear out the buffer
   return $lastresult;
   # should there be a check for SQL Server errors somewhere in here?
}

Thanks in advance!

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


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

Date: Wed, 29 Apr 1998 19:43:51 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Matts Script Archive-WWWBoard-FrontPage-Suddenly Not Working
Message-Id: <comdog-ya02408000R2904981943510001@news.panix.com>
Keywords: from just another new york perl hacker

In article <893890098.457107@cabal>, ? the platypus {aka David Formosa} <dformosa@st.nepean.uws.edu.au> posted:

>In <6i71mi$he@fridge.shore.net> "Grinch" <grinch@whoville.com> writes:
>
>>It's really sad that kid makes five times as much $$ as the people who clean
>>up after him.
>
>Ok, hands up who read that sentence and thourt "Why dose Matt makes more
>PIDs?"

because a lot of newbies run his stuff, and they don't use mod_perl?

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers <URL:http://www.pm.org>


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

Date: Wed, 29 Apr 1998 16:29:25 -0400
From: Teodoro Cipresso <tcipress@niu.edu>
Subject: NEED HELP WITH SYNTAX
Message-Id: <35478DA2.EFB25FAD@niu.edu>

descrip1 and descrip2 are the input names for textboxes on my website
I'm getting an error when I use the following if statements to check
if the boxes are empty.

Can anyone help me with the syntax? I got these if statments to work
with
list boxes but I get an error with text boxes.

:-)

tcipress@niu.edu


if ($in{'descrip1'} eq "" && $CHECK ==1) {
       $MIS8='You Forgot To Fill Out The Problem Description Box';
        $pderror='y'; error='y';}

if ($in{'descrip2'} eq "" && $CHECK ==1) {
       $MIS9='You Forgot To Fill Out The Problem Symptoms Box';
        $pserror='y'; error='y';}



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

Date: Wed, 29 Apr 1998 19:51:30 -0400
From: comdog@computerdog.com (brian d foy)
Subject: NY.pm hosts Dancing Chihuahuas at Perl Jam, April 30th
Message-Id: <comdog-ya02408000R2904981951300001@news.panix.com>
Keywords: Dancing Chihuahuas


Dancing Chihuahuas at Evolution Online Systems Perl Jam!
<URL:http://ny.pm.org/events.html>

We're celebrating the Grand Opening of the new office space
of Evolution Online Systems. Just an informal gathering of
Perl hackers. Soda, ice & cups provided by Evo - everything
else you need to bring. There are lots of delis in the area
if you want to pick something up.  There will be live,
dancing chihuahuas!

   * Where: 34 W. 17th St., 2nd floor. Between 5th & 6th Aves. Ring the
     bottom buzzer, come up in the back elevator to the second floor.
   * When: Thursday, April 30th around 7:30 p.m.
   * What:
        o Dancing Chihuahuas! 
        o Comparison of Leatherman and Gerber tools
        o Palm Pilot Perl Man Page Race

and, for anyone who worked furiously through the night to
finish up their abstract for Perl Conference 2.0
<URL:http://conference.perl.com/cfp.html>, ask yourself
"Don't I deserve to see some dancing chihuahuas?"

____

if you wish you had a cool Perl user group with dancing
chihuahuas, visit Perl Mongers <URL:http://www.pm.org>. 
Find out if there is already a group near you, or register
your interest to help a group in your area find you!

there is absolutely no chihuahua requirement for Perl user
groups, although saying "chihuahua" a lot in a message helps
it come up in searches for "chihuahua".  and NY.pm has a
really cool chihuahua mascot
<URL:http://www.panix.com/~piglet/gifs/josephine3.gif>.

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers <URL:http://www.pm.org>


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

Date: 29 Apr 1998 14:17:45 -0400
From: Justin Vallon <vallon@pearl.fi.bear.com>
Subject: Re: o-modifier
Message-Id: <x6eogxkmr06.fsf@pearl.fi.bear.com>

"Robert Friberg" <robban@it-konsult.com> writes:

> Hi,
> 
> The following piece of code is run at worst case 80000 times, therefore
> I'm interested in having the regexp compiled only once. The @words
> array is assigned only once but $#words varies.
> 
>    for $w (@words){
>       $failed++ and last unless /$w/i;
>    }

Build a pattern 'word1|word2|word3':

    local @words = qw/the quick brown fox star.../;
    # Match the words and 'star...', not the pattern /star.../;
    
    local $pat = join '|', map { quotemeta $_ } @words;
    print "Pattern is $pat\n";
    
    for $in (qw/This quick brown fox started running/) {
    	    local $found = ($in =~ /$pat/o);
    	    $pat = ""; # Just to check if it was compiled
    	    print "$in " . ($found ? "found" : "not found") . "\n";
    }

The $pat is there to make sure the pattern was really compiled.  
Without the o, the second->end words are all found (matching //).
With the o, the pattern is reused.  So, the compilation works.  
(That was just a check).

Without the quotemeta, 'started' would match.

I'll leave performance testing up to you.

-- 
-Justin
vallon@bear.com


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

Date: Wed, 29 Apr 1998 18:07:56 GMT
From: jgloudon@hyssop.bbn.com.bbn.com (Jason Gloudon)
Subject: Re: Pack and Unpack problem!!
Message-Id: <00K11.2$F4.52634@cam-news-reader1.bbnplanet.com>

T-Master <tmaster@tea.com> wrote:
 .
>read :-----------------------------------------------------------------
>sysread(F,$buff,2,8);
>print unpack("v",$buff),"\n";

I'm not quite clear about what you expected, but you should take note
that sysread with an offset and a length will pad your scalar with null (0)
bytes.

--
Jason Gloudon


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

Date: Wed, 29 Apr 1998 13:32:48 -0400
From: "Phil R Lawrence" <prl2@lehigh.edu>
Subject: performance hit ?
Message-Id: <6i7o82$1fmm@fidoii.cc.Lehigh.EDU>

I have package Staple in Staple.pm.  One of the methods in Staple uses another
method within Staple.  Is there any performance hit when I say:

package Staple;
  <snip>
sub method_1 {
      <snip>
    $x = Staple->method_2();
      <snip>
instead of:
    $x = method_2();

Thanks,
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Phil R Lawrence               phone: 610-758-3051
Programmer / Analyst      e-mail: prl2@lehigh.edu
194 Lehigh University Computing Center
E.W. Fairchild - Martindale, Bldg. 8B
Bethlehem, PA  18018
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~





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

Date: Wed, 29 Apr 1998 18:33:14 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: performance hit ?
Message-Id: <ebohlmanEs6u7E.AKx@netcom.com>

Phil R Lawrence <prl2@lehigh.edu> wrote:
: I have package Staple in Staple.pm.  One of the methods in Staple uses another
: method within Staple.  Is there any performance hit when I say:

: package Staple;
:   <snip>
: sub method_1 {
:       <snip>
:     $x = Staple->method_2();
:       <snip>
: instead of:
:     $x = method_2();

Why not invoke the magic of Benchmark and find out for yourself?



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

Date: Wed, 29 Apr 1998 20:41:49 -0300
From: "Gilberto Mautner" <gilberto@locaweb.com.br>
Subject: Re: Perl for Win32 not writing to file
Message-Id: <3547ba4a.0@news1.ibm.net>

OK. Change was made. I still don't get any error messages - and the file is
simply not there...

>Aieee.  I think you might want:
>open(SAIDA,$SAIDA) || die "Cant open the file - $!";





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

Date: Wed, 29 Apr 1998 20:56:43 -0300
From: "Gilberto Mautner" <gilberto@locaweb.com.br>
Subject: Re: Perl for Win32 not writing to file
Message-Id: <3547bded.0@news1.ibm.net>

Oops... my mistake

The file was actually being written - but on the web site root directory...

Well, the problem is not that bad anymore - anyway how do I write to a file
in the same directory?

Thanks a lot for the help you gave - Gilberto


Gilberto Mautner escreveu na mensagem <3547ba4a.0@news1.ibm.net>...
>OK. Change was made. I still don't get any error messages - and the file is
>simply not there...
>
>>Aieee.  I think you might want:
>>open(SAIDA,$SAIDA) || die "Cant open the file - $!";
>
>
>




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

Date: Wed, 29 Apr 1998 19:48:39 -0400
From: Bob Trieger <sowmaster@juicepigs.com>
To: Gilberto Mautner <gilberto@locaweb.com.br>
Subject: Re: Perl for Win32 not writing to file
Message-Id: <3547BC57.2C0@juicepigs.com>

[posted and mailed]

Gilberto Mautner wrote:
> 
> OK. Change was made. I still don't get any error messages - and the file is
> simply not there...
> 
> >Aieee.  I think you might want:
> >open(SAIDA,$SAIDA) || die "Cant open the file - $!";


What does the documentation say about opening a filehandle for writing?


-- 
Bob Trieger               |  Titanic: big boat, bigger
sowmaster@juicepigs.com   |           iceberg, big deal


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

Date: 29 Apr 1998 17:47:54 GMT
From: Art Cohen <upsetter@shore.net>
Subject: Re: QRe: == vs. eq
Message-Id: <6i7p4a$o4k@fridge.shore.net>

Tom Christiansen <tchrist@mox.perl.com> wrote:

: I assure you that I find Windows more difficult and less intuitive --
: you may drain-bramaged at will -- than Unix by a factor of something
: like a googolplex.

That's just because you've been using Unix longer. Say what you will about
Windows but I think most people would consider the Win95 interface more
"intuitive" than a shell prompt.

--Art

National Ska/Reggae Calendar: www.ziplink.net/~upsetter/ska/calendar.html
        Boston Ska Home Page: www.ziplink.net/~upsetter/ska/index.html



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

Date: Wed, 29 Apr 1998 17:33:55 GMT
From: Marc.Haber-usenet@gmx.de (Marc Haber)
Subject: Re: Sys::syslog not working? SOLVED!
Message-Id: <6i7obo$msu$1@nz12.rz.uni-karlsruhe.de>

Marc.Haber-usenet@gmx.de (Marc Haber) wrote:
>I am trying to have a perl script log something on the syslog on a
>Linux box. I am using the example from the Camel book. That program
>does: nothing. There is nothing being logged to syslog. syslog.ph is
>present on the system.

syslogd -r did the trick. Does the documentation say that sys::syslog
goes via port 514?

Greetings
Marc

-- 
-------------------------------------- !! No courtesy copies, please !! -----
Marc Haber          |   " Questions are the         | Mailadresse im Header
Karlsruhe, Germany  |     Beginning of Wisdom "     | Fon: *49 721 966 32 15
Nordisch by Nature  | Lt. Worf, TNG "Rightful Heir" | Fax: *49 721 966 31 29


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

Date: 29 Apr 1998 22:53:17 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: System call in Perl not working
Message-Id: <6i8b0t$ne5$1@marina.cinenet.net>

Arun Gurjale (gurjale.arun@worldnet.att.net) wrote:
[snip]
: 	find /po/gwmail -size 0c -exec rm {} \;
: We had to put this in a cron job that runs every half hour and we did this
: in Perl.  The Perl script has many other things in it and we added the
: following line to the script:
: 	$err_msg = system("find /po/gwmail -size 0c -exec rm {}\;");
: The script complains that the "find command is incomplete".  We cannot in
: the world figure out what is wrong.  There is something there that Perl
: does not like.  

Double up that \ before the semicolon; Perl string processing is eating 
the one you have.

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


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

Date: Wed, 29 Apr 1998 17:49:03 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: tiles@pyramidtile.com
Subject: Re: web_store.cgi "locked"
Message-Id: <Pine.GSO.3.96.980429104754.19984C-100000@user2.teleport.com>

On Wed, 29 Apr 1998 tiles@pyramidtile.com wrote:

> Can anyone see whats wrong?

Not from what you've posted. Perhaps you should cut your code down to
a dozen lines or fewer which show your problem, then post that.

When you're having trouble with a CGI program in Perl, you should first
look at the please-don't-be-offended-by-the-name Idiot's Guide to solving
such problems. It's available on CPAN.

   http://www.perl.com/CPAN/
   http://www.perl.org/CPAN/
   http://www.perl.org/CPAN/doc/FAQs/cgi/idiots-guide.html
   http://www.perl.org/CPAN/doc/manual/html/pod/

Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

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


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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

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

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

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

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

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


------------------------------
End of Perl-Users Digest V8 Issue 2457
**************************************

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