[13731] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1141 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Oct 21 13:06:10 1999

Date: Thu, 21 Oct 1999 10:05:19 -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: <940525518-v9-i1141@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 21 Oct 1999     Volume: 9 Number: 1141

Today's topics:
    Re: [OFFTOPIC] WAS: Re: this darn error <gellyfish@gellyfish.com>
        a question about multiple substitutions in a string (Steven G. Listopad)
    Re: a question about multiple substitutions in a string (Andrew Johnson)
    Re: a question about multiple substitutions in a string (Steven G. Listopad)
        a tree of subdirectories in perl? <981414@dcc.unicamp.br>
    Re: a tree of subdirectories in perl? <dove@synopsys.com>
        Accessing Serial port stuckenbrock@my-deja.com
    Re: Archive (Jon Bell)
    Re: Archive <gellyfish@gellyfish.com>
    Re: Array written to a file: Extra space inserted <aqumsieh@matrox.com>
        At the risk of making myself an idiot ...How to create  <genlabs@gmx.net>
    Re: At the risk of making myself an idiot ...How to cre <AgitatorsBand@yahoo.com>
        chomp() nested in split() doesn't work - why? rev_bhagwan@my-deja.com
    Re: chomp() nested in split() doesn't work - why? <dan@tuatha.sidhe.org>
    Re: dereferencing complex expression <ltl@rgsun5.viasystems.com>
    Re: Examining Win32 processes (Michel Dalle)
    Re: File "cgi-lib.pl" not found in @INC? <AgitatorsBand@yahoo.com>
    Re: File "cgi-lib.pl" not found in @INC? <green@argonet.co.uk>
    Re: file upload <lr@hpl.hp.com>
    Re: flcoking a DBM <dove@synopsys.com>
    Re: formatting text with filling '.'s (Craig Berry)
    Re: Ignore the idiots (including Tad) <hman@dei.unipd.it>
    Re: Ignore the idiots (Greg Snow)
    Re: in need of example... <AgitatorsBand@yahoo.com>
    Re: in need of example... <gellyfish@gellyfish.com>
    Re: in need of example... <newsposter@cthulhu.demon.nl>
    Re: in need of example... <gellyfish@gellyfish.com>
    Re: in need of example... (Neko)
    Re: in need of example... <AgitatorsBand@yahoo.com>
        Language resource / module (Bianka Martinovic)
        NEED URGENT HELP <trenic@nortelnetworks.com>
    Re: NEED URGENT HELP <AgitatorsBand@yahoo.com>
    Re: Problem w/ PERL and SQL mirak63@yahoo.com
        TCP Look ahead under perl zephar@my-deja.com
    Re: Trim text (Craig Berry)
    Re: Unix code to perl (Peter J. Kernan)
    Re: Wall Street E-Commerce <AgitatorsBand@yahoo.com>
        win32::odbc question <joao.f.sil@telecom.pt>
    Re: WTB: Web Client Programming in Perl <green@argonet.co.uk>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 21 Oct 1999 17:01:51 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: [OFFTOPIC] WAS: Re: this darn error
Message-Id: <380f38ef_2@newsread3.dircon.co.uk>

Tom Briles <sariq@texas.net> wrote:
>> Posted via CNET Help.com
>> http://www.help.com/
> 
> help.com is disgusting.
> 
> The death of USENET?
> 

I dont know about that bit it consistently renders my sigdash as
/J-- that in itself is evil ...

/J\\  ;-}
-- 
"Killing myself is the last thing I'd ever do" - Homer Simpson


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

Date: 21 Oct 1999 15:43:40 GMT
From: listopad@lucent.com (Steven G. Listopad)
Subject: a question about multiple substitutions in a string
Message-Id: <7uncbc$6to@nntpb.cb.lucent.com>

All,

I have a question about how perl operates on a string as a substitution is
taking place.  I have an ASCII text file, delimited by pipes (|).  I'd
like to search for a pipe followed by a certain string foillowed by a pipe,
and replace it with just the pipes.  In other words, remove the certain 
string.

All's well until I run into a case where the pattern to be removed is found
"back to back" in the file.  I think I understand what perl is doing, but,
naturally, I want to find a perl-ish (i.e. easy) way around it.  Is there
a way to force perl to iterate over the string until no matches are found?
I'd rather not write a loop myself, if I don't have to. I guess I could
rewrite the code to work differently, but now I'm interested in how perl is
behaving, and how (if possible) that behavior can be modified.

Technical guru-type explanations welcome!

Steve


Code snippet:

$x = "|NULL|NULL|any text, even NULL, here|NULL|so on and so forth|";
$x =~ s/\|NULL\|/\|\|/g;
print "$x\n";


Output:

||NULL|any text, even NULL, here||so on and so forth|

Desired output:

|||any text, even NULL, here||so on and so forth|



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

Date: Thu, 21 Oct 1999 16:20:23 GMT
From: andrew-johnson@home.com (Andrew Johnson)
Subject: Re: a question about multiple substitutions in a string
Message-Id: <b3HP3.118$pA3.3160@news1.rdc1.mb.home.com>

In article <7uncbc$6to@nntpb.cb.lucent.com>,
 Steven G. Listopad <listopad@lucent.com> wrote:
