[13724] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1134 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Oct 20 17:06:43 1999

Date: Wed, 20 Oct 1999 14:05:24 -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: <940453522-v9-i1134@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 20 Oct 1999     Volume: 9 Number: 1134

Today's topics:
        Array written to a file: Extra space inserted etm001@yahoo.com
    Re: Array written to a file: Extra space inserted (Andrew Johnson)
    Re: Array written to a file: Extra space inserted <newsposter@cthulhu.demon.nl>
    Re: Array written to a file: Extra space inserted <monty@primenet.com>
    Re: array (Joe Petolino)
    Re: BEGIN causes errors! (Eric Kuritzky)
    Re: Building Perl with @INC using ENV var <gellyfish@gellyfish.com>
    Re: Card shuffling <aqumsieh@matrox.com>
    Re: Card shuffling (Peter J. Kernan)
        CGI Form Problem <martin@mert.globalnet.co.uk>
        create hash for db index?? <shmooth@yahoo.com>
        Displaying query results in a table format jdkronicz@my-deja.com
    Re: Displaying query results in a table format (Gordon)
    Re: Displaying query results in a table format (Gordon)
    Re: Displaying query results in a table format (Gordon)
    Re: Exact pattern match (Neko)
    Re: HELP: Perl CGI for network monitoring <elaine@chaos.wustl.edu>
    Re: How to get file size? <gellyfish@gellyfish.com>
    Re: How to get file size? <gellyfish@gellyfish.com>
    Re: How to use cperl-mode in emacs <aqumsieh@matrox.com>
    Re: Ignore the idiots <AgitatorsBand@yahoo.com>
    Re: Importing symbols and memory usage - Apahce::Regist <ltl@rgsun5.viasystems.com>
        in need of example... <miah@idcomm.com>
    Re: in need of example... <newsposter@cthulhu.demon.nl>
    Re: IP address <elaine@chaos.wustl.edu>
    Re: IP address <gellyfish@gellyfish.com>
    Re: Matching an asterisk (Peter J. Kernan)
        ODBC extension for core distribution of Win32 Perl rbansal@zip2.com
        Perl for Epoc ? <netsoft@freenetname.co.uk>
    Re: Perl lite (Kai Henningsen)
        Permissions calculating user space on NT <tjnelson@iastate.edu>
    Re: Searching <gellyfish@gellyfish.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Wed, 20 Oct 1999 20:08:26 GMT
From: etm001@yahoo.com
Subject: Array written to a file: Extra space inserted
Message-Id: <7ul7fe$m7p$1@nnrp1.deja.com>

Hello,

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. For exmaple

field1,field2,field3,field4
 field1,field2,field3,field4
 field1,field2,field3,field4

I've verified that there are no leading spaces in this array--it prints
fine to the terminal window up until this line of code.

Any thoughts?

Thanks.
etm001@yahoo.com


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


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

Date: Wed, 20 Oct 1999 20:37:03 GMT
From: andrew-johnson@home.com (Andrew Johnson)
Subject: Re: Array written to a file: Extra space inserted
Message-Id: <PJpP3.49$pA3.391@news1.rdc1.mb.home.com>

In article <7ul7fe$m7p$1@nnrp1.deja.com>,
 etm001@yahoo.com <etm001@yahoo.com> wrote:
! Hello,
! 
! 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. For exmaple

See: man perlvar for the $" ($LIST_SEPARATOR) variable.
And if you do not want double-quotish interpolation, don't print
your array in a double quoted string.

hope it helps
andrew

-- 
Andrew L. Johnson   http://www.manning.com/Johnson/
      Reality is that which, when you stop believing in 
      it, doesn't go away.
          -- Philip K. Dick
      


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

Date: 20 Oct 1999 20:36:29 GMT
From: Erik van Roode <newsposter@cthulhu.demon.nl>
Subject: Re: Array written to a file: Extra space inserted
Message-Id: <7ul94d$3td$3@internal-news.uu.net>

etm001@yahoo.com wrote:

> print INFILE "@array";

See perlfaq5:
  Why do I get weird spaces when I print an array of lines?

