[9580] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3174 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jul 16 07:11:25 1998

Date: Thu, 16 Jul 98 04:00:56 -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           Thu, 16 Jul 1998     Volume: 8 Number: 3174

Today's topics:
    Re: "Telnet" Perl Script (I R A Aggie)
        Annoying warning : Variable %s will not stay shared ... <chris.wareham@blackwell.co.uk>
    Re: Arrays <r11354@email.sps.mot.com>
        build option: MULTIPLICITY (Edwin Litterst)
    Re: Changing IP address via perl <joe@we-don't-like-spam-here.bysnet.com>
        database accessing from UNIX dominic01@my-dejanews.com
    Re: database accessing from UNIX <chris.wareham@blackwell.co.uk>
    Re: direct access? <tkil@scrye.com>
        dynamically changing values in html from script.... (Sue & Mike)
    Re: efficiency: print<<"xxx" vs. print greenej@my-dejanews.com
        FORMAT with numbers....? (GEMINI)
    Re: HELP: Internet Database Design questions... (-)
    Re: newbe- execute command on server--- (-)
    Re: OFFTOPIC: Re: HELP: Internet Database Design questi <jamiec@hampton.co.uk>
        passing control of forms in script.... (Sue & Mike)
    Re: passing control of forms in script.... <quednauf@nortel.co.uk>
        Perl 5.0005 for  Win32 ? <mbl@startext.de>
    Re: Perl embedding question - embedding code which call (Des Herriott)
    Re: ping scan (-)
        PROBLEM: Reading Speech File <M.Ahmadi@nortel.co.uk>
    Re: Q: Changing IP address via perl (-)
        real quick and easy - replace.... <joe@rhein.to>
    Re: real quick and easy - replace.... (Real)
    Re: Recipient Validation (-)
    Re: Regexp to handle \\n\n\n (Ilya Zakharevich)
    Re: Restricting refering domains access to script? (-)
        Script to traceroute ip addresses <s.h.atack@pemail.net>
    Re: Script to traceroute ip addresses <Tony.Curtis+usenet@vcpc.univie.ac.at>
    Re: Sendmail ? (-)
    Re: Win NT Perl 5.0 Y2K compliance (I R A Aggie)
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Tue, 14 Jul 1998 17:43:12 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: "Telnet" Perl Script
Message-Id: <fl_aggie-1407981743120001@aggie.coaps.fsu.edu>

In article <35AB9DE6.FF90D667@hydro.on.ca>, Vlado Baskot
<v.baskot@hydro.on.ca> wrote:

+ Could anyone please help me to find Perl "Script" to telnet and check if
+ process is running [ps -ef OR ps -ax]

>From the Net::Telnet docs:

    Here's an example that prints who's logged-on to the remote host
    sparky. In addition to a username and password, you must also
    know the user's shell prompt, which for this example is `bash$'

        use Net::Telnet ();
        $t = new Net::Telnet (Timeout => 10,
                              Prompt => '/bash\$ $/');
        $t->open("sparky");
        $t->login($username, $passwd);
        @lines = $t->cmd("/usr/bin/who");
        print @lines;

    More examples are in the EXAMPLES section below.

James


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

Date: Thu, 16 Jul 1998 10:28:15 GMT
From: Chris Wareham <chris.wareham@blackwell.co.uk>
Subject: Annoying warning : Variable %s will not stay shared ...
Message-Id: <35ADD656.18C77E6A@blackwell.co.uk>

I have some code that gives the following warnings:

  [tcw@sundog packaging]$ perl -c contentPackage 
  Variable "$user" will not stay shared at lib/createManifest.pm line 118.
  Variable "$passwd" will not stay shared at lib/createManifest.pm line 118.
  contentPackage syntax OK

The perldiag.pod says that making block with the
offending variables an anonymous sub should cure
this. My block is defining a class that inherits
from LWP::UserAgent, and can't be an anonymous
sub ...

Is there any way of adapting my code to stop the
warnings? Failing that, can I turn off warnings
for a block?

###################################################

