[16113] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3525 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jun 30 14:10:33 2000

Date: Fri, 30 Jun 2000 11:10:20 -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: <962388620-v9-i3525@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Fri, 30 Jun 2000     Volume: 9 Number: 3525

Today's topics:
        How to create tables - comparing bet. paragraphs? (Seemadesar)
    Re: How to open another browser in Perl? <tony_curtis32@yahoo.com>
        Include Files <news@chrismo.com>
    Re: Keeping track of open files (Tad McClellan)
    Re: Looking for the comp.lang.perl.misc FAQ (Tad McClellan)
    Re: Net::FTP not on CPAN <gerard@NOSPAMlanois.com>
        perl 5.6.0 install problem ceverett@ceverett.com
        ppm: no element found at line 1810.... <renenyffenegger@my-deja.com>
    Re: Q: What happens if a 'path' had a space in it? <Allan@due.net>
    Re: Random number generator <jcook@strobedata.com>
    Re: Random number generator (Andrew Johnson)
        referencing with cgi jinrai@my-deja.com
    Re: referencing with cgi <tony_curtis32@yahoo.com>
        Return an array of hashes from C++? <jfavazza@mediaone.net>
    Re: shouldn't sort return a list? tmorset@tus.ssi1.com
        StarOffice (StarCalc) in Perl <arifsaha@yahoo.com>
    Re: Still stuck: "converting rel. HTML paths into abs.  (Randal L. Schwartz)
    Re: Strange behaviour in upper case conversion (Tad McClellan)
    Re: Strange behaviour in upper case conversion (Tad McClellan)
        Use of uninitialized value <remove.this.talexb@tabsoft.on.ca>
    Re: Use of uninitialized value <nospam@forget.it>
    Re: Use of uninitialized value <remove.this.talexb@tabsoft.on.ca>
        Windows paths for PERL's 'glob' command manchester_united@my-deja.com
    Re: Windows paths for PERL's 'glob' command <nospam@forget.it>
    Re: WWWBoard: Internal Server Error brianthecoder@my-deja.com
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 30 Jun 2000 17:26:34 GMT
From: seemadesar@aol.com (Seemadesar)
Subject: How to create tables - comparing bet. paragraphs?
Message-Id: <20000630132634.02732.00001310@ng-cg1.aol.com>

My keywords code just the 10 most frequent words (ie TOTAL) from the entire
document. 

The following code finds the 
5 most freq. words per parah and 10 most freq. words in the entire document. 
So how can I do I modify the code above so it does the same statistics for the 
Per Paragraph statitics ( 3 tables each paragraph) and 
The Total Statistics(3 Tables). 

Here's the code: 

#########################Routine to count the words per Parah and total 

 open IN,"<./tmp/fileParse.txt" or die "can't open fileParse.txt:$ 
!"; 
               open OUT,">./tmp/fileKeys.txt" or die "can't open