Erik



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

Date: 20 Oct 1999 20:49:45 GMT
From: Jim Monty <monty@primenet.com>
Subject: Re: Array written to a file: Extra space inserted
Message-Id: <7ul9t9$8v5$1@nnrp02.primenet.com>

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:

    $" = '';

-- 
Jim Monty
monty@primenet.com
Tempe, Arizona USA


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

Date: 20 Oct 1999 20:23:46 GMT
From: petolino@joe.Eng.Sun.COM (Joe Petolino)
Subject: Re: array
Message-Id: <7ul8ci$pdn$1@engnews2.Eng.Sun.COM>

In article <MPG.1276fc8642c23f2598a0ca@nntp.hpl.hp.com>,
Larry Rosler  <lr@hpl.hp.com> wrote:

>In article <QNMMOEqN11IXCNNJfXqhPaKuglul@4ax.com> on Tue, 19 Oct 1999 
>21:24:37 +0100, Dave Cross <dave@dave.org.uk> says...

>> On Tue, 19 Oct 1999 20:07:05 GMT, Marcel Grunauer
>> <marcel.grunauer@lovely.net> wrote:

>> >On Tue, 19 Oct 1999 20:04:32 +0100, Dave Cross <dave@dave.org.uk>
>> >wrote:

>> >> On 19 Oct 1999 18:28:06 GMT, GiN@hookers.org (GiN) wrote:

>> >> >I have an array: @arr = ("weeh", "waah", "wuuh", "wiih", "wooh");
>> >> >
>> >> >what is the simpliest way to remove "wuuh" from @arr?

>> >> @arr = @arr[0, 1, 3, 4];

>> >Tsk, tsk.
>> >
>> >splice @arr,2,1;

>> tmtowtdi :-)

>Yes.  And in this case one of the ways is the 'best' way, and the other 
>ways are 'worse' and oughtn't be defended.

(No smiley, so I guess he was serious.)

I think you're confusing "best" with "most efficient", and he asked for the
"simplest" way, not the best.

If we don't know anything about the context that this code is going to
fit into, we can't really make any pronouncements about one way being
better than another.  The splice solution is more efficient in execution time
and memory usage (no, I'm not going to run benchmarks to prove this), but
efficiency would be an issue here only if this array manipulation comprises
the major work of the program - for all we know, he only has to do it once. 
Often it's worth sacrificing a few CPU cycles for the sake of clarity and/or
maintainability. The array slice solution seems a bit clearer and more
intuitive than the splice solution to me.  If the problem changed, and (for
example) it became necessary to remove *two* non-contiguous elements, or to
rearrange the order of the elements, then the programmer who used an array
slice would have an easier time changing his program to fit the new
requirements.  On the other hand, if the problem was to remove element number
N, where N is a variable, then the splice would be the obvious choice.  We
don't have enough information to make this choice - that's up to the
programmer to decide.


-Joe


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

Date: 20 Oct 1999 19:23:23 GMT
From: kuritzky@pub-708c-22.math.berkeley.edu (Eric Kuritzky)
Subject: Re: BEGIN causes errors!
Message-Id: <7ul4rb$l5h$1@agate-ether.berkeley.edu>

In article <7u7ghb$h7q$1@eagle.eku.edu>,
Jerry LeVan <levan@eagle.eku.edu> wrote:
>Greetings,
>
>I just upgraded our Perl to 5.0005.03 (latest_stable).
>
>I wrote a WWW server in Perl some time ago (5.002 Perl)
>and started the code with
>    BEGIN { fork && exit } 
>
>The intent was to immediately drop into the "background"
>before compilation started.
>

I just added the above line to a working script;  it works fine in
perl 5.005.03.

>It worked fine through 5.004_3, now I am getting syntax errors
>It looks like the scanner is screwing up the input
>  I get an error on a require 5.0; statement , the output
>  from the error message complains about prequire 5.0 being
>  syntacally incorrect.
>

Could you post the require line, with a few of the surrounding lines?
I think that's where the problem is.

>A workaround is to simply drop the word BEGIN.
>

Does this actually work?

--Eric Kuritzky





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

Date: 20 Oct 1999 20:56:45 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Building Perl with @INC using ENV var
Message-Id: <7ulaad$agg$1@gellyfish.btinternet.com>

[I always ignore Followup-to: poster unless there is a very good reason]

On Tue, 19 Oct 1999 14:14:46 -0400 Lawrence K. Chen, P.Eng. wrote:
> Is it possible to build Perl where the pathnames contained in @INC are rooted
> under an environment variable?
> 

The environment variable :

PERL5LIB

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: Wed, 20 Oct 1999 13:02:18 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Card shuffling
Message-Id: <x3yr9iqhso7.fsf@tigre.matrox.com>


Mikko Saari <msaari@tukki.cc.jyu.fi> writes:

> 
> Abigail <abigail@delanet.com> wrote:
> > Your zeroth and most serious problem is your inability to read.
> > If you can't read the faq, you wouldn't be able to read my answer either.
> 
> And where this faq might be found? I tried looking around in the perl.com
> but I didn't find any help. 

1) A copy of the FAQs should be installed on your system (if Perl was
properly installed, that is), and is accessible via the perldoc
program. Just type 'perldoc perldoc' on the command line.