sub checkUrl {
	my ($url, $user, $passwd) = @_;

	require LWP;

	{
		package RequestAgent;
		my @ISA = qw(LWP::UserAgent);

		sub get_basic_credentials {
			return($user, $passwd); # line 118
		}
	}

	my $ua = new RequestAgent;
	my $request = new HTTP::Request 'HEAD';

	$request->url($url);
	my $response = $ua->request($request);

	if($response->code != 200) {
		return(1);
	} else {
		return(0);
	}
}

###################################################

Chris
-- 
chris.wareham@blackwell.co.uk
+44 (0)1865 792792 ext. 3381
http://www.killingmiranda.pair.com/


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

Date: Thu, 16 Jul 1998 10:12:05 +0100
From: Paul Keenan <r11354@email.sps.mot.com>
Subject: Re: Arrays
Message-Id: <35ADC3E5.808804C9@email.sps.mot.com>

Aaargh - I've just been "upgraded" to a Windows NT box, and
am reading with Communicator. (I know, bad combination ...)

I'm not sure what's going on, but I'll find it and sort it out.
Pretend I never spoke.

(I *knew* the problem sounded too easy ...)

Thanks for the clue.
Paul


Martien Verbruggen wrote:
> 
> In article <35AB3140.42ADBF7F@email.sps.mot.com>,
>         Paul Keenan <r11354@email.sps.mot.com> writes:
> 
> > The most serious error seems to be that you don't increment your
> > loop variable $i.
> >
> > Replace
> >     for (...; ...; $i)
> 
> Errrr.. I don't know what's going wrong with your news reader, but the
> original post contained:
> 
> for ($i = 0;$i < MAX;$i) {
>     $array[$i] = $i;
> }
> 
> That clearly increments $i.
> 
> > with
> >     for (..., ..., $i+-+-)
> 
> Where is the operator +-+- documented?
> 
> Martien
> --
> Martien Verbruggen                      |
> Webmaster www.tradingpost.com.au        | "In a world without fences,
> Commercial Dynamics Pty. Ltd.           |  who needs Gates?"
> NSW, Australia                          |

-- 
Regards,                                     Tel: +-44 1355 566168
Paul           Systems Support Engineer      Fax: +-44 1355 265201
   Body Electronics,  Motorola SPS,  East Kilbride,  Scotland


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

Date: Thu, 16 Jul 1998 09:49:15 GMT
From: el@fiz-karlsruhe.de (Edwin Litterst)
Subject: build option: MULTIPLICITY
Message-Id: <35adcbee.12571978@news>

Hi,

I am trying to build perl with -DMULTIPLICITY.
In the Makefile I can read that it doesn't work - I built it and there
really seem to be some problems.
Does anyone use this? It's needed to be able to work with more than
one perl interpreter in one process (e.g. called from C) or in my case
I am calling C from perl which itself is calling perl again (this has
to be another interpreter instance).

Thanks in advance for any help,
Eddie



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

Date: Thu, 16 Jul 1998 05:09:03 -0500
From: "Joe Hance" <joe@we-don't-like-spam-here.bysnet.com>
Subject: Re: Changing IP address via perl
Message-Id: <6okjgi$4vu$1@news.iquest.net>


Bullwinkle wrote in message <35A8B682.C46C6239@whatsamattau.edu>...
>I routinely move my laptop between the ethernet at work and an ethernet
>at home. I've got the changes needed down to just changing the IP
>address and rebooting. However, it's still kludgey.
>


You might try NetSwitcher from www.netswitcher.com





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

Date: Thu, 16 Jul 1998 09:37:15 GMT
From: dominic01@my-dejanews.com
Subject: database accessing from UNIX
Message-Id: <6okhkc$uvk$1@nnrp1.dejanews.com>



Hello Perlians,

Is there any way to create and access a (any) database in a UNIX from Perl?

I am using Perl-5.004 in a Solaris environment. I just want some examples to
create a new database and add/delete/update some records.

Or just point me to the right location.

Thanks and Regards

