[7488] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1114 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Oct 2 09:17:10 1997

Date: Thu, 2 Oct 97 06:02: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, 2 Oct 1997     Volume: 8 Number: 1114

Today's topics:
     Re: accessing permissions (rwx) (Tom Grydeland)
     associative arrays prob <webadmin@prestel.net>
     Re: associative arrays prob (Jeremy D. Zawodny)
     Re: Change /etc/passwd <jcarlosd@ford.com>
     Re: expect lib for perl? <ccr@jordan.uni-paderborn.de>
     FilePush Browser Probs <onworld@best.com>
     Re: How do I change group (GID) in perl <mirror@scruznet.com>
     How to write a context sensitive subroutine in PERL? <rayyu@cup.hp.com>
     Re: How to write a context sensitive subroutine in PERL (Jeremy D. Zawodny)
     Re: HTML->RTF ? (Jeremy D. Zawodny)
     Numeric Sort <cstewart@flash.net>
     Re: Numeric Sort (Jeremy D. Zawodny)
     Re: oraperl (Jeremy D. Zawodny)
     Re: Parsing compressed text <seay@absyss.fr>
     Re: perl and HTTP <laurijsd@se.bel.alcatel.be>
     perl and oracle <webadmin@prestel.net>
     Re: perl and oracle (Jeremy D. Zawodny)
     Perl on NT4 and Mac files on NTFS disk. (Patrick769)
     Re: Perl on NT4 and Mac files on NTFS disk. (Jeremy D. Zawodny)
     Re: Perl pack templates ARE crippled (Was: Perl <=> C S <uwe@ptc.spbu.ru>
     Re: post-query form help! (Jeremy D. Zawodny)
     Re: Traceroute, a perl version <ghowland@hotlava.com>
     Trapping Errors on Object Creation <jgostin@shell2.ba.best.com>
     Using Perl Format <IggieBee@worldnet.att.net>
     Re: Using Perl Format (Jason Gloudon)
     Re: Using Perl Format <eike.grote@theo.phy.uni-bayreuth.de>
     Using Win32 API from Perl <curbano@ccg.uc.pt>
     Re: Using Win32 API from Perl (Jeremy D. Zawodny)
     WIN32::ODBC ColAttributes <jmaier@syskonnect.de>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 2 Oct 1997 11:34:08 GMT
From: Tom.Grydeland@phys.uit.no (Tom Grydeland)
Subject: Re: accessing permissions (rwx)
Message-Id: <slrn6371lf.c3k.Tom.Grydeland@mitra.phys.uit.no>

> Tom.Grydeland@phys.uit.no (Tom Grydeland) writes:
> > perldoc -f -X

Martien Verbruggen <mgjv@mali.comdyn.com.au> wrote:
> Yeah, but that only tells him if a certain specific mod is set, not
> what all the mod settings are :).

Of course,  but for the simple cases a -r "filename" is a lot easier
than parsing the permission bits, comparing uids and gids, and if you
see the original question, he appears to want the rwx-parts.

I just pointed out a simple way of doing most of the stuff people want
stat for.  Compare:


($mode,$uid,$gid) = (stat($filename))[2,4,5];
if ((($< == $uid) && (($mode & 0500) == 0500))
    || (($( == $gid) && (($mode & 050) == 050))
    || (($mode & 05) == 05))

with:

if (-r $filename && -x _)


> Martien Verbruggen                  | 

-- 
//Tom Grydeland <Tom.Grydeland@phys.uit.no>


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

Date: Thu, 02 Oct 1997 13:41:03 +0100
From: webadmin <webadmin@prestel.net>
Subject: associative arrays prob
Message-Id: <3433965F.F36EB583@prestel.net>

Hi

I have an associative array which takes in details from a form

$in{'name1'}
$in{'name2'}
$in{'name3'}
$in{'name4'}

etc etc

I want to write these details contained with out to a file.

But I want to do it using a for loop rather than writing exh one out
individually

But I cant figure it out

for ($x=1; $x<=6; $x++)
	{
		print FILE $in{'name$x'};
	}

does not work or any other formation, is there a way around it, or do I
just have to use the longwinded route.

Iqbal


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

Date: Thu, 02 Oct 1997 12:44:21 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: associative arrays prob
Message-Id: <343d96c5.61649106@igate.hst.moc.com>

[cc'd automagically to original author]

On Thu, 02 Oct 1997 13:41:03 +0100, webadmin <webadmin@prestel.net>
wrote:

>Hi
>
>I have an associative array which takes in details from a form

[snip]

>I want to write these details contained with out to a file.
>
>But I want to do it using a for loop rather than writing exh one out
>individually

[snip]

>does not work or any other formation, is there a way around it, or do I
>just have to use the longwinded route.

You want a foreach() in conjunction with keys(). Something along the
lines of:

  foreach my $key (keys(%in)) {
	print "$key is $in{$key}\n";
  } # end foreach

Look up those two in the Perl docs for all the details.

Jeremy
-- 
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio

http://www.marathon.com/

Unless explicitly stated, these are my opinions only--not those of my employer.


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

Date: Thu, 02 Oct 1997 15:03:25 +0100
From: Juan Carlos del Rio <jcarlosd@ford.com>
Subject: Re: Change /etc/passwd
Message-Id: <3433A9AD.1A0E@ford.com>

John Strickler wrote:
> > > >> >Is there any perl function or routine that can send the password
> > > >> >parameters (user, old password,  new password) to the passwd command?
> > > >>
> > > >> The simplest way to do this from a language perspective is to use expect
> > > >> see http://expect.nist.gov.
> > > >
> > > You're suggesting that one use the HTTPD module to change Unix system
> > > passwords? I must have missed something...
> >
> > Yes that is correct. I am trying to work with expect, as J Gloudon
> > suggested. It seems like working in other environments, though I was not
> > able yet to make it work on HP-UX 10.20 and running the /bin/passwd
> > command. I think it can be useful for an Intranet and for changing a
> > password in a system people never access by telnet.
> 
>   Another approach is not to call the external 'passwd' command and operate it via
> expect, but to simply edit the password file with perl... The important concept is that
> with crypt(), you can create an encrypted password suitable for inclusion in the
> password file... I just did this 2 weeks ago on an SCO machine where we needed to automate 
> adding users with specific, externally-determined passwords.
> 
> The syntax is
>     $encrypted_password = crypt($plaintext_password,$salt);
> [a-zA-Z0-9./]
> 
> Salt is any two random characters in the set  [a-zA-Z0-9./], and is used to tweak the
> algorithm so two users with the same password get a different encrypted version.
> I used rand() to get my random characters, you could use time() or somethine different
> if you like.
 
I tested this way, and everything works fine, but I still have the same
problem:
if I want to edit the passwd file with perl, I must be root to save the
changes, and
no web is running as root.

/bin/passwd is the binary I have to use from expect, because it allows
changing users passwd
not being a superuser.

I post this question again: 
Is there any way I can allow users to change their passwords from CGI?


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

Date: Thu, 2 Oct 1997 11:37:19 +0200
From: Christopher Creutzig <ccr@jordan.uni-paderborn.de>
Subject: Re: expect lib for perl?
Message-Id: <Pine.GSO.3.95.971002113629.21584F-100000@jordan.uni-paderborn.de>

On Thu, 2 Oct 1997, Christopher Creutzig wrote:

>  my $save = $|;
>  $| = 1;

 OK, it should be 
 local $|=1;

 local is still useful...

regards,

Christopher Creutzig




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

Date: Thu, 02 Oct 1997 03:11:43 +0000
From: WebMaster <onworld@best.com>
Subject: FilePush Browser Probs
Message-Id: <3433104A.1956@best.com>

I am trying to understand why I can have my PERL script push a file to
NEtscape Nav and have the browser recognize the fileName, yet the same
push to Internet Explorer does not recognize the file, and names it
wrong and does not recognize the exe extension on the end of it either.

I am creating a file to be pushed from the server  with file setup like
this:

   print "Content-Type: application/octet-stream\n\n";
   print "Content-Length: $attribute\n";
   print "Content-Disposition: inline;filename=$pageName\n";

I then do Syswrite of an open file.

On both browsers it causes the standard file filter to pop up and asks
you to save the file, but in the Internet Explorer - it names the file
to the name of my cgi script and puts a strange extension on it that has
nothing to do with an application or an exe type of file.

Anyone know why other than the usual Microsoft SUX.


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

Date: Thu, 02 Oct 1997 04:46:12 -0700
From: Chuck Stein <mirror@scruznet.com>
Subject: Re: How do I change group (GID) in perl
Message-Id: <34338984.12EAE253@scruznet.com>

Solution summary:
Below is one solution involving starting a new shell.  Does anyone
have a way to change the group of the current process?  We've
already tried explicitly setting:

$( = $) = $the_new_group_id;

and it don't work.

----- perl code
open(P,"| newgrp isdb") || die "Can't open \"newgrp isdb\": $!";
print P "date > t7.out\n";    # writes a file with group "isdb"
close 
----- end perl code

Thanks to Jeremy D. Zawodny and Marek Rouchal for their help
and interest!

Chuck Stein
Mirror Imaging
mirror@scruznet.com


On Mon, 29 Sep 1997 09:36:41 -0700, Chuck Stein <mirror@scruznet.com>
wrote:

>Greetings,
>
>How can I change the group ID (GID) inside a perl
>script such that I can delete files of the new group
>that are writeable?  Assume I am changing to a group
>that the calling user is part of (but not their
>default group).


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

Date: Tue, 30 Sep 1997 17:42:07 -0700
From: Raymond W Yu <rayyu@cup.hp.com>
Subject: How to write a context sensitive subroutine in PERL?
Message-Id: <34319C5F.51B6@cup.hp.com>

I would like to write a context sensitive subroutine in PERL
much like localtime. For example:

  $scalar = localtime; # $scalar has a date string
  @array  = localtime; # @array has a list of time elements

I would like to know how to write a subroute to return a string
if it's called in a scalar context(ie $s = foo()), and to return
a hash if it's called in a hash context.

  $scalar = foo();	# gets a string
  %hash   = foo();	# gets a hash

Thanks in advance.

Raymond Yu
rayyu@cup.hp.com


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

Date: Thu, 02 Oct 1997 12:28:23 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: How to write a context sensitive subroutine in PERL?
Message-Id: <343b934b.60759227@igate.hst.moc.com>

[cc'd automagically to original author]

On Tue, 30 Sep 1997 17:42:07 -0700, Raymond W Yu <rayyu@cup.hp.com>
wrote:

>I would like to write a context sensitive subroutine in PERL
>much like localtime. For example:
>
>  $scalar = localtime; # $scalar has a date string
>  @array  = localtime; # @array has a list of time elements
>
>I would like to know how to write a subroute to return a string
>if it's called in a scalar context(ie $s = foo()), and to return
>a hash if it's called in a hash context.
>
>  $scalar = foo();	# gets a string
>  %hash   = foo();	# gets a hash

Have a search thru the Perl docs for 'wantarray'. I think it's just
the sort of thing you're looking for.

Jeremy
-- 
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio

http://www.marathon.com/

Unless explicitly stated, these are my opinions only--not those of my employer.


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

Date: Thu, 02 Oct 1997 12:18:33 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: HTML->RTF ?
Message-Id: <343590e5.60145023@igate.hst.moc.com>

[cc'd automagically to original author]

On Wed, 01 Oct 1997 17:03:13 -0400, pudge@pobox.com (Chris Nandor)
wrote:

>Anyone got something to convert HTML to RTF or Word or something?  Can't
>seem to find anything ...

Actually, relatively new versions of Word can edit HTML, so I'd say
the need for such a tool is diminishing.

I'll withhold judgement on what I think of Word as a product,
though...

Jeremy
-- 
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio

http://www.marathon.com/

Unless explicitly stated, these are my opinions only--not those of my employer.


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

Date: Thu, 2 Oct 1997 06:33:50 -0500
From: "Chuck" <cstewart@flash.net>
Subject: Numeric Sort
Message-Id: <61007b$m5a$1@excalibur.flash.net>

 I have a tab delimited file with name and number.  How can I sort this file
numerically?  Thanks......





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

Date: Thu, 02 Oct 1997 12:27:07 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: Numeric Sort
Message-Id: <343a9294.60576995@igate.hst.moc.com>

[cc'd automagically to original author]

On Thu, 2 Oct 1997 06:33:50 -0500, "Chuck" <cstewart@flash.net> wrote:

> I have a tab delimited file with name and number.  How can I sort this file
>numerically?  Thanks......

I'd read it in, split each line on the tab, stick the data into a
hash, sort it, and re-write the file.

Then again, there are other ways. That's just the first one that came
to mind.

If you're looking for specific code, lookup open(), close(), split(),
and print() in your Perl documentation. In fact, there are examples in
most of the Perl books that will be quite useful. :-)

Jeremy
-- 
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio

http://www.marathon.com/

Unless explicitly stated, these are my opinions only--not those of my employer.


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

Date: Thu, 02 Oct 1997 12:21:45 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: oraperl
Message-Id: <343691b8.60356087@igate.hst.moc.com>

[cc'd automagically to original author]

On Wed, 01 Oct 1997 21:19:34 -0700, MARI J MORTELL
<mari.mortell@Sun.COM> wrote:

>Hi,
>I am interested in oraperl.
>Can anyone point me to information on oraperl?

Sure. Go to AltaVista and search for "oraperl". I did, and it returned
lots o' useful stuff.

Jeremy
-- 
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio

http://www.marathon.com/

Unless explicitly stated, these are my opinions only--not those of my employer.


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

Date: Thu, 02 Oct 1997 11:07:49 +0200
From: Doug Seay <seay@absyss.fr>
To: Doug Roberts <zz---dougr--zz@headspace.com>
Subject: Re: Parsing compressed text
Message-Id: <34336465.7A4DA416@absyss.fr>

[posted, not mailed due to munged address]

Doug Roberts wrote:
> 
> Is there a relatively easy (for a Perl tourist, not purist) way to parse
> gigantic (40+ meg) files that have been conveniently gzip'ed to <4 megs?
> 
> I need to parse our HTTP server logs that are automagically compressed on
> the ISP side, downloaded and processed on a Mac. We may move log processing
> to a WinNT box, but as far as I know neither of those two platforms has a
> command similar to zcat, which is what I was using on Linux, piping it into
> the perl script.
> 
> If there is a Perl specific command to do something similar, I'd love to
> know what it is for use either in MacPerl, NT or Linux Perl versions.
> Ideally, all the log processing would take place on one platform.

Ain't no magic in zcat.  Try gzip with the -d option do decompress and
the -c option to dump to standard output.  This lets you do something
like

	gzip -dc MY_FILE | MY_PERL_SCRIPT

If you want to roll things into a single process, I think that there is
some sort of compression module in CPAN that works with gzip, go root
around a bit.

- doug

<advocacy>
dump NT, go back to Linux
</advocacy>


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

Date: Thu, 02 Oct 1997 13:21:43 +0200
From: Laurijssen Dirk <laurijsd@se.bel.alcatel.be>
Subject: Re: perl and HTTP
Message-Id: <343383C7.3DEC@se.bel.alcatel.be>

Matteo Pelati wrote:
> 
>  I do have a problem like this: when I got a reply from my perl script the
> text sent to the browser isn't interpreted as text/html but just as plain
> text. Anyone of you know wht could be the problem?
> 
> Thanks
> Regards

Add the line  print "Content-type: text/html\n\n";  in front of the
information you send to the browser


                                            Dirk L.


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

Date: Thu, 02 Oct 1997 10:47:42 +0100
From: webadmin <webadmin@prestel.net>
Subject: perl and oracle
Message-Id: <34336DBE.9C0295DD@prestel.net>

Hi

How can I get perl to query an orcale dtabase, and is there a idiots
guide out there somewhere. I can get it to query mSQL but I need to
upgrade to Oracle.


Iqbal


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

Date: Thu, 02 Oct 1997 12:23:25 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: perl and oracle
Message-Id: <34389223.60463972@igate.hst.moc.com>

[cc'd automagically to original author]

On Thu, 02 Oct 1997 10:47:42 +0100, webadmin <webadmin@prestel.net>
wrote:

>Hi
>
>How can I get perl to query an orcale dtabase, and is there a idiots
>guide out there somewhere. I can get it to query mSQL but I need to
>upgrade to Oracle.

You probably want to look at the DBI::* modules on CPAN. There's one
specifically for Oracle, and I've heard lots of good things about it.

Jeremy
-- 
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio

http://www.marathon.com/

Unless explicitly stated, these are my opinions only--not those of my employer.


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

Date: 2 Oct 1997 10:19:32 GMT
From: patrick769@aol.com (Patrick769)
Subject: Perl on NT4 and Mac files on NTFS disk.
Message-Id: <19971002101901.GAA27649@ladder02.news.aol.com>

I am working on a perl script using the stat function to get file info. When
 run with a mac file on ntfs it returns nothing. When the same file is moved to
 a fat disk it returns all file info. Anyone run into this one and how can it
 be corrected.
                                 Thanks Pat



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

Date: Thu, 02 Oct 1997 12:24:42 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: Perl on NT4 and Mac files on NTFS disk.
Message-Id: <3439924e.60506854@igate.hst.moc.com>

[cc'd automagically to original author]

On 2 Oct 1997 10:19:32 GMT, patrick769@aol.com (Patrick769) wrote:

>I am working on a perl script using the stat function to get file info. When
> run with a mac file on ntfs it returns nothing. When the same file is moved to
> a fat disk it returns all file info. Anyone run into this one and how can it
> be corrected.

It returns *nothing*?

Could you post some sample code, maybe?

I'd assume you're doing something like:

 @stats = stat($file);

and you're saying that @stats is empty?

Which Perl distribution are you using?

Jeremy
-- 
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio

http://www.marathon.com/

Unless explicitly stated, these are my opinions only--not those of my employer.


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

Date: Thu, 2 Oct 1997 14:39:53 +0400
From: "Valeriy E. Ushakov" <uwe@ptc.spbu.ru>
To: Doug Seay <seay@absyss.fr>
Subject: Re: Perl pack templates ARE crippled (Was: Perl <=> C Server)
Message-Id: <%9Q3M04naz@snark.ptc.spbu.ru>

On Thu, 2 Oct 1997, Doug Seay wrote:

> You seem to be argueing from the point of view of whatever was done in C
> is "right" and whatever any other languge does is "wrong" unless it is
> compatable with C.  Why is C the one and only norm?

No, I don't think that C or C++ is the only "right" language.  But
let's face it, most of existing operating systems and application
software are written in C or C++.  Browse through your /usr/include,
you will find many examples of structures with `char field[MAXLEN];'.
If you are to interface with that software, symmetric template letter
is very handy.

Here's how I discovered this "feature".  As I often need to write some
wtmp crunching code, I had a little library file with utmp related
constants and $sizeof_utmp and $struct_utmp (with 'A'). The other day
I was to write a wtmp filter.  Surprised I was when I saw the result
of
    print pack $struct_utmp, @wtmp;


> That said, I've always thought that your 'Z' idea was a good one.  You
> are right that trailing spaces at the end of a string might be valid and
> neither 'a' nor 'A' handle this well.  I've always just used 'A' because
> I needed the spaces to keep the field sized fixed, I've never cared
> about them in my variable.

When you talk both ways, you need your strings padded with nulls
because this is the way C wants it, for good or bad.

> You seem to have put quite a bit of effort into this, including making
> patches and having email conversations with a number of people.  What
> makes you think that your work is being abandoned?  Is it just radio
> silence from the porters?  Has someone said that they hate your idea and
> refuse to apply the patch?  I'm not a porter, I've never been in contact
> with Malcom, Chip or any other pumpkin holder, but I'd imagine that they
> are busy folks.  Maybe someone just forgot to reply?

A month ago, when I complained about the silence, Tom Phoenix
suggested ``You can probably finish up with a request like "Can anyone
see a reason why this shouldn't be implemented?  If not, I'd like to
see it incorporated in an upcoming release."''  but I never managed to
find a time to do this.  I had a free minute when I saw the thread, so
I jumped in, may be somewhat too aggressively (for which I sincerely
apologize).

As most p5p folks read clpm:

    Can anyone see a reason why this shouldn't be implemented?  If
    not, I'd like to see it incorporated in an upcoming release.


PS: Please Cc your follow-ups by e-mail as my newsfeed is terrible.

SY, Uwe
-- 
uwe@ptc.spbu.ru                         |       Zu Grunde kommen
http://www.ptc.spbu.ru/~uwe/            |       Ist zu Grunde gehen


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

Date: Thu, 02 Oct 1997 12:16:03 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: post-query form help!
Message-Id: <34349006.59922123@igate.hst.moc.com>

[cc'd automagically to original author]

On Mon, 29 Sep 1997 13:08:50 -0700, MT <sac31277@saclink.csus.edu>
wrote:

>Hi everyone.
>I am in desperate need of help getting my script to work on my WinNT4.0
>server.  The script is a post-query.c program and will not work from
>the web browser! I keep getting Server Error!...and it links with
>misconfiguration.  I am using the Netscape Enterprise server for my
>cgi-bin directory.  I also have tried using the script as .exe/.cgi 
>on my cgi directory with proper permissions.  and still nothing.
>I would appreciate any help you might have.

Sounds to me like you're trying to use C source code as a 'script',
which just isn't something you [can] do.

If you want a Perl solution, I'm guessing you did since this is a Perl
newsgroup, check out the FAQ and the CGI modules on the Comprehensive
Perl Archive Network (CPAN).

Jeremy
-- 
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio

http://www.marathon.com/

Unless explicitly stated, these are my opinions only--not those of my employer.


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

Date: Thu, 02 Oct 1997 12:09:48 +0100
From: Gary Howland <ghowland@hotlava.com>
Subject: Re: Traceroute, a perl version
Message-Id: <343380FC.200E@hotlava.com>

Russ Allbery wrote:
> 
> [ Posted and mailed. ]
> 
> Mark Worsdall <jaydee@worsdall.demon.co.uk> writes:
> 
> > 2) I would like to implement my own version of traceroute in perl so I
> > can get the last domain name (text address as oppose to Number) seen.
> 
> traceroute requires raw sockets, involves a lot of low-level diddling with
> ICMP packets, and would therefore require that your Perl script run as
> root on a Unix system.  I'm honestly not sure if it's even *possible* to
> do this in Perl on a non-Unix system; it's going to depend on what sort of
> networking support you have.

I agree that it's going to be difficult on a non-unix system.  However,
if you're running unix, then my IP perl scripts at
http://www.hotlava.com/software would be a good startinfg point.  The
modules there do stuff like building IP packets, sending them through
the raw interface etc.  You'll find a perl version of ping (and, yes, it
does use ICMP).  There is also a module to read the BPF device (although
there is no rule to bytecode converter yet).

 
> I highly recommend against trying to do this in Perl.  traceroute is a
> tricky bit of network code that's already been done for you and that's
> more naturally done in C; you'll find it *much* easier (and probably more
> secure) to just run the external traceroute binary and capture its output.

I disgree.  I for one would love to see a traceroute written in Perl

Gary
-- 
pub  1024/C001D00D 1996/01/22  Gary Howland <gary@hotlava.com>
Key fingerprint =  0C FB 60 61 4D 3B 24 7D  1C 89 1D BE 1F EE 09 06


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

Date: 2 Oct 1997 10:18:17 GMT
From: Jeff Gostin <jgostin@shell2.ba.best.com>
Subject: Trapping Errors on Object Creation
Message-Id: <60vsd9$2nj$1@nntp1.ba.best.com>

	I apologize, in advance, if this is an FAQ, but after checking many
of the resources offered, I haven't found an answer. I've RTFManpage'd,
checked perldoc, the FAQ, and Programming Perl's error message index. A
brief code snippet is included below, as well. I'm using Perl 5.004_1, and
in specific problem, Net::FTP 2.0 (_very_ neat module, btw!).

	My question, in general terms, is this: How can I tell if an
instance of an object has been successfully created?

	More specifically, here's the relevent line of code (referred to as
<the snippet above> hereafter):

my $ftp = Net::FTP->new($host, @firewall, Debug => $debug ? 1 : 0);

	If $host is an invalid hostname, I get a message indicating this
from Net::FTP. No problem there, but I'm unsure of what to do after that to
gracefully exit the script, with the message of my choosing.

	Thus far, I've attempted the following, all of which generate
either:

1. "Uncaught exception. . ." (dangit, I'm _trying_ to catch it!), or

2. A message indicating that "a package name must be specified . . . " for a
line that tries to use the instance. Fine, so it failed to create an
instance of the object. That's the point of this exercise, to get some nice
error checking into the script for OO problems.

Each "attempt" listed below resided in my script as a result of editting the
previous attempt.

#first attempt, "ugly" for brevity
eval { <the snippet above>};
if $@ { die "$@"; } 

#second attempt, still "ugly"
eval { <the snippet above>; if $@ { die "$@"; } };

#third attempt, $ugly = 1;
<snippet above>

if (ref($ftp) ne "Net::FTP")
{
	die "$@";
}

None of these appear to work as I'm trying to get it to, and generate one of
the two messages indicated above. I'm at a complete loss at this point. If
anyone can assist, I'd _very_ much appreciate it. :)

Thank you, in advance!


				--Jeff Gostin


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

Date: Thu, 02 Oct 1997 06:19:59 -0400
From: Ignacio Bustamante <IggieBee@worldnet.att.net>
Subject: Using Perl Format
Message-Id: <3433754F.3572@worldnet.att.net>

Is there a way of directly saving the output of Perl "Format" to a
variable?

TIA,

Ignacio

----------------------------------------------------
If you make something idiot proof...They will make better Idiots.


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

Date: 2 Oct 1997 11:04:52 GMT
From: jgloudon@bbn.remove.com (Jason Gloudon)
Subject: Re: Using Perl Format
Message-Id: <60vv4k$o79$1@daily.bbnplanet.com>

Ignacio Bustamante (IggieBee@worldnet.att.net) wrote:
: Is there a way of directly saving the output of Perl "Format" to a
: variable?

Did you man perlform - If you do you will find formline().

: Ignacio

: ----------------------------------------------------
: If you make something idiot proof...They will make better Idiots.

Well manpages are idiot proof i guess.

Jason Gloudon


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

Date: Thu, 02 Oct 1997 13:28:01 +0200
From: Eike Grote <eike.grote@theo.phy.uni-bayreuth.de>
Subject: Re: Using Perl Format
Message-Id: <34338541.167E@theo.phy.uni-bayreuth.de>

Hi,

Ignacio Bustamante wrote:
> 
> Is there a way of directly saving the output of Perl "Format" to a
> variable?

Take a look at the 'perlform' manual page. It contains sample code
showing how to do this ("Accessing Formatting Internals").


Bye, Eike
-- 
======================================================================
 Eike Grote, Theoretical Physics IV, University of Bayreuth, Germany
----------------------------------------------------------------------
 e-mail -> eike.grote@theo.phy.uni-bayreuth.de
 WWW    -> http://www.phy.uni-bayreuth.de/theo/tp4/members/grote.html 
           http://www.phy.uni-bayreuth.de/~btpa25/
======================================================================


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

Date: Thu, 02 Oct 1997 09:52:16 +0100
From: Carlos Urbano <curbano@ccg.uc.pt>
Subject: Using Win32 API from Perl
Message-Id: <343360C0.441944B6@ccg.uc.pt>

Is that possible?
How?

Thanks

Urbano




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

Date: Thu, 02 Oct 1997 12:22:26 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: Using Win32 API from Perl
Message-Id: <343791ef.60411637@igate.hst.moc.com>

[cc'd automagically to original author]

On Thu, 02 Oct 1997 09:52:16 +0100, Carlos Urbano <curbano@ccg.uc.pt>
wrote:

>Is that possible?

Yes.

>How?

Using the Win32::API module.

Jeremy
-- 
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio

http://www.marathon.com/

Unless explicitly stated, these are my opinions only--not those of my employer.


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

Date: Thu, 02 Oct 1997 14:20:12 +0100
From: Joerg Maier <jmaier@syskonnect.de>
Subject: WIN32::ODBC ColAttributes
Message-Id: <34339F8C.6632@syskonnect.de>

Hello,
I' m using Roth Consulting' s WIN32::ODBC extension. I' m searching for
a way to get datatypes of columns at a SQL database on Microsoft SQL
Server v.6.5. I found function ColAttributes($Attributes,
[@Fieldnames]), but I don' t know how and if I can get datatypes with
this function. I tried $O->ColAttributes(SQL_COLUMN_TYPE_NAME,
[@FieldNames]) but getting nothing back. (@Fieldnames containing Names
of Columns of a table).

Any comments or suggestions?

thanks Joerg


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

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


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

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

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

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V8 Issue 1114
**************************************

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