2) On perl.com, there is a "Documentation" button as well as a "FAQs"
button on the left. Did you try clicking on them?

--Ala



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

Date: 20 Oct 1999 20:40:01 GMT
From: pete@theory2.phys.cwru.edu (Peter J. Kernan)
Subject: Re: Card shuffling
Message-Id: <slrn80sa51.di2.pete@theory2.phys.cwru.edu>

On Wed, 20 Oct 1999 15:53:40 GMT, Bart Lateur <bart.lateur@skynet.be> wrote:
 .=    Foreach card:
 .=        pick a card, any card, in the deck (maybe even this one)
 .=        exchange the current card with that one
 .=
 .=Code:
 .=
 .=	my @deck = (1..52);
 .=	for (my $i=0; $i<@deck; $i++) {
 .=		my $j = int rand @deck;
 .=		@deck[$i,$j] = @deck[$j,$i] if $i!=$j;
 .=	}
 .=	print "Deck: @deck\n";
or, with a perl wedge:

@deck = map {splice @deck,rand @deck,1} 0..$#deck;

-- 
  Pete


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

Date: Wed, 20 Oct 1999 20:59:59 +0100
From: "Martin Elliott" <martin@mert.globalnet.co.uk>
Subject: CGI Form Problem
Message-Id: <7ul7im$ple$1@gxsn.com>

I've used a few on-line tutorials and still can't get this right.

I basically need a CGI that takes the contents of a form (an order form,
with a quantity field), checks that against a flat file database, and if the
quantity wanted is in the flat file, writes the order to another file and
ammends the database.

Can any one help, or steer me in the right direction ??

Thanks a lot,

Martin




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

Date: Wed, 20 Oct 1999 19:17:33 GMT
From: Shmooth <shmooth@yahoo.com>
Subject: create hash for db index??
Message-Id: <380E142E.ED3462F5@yahoo.com>

I'm using Oracle 8i and I need to create a unique key for these long
records I have.  I know nothing of Oracle, so I thought maybe I could
create a hash of the concatentation of several fields to obtain a unique
value?

is this possible in Perl??  The only references I've found for hashing
anything are the Tie::Hash and Tie::StdHash modules, and I can't figure
out if they're what I want.

Thanks.



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

Date: Wed, 20 Oct 1999 19:07:19 GMT
From: jdkronicz@my-deja.com
Subject: Displaying query results in a table format
Message-Id: <7ul3st$jf7$1@nnrp1.deja.com>

Hi I am trying to create a CGI to an Access Database.  I want to be able to 
display the results of the Select in a HTML table but I am having trouble. 
The following lines of code illustrate what I am trying to do.	The select
statement returns two fields from the table.  Could someone tell me what I
need to do differently?

 ....dbi stuff up here.......... use CGI; $q=new CGI; print start_html; print