Dominic

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Thu, 16 Jul 1998 10:45:53 GMT
From: Chris Wareham <chris.wareham@blackwell.co.uk>
Subject: Re: database accessing from UNIX
Message-Id: <35ADDA77.4256307A@blackwell.co.uk>

dominic01@my-dejanews.com wrote:
> 
> Hello Perlians,
> 

Actually, I'm human ...

>
> Is there any way to create and access a (any) database in a UNIX from Perl?
> 

For simple DBM type stuff that binds a hash array to a disk file, have
a look at the AnyDBM_File module. You can use either the dbmopen / dbmclose
or tie / untie functions. The latter are preferred, but the former are
easier to use (though perhaps deprecated?).

For instance:

  dbmopen %dbmfile, "dbmfile", 0666 || die "Unable to open DBM file:\n$!\n";

  $entities{key1} = 'value2';
  $entities{key2} = 'value2';

  foreach(keys %dbmfile) {
    print $_, ' = ', $dbmfile{$_}, "\n";
  }

  dbmclose %dbmfile;

Writes the folowing to stdout:

  key1 = value1
  key2 = value2

For interfacing to relational databases, there are the DBD / DBI modules
and MySQL module. I use MySQL as it's a great database, and free!

Chris
-- 
chris.wareham@blackwell.co.uk
+44 (0)1865 792792 ext. 3381
http://www.killingmiranda.pair.com/


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

Date: 16 Jul 1998 02:30:31 -0600
From: Tkil <tkil@scrye.com>
Subject: Re: direct access?
Message-Id: <gpvf6dwpk.fsf@scrye.com>

[posted and cc'd]

>>>>> "Jim" == Jim Lewis <jrl@ast.cam.ac.uk> writes:

Jim> Is there any way in perl to replace a line in a file without
Jim> having to recreate the whole file? (i.e. like a direct access
Jim> file in FORTRAN)

use the faq:

   http://www.perl.com/CPAN-local/doc/FAQs/FAQ/PerlFAQ.html#How_do_I_change_one_line_in_a_fi

t.
-- 
Tkil * <URL: http://www.scrye.com/~tkil> * hopelessly hopeless romantic.
  "So amplify this little one 	|   She hears as much as she can see
   She's a volume freak       	|   And what she sees, she can't believe."
        -- Catherine Wheel, _Happy Days_, "Judy Staring At The Sun"


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

Date: Sun, 12 Jul 1998 02:26:05 GMT
From: visualsolutions@easynet.on.ca (Sue & Mike)
Subject: dynamically changing values in html from script....
Message-Id: <6o9797$rlk$1@bigdog.easynet.on.ca>


  Hi,

    I am writing a script to control a form that accepts shipping
information.  One of the requirements is that if the country is
Canada, I display the provinces or if the country is USA, then display
the states in the same spot.

   Can this be accomplished via a Perl cgi script or is this something
I have to take care of using some client side java script????


   Thanks

   Mike K



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

Date: Thu, 16 Jul 1998 10:14:22 GMT
From: greenej@my-dejanews.com
Subject: Re: efficiency: print<<"xxx" vs. print
Message-Id: <6okjpu$25b$1@nnrp1.dejanews.com>

In article <6ogisv$je0$1@netnews.upenn.edu>,
  rjking@blue.seas.upenn.edu (Rachel J King) wrote:
> I'm wondering about the efficiency of using print<<"xxx" versus that of
> just writing a whole bunch of print statements.

I had a similar question yesterday, but I'm more interested in the question of
style rather than efficiency.

I have used pring <<TAG; several places in a script, but I had to keep
inventing new TAGs for each print statement. As an alternative, I tried the
following construct, which seemed to work just the same, without the TAG
problem:

print qq{
 ...
A whole bunch of stuff, including $variables,
carriage returns,
    and indented lines.
 ...
};

Any comments/flames to this construction???

JAG
--
# James Greene - Informatics Consulting - D-79539 Loerrach, Germany
# Internet: www.gucc.org/greene/consult - greene@gucc.org
# PGP Fingerprint: 8930 41E7 351B 56D8 801C  D4D9 4C76 AF0F E24E F307
perl -we "$_=join'<',qw{d2by' f5e;f4z($iu w0@86yo=&ae b!097)l(&aa8vme
b$*};$_=unpack'u*',uc;print"

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: 16 Jul 1998 10:14:54 GMT
From: dennis@info4.csie.nctu.edu.tw (GEMINI)
Subject: FORMAT with numbers....?
Message-Id: <6okjqu$3ee$3@netnews.csie.NCTU.edu.tw>


