[18479] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 647 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Apr 7 09:05:44 2001

Date: Sat, 7 Apr 2001 06:05:13 -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: <986648713-v10-i647@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sat, 7 Apr 2001     Volume: 10 Number: 647

Today's topics:
    Re: $text in a text file - how do I get it to print? <alan@scotlpuk.com>
    Re: complaint about moderation of this group (Gwyn Judd)
    Re: complaint about moderation of this group (Gwyn Judd)
    Re: complaint about moderation of this group (Mark Jason Dominus)
        Copy a directory structure <root@novastar.dtdns.net>
    Re: Database queries from a web browser Questions.... <a.v.a@home.nl>
        Go jump in the lake (was: cookie woes) nobull@mail.com
    Re: Go jump in the lake (was: cookie woes) <uri@sysarch.com>
    Re: newbie help - replace <P> tags only if within <DIR> (Logan Shaw)
    Re: password encryption <SiStie@nuclear-network.com>
    Re: password encryption <SiStie@nuclear-network.com>
        perl 5.6 and apache <a.v.a@home.nl>
    Re: perl hacker wanted (Tony L. Svanstrom)
    Re: perl->speech <bmb@ginger.libs.uga.edu>
        Radius detail File to csv <matt@webexplorers.com.au>
    Re: snmpwalk with perl nobull@mail.com
        The return value takes no notice about the exact match. <kalle@tvettsvamp.a.se>
    Re: time difference 2 nobull@mail.com
    Re: Using ftell() and fseek() nobull@mail.com
        Wait a proccess to finish <root@novastar.dtdns.net>
    Re: Why Perl? <gtoomey@usa.net>
    Re: Win32 fork() hangs - activestate perl build 623 <carvdawg@patriot.net>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sat, 7 Apr 2001 11:23:49 +0100
From: "Alan Fleming" <alan@scotlpuk.com>
Subject: Re: $text in a text file - how do I get it to print?
Message-Id: <nRBz6.2915$cF4.498697@news6-win.server.ntlworld.com>

Thanks everyone

Alan
"Wyzelli" <wyzelli@yahoo.com> wrote in message
news:vR9z6.11$YK2.2752@vic.nntp.telstra.net...
> "A_Geekette" <moiraine{NOSPAM}@qwest.net> wrote in message
> news:3ACD2719.3A9402B9@qwest.net...
> > Alan Fleming wrote:
> >
> > > I have a program which reads info from a plain text file, containing
> > > variable names, eg:
> > >
> > > Hi, my name is $name, and I am $age years old...
> >
> > This will display $name as the value of $name, etc:
> > print "Hi, my name is $name, and I am $age years old.";
> > This will display "$name":
> > print 'Hi, my name is $name, and I am $age years old.';
> >
> > It's the difference between the single and double quotes.
>
> Not when $name is within a scalar read in from a text file, as the OP
> described.
>
> As other responders have already said, PerlFAQ4 gives the answer, though
it
> is probably A Bad Way to do things.
>
> Wyzelli
> --
> push@x,$_ for(a..z);push@x,' ';
> @z='092018192600131419070417261504171126070002100417'=~/(..)/g;
> foreach $y(@z){$_.=$x[$y]}y/jp/JP/;print;
>
>




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

Date: Sat, 07 Apr 2001 07:57:16 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: complaint about moderation of this group
Message-Id: <slrn9ctluq.79v.tjla@thislove.dyndns.org>

I was shocked! How could Kyle Dusang <hhsoft@csoft.net>
say such a terrible thing:
>To whom it may concern: I was under the (perhaps mistaken) impression
>that usenet was a forum in which to exchange information and for
>novices to be able to ask questions and for those more experienced or
>knowledgable to answer said questions if they so desire. I was also
>under the impression that Perl was a programming language that was
>used to create web applications. Sorry if this isn't as eloquently

You seem to be labouring under a bunch of misconceptions. I doubt that
this will help you, possibly you may be able to get the chip off of your
shoulder for long enough to let some of it sink in. Actually I think you
are a troll and a bit of an ass so really I'm just writing this to get
some stuff off my chest.

1) Perl is a perfectly general programming language that is used for all
sorts of things. If I wrote a Perl program to cook my breakfast, would
it make sense to ask here for a good recipe for French Toast?

2) The Usenet Cabal TINC decided long ago that you should never be
allowed to post here. That is why you never got any helpful responses.
Not that actually there are no moderators and  you just consistantly
have posted off-topic questions.