$q->table({-border}, where(@row=fetchrow_array) {$q->TR($q->td($row[0],
$row[1])});


Any help greatly appreciated - JD


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


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

Date: 20 Oct 1999 19:38:23 GMT
From: justarious@hotmail.com (Gordon)
Subject: Re: Displaying query results in a table format
Message-Id: <36453.52457256CBC2justooltries@4.22.39.85>

jdkronicz@my-deja.com wrote in <7ul3st$jf7$1@nnrp1.deja.com>:

>Hi I am trying to create a CGI to an Access 
>Database.  I want to be able to 
>display the results of the Select in a 
>HTML table but I am having trouble. 
>The following lines of code illustrate 
>what I am trying to do.     The select
>statement returns two fields from the table.  
>Could someone tell me what I
>need to do differently?
>
>....dbi stuff up here.......... use CGI; 
>$q=new CGI; print start_html; print
>$q->table({-border}, where(@row=fetchrow_array)
>{$q->TR($q->td($row[0],
>$row[1])});
>

I'm sure there is a better way, but perhaps something
like this might help you if you are using DBI:

$sth = $your_database_handle->prepare($your_query) || die DBI->errstr;
print "<tr><td>$row[0]</td><td>$row[1]</td></tr>" 
  while (@row = $sth->fetchrow_array);


hope this helps
-- Gordon --


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

Date: 20 Oct 1999 19:43:43 GMT
From: justarious@hotmail.com (Gordon)
Subject: Re: Displaying query results in a table format
Message-Id: <36453.52828635CD3Cjustooltries@4.22.39.85>

jdkronicz@my-deja.com wrote in <7ul3st$jf7$1@nnrp1.deja.com>:

>Hi I am trying to create a CGI to an Access 
>Database.  I want to be able to 
>display the results of the Select in a 
>HTML table but I am having trouble. 
>The following lines of code illustrate 
>what I am trying to do.     The select
>statement returns two fields from the table.  
>Could someone tell me what I
>need to do differently?
>
>....dbi stuff up here.......... use CGI; 
>$q=new CGI; print start_html; print
>$q->table({-border}, where(@row=fetchrow_array)
>{$q->TR($q->td($row[0],
>$row[1])});
>

I'm sure there is a better way, but perhaps something
like this might help you if you are using DBI:

$sth = $your_database_handle->prepare($your_query) || die DBI->errstr;
print "<tr><td>$row[0]</td><td>$row[1]</td></tr>" 
  while (@row = $sth->fetchrow_array);

perhaps take a look at perldoc DBI

hope this helps

-- Gordon --


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

Date: 20 Oct 1999 19:46:20 GMT
From: justarious@hotmail.com (Gordon)
Subject: Re: Displaying query results in a table format
Message-Id: <36453.53009810B5F8justooltries@4.22.39.85>

jdkronicz@my-deja.com wrote in <7ul3st$jf7$1@nnrp1.deja.com>:

>Hi I am trying to create a CGI to an Access 
>Database.  I want to be able to 
>display the results of the Select in a 
>HTML table but I am having trouble. 
>The following lines of code illustrate 
>what I am trying to do.     The select
>statement returns two fields from the table.  
>Could someone tell me what I
>need to do differently?
>
>....dbi stuff up here.......... use CGI; 
>$q=new CGI; print start_html; print
>$q->table({-border}, where(@row=fetchrow_array)
>{$q->TR($q->td($row[0],
>$row[1])});
>

I'm sure there is a better way, but perhaps something
like this might help you if you are using DBI:

$sth = $your_database_handle->prepare($your_query) || die DBI->errstr;
print "<tr><td>$row[0]</td><td>$row[1]</td></tr>" 
  while (@row = $sth->fetchrow_array);

perhaps take a look at perldoc DBI

hope this helps

-- Gordon --


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

Date: Wed, 20 Oct 1999 13:34:11 -0700
From: tgy@chocobo.org (Neko)
Subject: Re: Exact pattern match
Message-Id: <9CMOODcUxgfYGy8SY1y3f+o8ju7T@4ax.com>

On Wed, 20 Oct 1999 11:02:59 -0700, Larry Rosler <lr@hpl.hp.com> wrote:

>I know that conventional wisdom says that 'eq' is faster than a regex 
>match.  Perhaps someone can explain away this benchmark, which compares 
>two string case-independently for complete match, late mismatch, and 
>immediate mismatch.

[snippage]

>timethese(1 << (shift || 0), {
>	eq0      => sub { my $r = lc($x) eq lc($x) },
>	eq1      => sub { my $r = lc($x) eq lc($y) },
>	eq2      => sub { my $r = lc($x) eq lc($z) },
>	regex0   => sub { my $r = $x =~ /^\Q$x\E$/io },
>	regex1   => sub { my $r = $x =~ /^\Q$y\E$/io },
>	regex2   => sub { my $r = $x =~ /^\Q$z\E$/io },
>});

The problem with the benchmark is that you have included a /o modifier with
your RE matches.  So while each 'eq' ends up doing two lc(), each 'regex'
will essentially do only one.  These are the numbers I get after removing /o
from the picture:

Benchmark: timing 200000 iterations of eq0, eq1, eq2, regex0, regex1,
regex2...
       eq0:  2 wallclock secs ( 1.70 usr +  0.00 sys =  1.70 CPU)
       eq1:  2 wallclock secs ( 1.71 usr +  0.00 sys =  1.71 CPU)
       eq2:  1 wallclock secs ( 1.60 usr +  0.00 sys =  1.60 CPU)
    regex0:  3 wallclock secs ( 2.63 usr +  0.00 sys =  2.63 CPU)
    regex1:  3 wallclock secs ( 2.70 usr +  0.00 sys =  2.70 CPU)
    regex2:  3 wallclock secs ( 2.30 usr +  0.00 sys =  2.30 CPU)

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


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

Date: Wed, 20 Oct 1999 16:36:39 -0400
From: Elaine -HFB- Ashton <elaine@chaos.wustl.edu>
Subject: Re: HELP: Perl CGI for network monitoring
Message-Id: <380E27B6.290252EE@chaos.wustl.edu>

[courtesy cc mailed to original poster]
Kragen Sitaker wrote:
> Dean Tran  <deantran@cup.hp.com> wrote:
> >Any pointer to where I can get something that might loosely fit my
> >need above so that I don't need to re-invent the wheel?
> 
> This is the wrong place to ask; this newsgroup is for programming Perl.

But, he was asking for something written in Perl that involves network
monitoring right? Such a something exists; mon.
http://www.kernel.org/software/mon/ and it even includes a cgi doo-dad
for monitoring status from the web. It's free, written in Perl, and is
extensible with Perl. 

e.


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

Date: 20 Oct 1999 20:09:32 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: How to get file size?
Message-Id: <7ul7hs$af6$1@gellyfish.btinternet.com>

On Wed, 20 Oct 1999 19:27:53 +0100 Acacia wrote:
> sorry about the repost, but i typed something wrong in the one im replying
> to...
> 
> 
> $temp = 'bigfile.zip';
> 
> is supposed to be...
> 
> $temp = 'http://www.domain.com/files/misc/strange/bigfile.zip';
> 
> anyway, u get my point...
> 

Except I wouldnt recommend doing that except in the most tightly controlled
case ...

You could use the module URI::URL to split the URL up into its constituent
parts and then take the resource path from that - or you could use a
regular expression :

($temp ) = ($temp =~ m#^http://[^/]+/(.+?)\s*$#);

But of course this very much depends on whether there is a direct mapping
between the URLs resource path and the actual path to the storage object ...

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: 20 Oct 1999 19:40:38 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: How to get file size?
Message-Id: <7ul5rm$ae1$1@gellyfish.btinternet.com>

On Wed, 20 Oct 1999 16:11:18 GMT Vincent Murphy wrote:
> 
> To think, I could have a pro!!!  :-)
> 

Instead you got a one way ticket to Palookaville ;-}

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: Wed, 20 Oct 1999 14:43:57 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: How to use cperl-mode in emacs
Message-Id: <x3ypuy9j2j7.fsf@tigre.matrox.com>


Lin Yong <p146046183@ntu.edu.sg> writes:

> I use emacs to write my perl program in Linux.  I found there is a
> cperl-mode.el package for Perl in emacs.  But, I don't know how to use
> it and how to setup it in .emacs.  Can anyone help me?  Thanks a lot.

I believe the cperl-mode.el file contains a lot of documentation as
comments inside it. Have a look at it. But, to get you going, add the
following to your .emacs file:

(autoload 'perl-mode "cperl-mode" "alternate mode for editing Perl programs" t)
(setq auto-mode-alist
      (append '(("\\.\\([pP][Llm]\\|al\\)$" . perl-mode))  auto-mode-alist ))


This should get you going.

HTH,
--Ala



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

Date: Wed, 20 Oct 1999 19:45:59 GMT
From: Scratchie <AgitatorsBand@yahoo.com>
Subject: Re: Ignore the idiots
Message-Id: <XZoP3.757$LR3.132822@news.shore.net>

Greg Snow <snow@statsci.com> wrote:
:>This is comp.lang.perl.misc right? Maybe there should be a
:>comp.lang.perl.peoplewhoknowitallalready so that us newbies don't feel
:>like we're encroaching on the elitists' turf.

: This has been suggested before, but think about it for a minute, if there
: were a newbies group and an experts group and you had a question that you
: thought was important, would you go to the newbies group where the only
: people who would answer the question might know less than you

That's not a valid assumption. There might be experts, or people of
moderate knowledge, who don't find it morally repellant to answer newbies'
stupid questions. Therefore, it is not logical to assume that there will
only be newbies on the newbie group.

OTOH, there are probably a lot of newbie questions ("Why am I getting a
server error when I run my CGI script?") that *could* be answered
accurately by newbies or recent newbies.

In either case, there might be plenty of value in the newbies' group.

--Art

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


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

Date: 20 Oct 1999 20:04:41 GMT
From: lt lindley <ltl@rgsun5.viasystems.com>
Subject: Re: Importing symbols and memory usage - Apahce::Registry
Message-Id: <7ul78p$ar$1@rguxd.viasystems.com>

Bill Moseley <moseley@best.com> wrote:
:>Right, but does that mean other Apahce::Registry programs running in 
:>that same child process would have their STDERR sent to my log file?  Or 
:>am I confused about this point.  I thought that a server process could 
:>be running a number of Apache::Registry programs -- each just a 
:>different subroutine.  If that's the case it would seem as if changing 
:>STDERR could change it for all the 'programs' running in that server 
:>child process.  Just like changing $/ without local() would change $/ 
:>for the entire server process during its life.

Ah.  You seem to have a point, but note that I have not done this
myself and so can only surmise what will happen from reading the
Apache::Registry documentation same as you.  I haven't looked deeply
at the FAQ for Apache::Registry.  This topic may well be covered
there.  You have already pointed out another example of a global
symbol that demonstrates the same problem.  The only additional 
burden of STDERR is that you don't want to close the underlying
file descriptor either.

You can get around the problem though using a trick that we discussed
last week.  

local *MYERR;
open MYERR, ">>some_file" or die " whatever: $!";
local *STDERR = *MYERR;

File descriptor 2 is still going to the apache log.  STDERR for other
perl programs in the same thread still go to the apache log.  But now
your perl script writes STDERR to your file instead.  Beware though
that any programs you fork still inherit File descriptor 2 as the
apache log (which may be what you want anyway).

-- 
// 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: Wed, 20 Oct 1999 13:51:08 -0600
From: "Jeremiah Stanley" <miah@idcomm.com>
Subject: in need of example...
Message-Id: <380e0a61@mindmeld.idcomm.com>

Newbie here.

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! :)

Any help will be appreciated.

Jeremiah Stanley
--
"Perfection (in design) is achieved not when there is nothing more to add,
but rather when there is nothing more to take away."
-Antoine de Saint-Exupery


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

Date: 20 Oct 1999 20:35:06 GMT
From: Erik van Roode <newsposter@cthulhu.demon.nl>
Subject: Re: in need of example...
Message-Id: <7ul91q$3td$2@internal-news.uu.net>

Jeremiah Stanley <miah@idcomm.com> wrote:
> Newbie here.

Thanks for the warning ;)

> 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.

Erik



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

Date: Wed, 20 Oct 1999 16:29:43 -0400
From: Elaine -HFB- Ashton <elaine@chaos.wustl.edu>
Subject: Re: IP address
Message-Id: <380E2615.31DB57AC@chaos.wustl.edu>

hakanogren@my-deja.com wrote:
> I would like to know how I can get the IP number from the machine where
> the script is running.

'perldoc -f gethostbyaddr'

e.


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

Date: 20 Oct 1999 20:13:33 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: IP address
Message-Id: <7ul7pd$afd$1@gellyfish.btinternet.com>

On Wed, 20 Oct 1999 10:09:08 -0700 Larry Rosler wrote:
> In article <7ukoid$bgs$1@nnrp1.deja.com> on Wed, 20 Oct 1999 15:53:55 
> GMT, hakanogren@my-deja.com <hakanogren@my-deja.com> says...
>> I would like to know how I can get the IP number from the machine where
>> the script is running.
> 
> I assume you mean that the program is being run by a server.
> 
> Dump the list of environment variables.  Some servers set 
> $ENV{LOCAL_ADDR} as an IP address.  Most servers set $ENV{SERVER_NAME} 
> as a domain name, which you can resolve using gethostbyname().
> 
> As a last resort, many systems have a `hostname` command, whose results 
> you can resolve also.
> 

Larry, Larry, Larry :

perlfaq9:

 =head2 How do I find out my hostname/domainname/IP address?

Back to the Old Grouch School for you matey ;-}

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: 20 Oct 1999 19:54:21 GMT
From: pete@theory2.phys.cwru.edu (Peter J. Kernan)
Subject: Re: Matching an asterisk
Message-Id: <slrn80s7fd.di2.pete@theory2.phys.cwru.edu>

On 19 Oct 1999 22:44:11 -0500, Abigail <abigail@delanet.com> wrote:
 .=Brett W. McCoy (bmccoy@foiservices.com) wrote on MMCCXLI September
 .=--
 .=-- text =~ /.*\*$/;
 .=

the verbosity seems like the only problem

 .=That's going to fail on "foo\nbar*" (false negative).
 .=
 .=It's also going to fail on "foo*\n" (false positive).
 .=

i dont see either failure for 5.005_02 

for ('foo\nbar*','foo*\n') {
   print "$_: ",m/.*\*$/,"\n";
};


prints

foo\nbar*: 1
foo*\n: 

-- 
  Pete


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

Date: Wed, 20 Oct 1999 19:10:04 GMT
From: rbansal@zip2.com
Subject: ODBC extension for core distribution of Win32 Perl
Message-Id: <7ul420$jgp$1@nnrp1.deja.com>

I performed the following installation steps:

HOW TO INSTALL:

  - IF you are using the core distribution of Win32 Perl:
        a) Copy the ODBC.PM file into the directory perl\lib\site\win32\
        b) Rename the file ODBC_CORE.DLL to ODBC.DLL
        c) Make a directory: perl\lib\site\auto\win32\odbc\
        d) Copy the ODBC.DLL file into the directory in step c