hi there,

  I'd like to use FORMAT statement to print something,
say,

FORMAT aaa =
here is your number: @###.####
$mynumber
 .


however, I don't know how many digits the $mynumber has.
if $mynumber is 1234567.12345, the output will be truncated.
if I preserved more digits for it like @#########.####
there will be too many spaces if $mynumber is small.
how can I express the number as the sprintf("%.4f".... does?
thanks in advance.


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

Date: Thu, 16 Jul 1998 08:31:31 GMT
From: root.noharvest.\@not_even\here.com (-)
Subject: Re: HELP: Internet Database Design questions...
Message-Id: <35adb7b1.175572467@nntp.idsonline.com>

"dogmat" <macdonaldrj@bv.com> Said this:

>>
>Such insight. You probably hang out with your other lonely guy colleagues
>making fun of all those silly users.
>Grow up. And if you have any brains, keep an eye on NT. It may not be better
>than Unix, but it wasn't any better than the Mac either.
>

No, I don't make fun of the silly users, as long as they don't try to
make technical decisions and I don't try to make unqualified decisions
about their jobs, we get along quite nicely.  Of course, drawing an
annual salary well beyond that of most of the "users" makes it a bit
easier to stomach some of the ridiculous stuff I encounter on a daily
basis.  I never dreamed I'd be earning WELL over 150K a year before I
even turned 30.  And as for lonely, well....  If I was, I don't think
I would be for long with the kind of money I'm making.  After 28
months at this ungodly salary, I still have trouble believing it, or
even spending it all.







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

Date: Thu, 16 Jul 1998 09:13:42 GMT
From: root.noharvest.\@not_even\here.com (-)
Subject: Re: newbe- execute command on server---
Message-Id: <35adc3a0.178614603@nntp.idsonline.com>

"User" <user@informatics.net> Said this:

>I need to be able to pause a database server from anywhere.  I can currently
>start and stop the service from anywhere, however this requires that all
>users be out of the application. Pausing is a better solution as the users
>do not have to exit the application.  At the server all i have to do is to
>type the "server.exe" followed by /Pause or /Resume.  Is there an easy way
>to execute this from a web page using a perl script??   If any one has
>detailed instructions please let me know.....
>

I wouldn't suggest it.  You'd just be opening up a nice security hole
that someone could take advantage of.  If you've got a web browser,
chances are you have a telnet client.  Telnet into the machine and do
your work on the command line.  oops, sorry, I suppose you could be
using NT, in which case, serves you right for using NT, because unless
you've installed a telnet-like feature seperately, you can't do that
on NT. ;)




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

Date: Thu, 16 Jul 1998 10:21:35 +0100
From: "Jamie Cruise" <jamiec@hampton.co.uk>
Subject: Re: OFFTOPIC: Re: HELP: Internet Database Design questions...
Message-Id: <900580718.1086.0.nnrp-08.c3ad2585@news.demon.co.uk>

Hi C,
    The bug that you outline is indeed quite serious, though also quite
easily resolved. To dismiss a platform because of such a bug is still
however somewhat naive. For example I cannot see how this is in any way as
serious as some previous unix security holes (e.g. sendmail) I mean,
viewing the contents of a script instead of executing is indeed a big issue,
but not quite as big as allowing remote users to su root and rm -rf /.
However those issues are pretty much resolved and the world has moved
on...Like you should.

Regards J

