[8793] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2410 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Apr 24 10:07:59 1998

Date: Fri, 24 Apr 98 07:00:33 -0700
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, 24 Apr 1998     Volume: 8 Number: 2410

Today's topics:
    Re: best way to find disk space for a directory <jamesr@aethos.co.uk.nospam>
    Re: best way to find disk space for a directory (Jason Gloudon)
    Re: best way to find disk space for a directory <flavell@mail.cern.ch>
    Re: commenting a whole block? <stuartc@ind.tansu.com.au>
        Converting SID in WIN32::LookupAccountName? <cbrown_no-spam_@erols.com>
    Re: Grabbing a webpage with Perl <webmaster@zdo.wssk.am.wroc.pl>
    Re: Grabbing a webpage with Perl scott@softbase.com
    Re: Grabbing a webpage with Perl (Jason Gloudon)
        help <soetensi@se.bel.alcatel.be>
    Re: help (Jason Gloudon)
    Re: help <perlguy@inlink.com>
    Re: help <ljz@asfast.com>
        How to read a web page? (Stan Majka)
    Re: How to read a web page? <Tony.Curtis+usenet@vcpc.univie.ac.at>
    Re: How to read a web page? (Jason Gloudon)
        HTML::Table <stuart@euronova.com>
    Re: ODBC/DBI on WIN32 host <brhess@email.msn.com>
    Re: PC-based editors for Perl? scott@softbase.com
    Re: PC-based editors for Perl? <perlguy@inlink.com>
        Perl ASP's and IIS4 <weekesd@logica.com>
    Re: Perl executable version for x86 solaris 2.5 <bill@astro.fccj.cc.fl.us>
    Re: print multiple lines before or after match ? <jamesr@aethos.co.uk.nospam>
    Re: Read-only value? <bmb@ginger.libs.uga.edu>
    Re: Regular Expression to match a valid IP address (Jason Gloudon)
    Re: Regular Expression to match a valid IP address <flavell@mail.cern.ch>
    Re: Serial port quandry (Andrew M. Langmead)
    Re: status output. <mck@rahul.net>
        Win32 & Process listing <xxxgormxxx@p4.no>
        Win32 .lib vs. .pll <brhess@email.msn.com>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 24 Apr 98 11:50:44 GMT
From: "James Richardson" <jamesr@aethos.co.uk.nospam>
Subject: Re: best way to find disk space for a directory
Message-Id: <01bd6f6e$bfe3b960$26c0a4c1@kitkat.aethos.co.uk>

Ronald J Kimball <rjk@coos.dartmouth.edu> wrote in article <354013A2.1AB907D6@coos.dartmouth.edu>...
> Alex Krohn wrote:
> > 2. use find to get a list of files and then loop through and stat each
> > one to get the file size.
> 
> Painful.  Watch out for symbolic links.
> 
> > Which option is preferable? Is there a better way?
> 

Definately dont use du.

Use opendir/readdir/stat/lstat

