[17416] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4836 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Nov 7 18:20:48 2000

Date: Tue, 7 Nov 2000 15:20:29 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <973639229-v9-i4836@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 7 Nov 2000     Volume: 9 Number: 4836

Today's topics:
    Re: read > find > run <bcanning@netresults-media.co.uk>
    Re: read > find > run <jeff@vpservices.com>
    Re: read > find > run <bcanning@netresults-media.co.uk>
        Really stupid question: coder3555@my-deja.com
        Recursively delete directory on Windows dave@andromeda.rutgers.edu
    Re: returning a true value is FUN! (was Re: Log.pm did  <ren.maddox@tivoli.com>
        Sockets? joekind@my-deja.com
    Re: Sorting hash of hashes by value (Gwyn Judd)
    Re: Splitting variable length fixed records <peter.sundstrom@eds.com>
        strip html tags from string $text dobrocinitelj@my-deja.com
    Re: strip html tags from string $text <geoff@800-800-cruise.com>
        Tele Commute ONLY - PERL - Java - JS - CSS - HTML - Dre InternationalPERLjavaPRG@IJavaPerlPrg.com
        Trying to subclass Net::LDAP and failing, any ideas wha (Marc Spitzer)
    Re: Trying to subclass Net::LDAP and failing, any ideas (Kenneth Graves)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Tue, 7 Nov 2000 20:32:54 -0800
From: "Brian Canning" <bcanning@netresults-media.co.uk>
Subject: Re: read > find > run
Message-Id: <8u9ouu$lj6$1@news6.svr.pol.co.uk>

sorry been off line for a few days, not sure what I have missed on the
thread
as this is now the only bit I can find of it.

OK the script isn't failing, just not putting the bits where I what them.
E.G.
here is a bit of the HTML it reads in.

<TR>
      <TD WIDTH="25%"><FONT SIZE="+1">Type</FONT></TD>
      <TD WIDTH="75%"><!--type-->
      </TD>
    </TR>

where the <!--type--> is I want it to run the  &create_types;, it does it
but puts it at the top of the page instead of inside the <TD> tags

Brian



Jeff Zucker <jeff@vpservices.com> wrote in message
news:3A06DB1A.21DCB25@vpservices.com...
> Brian Canning wrote:
> >
> > does that make sense now?
>
> What you are trying to do made sense the first time.  What isn't evident
> from any of your posts is that you have never said in what manner the
> script fails to do what you want.  Is there an error message, if so,
> what?  Is it failing to print?  Is it printing the wrong thing? Is it
> failing to find the comments?  Is it replacing other things instead of
> the comments?  There is no way for anyone to guess which of those things
> you mean by "going wrong".
>
> --
> Jeff




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

Date: Tue, 07 Nov 2000 13:10:06 -0800
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: read > find > run
Message-Id: <3A086FAE.D4C7802@vpservices.com>


Brian Canning wrote:
> 
> <TR>
>       <TD WIDTH="25%"><FONT SIZE="+1">Type</FONT></TD>
>       <TD WIDTH="75%"><!--type-->
>       </TD>
>     </TR>
> 
> where the <!--type--> is I want it to run the  &create_types;, it does it
> but puts it at the top of the page instead of inside the <TD> tags

Then I guess you'll need to show us the code that produces that output.

-- 
Jeff


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

Date: Tue, 7 Nov 2000 22:26:06 -0800
From: "Brian Canning" <bcanning@netresults-media.co.uk>
Subject: Re: read > find > run
Message-Id: <8u9vk4$r84$1@news6.svr.pol.co.uk>

OK here is it, not no laughing, I'm not the best
coder in the world
$types & $musicT are defended in a config file

#############
 # show form #
 #############

sub show_form {
 open (formfile, "add.htm") || die print "Oh my god, where is the form file
called add.htm";
 while (<formfile>) {
  if ($_ =~ s/<!--type-->//){
   &create_types;
  }
  elsif ($_ =~ s/<!--music-->//){
   &create_music;
  }
  else {
   print $_;
  }

 }
}
 ################
 # create types #
 ################

sub create_types

 @types = split(/\|/,$types);
 foreach $type(@types){
  print "<input TYPE=\"RADIO\" NAME=\"type\" value=\"$type\">$type<br>\n";
   }
}

 ################
 # create music #
 ################