C. Abney wrote in message <6ojl4j$iku$1@news.infonex.net>...
>In article <6ogl04$69d$1@bvbsd2.kc.bv.com>,
> "dogmat" <macdonaldrj@bv.com> writes:
>> - wrote in message <35aa9523.19867848@nntp.idsonline.com>...
>
>>>Just because you've had a pc on your desk for a couple years does not
>>>make you technically literate.  Using word, or netscape is not a
>>>computer skill, it's being a computer user.  Being a computer user
>>>does not qualify you to make suggestions about network environments.
>
>> Such insight. You probably hang out with your other lonely guy colleagues
>> making fun of all those silly users.
>> Grow up. And if you have any brains, keep an eye on NT. It may not be
better
>> than Unix, but it wasn't any better than the Mac either.
>
>If you *really* want to know why you shouldn't want to do anything using
>NT, or IIS, or any of MS offalings, just point your browser at:
>
>http://www.any.site.stupid.enough.to.serve.asps/default.asp::$DATA
>
>and you will understand that what you don't see is often what you get
>when you buy from MS.  Using a computer on the web is /not/ the act of a
>pedestrian.  Frightening.  Kind of makes one want to stick with perl if
>only to stay away from VBscript ( among its other weaknesses.  I don't
>really know if this works for _any_ scripted page on IIS or not, I am
>only trying to bring the discussion a little closer to on topic. :)
>
>-C
>--
>All your qualifications for kookiness seem to be aimed at eliminating
>yourself simply because you advocate a mainstream product.  That is sort
>of just being a kook who is a conformist.  A bit of a contradiction in
>terms, but a valid description. -Bob O                        C. Abney
>




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

Date: Sun, 12 Jul 1998 02:01:42 GMT
From: visualsolutions@easynet.on.ca (Sue & Mike)
Subject: passing control of forms in script....
Message-Id: <6o95rf$r27$1@bigdog.easynet.on.ca>


  Hi,

     I am writing a script to control a few (about 5) order forms.  I
would like to be able to place buttons on each form to allow the user
to jump to anyone of the pages they want, rathe rthan following a set
order.

   My question is how do I control this in the script?  I have tried
putting multiple submit buttons in the html and giving each a
different value.  When I test this, I do not gete any value for the
field $FORM{'submit'} so I am not able to trap the button that was
clicked......


   any help is greatly appreciated.


    Thanks

    Mike K.



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

Date: Thu, 16 Jul 1998 10:59:07 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: passing control of forms in script....
Message-Id: <35ADCEEB.E0195C0@nortel.co.uk>

Sue & Mike wrote:
> 
>   Hi,
> 
>      I am writing a script to control a few (about 5) order forms.  I
> would like to be able to place buttons on each form to allow the user
> to jump to anyone of the pages they want, rathe rthan following a set
> order.
> 

Hello Sue & Mike, are you one ? 

use CGI qw(:standard);

SWITCH: {
  $routine = 'first', last SWITCH if param('action') eq 'Go to first';
  $routine = 'secon', last SWITCH if param('action') eq 'Go to secon';
  $routine = 'third', last SWITCH if param('action') eq 'Go to third';
  $routine = 'main';
}

print header;
print start_html;
  &$routine;
print end_html;

sub main {
  print startform;
  print submit('action', 'Go to first');
  print submit('action', 'Go to secon');
  print submit('action', 'Go to third');
  print endform;
}

sub first {
  print p("yoh");
}
sub secon {
  print p("doh");
}
sub third {
  print p("bloh");
}

-- 
____________________________________________________________
Frank Quednau               
http://www.surrey.ac.uk/~me51fq
________________________________________________


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

Date: Thu, 16 Jul 1998 11:03:21 +0200
From: Marcus Blaha <mbl@startext.de>
Subject: Perl 5.0005 for  Win32 ?
Message-Id: <35ADC1D9.52F79511@startext.de>

Hi everybody

on
http://www.ActiveState.com/support/faqs/win32/perlwin32faq9.html#How_can_I_use_modules_from_CPAN_

I saw, that this version should include makemaker.

But where is it available ?
The latest I found for Win32 is 5.003_07.


Thanx
Marcus
-- 
Marcus Blaha  				Tel.: +49.228.95996-16 
startext Unternehmensberatung GmbH	Fax.: +49.228.95996-66
Kennedyallee 2 / 53175 Bonn / Germany   Compuserve 101317,3140
http://www.startext.de                  mailto:mbl@startext.de


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