3) It's Perl. Not PERL. If you didn't take the time to figure out the
correct name of the language, how do you expect to learn to even program
in it?

4) This (as someone else so eloquently put it) is a discussion group,
not a help desk. If you ask a question and it is answered, then great.
If not, get over it.

5) If I want to, I can killfile you. That means that I personally cannot
see your posts. That stops nobody else from being able to see your
posts. You see that newsgroup over there entitled
"comp.lang.perl.moderated"? You see the "moderated" bit?

6) You might want to try alt.perl. I hear they get lots of CGI questions
over there. Incidentally, hardly anyone who really knows anything about
Perl posts there. The two facts are interrelated.

7) You assume too much about what the regulars of this group are
interested in. Just because they are interested in Perl doesn't mean
they are interested in CGI. If they aren't interested in it, why would
they be able to answer your question? The best you could hope for is a
half answer. You are better directing your question to a more
appropriate group whose topic centers around the focus of your question.

8) Actually we like helping people. I personally have helped hundreds
(possibly thousands) of people with Perl related problems here and in
numerous other forums. I (wouldn't speak for anyone else) don't do it
for money or kudos or anything like that. I just like helping people.

10) None of us care that you have gone and wont come back.  Actually
until you whined I expect none of us even knew you existed.  Usenet is
like that. We don't have some sort of "quota" of posts that we have to
meet. Actually this newsgroup is I would say one of the most popular
newsgroups around. And most people seem to get on just fine.

-- 
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
I don't wanna argue, and I don't wanna fight,
But there will definitely be a party tonight...


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

Date: Sat, 07 Apr 2001 07:58:29 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: complaint about moderation of this group
Message-Id: <slrn9ctm14.79v.tjla@thislove.dyndns.org>

I was shocked! How could Uri Guttman <uri@sysarch.com>
say such a terrible thing:

>BZZZZT! wrong. please try again. if i use perl to write a recipe
>program, am i allowed to ask about how to saute here? if anything
>possibly done with perl is on topic, then tell me what is off topic?
>perl can be used to program anything.

Hah! I'd like to see you write a Perl program to cut down a Redwood with
a bana...Whoops, wrong thread.

-- 
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
"The Lord gave us farmers two strong hands so we could grab as much as
we could with both of them."
		-- Joseph Heller, "Catch-22"


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

Date: Sat, 07 Apr 2001 09:37:07 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: complaint about moderation of this group
Message-Id: <3acedfce.4951$261@news.op.net>

In article <rebtct88mrc1frc42v8r21hpa32su5itbr@4ax.com>,
Kyle Dusang  <hhsoft@csoft.net> wrote:
>every time I ask a question in this
>group, one which concerns a PERL script I am working on...some anal
>retentive moderator tells me its off topic and that it doesn't deal
>specifically with PERL....(but it DOES dangit!) and probably kill
>filters me or something...(whatever the heck that means)

Just for the record, nobody with this this name or email address has
ever posted to comp.lang.perl.moderated.

-- 
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print


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

Date: Sat, 7 Apr 2001 15:54:41 +0200
From: "Otenet" <root@novastar.dtdns.net>
Subject: Copy a directory structure
Message-Id: <9an2mc$bd6$1@usenet.otenet.gr>


# This  script  will copy the whole  source directory  tree
# to the  destination. Be carefull  that if the root target
# ( destination ) directory does not exists then it will be
# created. This script will work only on Windows platforms,
# but with some  small changes  will work on unix  as well.
# The destination files will be over  writen if they exist.
# George Bouras
# root@novastar.dtdns.net

my $source_directory = 'f:/temp' ;
my $target_directory = 'c:/temp' ;

&xcopy($source_directory,$target_directory);

############# xcopy subroutine #############