! All,
! 
! I have a question about how perl operates on a string as a substitution is
! taking place.  I have an ASCII text file, delimited by pipes (|).  I'd
! like to search for a pipe followed by a certain string foillowed by a pipe,
! and replace it with just the pipes.  In other words, remove the certain 
! string.
! 
! All's well until I run into a case where the pattern to be removed is found
! "back to back" in the file.  I think I understand what perl is doing, but,
! naturally, I want to find a perl-ish (i.e. easy) way around it.  Is there
[snip]
! Code snippet:
! 
! $x = "|NULL|NULL|any text, even NULL, here|NULL|so on and so forth|";
! $x =~ s/\|NULL\|/\|\|/g;
! print "$x\n";

Your problem is that the continuation of matching (with /g) starts
from where the previous one left off and once you've matched
|NULL| you've eaten the second pipe: There is no |NULL| immediately
following the first |NULL|. Your example can be fixed using a
lookahead assertion which acts as an anchor rather than comsuming
part of the target string:
 
$x = "|NULL|NULL|any text, even NULL, here|NULL|so on and so forth|";
$x =~ s/\|NULL(?=\|)/|/g;
print "$x\n";

In other words, this matches |NULL only if it is immediately
followed by a pipe (but that pipe isn't part of the match) and
replaces it with one pipe.

lookahead (and lookbehind) assertions are discussed in the perlre
manpage.

regards
andrew

-- 
Andrew L. Johnson   http://www.manning.com/Johnson/
      The generation of random numbers is too 
      important to be left to chance.
      


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

Date: 21 Oct 1999 16:43:07 GMT
From: listopad@lucent.com (Steven G. Listopad)
Subject: Re: a question about multiple substitutions in a string
Message-Id: <7unfqr$7km@nntpb.cb.lucent.com>

Andrew,

Thanks for the tip.  That's exactly what I wa looking for.

I appreciate your help.

Steve



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

Date: Wed, 20 Oct 1999 20:48:49 -0200
From: Joyce Ynoue <981414@dcc.unicamp.br>
Subject: a tree of subdirectories in perl?
Message-Id: <380E46D1.9C3658A4@dcc.unicamp.br>

Does anybody know how to implement in perl something like described
below??

>tree usr

  usr
     bin
     temp
       linux
       unix
     dos

bin, temp and dos are subdirectories of usr
linux and unix are subdirectories of temp

Thanks
 Joyce Ynoue



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

Date: Thu, 21 Oct 1999 10:03:14 -0700
From: David Amann <dove@synopsys.com>
Subject: Re: a tree of subdirectories in perl?
Message-Id: <380F4752.49BB8CEB@synopsys.com>

Hi Joyce,

Joyce Ynoue wrote:

> Does anybody know how to implement in perl something like described
> below??
>
> >tree usr
>
>   usr
>      bin
>      temp
>        linux
>        unix
>      dos
>
> bin, temp and dos are subdirectories of usr
> linux and unix are subdirectories of temp

I would use some combination of File::Find and the File::Basename
modules.  Here's an example script you can play with.

Hope this helps,
-=dav

#!/usr/local/bin/perl-5.004 -w
# Always use -w to catch errors.

#
# Author: Dav Amann (dove@synopsys.com)
# Version: 1.0
#

use strict;                      # Always use strict.
use File::Find;
use File::Basename;

my $start_dir = "/remote/asrv1/dove";
find(\&print_dir, "$start_dir");

sub print_dir {
    if (-d) {
        my $basename = basename($File::Find::name);
        my $num_tabs = split(/\//, $File::Find::name) -
            split(/\//, $start_dir) - 1;
        for (my $i = 0; $i <= $num_tabs; $i++) {
            print "  ";
        }
        print "$basename\n";
    }
}







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

Date: Thu, 21 Oct 1999 15:05:45 GMT
From: stuckenbrock@my-deja.com
Subject: Accessing Serial port
Message-Id: <7una44$4tt$1@nnrp1.deja.com>

Hi,

is there any Perl-Module that demystifies the handling of the serial
port?
Didn't find anything on CPAN.

Thanks alot
Soeren


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


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

Date: Thu, 21 Oct 1999 15:45:22 GMT
From: jtbell@presby.edu (Jon Bell)
Subject: Re: Archive
Message-Id: <FJyMFM.DBx@presby.edu>

[posted to newsgroup, with an e-mail copy to the questioner]

  <scgilbert@my-deja.com> wrote:
>Is there a searchable archive of the messages in this news group? 

Right where you're posting from!  :-)  Use the "Power Search" feature.

-- 
Jon Bell <jtbell@presby.edu>                        Presbyterian College
Dept. of Physics and Computer Science        Clinton, South Carolina USA
        [     Information about newsgroups for beginners:     ]            
        [ http://www.geocities.com/ResearchTriangle/Lab/6882/ ]


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

Date: 21 Oct 1999 17:17:41 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Archive
Message-Id: <380f3ca5_2@newsread3.dircon.co.uk>

scgilbert@my-deja.com wrote:
> Is there a searchable archive of the messages in this news group? I'd
> hate to ask a question that's been covered before.
> 

<snip>

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

Beats me I never heard of such a thing ...

/J\
-- 
"If I was going to wear a wig I'd choose something a lot better than this"
- Barry Norman


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

Date: Thu, 21 Oct 1999 09:40:31 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Array written to a file: Extra space inserted
Message-Id: <x3yn1tcj0hc.fsf@tigre.matrox.com>


Jim Monty <monty@primenet.com> writes:

> etm001@yahoo.com wrote:
> > I have a simple statement:
> >
> > print INFILE "@array";
> >
> > Each element of the array is a string of comma seperated values. When
> > written to the file, all elements of the array, *excluding* the first
> > one, are having a space inserted infront of them. [...]
> >
> > Any thoughts?
> 
> The default value of the list separator variable $" is a single
> space. Try changing it to a null string:
> 
>     $" = '';

True. Or just remove the quotes from around @array, since the default
value of the output field separator $, is the empty string.

--Ala



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

Date: Thu, 21 Oct 1999 18:24:54 +0200
From: "paranoid" <genlabs@gmx.net>
Subject: At the risk of making myself an idiot ...How to create files in Perl ?
Message-Id: <940523094.476101@news.vbs.at>

Hello geeks.

Ì hope anyone of you can answer my question,
and mildly ignore it's dumbness .
I'm writing a subroutine that should do the following:
1) Check if a filename is available (not  containing illegal chars etc., not
already existing in the write directory)
2) Then Create the file
The filename has to be variable (userdefined) , the extension stays fixed .
Since the only Perl Book I ever read was "Perl for Dummies" - which should
explain why I'm posting here ;-),
and there is nothing to cover this topic, I thought it would be not possible
with Perl .
Can you create files from a Perl script ? If the answer is yes, what's the
command and syntax ?

Please help me if you can .

Ethan C. Castaneda





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

Date: Thu, 21 Oct 1999 16:59:13 GMT
From: Scratchie <AgitatorsBand@yahoo.com>
Subject: Re: At the risk of making myself an idiot ...How to create files in Perl ?
Message-Id: <BDHP3.874$LR3.154951@news.shore.net>

paranoid <genlabs@gmx.net> wrote:
: 1) Check if a filename is available (not  containing illegal chars etc., not
: already existing in the write directory)

To check whether a file exists you use something like
	if (-e $file) {
		print "File exists!\n";
	}

This is more generally called a "-X file test operator", which is how
you'll find it listed in the documentation (along with many other useful
file tests). To check the name of the file, you'll probably want to use a
regular expression.

