[25768] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 8007 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Apr 22 14:05:35 2005

Date: Fri, 22 Apr 2005 11:05:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 22 Apr 2005     Volume: 10 Number: 8007

Today's topics:
        Help getting started with Lanman  <david.sanabria@morte_spam.thehartford.mortespam.com>
        NET::DNS <alexj@freesurf.ch>
    Re: NET::DNS <alexj@freesurf.ch>
    Re: search and replace help  <tadmc@augustmail.com>
        subroutine explanation (fred)
    Re: subroutine explanation (Anno Siegel)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Fri, 22 Apr 2005 17:50:50 GMT
From: David Sanabria <david.sanabria@morte_spam.thehartford.mortespam.com>
Subject: Help getting started with Lanman 
Message-Id: <_Paae.1515$iB1.1080@newssvr19.news.prodigy.com>

Greetings!

I have just discovered the Win32::Lanman package and hope to use it to 
solve a problem I am sure has already been solved...

I have an Excel file that is used as a data source across a network. 
This file is commonly opened for reading from other Spreadsheets but I 
need to disconnect any users before I can update the source.

If anyone has a script that demonstrates how this can be done, I would 
greatly appreciate it.

What I need is to be able to use the NetFileEnum() function to get the 
open files in directory c:\foo where my data.xls file lives. From there, 
I would use the NetFileClose() function to close the file just before 
copying a new one over it.

Any help or suggestions would be greatly appreciated!

Regards,
Dave

PS. I will post my own script once I'm done hacking on it.


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

Date: Fri, 22 Apr 2005 15:53:39 +0200
From: Alexandre Jaquet <alexj@freesurf.ch>
Subject: NET::DNS
Message-Id: <426901e9$0$1152$5402220f@news.sunrise.ch>

Hi,

I'm writting a little program to get DNS information.

I'm trying to get HINFO values via  :


use Net::DNS;
use Net::DNS::RR;

my $host = "somehost.ch";
my $res   = Net::DNS::Resolver->new;

$query = $res->query($host, "NS");
   if ($query) {
       foreach $rr (grep { $_->type eq 'NS' } $query->answer) {
           print "nameserver: ";
           print $rr->nsdname, "\n";
           my $val = $rr->nsdname;
           my $txt   = Net::DNS::RR->new("$var 3600 HS TXT 'text record'");
           print $txt->print, "\n";
       }
   }
   else {
       warn "query failed: ", $res->errorstring, "\n";
   }

but I didn't get relevant datas with the code :

           my $txt   = Net::DNS::RR->new("$var 3600 HS INFO 'text record'");
           print $txt->print, "\n";

Any idea ?


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

Date: Fri, 22 Apr 2005 16:08:36 +0200
From: Alexandre Jaquet <alexj@freesurf.ch>
Subject: Re: NET::DNS
Message-Id: <4269056b$0$1150$5402220f@news.sunrise.ch>

Alexandre Jaquet a écrit :
> Hi,
> 
> I'm writting a little program to get DNS information.
> 
> I'm trying to get HINFO values via  :
> 
> 
> use Net::DNS;
> use Net::DNS::RR;
> 
> my $host = "somehost.ch";
> my $res   = Net::DNS::Resolver->new;
> 
> $query = $res->query($host, "NS");
>   if ($query) {
>       foreach $rr (grep { $_->type eq 'NS' } $query->answer) {
>           print "nameserver: ";
>           print $rr->nsdname, "\n";
>           my $val = $rr->nsdname;
>           my $txt   = Net::DNS::RR->new("$var 3600 HS TXT 'text record'");
>           print $txt->print, "\n";
>       }
>   }
>   else {
>       warn "query failed: ", $res->errorstring, "\n";
>   }
> 
> but I didn't get relevant datas with the code :
> 
>           my $txt   = Net::DNS::RR->new("$var 3600 HS INFO 'text record'");
>           print $txt->print, "\n";
> 
> Any idea ?

I correct the query with :
           my $info   = Net::DNS::RR->new("$var 3600 IN HSINFO '' ''");
           print $info->print, "\n";

according to the doc : http://www.tldp.org/LDP/nag/node88.html  but 
still don't get relevant informations

maybe this is because the record is not used


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

Date: Fri, 22 Apr 2005 09:07:22 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: search and replace help 
Message-Id: <slrnd6i18q.3r1.tadmc@magna.augustmail.com>

freedom <freedom@rogers.com> wrote:

> I m a newbie in perl 


Have you seen the Posting Guidelines that are posted here frequently?


> I generate an 
> html form with CGI.pm. 


Not with the code that you've shown us you don't.

If you mislead us like that, we are likely to ignore your questions
or give an answer that you cannot use.


> this is my generated form script


Errr, OK if you say so, but you also say that it runs when it won't run...


> #!/usr/bin/perl
> use strict;


><input name = "pattern" type = "text" value="$pattern" size = "50"></p>


You have a "use strict" violation there.

This isn't your real code (so what is the point of showing it to us?).


> #!/usr/bin/perl
> use strict;
> use warnings;


> if( $option == "URL" ) {


There is not much point in turning on warnings if you are just
going to ignore the messages that it produces...


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: 22 Apr 2005 07:40:12 -0700
From: fred78980@yahoo.com (fred)
Subject: subroutine explanation
Message-Id: <9a965338.0504220640.20f81511@posting.google.com>

I have some code created to takes some rules from external file and
apply these rules on text file. My perl experience is somewhat limited
and I was wondering if soneone on this group can give me an
explanation of it.

sub apply_rules {
  my ($_txt, $_rules) = @_;
  for (keys %{$_rules}) {
    my $exp = $_;
    $exp =~ s{\s}{\\s*}g;
    my $re = $_rules->{$_};
    my $rslt;
    eval ("\$rslt = \$\$_txt =~ s{$exp}{$re}gis");
    printf "  >Replaced '$exp' %d times.\n", $rslt;
  }
}


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

Date: 22 Apr 2005 15:32:26 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: subroutine explanation
Message-Id: <d4b5ea$qm5$1@mamenchi.zrz.TU-Berlin.DE>

fred <fred78980@yahoo.com> wrote in comp.lang.perl.misc:
> I have some code created to takes some rules from external file and
> apply these rules on text file. My perl experience is somewhat limited
> and I was wondering if soneone on this group can give me an
> explanation of it.
> 
> sub apply_rules {
>   my ($_txt, $_rules) = @_;
>   for (keys %{$_rules}) {
>     my $exp = $_;
>     $exp =~ s{\s}{\\s*}g;
>     my $re = $_rules->{$_};
>     my $rslt;
>     eval ("\$rslt = \$\$_txt =~ s{$exp}{$re}gis");
>     printf "  >Replaced '$exp' %d times.\n", $rslt;
>   }
> }

$_rules is a (reference to) a hash that contains pairs consisting of a
pattern and a replacement.  $_txt is a reference to some text.  Basically,
the pattern is replaced with the replacement everywhere it matches
(case-insensitively) in the text.  This happens for every pair in the hash.
Why the author thought "eval" was needed to achieve this isn't obvious,

    $rslt = $$_txt =~ s{$exp}{$re}gis;

would do the same thing.

Before application, each pattern is pre-processed to replace blanks with
"\s*", which means that when the pattern indicates a single blank, any
sequence of white space will match.  That includes no whitespace at all,
wonder if that's right.

After each pattern/replacement pair in the hash, the pattern is shown
along with the number of replacements that happened.

The effect of the routine is not well defined if the order of replacements
matters (if there are re-replacements), because the order of a hash
isn't well defined.

Anno


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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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 V10 Issue 8007
***************************************


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