sub xcopy {
my ($pwd,$i)=($_[0],$i++);
die "You have not defined the \$target_directory variable, sorry...\n" if    $target_directory eq "";
die "You have not defined the \$source_directory variable, sorry...\n" if -d $source_directory !=1;
 if (( -d $target_directory !=1 ) && ( -e $target_directory ==1 ))
 {die "Can't continue because a file has target's dir name\n";}
 elsif ( -e $target_directory !=1 )
 { mkdir $target_directory || die "Couldn't create dir : $target_node\n"}
opendir ($i,$pwd) || die "Can't list $pwd\n";
while (my $source_node=readdir $i) {
 next if $source_node=~/^\.*$/;
$source_node       = $pwd.'/'.$source_node;
( my $relative_node ) = $source_node =~/$source_directory(.*)/;
$target_node       = $target_directory.$relative_node;
if (-d $source_node==1) {
 if (( -d $target_node !=1 ) && ( -e $target_node ==1 )) {
 die "Can't mkdir $target_node because a same name file exist\n" }
 elsif ( -e $target_node !=1 ) {
 print "mkdir  $target_node\n";
 mkdir $target_node || die "Couldn't create dir : $target_node\n" } }
else {
 if (( -d $target_node ==1 ) && ( -e $target_node ==1 )) {
 warn "Can't copy $target_node because a same name dir exist\n"; }
 else {
 print "coping $source_node to $target_node\n" if -e $target_node !=1 ;
 (my $copy_target_node) = $target_node; $copy_target_node=~s/\//\\/g  ;
 (my $copy_source_node) = $source_node; $copy_source_node=~s/\//\\/g  ;
 `$ENV{ComSpec} /c copy /b $copy_source_node $copy_target_node`;      }
}
&xcopy($source_node) if -d $source_node==1 }
closedir $i}




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

Date: Sat, 07 Apr 2001 10:01:42 GMT
From: AvA <a.v.a@home.nl>
Subject: Re: Database queries from a web browser Questions....
Message-Id: <3ACEBD3B.6EB6DC85@home.nl>

yes u would like to use cgi and ofcourse the dbi module.

to get started see:  http://www.perl.com/pub/1999/10/DBI.html


have fun



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

Date: 07 Apr 2001 08:07:26 +0100
From: nobull@mail.com
Subject: Go jump in the lake (was: cookie woes)
Message-Id: <u9r8z5ur0x.fsf_-_@wcl-l.bham.ac.uk>

Kyle Dusang <hhsoft@csoft.net> writes jeapardy style:

> On Fri, 6 Apr 2001 20:24:51 +0000 (UTC), abigail@foad.org (Abigail)
> wrote:

> >What makes you think this is a Perl question? 

> Ummmm...maybe because it's a line from a PERL SCRIPT

On a related matter I have a line of Perl code:

print "Go jump in the lake\n";

When I execute this code the user is supposed to stand up from their
computer and go and jump into the nearest inland expanse of standing
water.  In fact they just sit there.

Can some here please tell me what is wrong with my Perl code?

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Sat, 07 Apr 2001 07:54:19 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Go jump in the lake (was: cookie woes)
Message-Id: <x73dblrvpw.fsf@home.sysarch.com>

>>>>> "n" == nobull  <nobull@mail.com> writes:

  n> Kyle Dusang <hhsoft@csoft.net> writes jeapardy style:
  >> On Fri, 6 Apr 2001 20:24:51 +0000 (UTC), abigail@foad.org (Abigail)
  >> wrote:

  >> >What makes you think this is a Perl question? 

  >> Ummmm...maybe because it's a line from a PERL SCRIPT

  n> On a related matter I have a line of Perl code:

  n> print "Go jump in the lake\n";

  n> When I execute this code the user is supposed to stand up from their
  n> computer and go and jump into the nearest inland expanse of standing
  n> water.  In fact they just sit there.

  n> Can some here please tell me what is wrong with my Perl code?

i think what is wrong with nobull's code is the content of the
string. it is way too mild a rebuke. please fix it and repost.

this twit just posted a typical kiddie flame about how this group is so
insensitive to his emotional needs and anything that perl goes near is
on topic. i posted/emailed him to correct his flawed views (which
included using PERL all the time). well of course i get back a response
that i was being anal for correcting the name.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Learn Advanced Object Oriented Perl from Damian Conway - Boston, July 10-11
Class and Registration info:     http://www.sysarch.com/perl/OOP_class.html


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

Date: 7 Apr 2001 02:47:33 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: newbie help - replace <P> tags only if within <DIR> tags
Message-Id: <9amgml$hfq$1@ahab.cs.utexas.edu>

In article <3aceb98a$1@news.microsoft.com>,
Jürgen Exner <juex@my-deja.com> wrote:
>Use HTML::Parser.
>RegExp's are not powerful enough and creating your own parser is not only
>re-inventing the wheel but also very error prone (unless of course you are
>holding a Ph.D. in compiler construction).

