[10729] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4328 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Dec 1 00:07:35 1998

Date: Mon, 30 Nov 98 21:00:19 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 30 Nov 1998     Volume: 8 Number: 4328

Today's topics:
    Re: `Scripting languages' are marketing deceipts (was:  (Erik)
        Bug in strict (5.004_04) ajs@ajs.com
    Re: Directory? <rra@stanford.edu>
        does perl support | piping? (was Re: localtime () - per <Russell_Schulz@locutus.ofB.ORG>
    Re: does perl support | piping? (was Re: localtime () - (Larry Rosler)
    Re: emulating sed's "/start/,/stop/<do something>"? (David Combs)
    Re: emulating sed's "/start/,/stop/<do something>"? (Mark-Jason Dominus)
    Re: field selection using "split" - question <jacklam@math.uio.no>
        Flushing <> <mcurley@newscorp.com>
    Re: Folder Recurison <jacklam@math.uio.no>
        Grabing Screen Output <frussell@mcmsys.com>
    Re: Grabing Screen Output <rra@stanford.edu>
        Help - cgi button to call browser's email program <dales@enhanced-performance.com>
    Re: Help - replacing a substring (Alastair)
        local & unwind-protect (Was: Re: regexp on multiple lin (David Combs)
    Re: localtime () - perl's  bug ? <rra@stanford.edu>
    Re: Multiplayer Roleplaying Game, Web-Based, Written in <hotstone@ozemail.com.au>
    Re: Multiplayer Roleplaying Game, Web-Based, Written in (Noel Llopis)
    Re: Obfuscation of perl scripts <rra@stanford.edu>
        PERL & SNMP help please!! <somckit@u.washington.edu>
    Re: Perl to awk? <jlarke@ans.net>
    Re: Perl5.005 in HP-UNIX? <rra@stanford.edu>
    Re: String Insertion <rra@stanford.edu>
        target help <dales@enhanced-performance.com>
    Re: When does CLOSE not FLUSH? <rra@stanford.edu>
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: 1 Dec 1998 01:56:28 GMT
From: eln@cyberhighway.net (Erik)
Subject: Re: `Scripting languages' are marketing deceipts (was: Y2K and Programmer Denial)
Message-Id: <73vicc$mlk$2@news.cyberhighway.net>

In article <73vg2h$ci5$1@csnews.cs.colorado.edu>,
	Tom Christiansen <tchrist@mox.perl.com> writes:
> In comp.lang.perl.misc, finsol@ts.co.nz writes:
>: The distinctions between programming languages, scripting languages,
> 
> There is no such distinction.  It is a myth.

Propagated to keep salaries of "scripters" much lower than those
of "real programmers".  At least, I'm a perl programmer, and I know I get
paid astronomically less than people who program primarily in C...or maybe
that's got something to do with working at an ISP.

-- 
Erik Nielsen, Cyberhighway Internet Services NOC
I don't believe I've ever cuddled my elses.
             -- Larry Wall in <199806221550.IAA07171@wall.org>


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

Date: Tue, 01 Dec 1998 02:22:05 GMT
From: ajs@ajs.com
Subject: Bug in strict (5.004_04)
Message-Id: <73vjrt$cc3$1@nnrp1.dejanews.com>

I was looking at Pod::Html, and came across a bit of code which I thought
should a) not work the way the author had thought it might and b) cause
strict to complain. I did some more research and was horrified to find that:

perl -lwe 'use strict;my $x = 1;&y;&z;
	sub y{$x = 2}sub z{print $x};{package p;$x=3;print $x}print $x'

fails to generate an error, and outputs:

2
3
3

I thought that my was supposed to defend you from such silliness, but in this
case, it's just hiding a global from strict, and what's worse, it's failing to
hide it from the subs!