sub create_music {
 print "<TABLE border=0 CELLPADDING=\"2\" CELLSPACING=\"5\"> \n";
 print "<TR> \n";
 print "<TD VALIGN=\"TOP\" ALIGN=\"LEFT\">";
 @musicT = split(/\|/,$musicT);
 $colcount = 0;
 $rowcount = 0;
 foreach $music(@musicT){
  if ($colcount == 10 ) {
   print "</TD><TD VALIGN=\"TOP\" ALIGN=\"LEFT\">";
   $colcount = 0;
   $rowcount++;
  }
  if ($rowcount == 3) {
   print "</TD></TR><TR><TD VALIGN=\"TOP\" ALIGN=\"LEFT\">";
   $rowcount = 0;
  }
  print "<INPUT TYPE=\"CHECKBOX\" NAME=\"music\"
value=\"$music\">$music<br>\n";
  $colcount++;

 }
 print "</TD></TR>  </TABLE>";
}

Jeff Zucker <jeff@vpservices.com> wrote in message
news:3A086FAE.D4C7802@vpservices.com...
>
> Brian Canning wrote:
> >
> > <TR>
> >       <TD WIDTH="25%"><FONT SIZE="+1">Type</FONT></TD>
> >       <TD WIDTH="75%"><!--type-->
> >       </TD>
> >     </TR>
> >
> > where the <!--type--> is I want it to run the  &create_types;, it does
it
> > but puts it at the top of the page instead of inside the <TD> tags
>
> Then I guess you'll need to show us the code that produces that output.
>
> --
> Jeff




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

Date: Tue, 07 Nov 2000 22:48:37 GMT
From: coder3555@my-deja.com
Subject: Really stupid question:
Message-Id: <8ua0s3$9jg$1@nnrp1.deja.com>

Hello Perl Community,

Can anyone tell me (a Perl newbie) what the scalar variable $? is.

Say, in the context of a line of code:


   $? == 0 || die "error...";


It obviously checks if it has a value of zero, but where is the $?
variable set?  Is it the return value of another instrinsic function?


Thanks for your help!


Carsten.


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


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

Date: Tue, 07 Nov 2000 20:35:41 GMT
From: dave@andromeda.rutgers.edu
Subject: Recursively delete directory on Windows
Message-Id: <8u9p2t$2av$1@nnrp1.deja.com>

Is there a module or other simple solution
that allows me to recursively delete
a directory under Windows 2000?

Thanks!

Dave


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


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

Date: 07 Nov 2000 13:09:30 -0600
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: returning a true value is FUN! (was Re: Log.pm did not return a true value)
Message-Id: <m3puk7r445.fsf@dhcp11-177.support.tivoli.com>

Jeff Pinyan <jeffp@crusoe.net> writes:

> Ah, but those are somewhat more intuitive.  Why would assigning 0 to an
> empty list return a true value?

Is that rhetorical?

If not, perldata(1) says:

       List assignment in scalar context returns the number of
       elements produced by the expression on the right side of
       the assignment:

-- 
Ren Maddox
ren@tivoli.com


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

Date: Tue, 07 Nov 2000 21:39:35 GMT
From: joekind@my-deja.com
Subject: Sockets?
Message-Id: <8u9sqn$5u0$1@nnrp1.deja.com>

Hi.  I am learning how to use sockets and I'm doing some
experimenting.  With the program below, I'm trying to create a new
socket but it seems like it just hangs for ever because it wouldn't
print anything.  So what am I doing wrong because I copied this example
from the perl cookbook.

use IO::Socket;
$remote_port = "27688";
$socket = IO::Socket::INET->new(LocalPort => $remote_port,
				Type => 'SOCK_STREAM',
				Reuse => 1,
				Listen => SOMAXCONN)
	or die "couldnt connect to: $@\n";
while ($client = $socket->accept) {
	print "test";
}
close($socket);