While I agree that using HTML::Parser is the best solution for the OP's
problem, I don't think you need a Ph.D. to parse HTML.  I believe it's
just a simple context-free language.  You should even be able to ignore
its structure and treat is as a regular language that happens to be a
sequence of alternating (formatting) commands and text.

All you need is a stack and the ability to tokenize.  I once wrote such
a parser when I wasn't yet aware of the existence of HTML::Parser.  It
took me a day or two, and this was before I had actually learned much
of anything about parsing.

Of course I have to admit things get more complicated when you see HTML
that looks like this:

	<B><I>foo</B></I>

And yes, you really do see this in real HTML, as I found out almost
immediately after I built my parser.  :-(

  - Logan
-- 
whose?  my  your   his  her   our   their   _its_
who's?  I'm you're he's she's we're they're _it's_


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

Date: Sat, 7 Apr 2001 13:01:20 +0200
From: Simon Stiefel <SiStie@nuclear-network.com>
Subject: Re: password encryption
Message-Id: <Pine.LNX.4.31.0104071257180.853-100000@server.stiefel.priv>

On 7 Apr 2001 nobull@mail.com wrote:

> cberry@cinenet.net (Craig Berry) writes:
>
>
> Using POST rather than get only prevents the user accidentally seeing
> the password.  If they users want to see the password they can view
> source.

I don't think so. The password is stored in a database which is invisible
for the users (they have no access through http, only over the script).


Mit freundlichen Gr=FC=DFen,        .~.     Open Minds.
with best regards               /V\             Open Sources.
                               // \\                    Open Future!
Simon Stiefel                 /(   )\_ I N U X
                               ^ ~ ^
--=20
|Simon Stiefel | Zwerbachstrasse 17 | 72555 Metzingen-Glems | Germany |
|SimonStiefel@nuclear-network.com   |  http://www.nuclear-network.com |
|ICQ#: 20196644 | phone: +49(0)7123/379070 | fax: +49(0)179/335990106 |
|Tux#: 114751 | PingoS - Linux-User helfen Schulen | Powered by LiNUX |



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

Date: Sat, 7 Apr 2001 12:56:25 +0200
From: Simon Stiefel <SiStie@nuclear-network.com>
Subject: Re: password encryption
Message-Id: <Pine.LNX.4.31.0104071255190.853-100000@server.stiefel.priv>

On Fri, 6 Apr 2001, Steven Smolinski wrote:

> Simon Stiefel <SiStie@nuclear-network.com> wrote:
> > I have to transmit a password with the "get"-function to my CGI-Script =
(so
> > it can be seen by everyone).
> >
> > What is the easiest way to encrypt and decrypt the password?
>
> In security, "easy" is negatively correlated with "secure."  The easiest
> way is to rot13 the password at the client, and rot13 it again at the
> server.  This also provides no security.

Yes, but I just want someone not to see the password (in plaintext) in the
URL.

This:
http://www.stiefel.priv/cgi-bin/pos/pos.cgi?admin=3D1&admcode=3Dhello
should look like this:
http://www.stiefel.priv/cgi-bin/pos/pos.cgi?admin=3D1&admcode=3Dx9dj40gklfj=
m0

But I don't know how to realize that in perl ;-).

> Rather than encrypting and decrypting the password (symmetric ciphers
> require you to solve the key distribution problem anyway), could you not
> use web services set up to solve this problem already, like SSL?  Once
> you have a secure channel, send the passowrd in plaintext.

afaik SSL wouldn't solve the problem, because the password still can be
seen in the URL.


> Steve


Mit freundlichen Gr=FC=DFen,        .~.     Open Minds.
with best regards               /V\             Open Sources.
                               // \\                    Open Future!
Simon Stiefel                 /(   )\_ I N U X
                               ^ ~ ^
--=20
|Simon Stiefel | Zwerbachstrasse 17 | 72555 Metzingen-Glems | Germany |
|SimonStiefel@nuclear-network.com   |  http://www.nuclear-network.com |
|ICQ#: 20196644 | phone: +49(0)7123/379070 | fax: +49(0)179/335990106 |
|Tux#: 114751 | PingoS - Linux-User helfen Schulen | Powered by LiNUX |




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

Date: Sat, 07 Apr 2001 09:12:14 GMT
From: AvA <a.v.a@home.nl>
Subject: perl 5.6 and apache
Message-Id: <3ACEB1A7.D218405C@home.nl>

i recently installed perl 5.6.0 and now my apache wont work properly
anymore.

its still looking for Cwd.pm in the old @INC from version 5.005 (which i
deleted)

has anyone encountered that aswell and how do i solve this.

thanks.



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

Date: Sat, 07 Apr 2001 09:00:24 GMT
From: tony@svanstrom.com (Tony L. Svanstrom)
Subject: Re: perl hacker wanted
Message-Id: <1erhqh2.1rynh0e16qkpvkN%tony@svanstrom.com>

A_Geekette <moiraine{NOSPAM}@qwest.net> wrote:

> I don't see what the big deal is about job posting.

The rest of us do.

> I mean...wouldn't it be nice to get paid for hacking?

If this is the only way for you to get paid for your work you're not
good enough to get paid for your work.

> I sure as hell would like to get paid.
> Post away with your jobs...if it's good enough, and you're not some
> sleezball co like Intel, I wouldn't mind.

Go hang around the job-NGs then...


        /Tony
-- 
########################################################################
            I'm sorry, I'm sorry; actually, what I said was:
                  HOW WOULD YOU LIKE TO SUCK MY BALLS?
                             - South Park -


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

Date: Sat, 7 Apr 2001 09:01:29 -0400
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: perl->speech
Message-Id: <Pine.A41.4.21.0104070900030.10824-100000@ginger.libs.uga.edu>

On Fri, 6 Apr 2001 charlie.openbsd@home.com wrote:
> if anybody's interested in helping and/or just curious
> here's the code i've written so far
> it's very sloppy and i don't know much about perl
> to clean it up much (maybe there's a tutorial out there on clean perl code?

See perldoc perlstyle

> __BEGIN PERL CODE__

This appears to be written in the Null programming language.

Brad



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

Date: Sat, 7 Apr 2001 19:51:02 +1000
From: "hangover" <matt@webexplorers.com.au>
Subject: Radius detail File to csv
Message-Id: <3acee424$1_4@news01.one.net.au>

Hi all

I am after a *simple* perl script that can parse all the stop records from
my radius detail file into a single "MS Access compatible" csv file.

I want all the data i can get my hands on, so if a user logs on 3 times in
one day, i want to have those 3 lines shown seperately, not all the data of
the 3 calls combined.

I can then import and do *any* query i want on the all the data that is
there rather than what is dictated by some of the perl scripts currently
available.

If someone has such a beast or is feeling generous enough to whip one up, i
would be most appreciative!

I am not able to do something like this myself at this stage :(

here are the relevant portions of the file, it just keeps repeating itself
over and over, obviously the users names and bandwidth changes.

thanks

-Matt


=====================================


Fri Jan 12 01:38:22 2001
 Acct-Status-Type = Start
 Acct-Session-Id = "00000004"
 Acct-Multi-Session-Id = "00000004"
 Acct-Authentic = RADIUS
 NAS-Identifier = "192.168.0.102"
 User-Name = "patcake"
 NAS-Port-Id = 4
 NAS-Port-Type = Async
 Called-Station-Id = "97888000"
 Calling-Station-Id = "unknown"
 Service-Type = Framed-User
 Framed-Protocol = PPP
 Ascend-Data-Rate = 14400
 Ascend-Xmit-Rate = 14400
 Acct-Delay-Time = 0
 Timestamp = 979223902
 Request-Authenticator = Verified

Fri Jan 12 01:50:06 2001
 Acct-Status-Type = Stop
 Acct-Session-Id = "00000004"
 Acct-Multi-Session-Id = "00000004"
 Acct-Authentic = RADIUS
 Acct-Session-Time = 723
 Acct-Input-Packets = 706
 Acct-Output-Packets = 513
 Acct-Input-Octets = 47182
 Acct-Output-Octets = 54351
 Acct-Terminate-Cause = User-Request
 NAS-Identifier = "192.168.0.102"
 User-Name = "patcake"
 NAS-Port-Id = 4
 NAS-Port-Type = Async
 Called-Station-Id = "97888000"
 Calling-Station-Id = "unknown"
 Service-Type = Framed-User
 Framed-Protocol = PPP
 Ascend-Data-Rate = 14400
 Ascend-Xmit-Rate = 14400
 Framed-IP-Address = 192.168.0.110
 Acct-Delay-Time = 0
 Timestamp = 979224606
 Request-Authenticator = Verified

Fri Jan 12 15:32:48 2001
 Acct-Status-Type = Start
 Acct-Session-Id = "00000001"
 Acct-Multi-Session-Id = "00000001"
 Acct-Authentic = RADIUS
 NAS-Identifier = "192.168.0.102"
 User-Name = "moboy"
 NAS-Port-Id = 1
 NAS-Port-Type = Async
 Called-Station-Id = "97888000"
 Calling-Station-Id = "unknown"
 Service-Type = Framed-User
 Framed-Protocol = PPP
 Ascend-Data-Rate = 31200
 Ascend-Xmit-Rate = 45333
 Acct-Delay-Time = 0
 Timestamp = 979273968
 Request-Authenticator = Verified

Fri Jan 12 15:35:05 2001
 Acct-Status-Type = Stop
 Acct-Session-Id = "00000001"
 Acct-Multi-Session-Id = "00000001"
 Acct-Authentic = RADIUS
 Acct-Session-Time = 169
 Acct-Input-Packets = 36
 Acct-Output-Packets = 18
 Acct-Input-Octets = 2628
 Acct-Output-Octets = 1057
 Acct-Terminate-Cause = User-Request
 NAS-Identifier = "192.168.0.102"
 User-Name = "moboy"
 NAS-Port-Id = 1
 NAS-Port-Type = Async
 Called-Station-Id = "97888000"
 Calling-Station-Id = "unknown"
 Service-Type = Framed-User
 Framed-Protocol = PPP
 Ascend-Data-Rate = 31200
 Ascend-Xmit-Rate = 45333
 Framed-IP-Address = 192.168.0.110
 Acct-Delay-Time = 0
 Timestamp = 979274105
 Request-Authenticator = Verified

=========================================




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

Date: 07 Apr 2001 08:00:20 +0100
From: nobull@mail.com
Subject: Re: snmpwalk with perl
Message-Id: <u9u241urcr.fsf@wcl-l.bham.ac.uk>

"T_Boss" <T_boss75@curanet.com> writes:

> Subject: Re: snmpwalk with perl

'with perl' is redundant.

'snmpwalk' appears to be the name of a function you are developing
(since you've not mentioned any module).  As such the name of the
function is irrlenvant.  Your question does not relate to SMNP but
calling functions in general.

> @r_modem = (&snmpwalk( $host, $ip, $Input, $Output));

Why is that & there? (If the answer is "I don't know" then loose it).

Why is the RHS enclosed in () ?

> How can I veriffy if the array @r_modem is empty?

!@r_modem

> When snmpwalk is not able to locate the host, it has to notify me.
> How can this be done?

The normal approahes would be to return a status or use the global
variable $@ to return an error message or throw an exception with
die().

> ------=_NextPart_000_0053_01C0BEAD.4EE034F0
> Content-Type: text/html;
> 	charset="iso-8859-1"
> Content-Transfer-Encoding: quoted-printable

Mo, please, Usenet is a plain text medium.  Use HTML only in
newsgroups where it is expressly permitted by the charter.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Sat, 07 Apr 2001 12:04:45 GMT
From: "Kalle Anka" <kalle@tvettsvamp.a.se>
Subject: The return value takes no notice about the exact match.
Message-Id: <xnDz6.5900$4N4.1243094@newsc.telia.net>

The form could be found at http://www.markisspecialisten.com/remove.htm

This is the list that i'm removing from: ( Could be found at
http://www.markisspecialisten.com/guestmail.htm
someone@somewere.com<br>
someone2@somewere.com<br>

This is the script that tells you that your address is removed = perfect
match, even if its not:
#!/usr/bin/perl -w

use CGI qw(:standard);

$filename = "/home/markisspecialisten/www/guestmail.htm";
$backupfile = "/home/markisspecialisten/www/backup.html";
$recipient = 'radera@markisspecialisten.com';

$q = CGI->new();
$email = $q->param( "email" ); # input from form.

print $q->header();
print $q->start_html('Resultat av kommando');
print $q->h1('Resultat av kommando');
(&cleanup);
print $q->end_html();
print "\n";


# Dont allow wildcards
sub cleanup {
  if ($email =~ tr/*?//d) {
print "Du har angivit en otillåten e-post address!<br>\n\n";
print qq {<a href="../remove.htm" target="_top">Försök igen!</a>\n} ;
} else{


    open INFILE, $filename
or return "Couldn't open file for reading";
    @infile = <INFILE>;
    close INFILE;

# Dont allow blanc inputs
if ( $email =~ /^\s*$/ ) {
print "Skriv in din e-postadress för att ta bort den från vår lista.<br>\n"
;
print qq {<a href="../remove.htm" target="_top">Försök igen!</a>\n} ;
exit ;
}

open INFILE, $filename or die "Can't open '$filename': $!";

$line;
  while (<INFILE>) {
    chomp; # drops trailing newlines; can omit if undesirable
    $line = $_, last if /^\Q$email/i && ! /^$/; # substr match!
  }

  close INFILE;
# Return "Your email address is removed."
  print "Din e-postadress fanns med i vår lista och är nu
borttagen.<br>\n\n" if defined $line;

# Return "There is no perfect match so nothing is removed"
  print "Din e-postadress fanns inte med i vår lista.<br>\n\n" unless
defined $line;
  print qq {<a href="../remove.htm" target="_top">Försök igen</a>\n} unless
defined $line;
  print " och kontrollera om det är rätt e-postadress du erhållit vår
information på.<br>\n\n" unless defined $line;
  print "Var noga med att ange små och stora bokstäver.<br><br>\n\n" unless
defined $line;
  print "Kontakta oss på " unless defined $line;
  print qq {<a href="mailto:radera@} unless defined $line;
  print qq {markisspecialisten.com">radera@} unless defined $line;
  print qq {markisspecialisten.com</a>\n} unless defined $line;
  print " om problemet kvarstår." unless defined $line;




    open BACKUP, ">$backupfile"
or return "Couldn't make backup of original file";

    if (@infile) { # Sjekk om den er tom
for $line (@infile) {
    print BACKUP $line;
}
    }

    open OUTFILE, ">$filename"
or return "Couldn't open file for writing";
for $line (@infile) {
 print OUTFILE $line unless ($line =~/^$email</);




}


   close OUTFILE;


}
}










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

Date: 07 Apr 2001 08:13:10 +0100
From: nobull@mail.com
Subject: Re: time difference 2
Message-Id: <u9ofu9uqrd.fsf@wcl-l.bham.ac.uk>

"Waarddebon" <Waarddebon@chello.nl> writes:

> On my site I want to display the difference in time between a file on my
> host and the current time on my host.

To find the difference between two values, A and B, subract one from the
other. Do not just take A and ignore B.

> I've got these lines, notice the last line, it should display the remaining
> time in hours.
> but somehow it doesn't work right... it gives me as result: 274046.027222222
> (hours ????)

 ... since 00:00:00 1/1/1970 UCT (excluding leap-seconds)

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: 07 Apr 2001 08:43:03 +0100
From: nobull@mail.com
Subject: Re: Using ftell() and fseek()
Message-Id: <u9lmpdupdk.fsf@wcl-l.bham.ac.uk>

If you really want help here then learn the rules of common courtesy -
post in the right order.

"Milliwave" <milliwave@rfengineering.freeserve.co.uk> writes:
> >> I would like someone to inform me how I would go about using the
> >> above two functions ftell() and fseek() to move within a file
> >
> >ftell() and fseek() ??  Those are the system calls, but the Perl
> >functions are simply tell and seek.
> >
> >> for example if I want to move to "five" and print everything which
> >> follows into another file how would I go about using the above
> >> functions in Perl?
> >
> >'move to "five"' isn't really the type of thing for which you use
> >seek.  Is there some reason that you want (or need) to solve this
> >problem with tell and seek? 

> Yes, there is a particular reason for doing this, because if I have
> a large file, while I would like to have access to specific lines
> within a text file over and over again.

> for example
> 
> one
> two
> three
> my
> to
> go
> the
> and so
> on
> 
> And I would like to jump to these line say "go" and read everything
> which follows go, then I would like the pointer to jump to two and
> read everythingthing which follows and so forth

On the first pass though the file record the file pointer at each line
that is a possible target.

my %position;

while (<FILE>) {
  chomp;
  $position{$_} = tell FILE if some_condition;
}

Where some_condition is a regex that detects lines that you may
want to be able to jump to later otherwise the as is going to be huge. 

To jump to the first line following "go"

seek FILE, $position{'go'}, 0;

If every line is a possible target then you probably should rethink
your problem.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Sat, 7 Apr 2001 13:46:36 +0300
From: "novastar" <root@novastar.dtdns.net>
Subject: Wait a proccess to finish
Message-Id: <9amr67$7sp$1@usenet.otenet.gr>

I have a script that at somepoint I must wait for a proccess to finish. It
is not a proccess that the main script starts directly so I  know its name
but not the PID. The script must continue after this proccess have finished.
The OS is Windows NT4. Is there any way to monitor the status of this
proccess ?




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

Date: Sat, 7 Apr 2001 20:28:03 +1000
From: "Gregory Toomey" <gtoomey@usa.net>
Subject: Re: Why Perl?
Message-Id: <PLBz6.11102$45.63018@newsfeeds.bigpond.com>

To compliment my Perl programming, I've been programming some Java servlets
(i.e. Java CGI). Well ...

Java doesn't have regular expressions, so there are Java regular expression
libraries out there. And guess what? To be really groovy they claim they
"are compatible with Perl 5". Good Grief!! Why don't you just use Perl.

And how many useful one line Java programs are there?

gtoomey
--------------
"GrapeApe" <grapeape@aol.comjunk> wrote in message
news:20010406224639.03914.00002106@ng-fh1.aol.com...
> Please excuse the broad simplicity of this question, but it is almost
'pre-faq'
> in its nature (I am rereading the FAQs by the way).
>
> I am not really a programmer of any sort by nature. But I did get
interested in
> how I could edit text using GREP. I would ask all sorts of 'how do I do
this
> with a regex' questions on usenet, and the answer would inevitably be,
"Gee,
> you really ought to to this in Perl".
 ...




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

Date: Sat, 07 Apr 2001 08:15:36 -0400
From: H C <carvdawg@patriot.net>
Subject: Re: Win32 fork() hangs - activestate perl build 623
Message-Id: <3ACF04E8.935381E2@patriot.net>

Which os are you running this on?  Win9x?  NT?  2K?

NJ Verenini wrote:

> I need some enlightened advice. This short test program (included at the
> end) hangs in Win32 if $maxproc > 2. It works on Linux/perl 5.6.0 with any
> number.
>
> I ran into this when trying to port some unix perl scripts to windows that
> make liberal use of fork and pipes. The general strategy in these scripts
> is to read from the pipe in the child till the parent tells it to exit.
> There needs to be at least 10 of these subprocesses available, hence the
> roadblock on Win32.
>
> I've read some stuff about the careful use of waitpid() to make sure of
> proper cleanup, but I am unsure of how it would be correctly applied to
> this example. (Note waitpid is called after all the processes are started
> and then told to exit through the pipe.)
>
> When running this with perl -d it wedges in the third call to fork(); it
> never returns and must be killed. The cpu is idle during this time.
> (Hopefully the debugger is not being misleading about where.)
>
> Change $maxproc = 3 to see the hang.
>
> Example code (forktest.pl):
>
> # fork tester.
> use IO::Handle;
>
> use strict;
>
> my $maxproc = 2;
> my @allpids;
>
> select STDERR;
>
> print "Starting " . ($maxproc) . " processes.\n";
>
> for (0..$maxproc-1)
>   {
>     my ($r, $w);
>     my $pidinfo = {};
>
>     pipe ($r, $w);
>     $r->autoflush (1);
>     $w->autoflush (1);
>
>     my $pipe = { READER => $r,
>                  WRITER => $w };
>
>     $pidinfo->{PID} = 0;
>     $pidinfo->{PIPE} = $pipe;
>
>     my $pid = fork ();
>
>     if ($pid)
>       {
>         $pidinfo->{PID} = $pid;
>         close ($pipe->{READER});
>         push (@allpids, $pidinfo);
>         print "Made process $pid, r=$r, w=$w\n";
>       }
>     else
>       {
>         die "cannot fork" unless defined $pid;
>         close ($pipe->{WRITER});
>         my $h = $pipe->{READER};
>         chomp (my $line = <$h>);
>         print "Child $$: From parent: $line\n";
>
>         print "Child $$ exiting\n";
>         close ($pipe->{READER});
>         exit (0);
>       }
>   }
>
> print "\nTelling all " . scalar (@allpids) . " to exit\n";
> foreach (@allpids)
>   {
>     my $pid = $_->{PID};
>     my $h = $_->{PIPE}->{WRITER};
>     print "Writing to $pid, handle $h\n";
>     print $h "Now you will die, process $pid.\n";
>     waitpid ($pid, 0);
>   }
> print "\nDone.\n";
>
> __END__
>
> --
> nverenin@san.rr.com



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

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.  

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


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