: Can you create files from a Perl script ? If the answer is yes, what's the
: command and syntax ?

You use the "open" command with either a ">" or ">>" to indicate that you
want to write to a file. Surely this is described in "Perl for Dummies"
*somewhere*? If not, I would normally recommend that you consult "perldoc
-f open", but I just tried that and it was all-but-illegible due to a
preponderance of "C<'E<lt>'>" and suchlike. You might be better off
reading the docs for "open" at
http://www.perl.com/CPAN-local/doc/manual/html/pod/perlfunc/open.html .

Hope this helps,

--Art
-- 
--------------------------------------------------------------------------
                    National Ska & Reggae Calendar
                  http://www.agitators.com/calendar/
--------------------------------------------------------------------------


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

Date: Thu, 21 Oct 1999 15:27:38 GMT
From: rev_bhagwan@my-deja.com
Subject: chomp() nested in split() doesn't work - why?
Message-Id: <7unbd1$5rq$1@nnrp1.deja.com>

chomp() does not behave the way I expect when nested in split().

example 1:
@title = ();
@avail = ();
@type = ();
$prodfile = 'c:\perl\mdat\products.txt';
open(prods,$prodfile) || die 'couldn\'t open products file';
$rec_num=0;
while ($record = <prods>) {
    chomp($record);
    ($title[$rec_num],$type[$rec_num],$avail[$rec_num]) =
split(/,/,$record);
    $rec_num++;
}
close(prods);
### end of example 1

products.txt is a comma delimited data file with the record structure:
product_name,type(integer),quantity(integer)
The above code fragment populates @title with the titles in the file.
However...

example 2:
@title = ();
@avail = ();
@type = ();
$prodfile = 'c:\perl\mdat\products.txt';
open(prods,$prodfile) || die 'couldn\'t open products file';
$rec_num=0;
while ($record = <prods>) {
    ($title[$rec_num],$type[$rec_num],$avail[$rec_num]) =
split(/,/,chomp($record));
    $rec_num++;
}
close(prods);
### end of example 2

The above example 2 populates @title with a '1' in each element, and
a '0' for the empty line at the end of all records.  Is there an error
I'm not noticing?  All I did to correct #2 above was to offload chomp to
its own line.  Why doesn't chomp work inside split?  Any thoughts?

Misha
misha@zensearch.net


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


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

Date: Thu, 21 Oct 1999 17:32:07 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: chomp() nested in split() doesn't work - why?
Message-Id: <r6IP3.2042$IZ5.27654@news.rdc1.ct.home.com>

rev_bhagwan@my-deja.com wrote:
> chomp() does not behave the way I expect when nested in split().

perldoc -f chomp

and be enlightened...

				Dan


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

Date: 21 Oct 1999 15:09:20 GMT
From: lt lindley <ltl@rgsun5.viasystems.com>
Subject: Re: dereferencing complex expression
Message-Id: <7unab0$keg$1@rguxd.viasystems.com>

Rich Ackerman <richmond@no.shadow.spam.net> wrote:
:>I inherited some code with lots of references and I'm stumped on this
:>one. Can anyone decode this for me? Given that

:>$cclog_results->[0]->{'authcode'} 