Also, once I do get this socket thing working:
I want to be able to retrieve the content from 10 different sites all
at once.  So would I just run the above program in a loop and use
LWP::UserAgent to retrieve the content?  And will this be able to
retrieve the content from each site at the same time rather than having
to wait for one site to finish before moving on?


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


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

Date: Tue, 07 Nov 2000 23:03:13 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Sorting hash of hashes by value
Message-Id: <slrn90h2hf.hbr.tjla@thislove.dyndns.org>

I was shocked! How could Jeff Zucker <jeff@vpservices.com>
say such a terrible thing:

>How about:
>
>my %cmpd_hash;
>while (my($country,$vals)=each %hash) {
>    while (my($color,$num)=each %{$vals}) {
>        $cmpd_hash{$num} = {country=>$country,color=>$color};
>    }
>}
>for my $num( sort {$a <=> $b} keys %cmpd_hash ) {
>   print "$num ", $cmpd_hash{$num}->{country},
>         ' '    , $cmpd_hash{$num}->{color}, "\n";
>}

Of course, that only works as long as there are no duplicate number
values. This version should guarantee unique hash keys:

my %cmpd_hash;
while (my($country,$vals)=each %hash) {
    while (my($color,$num)=each %{$vals}) {

        my $ref = {country=>$country,color=>$color};
        
        $cmpd_hash{$ref} = {val=>$num,ref=>$ref};
    }
}

for my $valref(sort {$cmpd_hash{$a}{val} <=> $cmpd_hash{$b}{val}}
        keys %cmpd_hash)
{
   print $cmpd_hash{$valref}{val}, " ";
   print $cmpd_hash{$valref}{ref}{country};
   print ' '    , $cmpd_hash{$valref}{ref}{color}, "\n";
}

I'm not sure why I can't do 'print "$valref->{country}"' though. I get
'Use of uninitialized value' (this is with "no strict 'refs'").

-- 
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
Save gas, don't use the shell.


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

Date: Wed, 8 Nov 2000 10:39:10 +1300
From: "Peter Sundstrom" <peter.sundstrom@eds.com>
Subject: Re: Splitting variable length fixed records
Message-Id: <8u9svs$gc$1@hermes.nz.eds.com>


Bart Lateur <bart.lateur@skynet.be> wrote in message
news:doqf0t4a1vd7grulkrgaoiah6pst1tifc3@4ax.com...
> Peter Sundstrom wrote:
>
> >I have a file of fixed records of variable length (newline terminated),
eg:
> >
> >F1F2..F120
> >
> >Where
> >
> >F1 is 120 bytes
> >F2 up to F120 is 60 bytes.
> >
> >The minimum number of fields is 2 and max is 120.
>
> chomp;
> @field = unpack 'A120'.('A60' x 119), $_;
>
> Apparently, this will fill in zero length strings for all fields with
> missing data, so yes, you will get 120 fields in total.
>
> If you don't like that, Martien's more elaborate way of calculating the
> unpack template, may help. But I don't get why he didn't use the 'x'
> operator.
>
> chomp;
> @field = unpack 'A120'.('A60' x int((length($_)-120)/60)), $_;


Thank's for all the suggestions.  It's great to see all the variations in
the solutions.




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

Date: Tue, 07 Nov 2000 22:04:57 GMT
From: dobrocinitelj@my-deja.com
Subject: strip html tags from string $text
Message-Id: <8u9ua3$774$1@nnrp1.deja.com>

I have a string $text containing multiple lines of text, how can I
strip all the html tags?


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


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

Date: Tue, 7 Nov 2000 14:24:37 -0800
From: "GC" <geoff@800-800-cruise.com>
Subject: Re: strip html tags from string $text
Message-Id: <Pg%N5.31640$Q92.828843@nntp2.onemain.com>

> I have a string $text containing multiple lines of text, how can I
> strip all the html tags?

Go here for help:

http://www.perldoc.com/perl5.6/pod/perlfaq9.html#How%20do%20I%20remove%2
0HTML%20from%20a%20string%3f


HTH
Geoff




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