Something like this may get you started... (I haven't really checked it for bugs so it might not be perfect... but I suppose that
it's a start)

This will currently follow symlinks across filesystems (which maybe you want), and should report he size of symlinks themselves
(linker?) rather than the size of the linked-to (linkee?) file.

#!/opt/perl5/bin/perl

sub read_directory {
  local ($directory_name, $file_ref) = @_;
  local (@files_in_dir);
  local ($filepath);
  
  if (-d $directory_name) {
    opendir (DIRECTORY, $directory_name);
    
    @files_in_dir = readdir(DIRECTORY);
    
    foreach $file (sort(@files_in_dir)) {

      next if $file =~ /^\.$/;
      next if $file =~ /^\.\.$/;

      $filepath = "$directory_name/$file";
      
      if (-d $filepath) {
	#if (-l $filepath) {
	#Ok, so the directory is a symlink*/
	#if ( (stat($filepath))[0] == (lstat($filepath))[0]) {
	#The directory is on the same filesystem...
	read_directory( "$filepath" , $file_ref) if $recurse_directories;
	#}
	#}
      }
      else {
	if (-l $filepath) {
	  @stat = lstat($filepath);	  
	}
	else {
	  @stat = stat($filepath);
	}
	$$file_ref{$stat[1]} = $stat[7];
      }
    }
  }
  else {
    $$file_ref{$stat[1]} = $stat[7];
  } 
  print;
}

$recurse_directories = 1;
$directory = ".";
%file_list = ();

read_directory($directory, \%file_list);

$sum = 0;

foreach $inode (keys(%file_list)) {
  $sum += $file_list{$inode};
}

print $sum;


James
 


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

Date: Fri, 24 Apr 1998 12:17:55 GMT
From: jgloudon@hyssop.bbn.com.bbn.com (Jason Gloudon)
Subject: Re: best way to find disk space for a directory
Message-Id: <slrn6k10n1.cdv.jgloudon@hyssop.bbn.com>

James Richardson <jamesr@aethos.co.uk.nospam> wrote:
>Ronald J Kimball <rjk@coos.dartmouth.edu> wrote in article <354013A2.1AB907D6@coos.dartmouth.edu>...
>> Alex Krohn wrote:
>> > 2. use find to get a list of files and then loop through and stat each
>> > one to get the file size.

3. Learn how to reuse code that works and use the File::Recurse module
www.perl.com/CPANll.

--
Jason Gloudon


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

Date: Fri, 24 Apr 1998 14:07:39 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: best way to find disk space for a directory
Message-Id: <Pine.A41.3.95a.980424140716.56968F-100000@rsplus08.cern.ch>

On Fri, 24 Apr 1998, Ronald J Kimball wrote:

> > 2. use find to get a list of files and then loop through and stat each
> > one to get the file size.
> 
> Painful.  Watch out for symbolic links.

And sparse files.





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

Date: 22 Apr 1998 09:46:36 +1000
From: Stuart Cooper <stuartc@ind.tansu.com.au>
Subject: Re: commenting a whole block?
Message-Id: <yeo4szm3fhf.fsf@kudu.ind.tansu.com.au>

abigail@fnx.com (Abigail) writes:

> Chris Nandor (pudge@pobox.com) wrote on MDCXC September MCMXCIII in
> <URL: news:pudge-1704981518550001@ppp-12.ts-1.kin.idt.net>:
> ++ 
> ++ Personally, I like:
> ++ 
> ++ =pod
> ++ 
> ++ comment();
> ++ out();
> ++ all_this_code();
> ++ 
> ++ =cut
> 
> 
> Yeah, but what if that section has a pod piece in it? ;)

Good point. Just like C comments, pod sections don't nest.
 
> Using an elegant editor:
>       :x,ys/^/#/
> 
> where x and y are the line numbers of the beginning and end.

Yeah, but like in many vi region operations, it's a pain having to 
calculate the beginning and end numbers.

In Emacs (in the Perl Mode) select the region you wish to comment.

M-x comment-region RET
  will comment the region
C-u M-x comment-region RET
  will uncomment the region

This also works (more or less; quite naively) in C mode.

I personally find this the most satisfying way to comment out blocks of
Perl code. However, I find Emacs the most satisfying way of doing tons of
things; so your feelings may vary.

People who already use Emacs for editing their Perl code should try these
commands out for block-(un)?commenting their code. In my view it will answer
their block-commenting needs better than code fiddling (if (0) {}), 
pod fiddling, or the vi solution.

I think the vi and the emacs solution could be mentioned in perlfaq7; as
answers to the question "How can I comment out a large block of perl code?"

Hope this helps.

Stuart Cooper
stuartc@ind.tansu.com.au


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

Date: Fri, 24 Apr 1998 09:27:32 -0400
From: "Chris Brown" <cbrown_no-spam_@erols.com>
Subject: Converting SID in WIN32::LookupAccountName?
Message-Id: <6hq40n$2gf@world2.bellatlantic.net>

Using WIN32::LookupAccountName, I'm receiving the SID in the form of special
characters.  How do I convert it into a readable SID?

Chris (cbrown_nosp@erols.com)




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

Date: Fri, 24 Apr 1998 13:56:09 +0200
From: Jacek Kubica <webmaster@zdo.wssk.am.wroc.pl>
Subject: Re: Grabbing a webpage with Perl
Message-Id: <35407DD9.CEB60699@zdo.wssk.am.wroc.pl>