:>gives me the right thing, the value of an authorization code. This
:>means (tell me if I'm wrong <g>) that $cclog_results is an array of
:>references; the first one points to a hash table in which 'authcode'
:>is a key; the whole expression returns the value at that key. Right?

Correct.  But you don't need the second arrow. It is implied.
$cclog_results->[0]{'authcode'};

:>Then $cclog_results is returned from the function along with another
:>results hash, in this doozy:

:>my $results;
:>%{$results->[0]} = (%{payment_results->[0]}, %{$cclog_results->[0]});
:>return $results;

Yuck.  
You are missing at least one $ there.  Copy and paste next time.
This is an absolutely ridiculous use of autovivification.  It is
also a waste of an array and a dereference, but there may
be a reason for it somewhere else in the program.

:>and my question is how to get to my authcode using $results. I would
:>think it would be:

:>$results->[1]->[0]->{'authcode'}

Use the debugger and examine the data.  Try:

x $results

It turns out that $results will be a pointer to an array of exactly
one element.  That element happens to be a pointer to a hash.  The
hash will contain 'authcode' as a key amongst others.

$results->[0]{'authcode'}

I hope you have already sent whoever wrote this to remedial training.

-- 
// Lee.Lindley   /// I used to think that being right was everything.
// @bigfoot.com  ///  Then I matured into the realization that getting
////////////////////   along was more important.  Except on usenet.


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

Date: Thu, 21 Oct 1999 16:49:35 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: Examining Win32 processes
Message-Id: <7ungga$1hi$1@news.mch.sbs.de>

In article <380f3614.703375@news.vnet.net>, mirak63@yahoo.com wrote:
>On Wed, 20 Oct 1999 17:54:37 GMT, michel.dalle@usa.net (Michel Dalle)
>wrote:
[snip]
>>The GetTickCount function retrieves the number of milliseconds that have 
>>elapsed since Windows was started. 
>>
>>DWORD GetTickCount(VOID)
>>
>>See the documentation of Win32::API for more details on how to use this.
>>
>>Have fun,
>>
>>Michel.
>The only problem with this is that every 47 days or so the counter
>resets itself... Or maybe I'm reading something wrong.  In any case an
>example of any PERL script that has been written would be appreciated.


Here goes nothing :

#!/usr/local/bin/perl -w
use Win32::API;
my $tickcount = new Win32::API("kernel32", "GetTickCount", [], N);
my $uptime = $tickcount->Call();
print "The system has been running since $uptime milli-seconds...\n";
exit;

Incidently, my Task Manager reports that System Idle Process has been
running for 19:03:58, while this script reports 81673350 milli-second,
which is about 22:41:13.

And I see in the Event Viewer that my system was last restarted at 19:57:11
yesterday. Now guess how late it was on my PC : 15:01:09 or 18:38:24 ?

The problem of 49.7 days is true, but then your system is not likely to run
that long without problems, is it ? :-)

Michel.


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

Date: Thu, 21 Oct 1999 15:30:09 GMT
From: Scratchie <AgitatorsBand@yahoo.com>
Subject: Re: File "cgi-lib.pl" not found in @INC?
Message-Id: <5kGP3.858$LR3.151347@news.shore.net>

Thomas j. Evans <thomas@skyweb.net> wrote:
: I have this Perl program that requires cgi-lib.pl, and keeps giving me
: a message saying:
: File "cgi-lib.pl" not found in @INC at line 12......

: cgi-lib.pl does exist in the same directory as the Perl script that is
: getting the error, and permissions are set correctly.  The failing
: script starts out like this:

You either need to add the directory to your @INC array or give the full
path in your "require" statement, but the chances are pretty good that
you'll be better off using CGI.pm anyway.

--Art
-- 
--------------------------------------------------------------------------
                    National Ska & Reggae Calendar
                  http://www.agitators.com/calendar/
--------------------------------------------------------------------------


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

Date: Thu, 21 Oct 1999 17:32:30 +0100
From: Andrew Green <green@argonet.co.uk>
Subject: Re: File "cgi-lib.pl" not found in @INC?
Message-Id: <49548e75d3green@argonet.co.uk>

In article <slrn80u5a9.llb.bmccoy@moebius.foiservices.com>,
   Brett W. McCoy <bmccoy@foiservices.com> wrote:

> I recommend getting rid of cgi-lib.pl and upgrading to CGI.pm -- it's a
> much better module and is still being supported.  You'll have to rewrtie
> your CGI scripts, however.

For the benefit of the original poster, not much rewriting need be
involved, thanks to CGI.pm's "pretend to be cgi-lib.pl" mode.  Just
replace your:

        require "cgi-lib.pl";

with:

        use CGI qw(:cgi-lib);

and Bob's your proverbial close relation.  Nothing else need be changed
in your script.

Cheers,
Andrew.

-- 
Andrew Green ---------------------------------------- green@argonet.co.uk
A founder member of the Charles Fort Institute - http://www.forteana.org/
Article Seven Graphic and Internet Design ---- http://www.article7.co.uk/


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

Date: Thu, 21 Oct 1999 08:06:58 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: file upload
Message-Id: <MPG.1278cbe94d6b6c3998a0e8@nntp.hpl.hp.com>

In article <380f2576_1@newsread3.dircon.co.uk> on 21 Oct 1999 15:38:46 
+0100, Jonathan Stowe <gellyfish@gellyfish.com> says...
> CS <@mdo.net> wrote:

 ...

> > open INFILE, "<$myfile";
> 
> Except that you really must check that the file was opened successfully:
> 
>   open INFILE, "$myfile" or die "Cant open $myfile - $!\n";

I would move the first two quotes to where they might be useful (for 
example, leading or trailing spaces in the filename):

    open INFILE, $myfile or die "Cant open '$myfile' - $!\n";

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


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

Date: Thu, 21 Oct 1999 09:37:09 -0700
From: David Amann <dove@synopsys.com>
Subject: Re: flcoking a DBM
Message-Id: <380F4135.D572C2FA@synopsys.com>

Hi Darrick,

Darrick Wolfe wrote:

> I was wondering if using the flock function works with DBM files?  I
> know how to use flock with regular files, just not sure about using it
> with DBM.

Depends on what sort of DBM file you are using.  If you are using GDBM or
SDBM then you can't do a lot to lock the database itself.

When you open a GDBM file, you can specify whether you want to open in
read-mode or in write mode.  The write mode should only allow one writer at
a time.

Finally, with version 1 of Berkeley DB, you can get a file descripter from
the datbase by using the 'fd' method and flock that.

As Bill wrote earlier though, you can implement a lock file procedure that
should generalize to every case of DBM files.

Hope this helps,
-=dav




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

Date: Thu, 21 Oct 1999 16:43:00 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: formatting text with filling '.'s
Message-Id: <s0ugkklhr0117@corp.supernews.com>

Frank Mower (frank.mower@east.sun.com) wrote:
: SmFyZWQgRXZhbnMgd3JvdGU6DQoNCj4gSGksDQo+DQo+IElzIHRoZXJlIGFuIGVhc3kgd2F5
[snip]
: c3BlYWsgZm9yIFN1biBNaWNyb3N5c3RlbXMuLS0NCg==

I think I like Larry's solution better.

-- 
   |   Craig Berry - cberry@cinenet.net
 --*--  http://www.cinenet.net/users/cberry/home.html
   |   "They do not preach that their God will rouse them
      a little before the nuts work loose." - Kipling


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

Date: Thu, 21 Oct 1999 18:14:17 +0200
From: Heiko Herold <hman@dei.unipd.it>
Subject: Re: Ignore the idiots (including Tad)
Message-Id: <tDsPOITfHeQ3i=9BxIgTacqbHZVl@4ax.com>

"Benjamin Vargas" <bvargas@cmh.edu> wrote:

>
>Tad McClellan <tadmc@metronet.com> wrote in message
>news:le5ku7.h2e.ln@magna.metronet.com...
>> emlyn_a@my-deja.com wrote:
>>
>> : Just because Abigail is posting questions that engage YOU, it does not
>> : exclude anyone else from posting for legitimate questions they have.
>>                                        ^^^^^^^^^^
>>
>>    FAQs are not legitimate questions in *any* Usenet newsgroup.
>>
>>
>> --
>>     Tad McClellan                          SGML Consulting
>>     tadmc@metronet.com                     Perl programming
>>     Fort Worth, Texas
>
>I would never consider hiring a consultant with an attitude such as yours.
>

You don't hire people you ask advice on newsgroups. You get it for free.

Heiko
-- Heiko Herold
-- Heiko.Herold@previnet.it
-- Heiko.Herold@dei.unipd.it


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

Date: 21 Oct 1999 16:32:32 GMT
From: snow@statsci.com (Greg Snow)
Subject: Re: Ignore the idiots
Message-Id: <7unf70$joe$1@junior.statsci.com>

In article <slrn80s1k1.6vb.M.Ray@carlova.ulcc.ac.uk>,
Malcolm Ray <M.Ray@ulcc.ac.uk> wrote:
>
>Stop right there!  While I agree with most of what you say, I think
>you're falling into a trap here.  This classification of clpm posters
>into 'newbies' and 'experts' is, IMO, something of a straw man put
>forward by those guilty of the sin of False Laziness.  It allows them
>to accuse clpm of elitism, 

So, did I fall into the trap, or do the people that suggest a seperate
group just for experts fall into the trap.

I agree that using only 2 groups is an oversimplification, the question
is: does the simplification aid the argument or harm it.  I was arguing
against splitting off an new group, (or a lot of groups for many different
levels).  Splitting groups is good if the posters will only post to the
appropriate group, my point was that splitting off the experts group would
only increase the total number of posts flying around, not improve either
group (and I think that point is still valid).


>                           and (I suspect) scares off some potential
>answerers who don't consider themselves experts.  clpm has room for
>programmers of all levels of expertise, answering as well as asking.

Yes, we do need more posters from the "middle levels of Perl expertise", I
thought of adding some posting advice for non-experts answering questions,
but sent off the post before finding the place to insert it.  So here
seems like a good place (note these are my opinions based on reading and
posting to the group, nothing official):

Advice to non-expert/non-novices for posting to clpm:

Have you gained from reading clpm and want to give something back?  Do you
think you know the answers to some of the basic questions?  Would you like
expert advice on your coding?

Would you post answers to clpm but are afraid of the experts?

Well go ahead and post (please), just put a little thought and effort into
your post, here are some suggestions for getting positive rather than
negative feedback:

* State you expertise, or lack thereof.  A statement like "I'm not an
expert yet, but I think this will work"  or "this works, but there may be
better methods" will head off complaints that you are passing yourself off
as an expert.

* Ask for improvements/suggestions and accept this advice (how
many flame wars start when someone gets defensive instead of learning)

* Test your code.  It is realy easy to test your code before posting and
isn't a correct working answer better?

* Copy and paste (tested) code rather than typing it in again (those darn
typos).

* State your assumptions clearly.  Your solution may solve a slightly
different problem than what others think was asked for.

* Check the FAQ and DOCS.  If there is an answer there, it is probably
better than the one you would have given (if you dissagree, send a bugfix
or invite discussion here, but let others compare the 2 before putting
your method up as *THE* method to use). 


Other suggestions anybody?



>If a new poster appeared on the scene and steadily answered a dozen
>FAQs a day, each answer beginning "I'm no expert, but...", do you
>think they'd be received with hostility by the real experts?  I don't.