Date: Tue, 07 Nov 2000 21:01:17 GMT
From: InternationalPERLjavaPRG@IJavaPerlPrg.com
Subject: Tele Commute ONLY - PERL - Java - JS - CSS - HTML - DreamWeaver
Message-Id: <x4_N5.5599$bl.2374214@typhoon.san.rr.com>

          *** TELE COMMUTE ONLY  ****
      
             WEB PAGE PROGRAMMER   
                 
      MUST HAVE EXCELLENT EXPERIENCE WITH:
*  DREAMWEAVER (Large Domain Mgt.) PREFERRED
*  DHTML AND CSS CAPABILITIES OF DREAMWEAVER
*  WINDOWS NT 4.0 IIS 5.0  (server) 
*  WEB PROGRAMMING: PERL / CGI / JavaScript / DHTML / CSS / JAVA
*  PROGRAMMING: C / Java  

          15 TO 40 HOURS PER WEEK  

$15.00 to $25.00 per hour commensurate with experience.

* Using a Remote Control software utility called TIMBUKTU
* 2 people can work on the same computer simultaneously 
  even though thousands of miles apart..
* Timbuktu has an audio channel and chat features.

* High-Bandwidth Not necessary, but PREFERRED. 

* Specific "Log-On' Schedule required. 
* Flexible 
* Prefer Mornings: Pacific Standard Time (PST), 
  but afternoons, ok.
* 2 to 3 hours per remomte 'log-on' session using Timbuktu
* 2 to 3 times per week minimum.
  
* Some work done off-line, but this is PRIMARILY a 
  real-time, log-on position. 
* Instead of having a specific schedule at an office, 
   a specific computer log-on schedule is required.

* Please respond directly to:
    
    Telecommuter@Law.com




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

Date: Tue, 07 Nov 2000 22:30:58 GMT
From: marc@oscar.noc.cv.net (Marc Spitzer)
Subject: Trying to subclass Net::LDAP and failing, any ideas what I an doing wrong?
Message-Id: <slrn90gvro.2af8.marc@oscar.noc.cv.net>

Thanks for your time.

here are the test cases:
# /opt/perl5.00503/bin/perl -MCVE::LDAPConnect -e "CVE::LDAPConnect->connect();"
Can't locate object method "new" via package "CVE::LDAPConnect" at \
CVE/LDAPConnect.pm line 15.
# /opt/perl5.00503/bin/perl -MCVE::LDAPConnect -e "CVE::LDAPConnect->new();"    
Can't locate object method "new" via package "CVE::LDAPConnect" at -e line 1.
# 

here is the module:
# more CVE/LDAPConnect.pm
package CVE::LDAPConnect;

#use Net::LDAP;

@ISA = ( "Net::LDAP" ,);

sub connect {
    my $self = shift;
    my $class = ref($self) || $self;
    my @ldap_servers = qw( ldap.server.1 ldap.server.2 );


    foreach my $ldap (@ldap_servers) {

        my $obj = CVE::LDAPConnect->new($ldap , @_);
        next unless($obj);
        $obj->bind(        
                           dn              => 'cn=##########',
                           password        => '#############'
                           )|| next;
        return $obj;
    }
    return undef;
}

return 1;


I am tring to have this go through a list of ldap servers and bind
to the first one that is up.  I have modled what I did on Object
Orented Perl page 172, use @ISA and Perl will figure it out so I
am lost.  I am now going to reread chapter 6 of OOP.  I you can
tell me what stupid thing I did or did not do thanks.

Marc Spitzer

ps this is my first object.

Marc



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

Date: Tue, 07 Nov 2000 22:44:46 GMT
From: kag@kag.citysource.com (Kenneth Graves)
Subject: Re: Trying to subclass Net::LDAP and failing, any ideas what I an doing wrong?
Message-Id: <slrn90h1eu.b6.kag@kag.citysource.com>

In article <slrn90gvro.2af8.marc@oscar.noc.cv.net>, Marc Spitzer wrote:
>#use Net::LDAP;

Uncomment this.  If perl has never read the Net::LDAP package, then it
can't find its methods.

--kag


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

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


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