Either way you feel on this, Pod::Html should be fixed, as it's declaring
everything twice, and the first pass does not take (i.e. on exiting the "use
Pod::Html" the parser promptly thows away all of those variable definitions).

			-AJS

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: 30 Nov 1998 20:21:43 -0800
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Directory?
Message-Id: <ylg1b0pk4o.fsf@windlord.stanford.edu>

Mario Luoni <luoni@gol.com> writes:

> Has anybody encountered the problem that Perl considers something not to
> be a directory, although it is one? I check with

>     if (-d $name) {...}

> but the result of the test is just wrong (not: false).

Does your script have permissions to perform this test?  Observe:

windlord:~> mkdir -p foo/bar
windlord:~> chmod 000 foo
windlord:~> perl -e 'print "not directory\n" unless -d "foo/bar"'
not directory

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: Mon, 30 Nov 1998 20:05:28 -0500
From: Russell Schulz <Russell_Schulz@locutus.ofB.ORG>
Subject: does perl support | piping? (was Re: localtime () - perl's  bug ?)
Message-Id: <19981130.200528.1f6.rnr.w164w_-_@locutus.ofB.ORG>

lr@hpl.hp.com (Larry Rosler) quotes and writes:

>> Determining which year is represented by the name "98" is in
>> general impossible, which is why programs using the system are buggy.
>
> Two-word answer:    CONTEXT    CONVENTION

this could be true only if your programs' output was never fed into
other programs.

but last I checked, perl still `supported' this type of programming.
-- 
Russell_Schulz@locutus.ofB.ORG  Shad 86c


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

Date: Mon, 30 Nov 1998 20:24:19 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: does perl support | piping? (was Re: localtime () - perl's  bug ?)
Message-Id: <MPG.10cd0f52ee46069a989936@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and copy mailed.]

In article <19981130.200528.1f6.rnr.w164w_-_@locutus.ofB.ORG> on Mon, 30 
Nov 1998 20:05:28 -0500, Russell Schulz <Russell_Schulz@locutus.ofB.ORG> 
says...
> lr@hpl.hp.com (Larry Rosler) quotes and writes:
> 
> >> Determining which year is represented by the name "98" is in
> >> general impossible, which is why programs using the system are buggy.
> >
> > Two-word answer:    CONTEXT    CONVENTION
> 
> this could be true only if your programs' output was never fed into
> other programs.

I can't imagine what you are thinking of!  Here is an expansion of a 
snippet I posted yesterday, that shows how a program can disambiguate 
*any* year input (including each of the Y2K bugs):

    $year = ($year % 100 > 69 ? 1900 : 2000) + $year % 100
        if $year < 1900 || $year >= 19100;

This handles the following mappings:

DIGITS  EXAMPLE  OUTPUT  Y2K BUG
  1          0    2000
  2         69    2069
  2         70    1970
  3        100    2000   Forgot % 100
  4       1900    1900
  4       1970    1970
  4       2000    2000
  5      19100    2000   Concatenated to '19'

The CONTEXT for the two-digit disambiguation is the Unix epoch, which 
will do perfectly well for almost all of our programs.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Tue, 1 Dec 1998 03:16:48 GMT
From: dkcombs@netcom.com (David Combs)
Subject: Re: emulating sed's "/start/,/stop/<do something>"?
Message-Id: <dkcombsF39ns0.H4L@netcom.com>

THANK YOU ALL!

suggestion: in EACH book that talks about the .. (ie, every
book, presumably), add in the index a ref under "sed",
ie emulating sed's flip-flop on-off on-off ... ranges.

What I recall reading (and now I will go read it, now
that I know thanks to you all where to look) mentioned
sed, which is what I remembered, and what I looked for.

Might help other unix people coming to perl, basing it
on something they already know and can hook the memory to.

(Of course, I should have remembered the .. myself.  Oh, well.
Thanks!)

David



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

Date: 30 Nov 1998 22:26:24 -0500
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: emulating sed's "/start/,/stop/<do something>"?
Message-Id: <73vnl0$7ca$1@monet.op.net>

In article <5iiv37.432.ln@flash.net>, Tad McClellan <tadmc@flash.net> wrote:
>   s/foo/bar/ if /startHere/i .. /stopdoingitHere/i;

To emulate sed, you need to use the little-known  `...' operator
instead of the more common `..' operator.



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

Date: Tue, 01 Dec 1998 02:34:41 +0100
From: Peter John Acklam <jacklam@math.uio.no>
Subject: Re: field selection using "split" - question
Message-Id: <366347B0.C774E3DF@math.uio.no>

Larry Rosler wrote:
> 
> (...)
> or (using a regex instead of split):
> 
>   ($last_field) = $str =~ m:([^/]+)$:;   # $last_field = "filename"

($last_field = $str) =~ s:.*/::;

Peter
-- 
Peter J. Acklam - jacklam@math.uio.no - http://www.math.uio.no/~jacklam




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

Date: Mon, 30 Nov 1998 12:22:13 -0500
From: "Morgan Curley" <mcurley@newscorp.com>
Subject: Flushing <>
Message-Id: <73uk9h$3lk$1@fisher.nis.newscorp.com>

I am in the process of writing a module that reads templates and uses the
magical <>. Unfortuneately, I am finding that I get file overflow - if there
is any data in the last file read with <> it comes across first. My question
is, is there any way to flush <>, I am localizing @ARGV each time but that
doesn't seem to help.

Morgan




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

Date: Tue, 01 Dec 1998 02:59:44 +0100
From: Peter John Acklam <jacklam@math.uio.no>
Subject: Re: Folder Recurison
Message-Id: <36634D90.CB754D0D@math.uio.no>

Tk Soh wrote:
> 
> Hmm, unfortunately I could only try it on Mac and *nix (I thought
> someone mentiones in this ng both '/' and '\' work on the Windoze
> system, but maybe I am wrong), and the document doesn't mention about
> the portability. (...)

I have used File::Find extensively on Win32 and '/' and '\' are
supported, but there is a problem with using '\' (see below).  The
output from File::Find always uses '/' except for the separators that
are a part of the input argument to find.

But back to the problem:  When find is given 'e:\\',

  perl -MFile::Find -we "find sub {print \"$File::Find::name\n\"}, 'e:\\'"

the output is on my computer:

  e:\
  e:\/acrobat3
  e:\/acrobat3/Reader
    ^^

Likewise, starting at 'e:\\tex\\', I get

  e:\tex\
  e:\tex\/share
  e:\tex\/share/texmf
        ^^

but when given 'e:/' it returns

  e:/
  e:/acrobat3
  e:/acrobat3/Reader

so the preferred way seems to be to use '/' rather than '\'.

Peter

PS.  My File::Find does not contains any version information, but it's
the one shipped with ActiveState's Perl 5.005 patch level 2.

-- 
Peter J. Acklam - jacklam@math.uio.no - http://www.math.uio.no/~jacklam



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

Date: Mon, 30 Nov 1998 16:25:17 -0600
From: "Floyd Russell" <frussell@mcmsys.com>
Subject: Grabing Screen Output
Message-Id: <73v5sr$k1r$1@news.mcmsys.com>

I am sorry if this question is too simple for most of you.

I need to know how to make a Perl program "see" what a program has printed
for a prompt and enter the correct information.
Ex:
[Screen Print]
Enter New Password:

[Perl Program]
system("passwd $password")

need to pass the $password variable to the prompt.
TIA,
Floyd R.






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

Date: 30 Nov 1998 20:42:10 -0800
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Grabing Screen Output
Message-Id: <ylyaoso4m5.fsf@windlord.stanford.edu>

Floyd Russell <frussell@mcmsys.com> writes:

> I need to know how to make a Perl program "see" what a program has
> printed for a prompt and enter the correct information.
> Ex:
> [Screen Print]
> Enter New Password:

> [Perl Program]
> system("passwd $password")

> need to pass the $password variable to the prompt.

In other words, you don't have a program named passwd that takes a
password on the command line; actually, what happens is that passwd
prompts for a password and you want to answer that prompt?  Your question
was a bit confusing.

If my guess is right, this is actually fairly difficult to do, since
passwd goes to some lengths to prevent it.  That's intentional; it's
usually a bad idea to do what you're doing, since changing of system
passwords is critical to the security of the system and should be as
tightly controlled and subject to as few entry points as possible.  Is
there any way to just use passwd itself for this purpose, including the
prompt for the password?

If not, you may want to look at the Expect Perl module, which will allow
you to run passwd in a pseudo-tty, which may be required to capture its
prompts.

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: Mon, 30 Nov 1998 18:20:35 -0800
From: Dale Sutcliffe <dales@enhanced-performance.com>
Subject: Help - cgi button to call browser's email program
Message-Id: <36635272.47684C1C@enhanced-performance.com>

I have a script that contains several different buttons, one button I would like users to be able to click on and their browser's email program
appears for them to be able to email anyone a web page.
For various reasons, it must be activated from a cgi script created button and must not use formmail.
Any ideas?
    Thanks.



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

Date: Tue, 01 Dec 1998 02:01:44 GMT
From: alastair@calliope.demon.co.uk (Alastair)
Subject: Re: Help - replacing a substring
Message-Id: <slrn766jfd.77.alastair@calliope.demon.co.uk>

Dale Sutcliffe <dales@enhanced-performance.com> wrote:
>I would like to replace the a substring (| with &) in a string.  How can I do
>it without prior knowledge of location of the substring or without tearing
>apart the string?

You might want to look at regexes ;

perldoc perlre

or maybe using 'index';

perldoc -f index

HTH.

-- 

Alastair
work  : alastair@psoft.co.uk
home  : alastair@calliope.demon.co.uk


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

Date: Tue, 1 Dec 1998 03:40:09 GMT
From: dkcombs@netcom.com (David Combs)
Subject: local & unwind-protect (Was: Re: regexp on multiple lines, etc.)
Message-Id: <dkcombsF39oux.Ip1@netcom.com>

In article <73fbat$gc$1@gellyfish.btinternet.com>,
Jonathan Stowe  <gellyfish@btinternet.com> wrote:
>On Tue, 24 Nov 98 17:45:50 GMT John Joergensen <jjoerg@crab.rutgers.edu> wrote:
>> Hi.  I hope someone can help with this.
>> 
>> Here's the situation:  I have documents where I have to do many find 
>> operations.  I will be getting multiple matches on some lines, and, there are 
>> several instances where the expression will span two lines.
>> 
>> I have the regexp set to global  (ie. m/regexp/g), and I set the $/ parameter 
>> to null (so I can slurp paragraphs, but not the whole file.  I also set the 
>> expression to accept return chrarcters in all the where the expression may be 
>> wrapped. So far, so good.
>> 
>> The problem is, when I set the $/ to null, I am only getting one match per 
>> paragraph.  
>> 
>> What am I doing wrong?
>> 
>
>local $/;
>
>$blah = <INHANDLE>;
>
>while ($blah =~ /(<pattern>)/msg )
>  {
>     #do something with $1 or whatever
>  }
>
>
>/J\
>-- 
>Jonathan Stowe <jns@btinternet.com>
>Some of your questions answered:
><URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>


Question: that "local" redef of $/.

Suppose in that "do something", ten levels down
in subroutine calls (well, ten levels UP the growing
call-stack-direction), something blows up.

And somewhere down the stack is a catch.  (some caller of caller
of caller of US).

Does the local automatically get unwound?

I mean, what with what Allen in his ancient lisp book
called "shallow binding" (I think that was the name), 
which is what I think perl uses,
if that term means the same when mentioned in perl posts,
then there's got to be an unwind protect or something
that automatically restores these dynamically-scoped variables.


Any answer?

Thanks!

David Combs



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

Date: 30 Nov 1998 20:25:58 -0800
From: Russ Allbery <rra@stanford.edu>
Subject: Re: localtime () - perl's  bug ?
Message-Id: <ylbtlopjxl.fsf@windlord.stanford.edu>

Jarkko Hietaniemi <jhi@alpha.hut.fi> writes:

> Definitely.  I hope whoever designed the contents of struct tm feels
> really ashamed.  There are at least three bad decisions.  (1) The year
> has no good reason [1] to be -1900'ed. (2) The month has no good reason
> to be -1'ed [2].  (3) If the month is -1'ed, why not the day of the
> month?

> [1] "the seconds since 1900-01-01 fit better into a X-bit integer
>      than the seconds since 1-01-01" is not a good reason.  The library
>      should worry about such details, the user shouldn't be punished
>      for poor library implementation.

It's worse than that, of course.  Everything else uses seconds since 1970.

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: Tue, 1 Dec 1998 12:56:33 +1100
From: "Matthew Hotstone" <hotstone@ozemail.com.au>
Subject: Re: Multiplayer Roleplaying Game, Web-Based, Written in Perl.
Message-Id: <73vilp$6m4$1@reader1.reader.news.ozemail.net>


dturley@pobox.com wrote in message <73vgcv$9dq$1@nnrp1.dejanews.com>...
>In article <MPG.10ccb5f985594d869896fb@news.oit.umass.edu>,
>  llopis@zonker.ecs.umass.edu (Noel Llopis) wrote:
>> In article <73unup$jvu$1@nnrp1.dejanews.com>, wyndo@cxo.com says...
>
>> > Tomorrow (December 1st) we will be opening LUNATIX ONLINE: GLOBAL
INSANITY
>> > CRISIS for public play. It's still in Beta and is still undergoing some
>                            ^^^^^^^^^^^^^^^^^^^
>> > development, but it's very playable and integrated chat works --
billions of
>
>
>Guess Noel "forgot" what he read. :-)
>


How does "public play" equate to "you have to pay to use this beta"?
If anything, the statement "we will open BLAH to the public tomorrow"
implies to me you won't have to pay, more than it implies that you will. :)

-matt




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

Date: Mon, 30 Nov 1998 21:00:43 -0500
From: llopis@zonker.ecs.umass.edu (Noel Llopis)
Subject: Re: Multiplayer Roleplaying Game, Web-Based, Written in Perl.
Message-Id: <MPG.10cd17d4f3452b759896fd@news.oit.umass.edu>

In article <73vgcv$9dq$1@nnrp1.dejanews.com>, dturley@pobox.com says...
> In article <MPG.10ccb5f985594d869896fb@news.oit.umass.edu>,
>   llopis@zonker.ecs.umass.edu (Noel Llopis) wrote:
> > In article <73unup$jvu$1@nnrp1.dejanews.com>, wyndo@cxo.com says...
> 
> > > Tomorrow (December 1st) we will be opening LUNATIX ONLINE: GLOBAL INSANITY
> > > CRISIS for public play. It's still in Beta and is still undergoing some
>                             ^^^^^^^^^^^^^^^^^^^
> > > development, but it's very playable and integrated chat works -- billions of
> 
> > They "forgot" to tell us that we'll be paying for the honor of
> > using a Beta version and help them in the development process.
> > How nice of them.
> 
> Guess Noel "forgot" what he read. :-)

I meant the paying, not the Beta. It was an ambiguous sentence though, 
so I deserve that :)

--Noel


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

Date: 30 Nov 1998 20:18:45 -0800
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Obfuscation of perl scripts
Message-Id: <yliufwpk9m.fsf@windlord.stanford.edu>

Santi Cots <fghhf@dj.es> writes:

> The fact is that obfuscating perl is posible through filters. I have
> seen it.

Sure.  It's quite possible.  You can do almost anything in Perl.  Or, for
that matter, observe my signature, which is mildly (and intentionally)
obfuscated.

> But it seems like there were some who don't want to explein the way to
> do it.

I've never done it.  I've never had any need.  I'm therefore not the best
person to tell someone else how to do it, since I don't have any
experience.  I did have a few comments about the more general point this
thread raised, so I offered those.  Like everything else on Usenet, people
are free to ignore unsolicited advice they don't care about.  :)

> News are for collaboration, but most people ask this kind of things: you
> don't need, code is public, no compiling needed, some people can crack
> the obfuscated code.

Well, some of that likely stems from the reasons why a lot of us read this
group and answer questions here.  We don't get our kicks out of being an
encyclopedic information retrieval service, but rather out of a
combination of really helping other people and discussing interesting
stuff.  I personally don't consider teaching someone how to obfuscate
their code to really be helpful to them, particularly compared to
explaining why they probably don't want to do that.

Other people may disagree, and are quite welcome to offer up hints on
obfuscation.  Apparently not many people in this newsgroup are interested
in that particular problem, so there hasn't been a lot of help offered.
The same is true of questions about any other relatively obscure subject.

> OK, i accept some initiated can crack the code, but can someone help me
> in obfuscating some code to dificult modifying it easily.

One of the major difficulties you'll encounter in doing this is that Perl
syntax is very hard to parse, and in order to perform syntactic
transformations of Perl code, you pretty much have to parse it, at least
partially.  That's likely the hardest problem to overcome.

It's quite possible to write some simple regexes that do things like
remove all unnecessary whitespace or keep a hash table of variables seen
in the program, assign randomly generaged names to them, and then go back
and replace all references to a variable with its randomly-generated
replacement.  But most of those implementations will depend on you writing
in a limited dialect of Perl, since they won't be smart enough to parse
the whole language.

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: Mon, 30 Nov 1998 18:31:53 -0800
From: Somckit Khemmanivanh <somckit@u.washington.edu>
Subject: PERL & SNMP help please!!
Message-Id: <36635519.F39379E1@u.washington.edu>

Hi,

I am trying to use the SNMP_Session module. What I need to do is query a
Synoptics 3000 hub to get the count
of IfInOctets that the hub has seen on each of its ports.  This
Synoptics hub has 4 slots, with each slot having a variable number of
ports ( physical plugs for 10baseT cable).  I used Mike Mitchell's
SNMP_util module's snmpwalk subroutine to query the hub's interfaces,
but the snmpwalk routine thinks that there is only one interface on the
hub.

I am really new to SNMP, so could some please give me some guidance on
how I could query each slot, then each port on the slot for the
IfInOctets OID

I know this can be done because we are currently using Sun Netmanager to
query for these values. We want to move off of the SuNNet software onto
PERL.

Any code example would be appreciated. I have stared at Simon Leinen's
page for while but didn't see what
I needed thanks.

Please cc: me at somckit@u.washington.edu

Thanks.

Somckit



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

Date: 30 Nov 1998 23:32:28 -0500
From: Jason Larke <jlarke@ans.net>
Subject: Re: Perl to awk?
Message-Id: <vat67bwqy77.fsf@anthem.aa.ans.net>

>>>>> On 30 Nov 1998 19:44:36 GMT, "watsiyem" <watsiyem@vt.edu>
>>>>> said:

w> I am aware of a program that will convert from awk to Perl,
w> but is there one available to do the reverse?

No. Why write a program to go from good to bad? Things are
difficult enough already. :)
-- 
Jason Larke- jlarke@ans.net- Just a happy little pimp for mayhem
http://www.nnaf.net/~jlarke/   Send mail for PGP public key.
I don't speak for ANS or the international communist conspiracy.
"People change, and smile: but the agony abides."-T.S. Eliot, The Dry Salvages


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

Date: 30 Nov 1998 20:32:51 -0800
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Perl5.005 in HP-UNIX?
Message-Id: <yl67bwpjm4.fsf@windlord.stanford.edu>

Yao, Hsin (EXCHANGE:MTL:1T83) <hsinyao@americasm01.nt.com> writes:

> Has anyone succesfully installed PERL5.005_02 with thread in a HP-UX ver
> 10? I am having a lot of difficulty doing so. Suggestions for any useful
> pointers are appreciated.

It may well be possible to do this, but you should be warned that Perl
5.005_02 is not stable for threaded applications.  The threading in 5.005
was experimental, which translates to pre-alpha, and there were several
serious bugs.

If you want to experiment with threading, you'd be better off getting the
latest development version of Perl (5.005_54 as of this writing).  You
probably don't want to use any version of Perl compiled with threading for
critical production applications at this time.

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: 30 Nov 1998 20:38:32 -0800
From: Russ Allbery <rra@stanford.edu>
Subject: Re: String Insertion
Message-Id: <yl3e70pjcn.fsf@windlord.stanford.edu>

Greg Ewing <gewing@wharton.upenn.edu> writes:

> I'm working on a script that will take a template HTML file, ask a user
> a question such as "What would you like the title to be?" and then take
> the user input and insert it into the template file.  Finally the script
> takes this substituted file and writes it to the file (output.html).

> My question is how do I insert the input text as opposed to just writing
> the text after the proper tag and overwriting the following text.

> I want to take <title>TITLE</title> and replace TITLE with whatever the
> user inputs(longer or shorter then 5 characters).

I'd highly recommend that you use a more distinguished syntax for the part
of the file that you're substituting.  In other words, use something that
you know will never naturally occur in the file.  It will make youre life
much easier.

Consider a template file that contains something like this:

        !!TITLE!!
        !!H1!!
        <p>This is some other stuff to illustrate the point.</p>

and a Perl script that looks like (excerpt):

        while (<>) {
            next unless /^!!(\S+)!!$/;
            my $element = $1;
            print "What would you like for $element? ";
            my $value = <STDIN>;
            chomp $value;
            print OUTPUT "<$element>$value</$element>\n";
        }

If you want something more elaborate, you can make aliases for given
elements with a hash table like:

        %html = (title => TITLE, heading => H1);

and then use !!heading!! in your template and in your Perl script, print
out $html{$element} rather than just $element for the HTML tags.

Hope this helps!

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: Mon, 30 Nov 1998 19:47:02 -0800
From: Dale Sutcliffe <dales@enhanced-performance.com>
Subject: target help
Message-Id: <366366B5.6D6999FA@enhanced-performance.com>

I would like the option to display results in either a separate frame or a new window, depending upon the users' selection.
I've tried:
print "Location: ".$str."\n\ntarget=\"Display\"\n\n";

(display is the name of the second frame)
and for the new window:

print "Content-type: text/html\ntarget=\"_blank\"\n\n";

Neither seem to work.



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

Date: 30 Nov 1998 20:29:54 -0800
From: Russ Allbery <rra@stanford.edu>
Subject: Re: When does CLOSE not FLUSH?
Message-Id: <yl90gspjr1.fsf@windlord.stanford.edu>

Abigail <abigail@fnx.com> writes:

> As the example on 'perldoc -f flock' tells you, you need to do a seek
> after you got the lock.

> open  FH, ">> /my/file" or die $!;
> flock FH, LOCK_EX       or die $!;
> seek  FH, 2, 0          or die $!;  # Seek to the end.

I thought open with a mode of ">>" uses O_APPEND.  If it doesn't, that
strikes me as really odd.  If it does, the seek should not be necessary:

     O_APPEND       If set, the file offset is set to the end  of
                    the file prior to each write.

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

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

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