Here in Seattle (and probably other places), there are a lot of signs in
the parks saying not to feed the water fowl (lots of ducks and geese
around).  The reason is that if people don't feed them, then a balance is
maintained and only enough birds hang around as the environment can
handle.  If people feed them, then soon there are too many and the big
problem becomes the exess of droppings fouling the water and grass.

There is potential for simmilar problems on clpm, if we feed the newbies
instead of teaching them how to learn the basic answers for themselves (I
have nothing against pointers to specific sections of the docs or
discussions of topics that differ a little from the examples given), then
are we not inviting more and more newbies to come here and polute the
newsgroup with things that could be better done on their own?  and doing
both the newbies and the regular readers a disservice?

>Any volunteers?

The mice thought putting a bell on the cat was a great idea, until it came
time to call for volunteers to actually do it.



-- 
-------------------------------------------------------------------------------
     Gregory L. Snow         |  Inertia makes the world go round,
     (Greg)                  |   Love makes the trip worth taking.
     snow@statsci.com        |


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

Date: Thu, 21 Oct 1999 15:23:42 GMT
From: Scratchie <AgitatorsBand@yahoo.com>
Subject: Re: in need of example...
Message-Id: <2eGP3.856$LR3.151347@news.shore.net>

Erik van Roode <newsposter@cthulhu.demon.nl> wrote:
:> Can anyone send me in the direction of a good example of listing and sorting
:> directories under Linux? I need to have a way to sort out .gif's and .jpg's
:> into an array and then output the list into HTML. I have the HTML part done,
:> but how do I do an 'ls' into an array so that I can sort it? So far all I
:> have done is wear out my harddrive and gotten frustrated! :)

: Check out the opendir, the grep, and the sort functions.

Or just try 

 my @graphics = `ls *.jpg *.gif`;

--Art
-- 
--------------------------------------------------------------------------
                    National Ska & Reggae Calendar
                  http://www.agitators.com/calendar/
--------------------------------------------------------------------------


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

Date: 21 Oct 1999 16:53:46 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: in need of example...
Message-Id: <380f370a_2@newsread3.dircon.co.uk>

Brett W. McCoy <bmccoy@foiservices.com> wrote:
> Also Sprach Jeremiah Stanley <miah@idcomm.com>:
> 
>>Can anyone send me in the direction of a good example of listing and sorting
>>directories under Linux? I need to have a way to sort out .gif's and .jpg's
>>into an array and then output the list into HTML. I have the HTML part done,
>>but how do I do an 'ls' into an array so that I can sort it? So far all I
>>have done is wear out my harddrive and gotten frustrated! :)
> 
> You'd want to use the DirHandle module to do that:
> 

From the DirHandle manpage:

       The DirHandle method provide an alternative interface to
       the opendir(), closedir(), readdir(), and rewinddir()
       functions.

       The only objective benefit to using DirHandle is that it
       avoids namespace pollution by creating globs to hold
       directory handles.


/J\
-- 
"I want to be like Oprah" - Sarah, Duchess of York


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

Date: 21 Oct 1999 15:59:16 GMT
From: Erik van Roode <newsposter@cthulhu.demon.nl>
Subject: Re: in need of example...
Message-Id: <7und8k$dft$1@internal-news.uu.net>

Scratchie <AgitatorsBand@yahoo.com> wrote:

> Or just try 

>  my @graphics = `ls *.jpg *.gif`;

  Which only works if you happen to have a program 'ls' in your path
that lists files. Even then, you get a newline after each filename
that you have to filter out.

Erik



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

Date: 21 Oct 1999 17:06:04 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: in need of example...
Message-Id: <380f39ec_1@newsread3.dircon.co.uk>

Erik van Roode <newsposter@cthulhu.demon.nl> wrote:
> Larry Rosler <lr@hpl.hp.com> wrote:
>> In article <7ul91q$3td$2@internal-news.uu.net> on 20 Oct 1999 20:35:06 
>> GMT, Erik van Roode <newsposter@cthulhu.demon.nl> says...
>>> 
>>> Check out the opendir, the grep, and the sort functions.
> 
>> Don't forget the readdir function, which is the one that does the heavy 
>> lifting!  :-)
> 
>   Then you have to mention the closedir as well ;) But seriously, the original
> poster asked for references. The opendir docs have refs to readdir/closedir
> so I thought checking those would be natural.
> 
>   I saw someone else posted a solution using `/bin/ls -1`. It didn't even work!
> 

It works fine for me ....

/J\
-- 
"You've got to remember it was the 1980s. There were a lot of people
alive back then who died in the Second World War" - This Morning with
Richard Not Judy


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

Date: Thu, 21 Oct 1999 09:21:57 -0700
From: tgy@chocobo.org (Neko)
Subject: Re: in need of example...
Message-Id: <uzAPOAwt+Hwblm8pv3YciPDgEfWk@4ax.com>

On Thu, 21 Oct 1999 07:32:06 -0700, Larry Rosler <lr@hpl.hp.com> wrote:

>In article <slrn80u5p2.llb.bmccoy@moebius.foiservices.com> on Thu, 21 
>Oct 1999 13:33:03 GMT, Brett W. McCoy <bmccoy@foiservices.com> says...
>
>> You'd want to use the DirHandle module to do that:
                         ^^^^^^^^^

>> $image_dir = new FileHandle;
                    ^^^^^^^^^^

>> $image_dir->open($fullpath);
>> #error handling code goes here
>> 
>> @files = grep /^(0*$doc)\.\d{3}/, $image_dir->read;
>
>As Tom Christiansen isn't around to grumble about this, I'll try 
>instead.  Someone ought to.
>
>Please, someone, please give me one (1) reason why this code is better 
>than using, e.g.:

$DIRHANDLE = 'bar';
sub foo { $DIRHANDLE }

>{
>    local *DIRHANDLE;

     print foo();  # Can't see $DIRHANDLE.

     # Also...
     my $dir1 = \do { local *DIR };
     my $dir2 = Symbol::gensym();

>    opendir DIRHANDLE, ...
>    ... readdir DIRHANDLE ...
>}
>
>Just one reason.  Please?

From DirHandle:
    The only objective benefit to using DirHandle is that it avoids
    namespace pollution by creating globs to hold directory handles.

-- 
Neko | tgy@chocobo.org | Will hack Perl for a moogle stuffy! =^.^=


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

Date: Thu, 21 Oct 1999 16:52:06 GMT
From: Scratchie <AgitatorsBand@yahoo.com>
Subject: Re: in need of example...
Message-Id: <WwHP3.871$LR3.154951@news.shore.net>

Erik van Roode <newsposter@cthulhu.demon.nl> wrote:
: Scratchie <AgitatorsBand@yahoo.com> wrote:

:> Or just try 

:>  my @graphics = `ls *.jpg *.gif`;

:   Which only works if you happen to have a program 'ls' in your path
: that lists files.

He said he was running Linux, so that's probably a safe bet.

: Even then, you get a newline after each filename
: that you have to filter out.

Life's a bitch, ain't it?

--Art
-- 
--------------------------------------------------------------------------
                    National Ska & Reggae Calendar
                  http://www.agitators.com/calendar/
--------------------------------------------------------------------------


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

Date: 21 Oct 1999 15:40:37 GMT
From: blackbird@dortmund.crosswinds.net (Bianka Martinovic)
Subject: Language resource / module
Message-Id: <7unc5l$84q$1@penthesilea.Materna.DE>

Hi,

I'd like to extract all the output of a script and put it into an external 
file, so I'm able to use the same script with different languages just 
changing the external file.

The external file looks like this:
  $msg1 = "$Conf::name - $Conf::area";

I have imported a configuration file like this:
  { package Conf; do 'config.rc'; }
and the 'Language file' like this:
  { package Lang; do 'language.rc'; }

Now, if my script prints out $msg1, the first variable of the whole string 
is okay, but the second one is empty. I get something like this:
  <Value of $Conf::name> - <nothing>

As $Conf::area is used to influence the process of the script, I am sure 
that it is NOT really empty.

Can anyone explain why this happens? Does somebody have a better proposal 
for solution?

Thanks a lot,
Bianka

P.S.: No I'm not going to write the english language file for my script... 
;-))))) Please don't mention my bad english...
-- 
Jede Epoche der Menschheit hat so ihre Plagen: Heuschreckenschwaerme
   im Altertum, die Pest im Mittelalter, Microsoft in der Neuzeit.
  /\_/\
 ( o.o )        eMail: blackbird@dortmund.crosswinds.net
  > ^ <



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

Date: Thu, 21 Oct 1999 11:53:02 -0400
From: Tom Renic <trenic@nortelnetworks.com>
Subject: NEED URGENT HELP
Message-Id: <380F36DE.86F74933@nortelnetworks.com>

Does anyone know how to use cgi on Personal Web Server?

I can't get anything to work.

HELP!


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

Date: Thu, 21 Oct 1999 16:53:28 GMT
From: Scratchie <AgitatorsBand@yahoo.com>
Subject: Re: NEED URGENT HELP
Message-Id: <cyHP3.872$LR3.154951@news.shore.net>

Tom Renic <trenic@nortelnetworks.com> wrote:
: Does anyone know how to use cgi on Personal Web Server?

Haven't the slightest idea, but a perl newsgroup is certainly not the
right place to go for "urgent" help on your web server.

--Art
-- 
--------------------------------------------------------------------------
                    National Ska & Reggae Calendar
                  http://www.agitators.com/calendar/
--------------------------------------------------------------------------


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

Date: Thu, 21 Oct 1999 19:10:40 GMT
From: mirak63@yahoo.com
Subject: Re: Problem w/ PERL and SQL
Message-Id: <380f6467.12564189@news.vnet.net>

On Tue, 19 Oct 1999 17:00:50 -0400, Kenneth Bandes <kbandes@home.com>
wrote:

>Scratchie wrote:
>> 
>> mirak63@yahoo.com wrote:
>> : When I push a scaler in to a SQL database (SQL 7)
>> : the data shows up OK. However, when I retrieve the same
>> : data using PERL, the data is truncated to 255 characters.
>> 
>> Just a wild guess, but it sounds like a problem with your database, not
>> Perl.
>
>Yup.  You're using SQL 7 but you've got an old version of DB-Library
>and/or the ODBC driver.  It's documented in MSDN that this will
>truncate to 255 characters.
>
>Update your drivers.
>
>Ken Bandes


Yep, I installed the newest MDAC from MS and it worked like a charm.
Also fixed some other problems. 
Thanks a bunch!

Susan



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

Date: Thu, 21 Oct 1999 16:44:43 GMT
From: zephar@my-deja.com
Subject: TCP Look ahead under perl
Message-Id: <7unftq$9ej$1@nnrp1.deja.com>

Has anyone come across a call using perl/tcp where
you can ask the socket how many bytes to read either
in block or no block mode?  I know I saw it in one of
the books somewhere but for the life of me I cant find
it again....