Chris wrote:
> 
> Does anyone know how to have a Perl program get a web page?  I just need
> for it to grab a url I give it.  Thanks.

Simple way is to use  HTTP_LIB.PL
Script written by Gunther Birznieks.

Regards

Jacek


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

Date: 24 Apr 1998 11:47:44 GMT
From: scott@softbase.com
Subject: Re: Grabbing a webpage with Perl
Message-Id: <6hpu50$b70$2@mainsrv.main.nc.us>

Chris (munu@munu.com) wrote:
> Does anyone know how to have a Perl program get a web page?

I wrote this just the other day.  Take the example client in
Programming Perl, and change it to go to port 80. Print:

GET /file.html HTTP/1.0

to the socket, and read what the socket gives you back. It
should be the web page. (Or an error.)

Scott
--
Look at Softbase Systems' client/server tools, www.softbase.com
Check out the Essential 97 package for Windows 95 www.skwc.com/essent
All my other cool web pages are available from that site too!
My demo tape, artwork, poetry, The Windows 95 Book FAQ, and more. 


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

Date: Fri, 24 Apr 1998 12:25:10 GMT
From: jgloudon@hyssop.bbn.com.bbn.com (Jason Gloudon)
Subject: Re: Grabbing a webpage with Perl
Message-Id: <slrn6k114k.cdv.jgloudon@hyssop.bbn.com>

Jacek Kubica <webmaster@zdo.wssk.am.wroc.pl> wrote:
>Chris wrote:
>> 
>> Does anyone know how to have a Perl program get a web page?  I just need
>> for it to grab a url I give it.  Thanks.
>
>Simple way is to use  HTTP_LIB.PL
>Script written by Gunther Birznieks.

Even simpler is to use LWP, locatable at www.perl.com/CPAN/,
which will even install itself.

--
Jason


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

Date: Fri, 24 Apr 1998 13:20:20 +0200
From: Inge Soetens <soetensi@se.bel.alcatel.be>
Subject: help
Message-Id: <35407574.7302@se.bel.alcatel.be>

Hi,

can anyone help me with the following :

>From a perl script I need to generate an HTML file
which contains the following line :

print "<INPUT NAME="GoOn" TYPE="submit" VALUE="Go On"> \n";

This line gives a problem.
Because there are "quotes" in between "quotes" ...
Any solutions to this ?


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

Date: Fri, 24 Apr 1998 12:11:00 GMT
From: jgloudon@hyssop.bbn.com.bbn.com (Jason Gloudon)
Subject: Re: help
Message-Id: <slrn6k10a2.cdv.jgloudon@hyssop.bbn.com>

Inge Soetens <soetensi@se.bel.alcatel.be> wrote:
 .
>print "<INPUT NAME="GoOn" TYPE="submit" VALUE="Go On"> \n";
>
>This line gives a problem.
>Because there are "quotes" in between "quotes" ...

You should read the documentation.

print "<INPUT NAME=\"GoOn\" TYPE=\"submit\" VALUE=\"Go On\"> \n";

or
print qq(  );

--
Jason Gloudon


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

Date: Fri, 24 Apr 1998 11:52:32 GMT
From: Brent Michalski <perlguy@inlink.com>
To: Inge Soetens <soetensi@se.bel.alcatel.be>
Subject: Re: help
Message-Id: <35407D00.FBCA1872@inlink.com>

You really should RTFM first, I KNOW the answer to this is in every Perl
manual I can think of.  Please remember to do your homework next time...

To answer your question, there are several different ways, here are a
couple.

print "<INPUT NAME="GoOn" TYPE="submit" VALUE="Go On"> \n";  # ERROR

print '<INPUT NAME="GoOn" TYPE="submit" VALUE="Go On"> \n';  # OK
print "<INPUT NAME=\"GoOn\" TYPE=\"submit\" VALUE=\"Go On\"> \n"; # OK

print<<EOT;
 <INPUT NAME="GoOn" TYPE="submit" VALUE="Go On">
EOT

There are others, but these will work, take your pick...

Brent
Perl Freak


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

Date: 24 Apr 1998 09:05:04 -0400
From: Lloyd Zusman <ljz@asfast.com>
Subject: Re: help
Message-Id: <ltlnsvpdz3.fsf@asfast.com>