When I run test.pl

A window pops up with the following message
"The procedure entry point Perl_sv_undef could not be located in the
dynamic link library Perl.dll"
And the following message appears on the cmd screen.

D:\perl\bin\MSWin32-x86>d:\perl\bin\mswin32-x86\perl.exe
d:\win32odbc\test.pl
Can't load 'd:\perl\site\lib/auto/Win32/ODBC/ODBC.dll' for module
Win32::ODBC: load_file:The specified procedure could not be found at
d:\perl\lib/MSWin32-x86/DynaLoader.pm line 169.

 at d:\win32odbc\test.pl line 39
BEGIN failed--compilation aborted at d:\win32odbc\test.pl line 39.

test.pl and DynaLoader.pm are part of the Win32_ODBC_Build_Core

line 39 of test.pl is Use win32::ODBC;

Can someone help me..

Thank you




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


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

Date: Wed, 20 Oct 1999 21:24:18 +0100
From: "Patrick Williamson" <netsoft@freenetname.co.uk>
Subject: Perl for Epoc ?
Message-Id: <7ul8gm$qdj$1@gxsn.com>

Is anyone aware of the existance of Perl for the Psion 5/Psion 5mx ? I need
to learn to Perl on the long journeys to and from work but, at this rate,
may have to lose a fantastic machine with a great op-system (although not
when compared to Unix), to a cack machine with an even worse op-system Wince
any/everyone ?