I expect one waits for the select to read fire and then
one can ask how many bytes to read and then go ahead
and read it. Place this in a hash or array and later
come back and assemble agreed upon blocks of data...
Sound ok?

Thanks in advance,

Jim 1999/10/21


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


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

Date: Thu, 21 Oct 1999 16:54:11 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Trim text
Message-Id: <s0uh9ja1r0110@corp.supernews.com>

sushi38@my-deja.com wrote:
: Thanks to all for the help. I tried Govindaraj's small piece of code
: and it worked off the bat. I am pasting below what I came up with, and
: although I might be wrong, I fell there must be a more efficient way of
: doing this. Thanks for any input.
: 
: #!/usr/bin/perl

Still no -w, still no 'use strict'.  Perl masochism appears to be the kink
du jour.

: #Turn off Perl buffering
: $| = 1;
: 
: @junk = `finger joe@there.com`;

Backticks create a double-quotish string parse.  That @there in your
string looks like an array name.  This causes a compilation error in
modern perls (can't recall offhand what version this welcome change
appeared in).

: open (Equake, ">quake.txt") || die "Can't open quake.txt for writing! $!
: \n";
: if (@junk eq ""){print "No results from finger"}

That comparison won't ever test true.  @junk is an array; coerced by eq
into a scalar, it becomes the number of elements in @junk, expressed as a
string ('0' for an empty array, '5' for five elements, and so forth).
Under no circumstances can it be coerced into an empty string.

Weirdly enough, if you replace eq by == here, it *would* work, but for all
the wrong reasons.  Don't do that. :)

:  else {print Equake @junk};
: close (Equake);
: 
: open(INPUT, "<quake.txt") || die "Can't open quake.txt for reading! $!
: \n";
: 
: while ( <INPUT> )
: {
:   if ( $_ =~ m/^--/ )

No harm in writing it that way, but idiomatically it's common to take
advantage of the fact that m// binds to $_ by default.

:   {
:       $LastLine = $PrevLine;
:   }
:   $PrevLine = $_;
: }
: close(INPUT);
: 
: open (Lastquake, ">lastquake.txt") || die "Can't open quake.txt for
: writing! $!\n";
: if ($LastLine ne "") {print Lastquake $LastLine}
:  else {print Lastquake "Nothing"};
: close (Lastquake);
: 
: print "Location: http://www.myserver.com/cgi-bin/quake.txt\n\n";
: 
: exit;

-- 
   |   Craig Berry - cberry@cinenet.net
 --*--  http://www.cinenet.net/users/cberry/home.html
   |   "They do not preach that their God will rouse them
      a little before the nuts work loose." - Kipling


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

Date: 21 Oct 1999 02:48:09 GMT
From: pete@theory2.phys.cwru.edu (Peter J. Kernan)
Subject: Re: Unix code to perl
Message-Id: <slrn80svn9.dh0.pete@theory2.phys.cwru.edu>

On Thu, 21 Oct 1999 01:43:21 GMT, 
  Vincent Murphy <vincent.murphy@cybertrust.gte.com> wrote:
 .=
 .=perl -nle '$/="";if (/pattern/) { print $ARGV; next}' *.pl
 .=
  perl -nle 'print $ARGV if ?pattern?; reset if eof' *.pl

-- 
  Pete


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

Date: Thu, 21 Oct 1999 15:26:52 GMT
From: Scratchie <AgitatorsBand@yahoo.com>
Subject: Re: Wall Street E-Commerce
Message-Id: <0hGP3.857$LR3.151347@news.shore.net>

TODD MURRAY <kipbrak@my-deja.com> wrote:
: We have all heard the rumours of the largest most prestigious Wall
: Street Brokerage Houses pursuing on-line trading.  Well the time has
: arrived!!

What a relief!!!

: Please help me!!!!
: I need to speak with the Guru's who are ready to accept this challenge
: both technically and financially.  If you are not interested please
: refer to those who are.

I don't think even the newbies on this group would want to work for an
idiot like you.

--Art
-- 
--------------------------------------------------------------------------
                    National Ska & Reggae Calendar
                  http://www.agitators.com/calendar/
--------------------------------------------------------------------------


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

Date: Thu, 21 Oct 1999 17:29:23 +0100
From: "João Sil" <joao.f.sil@telecom.pt>
Subject: win32::odbc question
Message-Id: <380F3F63.A6540173@telecom.pt>

hi,

I 'm using win32::odbc to connect to an rdb database and I need to know
if there is a way to query the module in such a way that it tells me the

number of rows retrieved from a select.
I used $db->RowCount() but it returns -1.

Is it possible to instruct FetchRow to start at a specified index istead

of having to run through all the record set?

any help appreciated

tia

joao sil
joao.f.sil@telecom.pt





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

Date: Thu, 21 Oct 1999 17:37:29 +0100
From: Andrew Green <green@argonet.co.uk>
Subject: Re: WTB: Web Client Programming in Perl
Message-Id: <49548eea97green@argonet.co.uk>

In article <7un618$1g8$1@nnrp1.deja.com>,
   <jmeacham@jhu.edu> wrote:

> This book seems to be out of print.

Oh?  I had no trouble getting it from amazon.co.uk just a couple of weeks
ago - I'd be very surprised if Amazon UK had it and Amazon US didn't...

Cheers,
Andrew.

-- 
Andrew Green ---------------------------------------- green@argonet.co.uk
A founder member of the Charles Fort Institute - http://www.forteana.org/
Article Seven Graphic and Internet Design ---- http://www.article7.co.uk/


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

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 1141
**************************************


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