Inge Soetens <soetensi@se.bel.alcatel.be> writes:

> Hi,
> 
> can anyone help me with the following :
> 
> From a perl script I need to generate an HTML file
> which contains the following line :
> 
> print "<INPUT NAME="GoOn" TYPE="submit" VALUE="Go On"> \n";
> 
> This line gives a problem.
> Because there are "quotes" in between "quotes" ...
> Any solutions to this ?

Here's one possibility:

print "<INPUT NAME=\"GoOn\" TYPE=\"submit\" VALUE=\"Go On\"> \n";

Here's another:

print <<EOD;
<INPUT NAME="GoOn" TYPE="submit" VALUE="Go On">
EOD

I tend to prefer the second possiblity when generating HTML in a Perl
script, but either one will do.  And there are other ways to do this,
as well.

-- 
 Lloyd Zusman   ljz@asfast.com
 perl -e '$n=170;for($d=2;($d*$d)<=$n;$d+=(1+($d%2))){for($t=0;($n%$d)==0;
 $t++){$n=int($n/$d);}while($t-->0){push(@r,$d);}}if($n>1){push(@r,$n);}
 $x=0;map{$x+=(($_>0)?(1<<log($_-0.5)/log(2.0)+1):1)}@r;print"$x\n"'


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

Date: 24 Apr 1998 12:01:03 GMT
From: spamblock_majka@richmond.infi.net (Stan Majka)
Subject: How to read a web page?
Message-Id: <6hputv$vcs$1@nw003t.infi.net>

Can I read a web page from Perl?  

I want to "ping" a web server, by sending a request such as:

	http://www.server.com/pingpage.htm