fileKeys.txt:$! 
"; 
               {local $/=''; 
                  while( <IN> ){ 
                     %wc = (); 
                     while( /(\w['\w-]*)/g ){ 
                         $seen{lc $1}++; 
                         $wc{lc $1}++; 
                     } 
                     print OUT "paragraph $.\n"; 
                     for( (sort {$wc{$b} <=> $wc{$a} } keys %wc)[0..4] ){ 
                         print OUT "$_ : $wc{$_}\n"; 
                     } 
                  } 
               } 
               print OUT "total\n"; 
               for( (sort {$seen{$b} <=> $seen{$a} } keys %seen)[0..9] ){ 
                  printf OUT "%5d %s\n", $seen{$_}, $_; 
               } 

here's the code 
and it works well!!

$ cat cnt_words.pl 
#!/usr/local/bin/perl 
# file name cnt_words.pl 

# @a=split /,/, "are,end,text,work,for,with,game,count,pattern,number"; 
# you can open your first file to get the content into @a 

# $fn1 = "cnt_keys.txt"; 
# $fn2 = "cnt_words.txt"; 
 $fn1 = "cnt_fn1.txt"; 
 $fn2 = "cnt_fn2.txt"; 
$fn3 = "cnt_out.txt"; 
$fn4 = "cnt_out2.txt"; 
open FILE, "<$fn1" or die "$!\n"; 
while (<FILE>) { 
  chomp; 
  next if (!$_); 
  s/ //; 
  push @a, $_; 
} 
close FILE; 

open WD, "<$fn2" or die "$!\n"; 
@b = <WD>; 
close WD; 

$p = 1;    # paragram counter 
%R =(); %R1=(); 
@PR=(); 
my $lastline=""; 
foreach $i (@b) {    # loop through each line 
    foreach $j (@a) {    
        if ($i =~  /$j\w*/) { ++$R{$j}[$p]; ++$R1{$j}{'tot'}; 
           my $rest_of_line = $';   # $POSTMATCH 
           while ($rest_of_line) { 
               # print "$`:$&:$':$rest_of_line\n"; 
               if ($rest_of_line =~ /$j\w*/) { 
                   ++$R{$j}[$p]; ++$R1{$j}{'tot'}; 
               } else { last; } 
               $rest_of_line = $';   # $POSTMATCH 
           } 
        } else { $R{$j}[$p] += 0; } 
    } 
    if ($i =~ /^\n$/ && $lastline !~ /^\n$/ ) { ++$p; } 
    $lastline=$i; 
    next if ($i =~ /^\n$/); 
    $PR[$p] .= $i; 
} 

for $i (sort keys %R) { 
    $t = ""; 
    my $max = 0; 
    my $min = 9999999; 
    for $j (1..$#{$R{$i}}) { $t .= " $R{$i}[$j]"; 
        if ($max < $R{$i}[$j]) { $max = $R{$i}[$j]; } 
        if ($min > $R{$i}[$j]) { $min = $R{$i}[$j]; } 
    } 
    $t .= ": $R1{$i}{'tot'}"; 
    $R1{$i}{'max'} = $max; $R1{$i}{'min'} = $min; 
    printf "%10s %-30s\n", $i, $t; 
} 

open OUT, ">$fn3" or die "could not write to $fn3:$!\n"; 
for $i (sort keys %R) { 
    $t = ""; 
    for $j (1..$#{$R{$i}}) { $t .= " $R{$i}[$j]"; } 
    printf OUT "%10s %-30s\n", $i, $t; 
} 
close OUT; 


$t = "           "; 
for $j (1..$#{$R{$a[1]}}) { $t .= sprintf " P%02d", $j; } 
$t .= " Tot Max Min"; 
print "$t\n"; 

for $i (sort keys %R) { 
    $t = ""; 
    for $j (1..$#{$R{$i}}) { $t .= sprintf " %3d", $R{$i}[$j]; } 
    $t .= sprintf " %3d %3d %3d", $R1{$i}{'tot'}, $R1{$i}{'max'}, 
        $R1{$i}{'min'}; 
    printf "%10s %-30s\n", $i, $t; 
} 

open OUT, ">$fn4" or die "could not write to $fn3:$!\n"; 
$t = "           "; 
for $j (1..$#{$R{$i}}) { $t .= sprintf " P%02d", $j; } 
print OUT "$t\n"; 

for $i (sort keys %R) { 
    $t = ""; 
    for $j (1..$#{$R{$i}}) { $t .= sprintf " %3d", $R{$i}[$j]; } 
    printf OUT "%10s %-30s\n", $i, $t; 
} 
close OUT; 


# for the new questions 
# 
%R2=(); 
for $i (sort keys %R) {    # loop through each word 
    for $j (1..$#{$R{$i}}) { 
        next if ($R{$i}[$j]<1); 
        if ($R{$i}[$j]>=1 && !defined($R2{$i})) { $R2{$i}="$j"; next; } 
        if ($R{$i}[$j]>2) { $R2{$i} .= " $j"; } # you can change it to n 
    } 
} 
print "\n"; 
for $i (sort keys %R2) { 
    $t = ""; 
    for $j (1..$#{$R{$i}}) { $t .= sprintf " %3d", $R{$i}[$j]; } 
    $t .= ": $R2{$i}"; 
    printf "%10s %-30s\n", $i, $t; 
} 

for $i (sort keys %R2) { 
    next if ((split / /, $R2{$i}) < 2); 
    print "Paragraphs meets the creteria for key word \"$i\" ($R2{$i}):\n\n"; 
    foreach $j (split / /, $R2{$i}) { 
        print "<<Paragraph $j>>\n$PR[$j]\n"; 
    } 
} 

# for crossing counts 
my @P=(); my @kw=(); 
# get a list of key words 
for $i (sort keys %R) { 
    push @kw, $i if $i; 
} 
# print join ":", @kw; 
# print "\n"; 
# print "Key words: @kw:$kw[0]:$#{$R{$kw[0]}}\n"; 

for $i (1..$#{$R{$kw[0]}}) {    # loop through each pragraph 
    for $j (0..$#kw) {          # loop through each key word 
        $k = $kw[$j]; 
        # print "$i:$j:$k:$R{$k}[$i]\n"; 
        # if the word did not appear in this paragraph, 
        # we are not interested in search other paragraph neither. 
        next if ($R{$k}[$i]<1); # skip to next key word 
        for $l (1..$#{$R{$k}}) {   # loop thru each paragraph 
            if ($i==$l) { $P[$i][$l] += $R{$k}[$i]; next; } 
            $P[$i][$l] += $R{$k}[$l]; 
        } 
    } 
} 

$t ="\nThe crossing counts\n    "; 
for $i (1..$#P) { $t .= sprintf " P%02d",$i; } 
print "$t\n"; 
for $i (1..$#P) { 
    $t = sprintf "P%02d ",$i; 
    for $j (1..$#{$P[$i]}) { $t .= sprintf " %3d", $P[$i][$j]; } 
    print "$t\n"; 
} 

$ ./cnt_words.pl 
 available  2 0 0: 2                       
    expert  1 2 2: 5                       
  intellig  2 3 3: 8                       
     total  0 1 0: 1                       
            P01 P02 P03 Tot Max Min 
 available    2   0   0   2   2   0        
    expert    1   2   2   5   2   1        
  intellig    2   3   3   8   3   2        
     total    0   1   0   1   1   0        

 available    2   0   0: 1                 
    expert    1   2   2: 1                 
  intellig    2   3   3: 1 2 3             
     total    0   1   0: 2                 
Paragraphs meets the creteria for key word "intellig" (1 2 3): 

<<Paragraph 1>> 
Is a text document that has all those words in different paragraphs 
that contain the word expert is available.  He / or she may be 
available to open the lab for testing the server. This program can 
find the key words based on their stem such as intellig for 
intelligent. 

<<Paragraph 2>> 
Then the second paragraph contains the word experts and intelligently 
and totality and availability.  They intelligently go through the site 
of personal interest and extract the keywords and the expertise. This 
is very intelligent. 

<<Paragraph 3>> 
intelligent intelligently intelligency expert expertise 


The crossing counts 
     P01 P02 P03 
P01    5   5   5 
P02    3   6   5 
P03    3   5   5 


Hope to hear from you soon!!


$ cat cnt_word2.pl 
#!/usr/local/bin/perl 
# file name cnt_words.pl 

# @a=split /,/, "are,end,text,work,for,with,game,count,pattern,number"; 
# you can open your first file to get the content into @a 

# $fn1 = "cnt_keys.txt"; 
# $fn2 = "cnt_words.txt"; 
 $fn1 = "cnt_fn1.txt"; 
 $fn2 = "cnt_fn2.txt"; 
$fn3 = "cnt_out.txt"; 
$fn4 = "cnt_out2.txt"; 
open FILE, "<$fn1" or die "$!\n"; 
while (<FILE>) { 
  chomp; 
  next if (!$_); 
  s/ //; 
  push @a, $_; 
} 
close FILE; 

open WD, "<$fn2" or die "$!\n"; 
@b = <WD>; 
close WD; 

$p = 1;    # paragram counter 
%R =(); %R1=(); 
@PR=(); 
@FP=(); %F=(); 
my $lastline=""; 
foreach $i (@b) {    # loop through each line 
    @a=split /[\s,.!]/, $i; 
    foreach $j (@a) {   
        $j =~ s/["'`\/]//g; 
        next if (!$j); 
        ++$F{$j}; ++$FP[$p]{$j}; 
    } 
    if ($i =~ /^\n$/ && $lastline !~ /^\n$/ ) { ++$p; } 
    $lastline=$i; 
    next if ($i =~ /^\n$/); 
    $PR[$p] .= $i; 
} 

@RST=(); 
$j=0; $r =""; 
for $k (sort byfreq1 keys %F) { 
    ++$j; last if $j > 10; 
    $r .= "$k($F{$k}) "; 
    # print "$k=$F{$k}\n"; 
} 
push @RST, $r; 

# print "-" x 55 . "\n"; 

for $p (1..$#FP) { 
    $r=""; $j=0; 
    foreach $k (sort byfreq2 keys %{$FP[$p]}) { 
        ++$j; last if ($j > 5); 
        $r .= "$k($FP[$p]{$k}) "; 
        # print "$k=$p:$FP[$p]{$k}\n"; 
    } 
    push @RST, $r; 
} 

for $p (0..$#RST) { 
    print "$p: $RST[$p]\n"; 
} 

sub byfreq1 { $F{$b} <=> $F{$a}; } 

sub byfreq2 { $FP[$p]{$b} <=> $FP[$p]{$a}; } 


$ ./cnt_word2.pl 
0: the(9) and(5) intelligent(3) intelligently(3) available(2) expertise(2)
word(2) that(2) for(2) words(2) 
1: the(4) words(2) that(2) available(2) for(2) 
2: the(5) and(5) intelligently(2) through(1) personal(1) 
3: expert(1) expertise(1) intelligently(1) intelligency(1) intelligent(1) 


PS- hope to hear from someone soon..
email - seema_desar@hotmail.com 

Thanks in advance!


 



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

Date: 30 Jun 2000 11:08:59 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: How to open another browser in Perl?
Message-Id: <87k8f7m9r8.fsf@limey.hpcc.uh.edu>

>> On Fri, 30 Jun 2000 16:03:06 +0200,
>> "Robert Voesten" <robert@pharmapartners.nl> said:

> DOOOOOOOOOOOH This is a very easy one

> This is an <a href="some URL" target="_blank">example
> link</a>

And how would this work with lynx, or a speech
synthesizer?

Server-side cannot force client-side behaviour.

Off-topic for clpm anyway.

hth
t
-- 
"With $10,000, we'd be millionaires!"
                                           Homer Simpson


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

Date: Fri, 30 Jun 2000 19:04:17 +0100
From: "Chris Moreton" <news@chrismo.com>
Subject: Include Files
Message-Id: <8jinhs$64c$1@lure.pipex.net>

Hi,

Is there a way to include text from another file in a perl script?  For
example, a list of constants that are common to several scripts or some
initiation code which is common?  And functions.

Thanks,
Chris




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

Date: Fri, 30 Jun 2000 11:22:01 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Keeping track of open files
Message-Id: <slrn8lpeop.696.tadmc@magna.metronet.com>

On 30 Jun 2000 01:17:26 EDT, Abigail <abigail@delanet.com> wrote:
>Peter Sundstrom (peter.sundstrom@eds.com) wrote on MMCDXCV September
>MCMXCIII in <URL:news:8jgv76$e2h$1@hermes.nz.eds.com>:
>:} 
>:} Abigail wrote in message ...
>:} >
>:} >I would use IO::File by subclassing it, and then strictly use that
>:} >subclass to open and access files.
>:} 
>:} I'm not sure what you mean.  Are you able to supply a code sample?
>
>
>What part of what I said aren't you sure about?


I'll go ahead and take a guess.

The OP needs to "intercept" file opens so that he can "log"
them somehow.

Abigail suggests that you subclass IO::File (providing
some method for opening files) and then always use
the new (or overridden) method for file opens.

You can then insert the "logging" code in the new method.



OP: If you mean that you don't know how to subclass objects,
    then there are standard docs that explain it:

      perldoc perlboot
      perldoc perltoot
      perldoc perltootc
      perldoc perlobj


-- 
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Fri, 30 Jun 2000 11:41:23 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Looking for the comp.lang.perl.misc FAQ
Message-Id: <slrn8lpft3.696.tadmc@magna.metronet.com>

On Fri, 30 Jun 2000 01:53:22 -0500, Jim Kauzlarich <o1technospam@skyenet.nospam.net> wrote:

>Ok, I'm sure I'm going to displease SOMEONE here, but I've looked on
>deja.com CPAN, www.perlfaq.com www.perl.com language.per.com and a few
>others I can't recall, 


Asking for clue better not displease anyone.

Post their displeasure here so we can scorn them  :-)


>but I still can't find the FAQ for this newsgroup.


I don't think there is one.


>I'm not looking for the Perl FAQ, but the rules and etiqute for this
>newsgroup.


The rules of netiquette are generally applicable to nearly all
Big 8 newsgroups, so there is not a specific set of netiquette 
rules for this particular newsgroup.


Seeing the regular postings on

   news.announce.newusers

ought to be enough.


-- 
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Fri, 30 Jun 2000 10:38:09 -0700
From: Gerard Lanois <gerard@NOSPAMlanois.com>
Subject: Re: Net::FTP not on CPAN
Message-Id: <395CDB01.BD8910ED@NOSPAMlanois.com>



Elaine Ashton, graduate of the Wired Magazine School of Web Design, wrote:
> Hmmm. What part of
> http://search.cpan.org/search?mode=module&query=Net%3A%3AFtp
> is easy to miss? 

The hyperlinks on this page are rendered in multiple nonstandard colors.
Yes, colors (plural).  Some links are #005555, some are #ffffff.

It's particularly confusing that the *one* link you need to click on 
(libnet) is rendered in white and is buried in the table header for 
the query result.  Except for the underlining, it is not obvious at 
all that this is a hyperlink, since this link is rendered in the same 
color (white) as all the other text in the table header.  It simply 
doesn't stand out as much as it needs to.

> What were you expecting and what about the result from
> above was misleading? 

I was expecting that word "download" would appear somewhere during
this interchange.  It's not necessarily practical for it to appear
on the query results page, but you could improve the libnet page

     http://search.cpan.org/search?dist=libnet

by using the word "download" next to or instead of "Latest release".


> The line '6 modules found in 1 distribution matching
> 'Net::Ftp' ' and the highlighting should be giving people a really 
> easy way to find their way, but if it isn't then what would you 
> suggest?

Highlighting?  Do you think rendering the link to the libnet page in
the same color as all the surrounding text in the same box is really
"highlighting"?  Is it "_really_ easy"?

It is nice that the Net::FTP link takes you to the man page, but if
you were looking to download it (as the original poster was) you are
doomed.

It is interesting to note that the Net::FTP man page doesn't mention
that Net::FTP is part of the libnet bundle.  In fact, the man page
doesn't even contain the word "libnet".
 
> e.

-Gerard
print "Just another Net::FTP hacker.\n";
http://www.lanois.com/perl/


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

Date: Fri, 30 Jun 2000 16:54:07 GMT
From: ceverett@ceverett.com
Subject: perl 5.6.0 install problem
Message-Id: <8jijb7$gcc$1@nnrp1.deja.com>

When running a make install on perl 5.6.0, I get an error:

Can't locate Carp/Heavy.pm in @INC (@INC contains: lib) at lib/Carp.pm
line 109

Anyone have a cluestick for me? :)

Everett


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


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

Date: Fri, 30 Jun 2000 16:57:58 GMT
From: Rene Nyffenegger <renenyffenegger@my-deja.com>
Subject: ppm: no element found at line 1810....
Message-Id: <8jijic$ggc$1@nnrp1.deja.com>

Hi

I have downloaded activestate's perl 613 and applied the
'hotfix' provided to fix some ppm problem.

Still, ppm doesn't seem to work.

in the dos prompt, i type ppm.
the ppm shell pops up.
i go
PPM> search dbi

ppm replies:
'no element found at line 1810, column 25, byte 98829 at
C:/Perl/site/lib/SOAP/Parser.pm line 73'

I decide to download the zipfile from acitvestate.com.
I unzip it.
I type:
c:\> ppm --install DBD-Oracle

ppm says:
'no element found at line 1810, column 25, byte 98829 at
C:/Perl/site/lib/SOAP/Pa
rser.pm line 73'

(which is the same message again.)

So, what can I do next?

TIA

Rene



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


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

Date: Fri, 30 Jun 2000 12:03:29 -0400
From: "Allan M. Due" <Allan@due.net>
Subject: Re: Q: What happens if a 'path' had a space in it?
Message-Id: <8jigcg$t99$1@slb3.atl.mindspring.net>


<manchester_united@my-deja.com> wrote in message
news:8jib8h$9na$1@nnrp1.deja.com...
: In article <cxcem5fgt2w.fsf@masterblaster.uio.no>,
:   jacklam@math.uio.no (Peter J. Acklam) wrote:
: > manchester_united@my-deja.com writes:
: > Exactly what code are you using?  Are you using something like
: >    $file = "c:\Program Files\test.txt";
: > If so, it won't work as expected.
:
: Specifically, I'm trying to use the 'glob' command, so, using the above
: $file, try something like:-
:
: @array = glob ($file);
:
: It will not return the files and folders of Program Files, no matter
: what permutations of back-slashes and forward-slashes I've tried.

Are you sure the test.txt is in the Program Files directory?

under 5.6 this works for me

$name = 'c:\progra~1\test.txt';
@array = glob($name);
$"="\n";
print "@array";

but it perl doesn't seem to like long file names in the glob, even though
something like
$name = 'c:\progra~1\*';
@array = glob($name);

reports long file names np.

HTH

AmD
--
$email{'Allan M. Due'} = ' All@n.Due.net ';
--random quote --
'Out, out brief candle!
Life's but a walking shadow,
a poor player, that struts and frets his hour upon the stage,
And then is heard no more; It is a tale, told by an idiot,
full of sound and fury, signifying nothing'
 - MacBeth





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

Date: Fri, 30 Jun 2000 09:26:13 -0700
From: Jim Cook <jcook@strobedata.com>
Subject: Re: Random number generator
Message-Id: <395CCA25.DE1ECC05@strobedata.com>

> > How does Perl choose a random number? Does it use a random seed? Most

> $ perldoc -q random

That mentions math::TrulyRandom. How do I get documentation on that?
I've tried:

perldoc Math::TrulyRandom
perldoc -f Math::TrulyRandom
perldoc -f math::TrulyRandom
perldoc -q Math::TrulyRandom
perldoc -q TrulyRandom
perldoc -f TrulyRandom
perldoc TrulyRandom
perldoc Math::
perldoc math::
perldoc Math
perldoc math

And they all say 
No documentation found for "<my dang thing>".

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


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

Date: Fri, 30 Jun 2000 16:56:39 GMT
From: andrew-johnson@home.com (Andrew Johnson)
Subject: Re: Random number generator
Message-Id: <bj475.2469$k5.49283@news1.rdc1.mb.home.com>

In article <395CCA25.DE1ECC05@strobedata.com>,
 Jim Cook <jcook@strobedata.com> wrote:
> > > How does Perl choose a random number? Does it use a random seed? Most
> 
> > $ perldoc -q random
> 
> That mentions math::TrulyRandom. How do I get documentation on that?
> I've tried:
> 
> perldoc Math::TrulyRandom

You probably don't have that module installed, it doesn't come with
the standard perl distribution -- head over to your nearest CPAN
mirror to download and install it. Or, you can find it using this
search engine and then read the docs online before you decide to
download it:
    
    http://theoryx5.uwinnipeg.ca/CPAN/cpan-search.html

regards,
andrew

-- 
Andrew L. Johnson   http://members.home.net/perl-epwp/
      In theory, there's no difference between
      theory and practice, but in practice there is!


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

Date: Fri, 30 Jun 2000 15:38:17 GMT
From: jinrai@my-deja.com
Subject: referencing with cgi
Message-Id: <8jiet7$cm1$1@nnrp1.deja.com>

Is there a way to retrieve the values of variables in a cgi-script from
another cgi-script?


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


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

Date: 30 Jun 2000 12:48:50 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: referencing with cgi
Message-Id: <87zoo3dpq5.fsf@limey.hpcc.uh.edu>

>> On Fri, 30 Jun 2000 15:38:17 GMT,
>> jinrai@my-deja.com said:

> Is there a way to retrieve the values of variables in a
> cgi-script from another cgi-script?

Yes, if there exists a communication path between the
processes.

I'd go over to comp.infosystems.www.authoring.cgi as your
question is about CGI, and has nothing to do with perl per
se.

hth
t
-- 
"With $10,000, we'd be millionaires!"
                                           Homer Simpson


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

Date: Fri, 30 Jun 2000 17:50:09 GMT
From: "John Favazza" <jfavazza@mediaone.net>
Subject: Return an array of hashes from C++?
Message-Id: <l5575.6599$DJ2.26938@typhoon.ne.mediaone.net>

Hi,
    I am writing my own C++ extension and I need to return an array of
hashes from C++ to Perl.  Is this possible?

Thanks in advance,
John






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

Date: Fri, 30 Jun 2000 15:38:56 GMT
From: tmorset@tus.ssi1.com
Subject: Re: shouldn't sort return a list?
Message-Id: <8jieue$cmk$1@nnrp1.deja.com>

Perl gurus,

> You are missing a good read of the docs :-)
>
>     % perldoc -f keys
>     keys HASH
>             Returns a list consisting of all the keys of the named
>             hash. (In a scalar context, returns the number of keys.)

Well, that makes sense.  I completely overlooked the fact that
using scalar would cause the subroutine to be called in a
scalar context and propagate down.  I was thinking everything
would be called in a list context and then scalar'd at the end.
I can't say anything in my defense.  It was there, I missed
it, sorry about that.

> > I also can't understand why if I try to sort the keys in the
> > subroutine with
> >
> > 	return sort keys %h;
> >
> > I get an 'uninitialized value' error in the print statement.
> > Given what keys %h returned, it seems I should get the same
> > answer of 2 even if I sort the keys.  Any help would be
> > appreciated, thanks.
> >
> >
> > #!/usr/local/bin/perl5 -w
> > print "Scalar of return ", scalar a(), "\n";
> > sub a
> > {
> >     my %h = (5 => 7,
> >              6 => 8,);
> >
> >     return keys %h;
> > }
>
> I can't explain the reason for the uninitialized warning. But, what
> baffles me is why do you want to sort the keys of the hash before
> returning their count?


I was just being lazy, trying to use an existing routine that
returned keys and just couting them with scalar.  One thing
led to another and I just ended up posting a small portion of the
code to show what was confusing me.

Thanks again for all the help.

Tim


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


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

Date: Thu, 29 Jun 2000 15:45:26 -0500
From: S P Arif Sahari Wibowo <arifsaha@yahoo.com>
Subject: StarOffice (StarCalc) in Perl
Message-Id: <Pine.LNX.4.21.0006291544300.8565-100000@ninitowo.civil.columbia.edu>

Hi!

Is there any way to automate staroffice (starcalc module) from perl?

Basically I want perl to get staroffice open a spreadsheet, change some
values in certain cells, and recalculate. Then I would like perl to get
the result from other cells - either directly or from a text file.

Can these be done?

Thank you.

-- 
                                   S P Arif Sahari Wibowo
  _____  _____  _____  _____ 
 /____  /____/ /____/ /____          arifsaha@yahoo.com
_____/ /      /    / _____/       http://www.arifsaha.com/


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

Date: 30 Jun 2000 09:17:32 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Still stuck: "converting rel. HTML paths into abs. paths
Message-Id: <m1k8f7jg83.fsf@halfdome.holdit.com>


[comp.lang.perl doesn't exist.  stop trying to post to it]

>>>>> "Jan" == Jan Bessels <j.bessels@quicknet.nl> writes:

Jan> I'm starting to feel very silly but for the live of me I can't figure
Jan> out how to get a $parsed_html which is the same as $html but with all
Jan> relative paths changed into absolute paths. Its probably very simple,
Jan> but I just don't see it.............. Any hints/tips/snippets of code
Jan> are VERY much appreciated. My boss starts breathing down my neck ;-(

It should be fairly trivial to adapt the core of the code from

        http://www.stonehenge.com/merlyn/WebTechniques/col22.html

to do that rather directly.  The current code uses HTML::Filger to
make URLs pointing "inside" the tree to be relative, and "outside" the
tree to be absolute, but all you'd need to do is fix that test so it
always comes back absolute.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: Fri, 30 Jun 2000 11:15:02 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Strange behaviour in upper case conversion
Message-Id: <slrn8lpebm.696.tadmc@magna.metronet.com>

On Fri, 30 Jun 2000 10:53:53 GMT, Philip Lees <pjlees@ics.forthcomingevents.gr> wrote:
>Thanks to all who responded. I have a clearer idea now of what I was
>doing wrong.
>
>Thanks particularly for the pointer to perllocale, which I had
>overlooked and will now study.
>
>On Thu, 29 Jun 2000 10:14:06 -0400, tadmc@metronet.com (Tad McClellan)
>wrote:
>
>>What you don't see in perlop is any mention of regular
>>expressions in connection with tr///
>
>>No mention of regular expressions to be found...
>
>Except that tr is listed under the section:
>
>> Regexp Quote-Like Operators
>
>which begins:
>
>> Here are the quote-like operators that apply to pattern matching and related activities. 
>> Most of this section is related to use of regular expressions from Perl. 


The "and related" part implies inclusion of things that are
not pattern matching, but are merely "related".

But that seems awfully sneeky. 

I don't think that tr/// is "related" to pattern matching,
except perhaps by virtue of also using the binding operator
(=~).


The docs ought to be able to make that more clear...


>That's why I thought there was a connection between the two. Does that
>seem unreasonable?


Not at all.

You might also consider filing a bug report against the docs,
asking that the non-regex nature of tr/// be more explicitly
stated.

I think such a clarification would be a Good Thing, judging
by the frequency of confusion on that issue.


-- 
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Fri, 30 Jun 2000 11:06:08 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Strange behaviour in upper case conversion
Message-Id: <slrn8lpdr0.696.tadmc@magna.metronet.com>

On Fri, 30 Jun 2000 10:31:33 GMT, Philip Lees <pjlees@ics.forthcomingevents.gr> wrote:
>On Thu, 29 Jun 2000 08:50:31 -0500, Tom Briles <sariq@texas.net>
>wrote:
>
>>Errr, you know that this is equivalent to:
>>
>>$name =~ tr/a-z/A-Z/;
>>
>>right?  Because you read the documentation in the perlop page of the
>>manual for the bind operator, tr///, and s///, right?
>>
>><Snipped the evidence that you have *not* read the proper documentation,
>>but would rather have someone else read it for you, and regurgitate.>
>>
>>Whoops...
>> 
>>> I'm sure this will seem quite simple to you gurus.
>>
>>It's quite simple for anyone who RTFM.
>
>Reading and fully understanding the documentation are not the same
>thing. I did the former, 
        ^^^^^^^^^^^^^^^^

And we could tell that how?

There was nothing in your post that indicated that you had
read it.

I think I also concluded from reading it that you had not read them,
and made some followup to that effect.

There are dozens of posts here *each and every day* where the
poster has not read the docs for the function they are using.

(of course you already know this, having lurked a bit before
 posting as recommended in   news.announce.newusers
)

Regular readers of this newsgroup thus see *hundreds* of such
questions *each week*.

Most regular readers of this newsgroup have been participating
for *many such weeks*.

That works out to a Very Large Number.   :-(


Your post looked very much like one of those.

(made even more suspicious by the cargo cultishness of the
 ($name = $name) part.
)


>but obviously not the latter. 

but NOT obviously that you had done the former either!

Try putting yourself in the position of a reader of your
original post, where you don't know that you have checked
the docs.

Do you see something there that indicates that you did
not understand the docs? Or that you had even read them?

I couldn't (and neither could Tom, it appears).



>That's why I
>posted my question to this group.
        ^^^^^^^^^^^

So then, it is _your_ fault for presenting your question poorly.

If you did not understand the docs then you should have included
something like:

   I do not understand this part of the docs:

    <quote docs here>

But you did not make any mention of the docs whatsoever.

(In your original post. You _have_ done the above in a followup,
 but that came after the post that Tom is replying to
 (check the References: header above)
)

We just figured you were another of the thousands.

A case of mistaken identity.

If you had identified yourself more clearly, none of the
angst would have occurred.


>Now why don't you take that artichoke out of your ass?


Oh my.

And you were doing so well right up to that point.

You even found what might be considered a bug in the docs,
an now you went and got vulgar in response to a perfectly
understandable response.

So long.



*plonk*



-- 
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Fri, 30 Jun 2000 16:43:44 GMT
From: T. Alex Beamish <remove.this.talexb@tabsoft.on.ca>
Subject: Use of uninitialized value
Message-Id: <pdjplsgfvvk5ids8uenanuoohj9vi493jn@4ax.com>

Hi folks,

This one has got me tied up in knots, and I'd love to get some
feedback from knowledgable clpm'ers.

I'm getting an uninitialized value error in the Apache log during the
run of a mod-perl module. The code is

sub GetTempRoot
{
    my ( $TempRoot, $TempFile, $Limit);
    $Limit = 0;

    $TempRoot = $TempFile = ""; # To get rid of errors?

    do
    {
      $TempFile = "$TmpImages/Temp" . int ( rand 10000 ) . ".gif";

      #  Safety valve -- if we get 50 hits, give up on the  process.

      if ( $Limit++ == 50 )
      {
        return ( "TempXYZ" );
      }
    } until ( open ( GP_FILE, $TempFile ) == 0 );

    close ( GP_FILE );

    return ( $TempRoot );
}

The 'uninitialized variable' error I get marks the line that starts
the do loop; recent experience has taught me that this means the error
could be anywhere within the scope of the do loop. Yet debug messages
(which I have not shown) dump out the value of the variables using the
following code:

      print "<p>1 TmpImages is " . ( defined ( $TmpImages ) ?
$TmpImages : "undef" );
      print "<br>1 TempRoot  is " . ( defined ( $TempRoot )  ?
$TempRoot  : "undef" );
      print "<br>1 TempFile  is " . ( defined ( $TempFile )  ?
$TempFile  : "undef" );
      print "<br>1 Limit  is " . ( defined ( $Limit )  ? $Limit  :
"undef" );

None of the these variables is ever undefined (since I put in the
initialization at the top) yet I *still* get an error.

Sign me,

Looking for a clue in Toronto.

Thanks!



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

Date: Fri, 30 Jun 2000 16:57:37 GMT
From: "HawaiiFiveO" <nospam@forget.it>
Subject: Re: Use of uninitialized value
Message-Id: <5k475.14973$aB6.71707@typhoon.hawaii.rr.com>

Toronto,

>     my ( $TempRoot, $TempFile, $Limit);
>     $Limit = 0;
Here is where you have initialized ALL your variables (well, almost all :->)

>       $TempFile = "$TmpImages/Temp" . int ( rand 10000 ) . ".gif";
You didn't init this one ^^^^^^^
Your error is coming from trying to assign a value from $TmpImages that
doens't yet exist


Good luck,

Ben




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

Date: Fri, 30 Jun 2000 17:25:01 GMT
From: T. Alex Beamish <remove.this.talexb@tabsoft.on.ca>
Subject: Re: Use of uninitialized value
Message-Id: <k5mpls8e9dppumsl9vfv4l9822gf1s18h2@4ax.com>

On Fri, 30 Jun 2000 16:57:37 GMT, "HawaiiFiveO" <nospam@forget.it>
wrote:

>Toronto,
>
>>     my ( $TempRoot, $TempFile, $Limit);
>>     $Limit = 0;
>Here is where you have initialized ALL your variables (well, almost all :->)
>
>>       $TempFile = "$TmpImages/Temp" . int ( rand 10000 ) . ".gif";
>You didn't init this one ^^^^^^^
>Your error is coming from trying to assign a value from $TmpImages that
>doens't yet exist

Heh. actually, I do have the line

    my($TmpImages)="../../../../tmpimages";

above the subroutine definition. And my debug messages show that it is
defined. Sorry for forgetting to post that. Any more ideas?

>Good luck,

I'm gonna need it. Thanks.



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

Date: Fri, 30 Jun 2000 15:47:59 GMT
From: manchester_united@my-deja.com
Subject: Windows paths for PERL's 'glob' command
Message-Id: <8jiff9$d5n$1@nnrp1.deja.com>

I cannot use the PERL's 'glob' command on Windows paths, if the path or
any of the folders contain a space.

To test this yourself, try using 'glob' as follows:-

@array = glob ("c:\Program Files");

and you will find that it has not returned the files or folders as it
should.

Have tried:-
1) permutation of the back-slashes and forward-slashes
2) escaping ('\') the space
3) giving it a short name i.e. "c:\progra~1"

but to no avail......going nuts, please help me.


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


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

Date: Fri, 30 Jun 2000 16:48:26 GMT
From: "HawaiiFiveO" <nospam@forget.it>
Subject: Re: Windows paths for PERL's 'glob' command
Message-Id: <ub475.14972$aB6.71704@typhoon.hawaii.rr.com>

> I cannot use the PERL's 'glob' command on Windows paths, if the path or
> any of the folders contain a space.

Try using a package called File::DosGlob to override Perl's core glob,
available from CPAN.
    # override core glob in current package
    use File::DosGlob 'glob'

per the package documentation:
". If you want to put in literal spaces in the glob pattern, you can escape
them with either double quotes, or backslashes. e.g. glob('c:/"Program
Files"/*/*.dll'), or glob('c:/Program\ Files/*/*.dll'). The argument is
tokenized using Text::ParseWords::parse_line(), so see ParseWords for
details of the quoting rules used. "

Regards,

Ben




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

Date: Fri, 30 Jun 2000 16:23:14 GMT
From: brianthecoder@my-deja.com
Subject: Re: WWWBoard: Internal Server Error
Message-Id: <8jihhj$got$1@nnrp2.deja.com>

Yeah.  His code sucks.  I want to build my own
message board in perl but, I need a temporary
one.  Let me know if you find a good perl message
board.

In article <20000608150935.15923.00004963@ng-
md1.aol.com>,
  canon50e@aol.comDELETE (Kar Yan Mak) wrote:
> Recently I have been trying to setup a message
board on my site using Matt's
> script from worldwidemart.com.  I have uploaded
the necessary files to run the
> board (have no started on wwwadmin.pl yet).
But when I try to post on the
> board it would give me this errror message:
> ---------------------------------
> Internal Server Error
> The server encountered an internal error or
misconfiguration and was unable to
> complete your request.
> Please contact the server administrator,
webmaster@kyphoto.com and inform them
> of the time the error occurred, and anything
you might have done that may have
> caused the error.
> More information about this error may be
available in the server error log.
> ----------------------------
>
> My board is located at:
http://www.kyphoto.com/classics/forum
>
> Path to Perl: /usr/bin/perl (this is what my
server indicated)
> $basedir: /classics/forum
> $baseurl: http://www.kyphoto.com/classics/forum
> $cgi_url: http://www.kyphoto.com/cgi-
bin/wwwboard.pl
>
> I have chmoded and placed all the necessary
files in "forum" directory and
> created a "message" directory in there.  The
only file I renamed was the
> "wwwboard.html" to "index.html."
>
> Any suggestions on how to clear this out?
Please e-mail me your response if
> possible.
>
> Thank you in advance.
>
> Sincerely yours,
> Kar Yan Mak
>
>



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


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

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


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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

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

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

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


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


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