Thanks for reading this far :-)

music music music

Patrick




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

Date: 20 Oct 1999 20:14:00 +0200
From: kaih=7REvFz3Xw-B@khms.westfalen.de (Kai Henningsen)
Subject: Re: Perl lite
Message-Id: <7REvFz3Xw-B@khms.westfalen.de>

mgjv@wobbie.heliotrope.home (Martien Verbruggen)  wrote on 13.10.99 in <slrn808qoi.a18.mgjv@wobbie.heliotrope.home>:

> Nono.. I think Ilya might be right, for some modern OSes. I wanted to
> go off and have a look at the sources for Linux and OpenBSD to see
> what they do (I expect Linux doesn't, and OpenBSD does have awareness
> of this), but I don't have the time, so I'll take Ilya's word for it
> :).

Linux has been doing this right for years. What was sometimes unsharable  
were some *dynamic libraries*, because they needed relocations none at  
runtime (and thus were copied by the trusty old copy-on-write logic that  
otherwise kept unique copies).

> > Think swapping.

Think ancient. *Really* ancient.

> I wouldn't want to write that sort of memory management though. A
> shared library makes it a lot easier :)

Actually, given that you need copy-on-write for fork() anyway, it's free.  
The stuff that means work is code to page in executables (and shared  
libraries) from the file system.