I don't want to ping the BOX; I want to ensure that the SOFTWARE hasn't gone 
into a "zombie" state.  (Other software already detects whether it is up or 
down.)  I don't want to display the contents of pingpage.htm; I just want to 
see if I receive the short text string it contains.  (As long as I'm doing 
this, I'll probably track the response time as well.)  

Can anyone give me a hint as to whether this is possible in Perl and, if so, 
how I might do it?

Thanks in advance.

Stan



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

Date: 24 Apr 1998 14:12:28 +0200
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
To: majka@richmond.infi.net
Subject: Re: How to read a web page?
Message-Id: <7xu37j1kr7.fsf@beavis.vcpc.univie.ac.at>

Re: How to read a web page?, Stan
<spamblock_majka@richmond.infi.net> said:

Stan> Can I read a web page from Perl?  I want to "ping" a
Stan> web server, by sending a request such as:

Stan> 	http://www.server.com/pingpage.htm

Stan> I don't want to ping the BOX; I want to ensure that
Stan> the SOFTWARE hasn't gone into a "zombie" state.
Stan> (Other software already detects whether it is up or
Stan> down.)  I don't want to display the contents of
Stan> pingpage.htm; I just want to see if I receive the
Stan> short text string it contains.  (As long as I'm doing
Stan> this, I'll probably track the response time as well.)

Use LWP::UserAgent with HTTP::Request.  You can build a HEAD
request for the above resource quite easily.

And you can put a simple timer around the request call.

Stan> Can anyone give me a hint as to whether this is
Stan> possible in Perl

You realise you could be shot for asking such a
question here? :-)


-- 
Tony Curtis, Systems Manager, VCPC,      | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien, AT | http://www.vcpc.univie.ac.at/

"You see? You see? Your stupid minds! Stupid! Stupid!" ~ Eros, Plan9 fOS.


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

Date: Fri, 24 Apr 1998 12:19:51 GMT
From: jgloudon@hyssop.bbn.com.bbn.com (Jason Gloudon)
Subject: Re: How to read a web page?
Message-Id: <slrn6k10qk.cdv.jgloudon@hyssop.bbn.com>

Stan Majka <spamblock_majka@richmond.infi.net> wrote:
>Can I read a web page from Perl?  
>
>I want to "ping" a web server, by sending a request such as:
>
>	http://www.server.com/pingpage.htm

Get the LWP module from CPAN. www.perl.com/CPAN/, a good place to look
when you have a can I do xxx in perl question ?

--
Jason Gloudon


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

Date: 24 Apr 1998 12:20:20 GMT
From: "st" <stuart@euronova.com>
Subject: HTML::Table
Message-Id: <01bd6f7a$f2c71af0$ef6995c1@server>

As demanded, the unzipped files are at http://www.euronova.com/pub/


----------
> De : st <stuart@euronova.com>
> Groupes de News : comp.lang.perl.modules
> Objet : HTML::Table
> Date : jeudi 23 avril 1998 16:54
> 
> I often use a module I wrote a while back for creating HTML tables. I've
> put it at http://www.euronova.com/pub/htmltable.zip 
> Feel free to use it. Any feedback, improvements are welcome.

> Cheers,
> Stuart
> 
> _______________________________________________________________
> Stuart Thorn                                 thorn@spinnaker.fr
> Spinnaker Internet Services             http://www.spinnaker.fr 



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

Date: Fri, 24 Apr 1998 08:26:00 -0400
From: "Bill Hess" <brhess@email.msn.com>
Subject: Re: ODBC/DBI on WIN32 host
Message-Id: <O#SJp43b9GA.255@upnetnews03>

I downloaded the Perl5.004_04 and DBI 0.90 and Oracle DBD 0.47and it works
great.  I built this on a Win NT 4.0 box with VC++ 5.0

Check out http://www.hermetica.com/technologia/DBI/index.html
for more details and download info...

Bill Hess
brhess@msn.com



Dennis Kowalski wrote in message <353FAC94.4B0E@daytonoh.ncr.com>...
>2nd try.  My 1st posting disappeared.
>
>I am running on a NT 4.0 host.
>
>Can anyone tell me what version of Perl of modules I need to have in
>order to use the ODBC or DBI interfaces to acces an ORACLE database from
>a perl program ??
>
>I am currently using build 316 from ActiveWare.
>
>Thanks (again)




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

Date: 24 Apr 1998 11:51:13 GMT
From: scott@softbase.com
Subject: Re: PC-based editors for Perl?
Message-Id: <6hpubh$b70$3@mainsrv.main.nc.us>

Lee Roth <leeroth-nospamo@worldnet.att.net> wrote in article

> Any suggestions for an editor on a PC that would be 'better suited' to
> writing Perl code than native editors such as Notepad, Wordpad or
> (uck) a word processing package ?

I prefer Emacs for Windows myself. Same great taste as the UNIX
version. If you hack it a little, you get syntax highlighting and
everything. I practically live in Emacs both in UNIX and Windows.
Shell mode is essential for Perl programming -- you can open a shell
and run your Perl program, and capture the output.

A good commercial editor is MultiEdit. It manages to be feature packed
while being affordable. It has an action-packed Perl mode with syntax
highlighting, the "electric" construction-completion for if, while,
etc, and all the other stuff you'd get in emacs. It boasts
a native Windows look and feel.

Scott
--
Look at Softbase Systems' client/server tools, www.softbase.com
Check out the Essential 97 package for Windows 95 www.skwc.com/essent
All my other cool web pages are available from that site too!
My demo tape, artwork, poetry, The Windows 95 Book FAQ, and more. 


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

Date: Fri, 24 Apr 1998 11:54:40 GMT
From: Brent Michalski <perlguy@inlink.com>
Subject: Re: PC-based editors for Perl?
Message-Id: <35407D80.127DA46B@inlink.com>

Go to www.solutionsoft.com  They have a Windows Perl IDE that is pretty
slick, although it is still in development.

Brent


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

Date: Fri, 24 Apr 1998 12:14:43 +0100
From: "Derren Weekes" <weekesd@logica.com>
Subject: Perl ASP's and IIS4
Message-Id: <6hps98$pe2@romeo.logica.co.uk>

I have recently installed IIS4 and it seem to have broken the PerlScript
 .asp support. Any ideas?

The following is an asp (perltest.asp) that used to run under IIS3 but is no
more in IIS4!

<%@ LANGUAGE = PerlScript%>
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Perl Test</title></head>
<body bgcolor="#FFFFFF">
<%
  for ($i=0;$i<10;$i++) {
%><%=$i%>,<%
  }
%>
</body>
</html>

The error I get is:

Response.WriteBlock(0) for ($i=0;$i<10;$i++) { error '80004005'
syntax error, near ") for " syntax error at (eval 9) line 1, near "++) "
Bare word found where operator expected at (eval 9) line 2, near ")
Response" (Missing operator before Response?)
?

Any help greatly appreciated.
----
Derren Weekes - Communication Consultant







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

Date: Fri, 24 Apr 1998 12:01:42 GMT
From: Bill 'Sneex' Jones <bill@astro.fccj.cc.fl.us>
Subject: Re: Perl executable version for x86 solaris 2.5
Message-Id: <35407D81.65AA3481@astro.fccj.cc.fl.us>

Henry Qiu wrote:
> 
> Hi, perl buddys
> 
> Does any one out there know where can I download
> the Perl executable version for x86 solaris 2.5 ?
> Any input would be appreciated.
> 
> henry

[http|ftp]://sunsite.unc.edu  

Has excellent references to 
just about all Sun resources.

(Although, in the x86 ftp subdirectory
there is a pointer to a site which
carries older Sun x86 2.5 binaries;
in case you didn't want to upgrade
to x86 2.5.1 or 2.6.  In which case
you should prolly change to Linux and
stay updated where Perl is concerned.)

HTH,
-Sneex :-)
____________________________________________________________________________
Bill Jones | FCCJ Webmaster | Voice 904-632-3089 | Fax 904-632-3007
Florida Community College at Jacksonville | 501 W. State St. | Jax, FL 32202
mailto:webmaster@fccjmail.fccj.cc.fl.us | http://www.fccj.cc.fl.us


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

Date: 24 Apr 98 11:56:46 GMT
From: "James Richardson" <jamesr@aethos.co.uk.nospam>
Subject: Re: print multiple lines before or after match ?
Message-Id: <01bd6f79$82f8a0a0$26c0a4c1@kitkat.aethos.co.uk>

Andrew M. Langmead <aml@world.std.com> wrote in article <ErvCr6.EFy@world.std.com>...
> tadmc@flash.net (Tad McClellan) writes:
> 
> >Mike Hammernik (mhammer@execpc.com) wrote:
> 
> >: I put the information in and forgot to ask the question.
> 
> >: I would like to print the matched line and the next x lines whether that
> >: might be 2 or 10 additional lines.  
> 

There is an answer in the Camel book. (At least in the old one, I dont have the new one)... Its in the example section at the back,
and it's called 'cgrep'

I would post the code here... but I'm not really sure if thats an 'ethical' thing to do; I'm sure its lurking on the 'net.

James


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

Date: Fri, 24 Apr 1998 09:29:20 -0400
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: Read-only value?
Message-Id: <Pine.A41.3.96.980424092639.23654D-100000@ginger.libs.uga.edu>

I don't mean to sound doubtful--just curious.  Could you include the code
that loads the array references?  I just wonder if this might uncover more
clues.

On Thu, 23 Apr 1998, Wade Williams wrote:
> foreach $val (@{$v->{ord}},@{$v->{ordpoints}})
>  {
>  	if (! $val)
>  	{
>  		$val="&nbsp";
>  	}
>  }
> 
> Naturally, $v->{ord} is a reference to an array.

---
Brad Baxter, UGA



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

Date: Fri, 24 Apr 1998 11:44:44 GMT
From: jgloudon@hyssop.bbn.com.bbn.com (Jason Gloudon)
Subject: Re: Regular Expression to match a valid IP address
Message-Id: <slrn6k0uoq.cbi.jgloudon@hyssop.bbn.com>

Nicholas Carey <a-bnc@microsoft.com> wrote:
 .
>Really? Try this on for size. It's a regular expression that will
>match any unsigned decimal (base-10) representation of a value between
>0 and 255. It's not *that* hairy:
>
>  (0*(1?\d?\d|2[0-4]\d|25[0-5]))
 .
Yes it is -that- hairy, because ($num >= 0 && $num <= 255) is a lot simpler
to read and write. I'll let the speed daemons benchmark it.

-- 
Jason Gloudon


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

Date: Fri, 24 Apr 1998 14:04:48 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Regular Expression to match a valid IP address
Message-Id: <Pine.A41.3.95a.980424140230.56968D-100000@rsplus08.cern.ch>

On Fri, 24 Apr 1998, Jason Gloudon wrote:

> Yes it is -that- hairy, because ($num >= 0 && $num <= 255) is a lot simpler
> to read and write.

There seems already to have been some agreement that a string that
contains only digits cannot test negative, and hence does not need to be
tested >=0.  If you know otherwise...? 

cheers




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

Date: Fri, 24 Apr 1998 13:22:04 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Serial port quandry
Message-Id: <Erx6Gs.wn@world.std.com>

mhannam@gardner-webb.edu writes:

>Hi.  For my final exam in a networking class, I'm trying to toggle an LED
>light from a remote computer via the internet.  I've got the LED running on
>the 5 volts from my serial port on pins 15 and 10.  Can I use Perl to turn the
>port on/off and in doing so turn th LED on/off?  Thanks for any help you can
>offer.  Matt

If you are at the end of your networking class, you should realize
that I/O tends to be an operating system specific function. Toggling
pins on a Unix machine's serial port will not be the same a toggling a
Windows box serial port. (And that will be different than a Mac. But
of course, even the connector and the pin numbering will be different
on a mac.)

If you are running Unix, I'd recommend looking at the POSIX::Termios
functions. If you need help with handling the terminal driver. I'd
recommend reading "Advanced Unix Programming" by W R Stevens.
<URL:http://cseng.aw.com/bookdetail.qry?ISBN=0-201-56317-7&ptype=1090>

For Windows, you might hope that Win32::SerialPort module is done
before your assignment is due. <URL:http://members.aol.com/Bbirthisel>
If not, maybe write your own code as an XS extention, or as a
standalone program to call with system().

For the Mac, you might want to use GUSI to speak to the Communications
Toolbox.

For MS-DOS, you might want to see if its handling of the pseudo files
"COM1", and "COM2" do what you want. If not, your choices, again, seem
to be an XS module or another program. (wait. Do any of the MS-DOS
ports talk to a TCP/IP stack? I don't think so. So if you are using
MS-DOS, I don't think you are going to be able to use perl to create a
server that will control the LED.)

-- 
Andrew Langmead


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

Date: 24 Apr 1998 03:12:59 GMT
From: David McKay <mck@rahul.net>
Subject: Re: status output.
Message-Id: <6hovvs$smc$1@samba.rahul.net>

Tom Phoenix <rootbeer@teleport.com> wrote:
: On Thu, 23 Apr 1998, George Kassyousef wrote:
:> Is there a way to clear a line or go back to beginning of the line to
:> write over the 20 and so on.
: Sounds as if you want the curses package. There's a module for this on
: CPAN. Hope this helps!

Is there some reason for not just printing the message with return (\r) 
and no line feed?  e.g.,  print "The status is: $percentage   \r";  

                                          -- David McKay


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

Date: 24 Apr 1998 14:47:27 +0200
From: Gorm Haug Eriksen <xxxgormxxx@p4.no>
Subject: Win32 & Process listing
Message-Id: <m3yawve68w.fsf@tehran.p4inet.no>


hi,

Someone know a way to list processes running on a Windows NT box?

Seems like a pain in the a** according to the fact that this is not
listed in any faqs I have seen, and not described in any Win32 docs I
have looked at...?

Cheers,

-- 
Gorm 

WARNING: By removing all the x's in my emailaddress, you also
confirm that you will not use it for commercial advertising.


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

Date: Fri, 24 Apr 1998 08:40:56 -0400
From: "Bill Hess" <brhess@email.msn.com>
Subject: Win32 .lib vs. .pll
Message-Id: <#qcAh83b9GA.296@upnetnews03>

I was using Activeware Perl 5.003 with two modules which had .pll files in
them.
I am now using Standard Perl 5.004_04 and I want to use the two modules with
it.

I thought copying the files into the appropriate directories would work,
because I have done this successfully before in UNIX, but this was not the
case on Win32

I have noticed that all of the modules on the standard Perl 5.004 come with
 .lib libraries and not .pll - What is the difference and should these be
treated differently?

Bill Hess
brhess@msn.com




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

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 2410
**************************************

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