Date: 16 Jul 1998 09:42:31 GMT
From: des@corp.netcom.net.uk (Des Herriott)
Subject: Re: Perl embedding question - embedding code which calls dyn. modules?
Message-Id: <6okhu7$ef6$1@taliesin.netcom.net.uk>

On 14 Jul 1998 10:12:08 GMT, I wrote:
> Hi, I've embedded a Perl interpreter in some C code I've written, which
> is successful so far.  However, I now want to dynamically load a module
> from the Perl script I run, and there's one thing I'm not to sure on:

Worked it out.  It was just me being dumb...

> I've read the docs (in particular perlembed & Advanced Perl Programming,
> chapter 19), which describe what I need to do in the way of calling an
> xs_init() routine.  So, what I've done so far:
> 
>   $ perl -MExtUtils::Embed -e xsinit -- -o xsinit.c -std DBI

I didn't need to specify DBI at all here, since "-std" brings in
DynaLoader, and that handles pulling in DBI.so if I do a "use DBI" in
my embedded code.  Have I got that right?

-- 
Des Herriott
des@corp.netcom.net.uk


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

Date: Thu, 16 Jul 1998 08:38:27 GMT
From: root.noharvest.\@not_even\here.com (-)
Subject: Re: ping scan
Message-Id: <35adbb70.176518316@nntp.idsonline.com>

James Nessen <nessenj@ns.net> Said this:

>I was curious if anyone has developed a perl application that will ping a
>range of ip's to see if anything is alive, ie you give it
>xxx.xxx.xxx.xxx/24 and it will ping the entire class c? or a /26, /29 etc.
>
>if anyone has, id be curious to see, ive been trying but i dont know where
>to start :-)
>

I don't know about this.... I can imagine you could annoy quite a few
people by having a program that pings all 254 hosts on someone's class
C block.  Not to mention that on many blocks, some host addresses are
unused, so you'll be pinging non-existant hosts.




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

Date: Thu, 16 Jul 1998 08:59:25 +0100
From: Masoud Ahmadi <M.Ahmadi@nortel.co.uk>
Subject: PROBLEM: Reading Speech File
Message-Id: <35ADB2DD.1481@nortel.co.uk>

Hi everybody,
I am trying to read some speech files with 16-bit samples stored in the
binary file.  I would like to know how can I read individual sample of
2-bytes, and how can I then write them into another file with similar
format.  

I have used sysread/syswrite but these wouldn't let me read individual
samples.

Any help would be appreciated.

Masoud


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

Date: Thu, 16 Jul 1998 08:57:29 GMT
From: root.noharvest.\@not_even\here.com (-)
Subject: Re: Q: Changing IP address via perl
Message-Id: <35adbf99.177582662@nntp.idsonline.com>

>Bullwinkle <at@whatsamattau.edu> writes:
>
>> 
>> I routinely move my laptop between the ethernet at work and an ethernet
>> at home. I've got the changes needed down to just changing the IP
>> address and rebooting. However, it's still kludgey.
>> 
>> 1) Is there a perl module that will let me write a script to change the
>> machine's IP address?
>> 2) Any conceivable way to "restart" just the ip stack, rather than the
>> entire machine?
>

I'm probably defeating the whole exercise here, but why not just make
it so you can use the same IP address both at home and at work??  I'm
guessing you have no say in the matter at work, but you most likely do
at home, so use the work IP at home.

I can't imagine there would be a problem, unless of course you've got
your home LAN connected to the internet without a firewall or proxy.

It shouldn't matter on a single segment LAN that you are using what
might be a "valid" IP elsewhere.... if it's not communicating with
other networks, it should never conflict with the legitimate user of
that IP address.




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

Date: Thu, 16 Jul 1998 10:18:03 +0200
From: "joe" <joe@rhein.to>
Subject: real quick and easy - replace....
Message-Id: <6okct4$7fb$1@usenet36.supernews.com>