Well, you get _that_ when you write mmap(), but getting the performance  
right in the executable case turns out to be nontrivial.




There's *one* good reason for dynamic linking: it reduces executable size.  
That is meaningful when you have lots of executables using the same  
library - libc is a prime example, or the X libraries.

So, when you have a dozen different applications using libperl (perl, INN,  
whatever), there's obviously an advantage to dynamic linking.

Kai
--
http://www.westfalen.de/private/khms/
"... by God I *KNOW* what this network is for, and you can't have it."
  - Russ Allbery (rra@stanford.edu)


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

Date: Wed, 20 Oct 1999 15:09:42 -0500
From: "TJ Nelson" <tjnelson@iastate.edu>
Subject: Permissions calculating user space on NT
Message-Id: <7ul7i9$1v2$1@news.iastate.edu>

Hi.

I want to monitor space usage for home directories.  I have a small script
which calculates the size of each file in a directory using the readdir
and -s commands.

Only the owner of the directory has full control permissions.

Is there a way I can go through each user's directory without having to take
ownership or change permissions on those directories to obtain file sizes?

Thanks!




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

Date: 20 Oct 1999 20:45:42 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Searching
Message-Id: <7ul9lm$afl$1@gellyfish.btinternet.com>

On Tue, 19 Oct 1999 16:54:44 -0400 Corey Martin wrote:
> I'm using the following code to request a page from eBay:
> 
<snip my original example>
> 
> I want to search the resulting page for prices (something like $*) and copy
> the first one I find in to a variable.  Is this as hard as I think?  What
> code would I use?  I'd really appreciate any advice you could give me.
> 

I think that perhaps you might have been better off following up in the
original thread ...

You will want to read the perlre manpage to found at how to frame a 
pattern that will match a currency string - you will need to read the
perlop manpage in order to find out how to use it ...

> Thank You
>

No worries
 
> --

If you place an extra space after those two dashes then newsreaders can
deal appropriately with the signature ...

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

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


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