Hello what is the function for replacing characters in a string... I cant
find anything on this in my "learning perl book"

thanks

joe




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

Date: Thu, 16 Jul 1998 10:54:40 +0200
From: real@earthling.net (Real)
Subject: Re: real quick and easy - replace....
Message-Id: <MPG.1017de3ef889e5719896b3@news.surfnet.nl>

joe wrote;
> Hello what is the function for replacing characters in a string... I cant
> find anything on this in my "learning perl book"

Hey Joe,

My first reaction is; get another "learning perl book"  :o)

In general, replace strings using :  $line =~ s/this/that/;
which will replace "this" by "that" in $line. There are some options (i, 
o, and g) but you'll have to check the documentation on this. There are 
also some related 'functions'.

Check http://www.perl.com for some online docs.

Good luck on learning Perl,
Real


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

Date: Thu, 16 Jul 1998 09:01:45 GMT
From: root.noharvest.\@not_even\here.com (-)
Subject: Re: Recipient Validation
Message-Id: <35adc120.177973979@nntp.idsonline.com>

"H.P. Buerki" <webmaster@mediapromotion.ch> Said this:

>That's not an answer !!!
>
>You better don't write something than these!
>
>It's possible to validate an E-Mail Address via nslookup -q=mx and check
>trough the Servers manually via telnet an vrfy and so on.
>
>I don't think so that nobody had ever an Idea to automate this Process.
>
>

Ummm... at that point, what have you gained?  If you just sent the
damn message you'd eventually get a returned mail notification or you
will immediately get a 5xx response code.




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

Date: 16 Jul 1998 08:32:18 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Regexp to handle \\n\n\n
Message-Id: <6okdqi$4vg$1@mathserv.mps.ohio-state.edu>
Keywords: from just another new york perl hacker

[A complimentary Cc of this posting was sent to brian d foy
<comdog@computerdog.com>],
who wrote in article <comdog-ya02408000R1507981655520001@news.panix.com>:
> after the first match, the engine is immediately finds
> '\n', and there is no character to match the negated character
> class.  we can, during a global match, influence the position
> of the match with pos().  if we tell the regex engine to move
> back one character after the match:
> 
>    while( $value =~ s/ ([^\\]) \\ n/$1\n/xg ) { pos($value)-- };
> 
> the character for preceding the next two can be compared to the
> negated character class.  in simpler terms, the regex takes one
> step backwards before trying the next match.
> 
> good luck :)

What is this /g doing there?  I'm not sure which way you extrapolate
what happens with scalar-context //g to what happens with
scalar-context s///g (I do not claim that your extrapolation is wrong,
but it is definitely undocumented).

Btw, I was thinking about a way to specify a pos() of a literal, as in

     "foo\Gbar";	    # pos() after 'foo'

Then one would be able to write the above substitution as

     $value =~ s/ ([^\\]) \\ n/$1\G\n/xg

(Imagine RE with minimal smarts, and 

   $value =~ s/ ([^\\]) \\ n/ $tmp = "$1\n"; pos $tmp = length $1; $tmp /xge;
)

Ilya


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

Date: Thu, 16 Jul 1998 09:10:18 GMT
From: root.noharvest.\@not_even\here.com (-)
Subject: Re: Restricting refering domains access to script?
Message-Id: <35adc2cc.178402706@nntp.idsonline.com>

"Doug Younger" <cgi-bin@mindspring.com> Said this:

>Hello,
>$ENV{REMOTE_HOST} is the machine where the end user is sitting at... (or
>$ENV{REMOTE_ADDR} for IP address.
> If you want where the script was called from (from a web page not on the
>same server), which I doubt is the case, but just in case, use:
>$ENV{HTTP_REFERER} will need to split out the server portion as it contains
>the entire URL.


You don't need to split out the server part at all, just do this:

if ($ENV{HTTP_REFERER} !~ /myserver\.com/)
	{
	print "Location: homepage.htm\n\n";
	}
else
	{
	<other stuff>



BUT!!!  Keep in mind that document referrer is not always accurate.
some versions of AOL will keep using the same referer when retrieving
images within a page, and other "browsers" (they may not even be
browsers) may not even include a referring document whatsoever.




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

Date: Thu, 16 Jul 1998 09:39:14 +0100
From: Simon Atack <s.h.atack@pemail.net>
Subject: Script to traceroute ip addresses
Message-Id: <35ADBC2A.AC866AD@pemail.net>

Can anyone help me with a script to traceroute a whole class c network
address so that it can display the list of nodes that are active and how
they are got to.  I am new to perl and have not really used it much
before.

Simon



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

Date: 16 Jul 1998 11:28:50 +0200
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: Script to traceroute ip addresses
Message-Id: <7x3ec25elp.fsf@fidelio.vcpc.univie.ac.at>

Re: Script to traceroute ip addresses, Simon
<s.h.atack@pemail.net> said:

Simon> Can anyone help me with a script to traceroute a
Simon> whole class c network address so that it can display
Simon> the list of nodes that are active and how they are
Simon> got to.  I am new to perl and have not really used it
Simon> much before.

step by step

1. how to launch traceroute: perldoc -f open, perldoc perlipc
   (hint: pipe)

2. capture output: use of <> operator, perldoc -f chomp

3. interpret results: perldoc -f split, perldoc perlre

4. Look in CPAN for the Net:: family of modules.

Hopefully that will get you to the point where you have some
code.  Then you can post the code and tell us what it should
do, what it actually does, and what you don't understand
about the problem.

helping people help themselves to help
tony
-- 
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: Thu, 16 Jul 1998 08:47:21 GMT
From: root.noharvest.\@not_even\here.com (-)
Subject: Re: Sendmail ?
Message-Id: <35adbca5.176826560@nntp.idsonline.com>

Zenin <zenin@bawdycaste.org> Said this:

>- <root.noharvest.\@not_even\here.com> wrote:
>	>snip<
>: >#!/usr/tools/bin/perl  -*-perl-*-
>: First of all, get rid of that crap at the end "  -*-perl-*-"  (I'm
>: showing an ascii character that may or may not produce a problem in
>: some interpreters.  Either way, it's a worthless thing that has no
>: purpose.
>
>	You're right, the META-W char should not be there, but the
>	-*-perl-*- is both valid (doesn't affect perl at all),
>	worthwhile, and has a very useful purpose, at least to users
>	of Emacs.  It tells Emacs to use "perl" mode, if it has such
>	a mode available.  Emacs (very correctly) doesn't try to gage
>	editor settings (autoindent, etc) by file suffix if it can
>	help it.
>

Ahh....  I stand corrected.  It looked to me like a WaREz DUdeZ
decoration kind of thing like a 14 year old would do.  ;)





>
>	And who in there right mind does. :-)

But vi is great... you just need to know how to use it, I suppose.  Of
course, I'm the antithesis of the typical computer user... I prefer
less bells, less whistles, and no extras popping up every time I try
to do something.


>
>: just use it to find the line, then use your windows
>: based text editor to do the editing ;)
>
>	s/windows based/joe, emacs, vim, (anything but stock vi)/
>

I know... I know... everyone knocks vi, but for a quick edit of a
script, you can't beat it. 

 vi filename [enter]  [esc] : 100 [enter] d d a <new line typed in>
[esc] : w q [enter]  DONE!




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

Date: Tue, 14 Jul 1998 17:41:25 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Win NT Perl 5.0 Y2K compliance
Message-Id: <fl_aggie-1407981741250001@aggie.coaps.fsu.edu>

In article <35ABA25D.6689C6FE@corp.disney.com>, Michael Yee
<michael_yee@corp.disney.com> wrote:

+ Does anyone know if Perl 5.0 for Windows NT 4.0 (SP3) is Year 2000
+ compliant? Thanks,

Why don't you lie to your machine and convince it the year is 2004, and
then run this in perl:

$local_time=localtime();
print $local_time,"\n";

Depending on the port of perl, perl probably depends on the underlying
NT time libraries. Is NT itself Y2K compliant?

James


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

Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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

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