cgi-bin

2001-05-24 Thread justin todd

Hi.

Can anyone tell me if with IIS on NT4.0 you need to create a cgi-bin or
if you set the file permissions through the IIS Manager?



Re: Matt Wrights Guestbook

2001-05-24 Thread Nigel G Romeril

Sorry, I omitted that particular reason for possible failure, perhaps the enquirer
could tell us what OS they are running and if they are on machine of their own or
rented server space. Then we could make a start on why it is not running.

SunDog wrote:

> But that's the rub ... Change the first line ... isn't it Nigel ?
>
>  if this is done in Windows, the script can get corrupted ...
>
>  the result is ^M's all over the place ...
>
>  When many of these scripts were first made available,
>
>  changes were made directly on the servers , usually with
>
>  telnet ... so the files were configured and saved in ISO format ...
>
>  not always true today ...
>
> regards
>
> SunDog
> ==
>
> At 05:36 PM 5/23/01 +0100, you wrote:
> >Dear all,
> >
> >Actually it does not depend on having an installation of Perl at all, let
> >alone a sane one. I am assuming
> >that the enquirer can take my supplied code, change the first line so that
> >it points to their Perl install
> >directory. Save it as test.pl in a suitable directory, change the
> >permissions and then execute it in their
> >browser or from the command line. If they can do this they will know that
> >they have got most of the set up
> >right and can then attempt to execute a 'real' script. Secondly if they do
> >not understand html how are they
> >going to customise and edit a Guest Book script until it works to their
> >satisfaction.
> >
> >
> >Regards
> >
> >Nigel R
> >
> >"Randal L. Schwartz" wrote:
> >
> >> > "Nigel" == Nigel G Romeril <[EMAIL PROTECTED]> writes:
> >>
> >> Nigel> Try something like;
> >> Nigel> #!/usr/bin/perl -w
> >> Nigel> print "Content-type: text/html\n\n";
> >> Nigel> print "Hello world, it works!\n";
> >>
> >> Nigel> This should print a line of black text on a white background if
> >your path, permissions etc are OK
> >>
> >> Well, the real simplest is:
> >>
> >> #!/bin/sh
> >> echo content-type: text/plain
> >> echo
> >> echo "hello world"
> >>
> >> which doesn't depend on a sane location of Perl installation,
> >> or even understanding HTML. :)
> >>
> >> If you can get exactly "hello world" from that, you're on your way...
> >> if you can't, you need to seek local authority to discover how things
> >> are set up.
> >>
> >> --
> >> Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
> >> <[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
> >> Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
> >> See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl
> training!
> >




Is there an alternative to #!/usr/bin/perl

2001-05-24 Thread Hobson, Neville

I'm writing perl scripts that will be distributed to locations where I
cannot gaurantee the location of perl. Is there a clean alternative to the
shebang with the specific perl path? Maybe using an environment variable to
locate perl?
The camel book suggests the following:

#!/bin/sh --
eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
  if 0;

Is this the best alternative and are there situations in which it might not
work?

Neville

 


 Neville Hobson (E-mail).vcf


Re: Require

2001-05-24 Thread Aaron Craig

At 09:33 23.05.2001 -0700, you wrote:

> >
> > # all modules must return a value when they compile, so stick this
> > line
> > somewhere in your module -- I usually put it at the end of all my
> > declarations and before the main code.
> > return 1;
>
>This is why, when you look at someone else's module, the last line of
>"code" is usually
>  1;

Oops - you have a point.  I use plain old 1 as well -- quick typing will 
always get you in trouble :)

>new() is NOT required to make a module.
>Some sort of constructor is a good idea if you're making an object
>class, but you don't have to do objects to make a module.
>Admittedly, most of the modules I write *are* OO, but it's not
>*necessary*.
>
> > sub new()
> >{
> >my ($proto) = @_;
> >my $class = ref($proto) || $proto;
> >my $self = {};
> >bless ($self, $class);
> >return $self;
> >}

You're right - but in 99% of the modules you use, they have a 
constructor.  Makes it nice and easy to keep your code straight and simple, 
since now you can say $mod->Function() instead of Module::Function.  I like 
thinking in pointers :)

>A module can be as simple as myFoo.pm:
>
>   package myFoo;
>   sub foo { print "bar!\n" }
>   1;
>
>which can be used by foo.pl:
>
>   use myFoo;
>   myFoo::foo;
>
>now say
>   perl foo.pl
>and it should respond with
>   bar!
>
>That's the simplest gist of it, though you can always use Exporter and
>objects and bootstrap some XS if you like. It's just not *required*.
>=o)

My idea was to give a template for a real-world module that a beginner 
could play around with immediately.  That's what I used for my first 
module, and it made my life so easy.  I didn't know what bless() did, but I 
did enjoy the benefits of bless()ing long before I got around to learning 
about what it actually does.  Having a guide for the more complicated stuff 
allows you to avoid future pitfalls because you've done things the safe 
way, without yet knowing why you did it that way.  Since I do this stuff 
for a living, most of the time the important thing is to get the project 
working -- figuring out how I got it to work is done on Saturday over a 
cold beer :)



Aaron Craig
Programming
iSoftitler.com




Re: Return values from Module

2001-05-24 Thread Aaron Craig

At 08:46 24.05.2001 +1000, you wrote:
>

>  $sth->finish;
>  #print "sumSales:\t$sales, $count\n\n";
>  if (@row){return @row};
>}

Probably has nothing to do with your problem, but as a matter of habit, I 
like passing around references instead of entire arrays or hashes.

Try returning \@row, which will give you a reference to that array in your 
call, ie.
my $sales = myMod::sumSales(@arg);

now $sales (if your function returns correctly) is an array which you can 
access by using $sales->[0]

>The sub is called like:
>
>my @sales = myMod::sumSales(@arg)
>  || die "Unable to complete sumSales routine: $!\n";
>where @arg only has one element.
>
>The doco about return says "The supplied expersion will be evaluated in the
>context of the subroutine invocation.  That is, if the subroutine was 
>called in
>a scalar context , EXPR is also evaluated in a scalar context.  If the
>subroutine was invoked in a list context then EXPR is also evaluated in a
>listcontext and can return a list value."
>
>I'm guessing that this is the problem but have no idea what it means...
>
>Any help would be appreciated.
>
>Thanks
>
>
>john

Aaron Craig
Programming
iSoftitler.com




Re: Is there an alternative to #!/usr/bin/perl

2001-05-24 Thread Jos I Boumans

well, it would probably involve some parsing not sure how you want to solve
that, but try running this on your box:

for (keys %ENV) { print "$_ has value $ENV{$_}\n" }
# this will print out all ENV key/values for you

$ENV{PATH} has the following contents on my machine:
C:\winnt\system32;C:\winnt;C:\winnt\system32\WBEM;C:\Perl\bin\;C:\PROGRA~1\U
LTRAE~1;E:\mysql\bin

so if perl is in your path, you can tell your machine where it is...

now, if you cant parse it, you could of course add a special temp folder or
something pointing at your perl path and use *that*
but it's perl that uses %ENV and i think you'll find yourself in a catch22
;-)

Regards,

Jos Boumans

> I'm writing perl scripts that will be distributed to locations where I
> cannot gaurantee the location of perl. Is there a clean alternative to the
> shebang with the specific perl path? Maybe using an environment variable
to
> locate perl?




Re: Is there an alternative to #!/usr/bin/perl

2001-05-24 Thread Nigel G Romeril

I think that you will have to program the humans, eg send a Readme out with the
scripts and let them do a little editing to get the script to run. If you do
not know where Perl is or it is not on the path then you cannot run it so you
cannot do any searching. We could call it Hobson's choice ;-)

"Hobson, Neville" wrote:

> I'm writing perl scripts that will be distributed to locations where I
> cannot gaurantee the location of perl. Is there a clean alternative to the
> shebang with the specific perl path? Maybe using an environment variable to
> locate perl?
> The camel book suggests the following:
>
> #!/bin/sh --
> eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
>   if 0;
>
> Is this the best alternative and are there situations in which it might not
> work?
>
> Neville
>
>




Problems with split

2001-05-24 Thread Andy Roden


Anyone help out...

%router_tables is something like (1.1.1.1|cisco, 2.2.2.2|juniper etc)

foreach $i (sort keys %router_tables)
{
next if ($i =~ "unknown");
($router_table{i},$router_type{$i}) = split(/\|/, 
$router_tables{i});
if ($router_table{i} ne "") {
print SH "\"$router_table{$i}\" ";
}
else {
print SH "\"$router_tables{$i}\" ";
}
}

For some reason, the script doesn't execute the split as I would hope
(giving $router_table{i} = 1.1.1.1  $router_type{i} = cisco) it just
returns two blanks (and hence prints out the $router_tables{$i} as its
told to

Any help appreciated

Andy





Re: Problems with split

2001-05-24 Thread Timothy Kimball


Andy Roden wrote: 
: For some reason, the script doesn't execute the split as I would hope
: (giving $router_table{i} = 1.1.1.1  $router_type{i} = cisco) it just
: returns two blanks (and hence prints out the $router_tables{$i} as its
: told to

Should be $router_table{$i}, shouldn't it?

-- tdk



Re: Is there an alternative to #!/usr/bin/perl

2001-05-24 Thread Timothy Kimball


: I'm writing perl scripts that will be distributed to locations where I
: cannot gaurantee the location of perl. Is there a clean alternative to the
: shebang with the specific perl path? Maybe using an environment variable to
: locate perl?

This may be a heavier solution than you were looking for, but you could
package the script in a module. The recipients would then use the usual
module installation procedure:

perl Makefile.PL
make
make test
make install

Scripts installed this way will automatically have their shebang lines
edited for the perl that built the module.

It also gives you the opportunity to check for pre-requisites, run
tests before installation, and include a README and Changes file.

(I don't know for sure, but you may need to create a dummy module file
for this to work.)

This may not solve your problem in the short term, but it's something
to think about if you're going to maintain the script regularly for the
long haul.

"perldoc ExtUtils::MakeMaker" for more info.

-- tdk



Re: Why can't $I = chop $array[1]

2001-05-24 Thread Timothy Kimball



David Blevins wrote:
: I'm wondering, why can I do this:
: 
: local @fileList = reverse sort `ls $list*.list`;
: local $current = $fileList[0];
: local $previous = $fileList[1];
: 
: chop $current;
: chop $previous;
: 
: But, not this:
: local @fileList = reverse sort `ls $list*.list`;
: local $current = chop $fileList[0];
: local $previous = chop $fileList[1];

Because you can do this:

chomp(local @fileList = reverse sort `ls $list*.list`);
local $current = $fileList[0];
local $previous = $fileList[1];

or better yet, this:

chomp(my @fileList = reverse sort `ls $list*.list`);
my $current = $fileList[0];
my $previous = $fileList[1];

n.b. chop() removes the last character; chomp() removes the last
character only if it's a record separator (defined in $/). Either one
will return the character chopped.

: As a side note, I think it's great that I can do this (although I find it
: difficult to read, for now):
: 
: local ($current,$previous) = (reverse sort `ls $list*.list`)[0,1];
: 
: chop $current;
: chop $previous;
: 
: Of course, I know there has to be a better way to do this:
: reverse sort `ls $list*.list`

Well, I don't know is this would be "better" by your definition, but I
prefer to do it this way:

opendir DIR, $directory or die "Can't opendir $directory: $!";
my @fileList = reverse sort grep /$list.*\.list$/, readdir DIR;
closedir DIR;

Longer, but no backticks, no shells in the way, no glob limits (I've
been burned by those), better control over the filenames you grab. And
no chomp() needed.

: I just get tired of looking everything up in my Perl book.

Try perldoc -h.

-- tdk



Re: Is there an alternative to #!/usr/bin/perl

2001-05-24 Thread Adam Turoff

On Thu, May 24, 2001 at 11:38:32AM +0100, Hobson, Neville wrote:
> I'm writing perl scripts that will be distributed to locations where I
> cannot gaurantee the location of perl. Is there a clean alternative to the
> shebang with the specific perl path? Maybe using an environment variable to
> locate perl?
> The camel book suggests the following:
> 
> #!/bin/sh --
> eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
>   if 0;

You can also try:

#!/usr/bin/env perl -w

[ rest of script ]

And that will invoke the first perl found in $PATH, and it will invoke 
it with the -w switch turned on.

(I *think* env is always installed in /usr/bin, but I'm not absolutely
positive at the moment.)

Z.




Re: Problems with split

2001-05-24 Thread Andy Roden

what should be $router_table{$i} ?

I have $router_tables{$i} (with the s) which is something like
1.1.1.1|cisco  and I want to split it to be $router_table{$i} (without the
s) is 1.1.1.1 and $router_type{$i} is cisco

Andy

On Thu, 24 May 2001, Timothy Kimball wrote:

> 
> Andy Roden wrote: 
> : For some reason, the script doesn't execute the split as I would hope
> : (giving $router_table{i} = 1.1.1.1  $router_type{i} = cisco) it just
> : returns two blanks (and hence prints out the $router_tables{$i} as its
> : told to
> 
> Should be $router_table{$i}, shouldn't it?
> 
> -- tdk
> 




Re: user script to logout users from unix

2001-05-24 Thread Craig Moynes/Markham/IBM

Ok heres my two cents


Hi guys,

[snip]
>sub DEBUG () { 1 }; # set level of debugness.
I have never seen this before, why do you use it ?

[snip]
>open (STDERR, "/tmp/userlog.log") or die $!;
[snip]

Personally I always include the 'arrow' I am using so in this case:
open (STDERR, ">/tmp/userlog.log") or die $!;
It makes it easier to read for me, but you are not me...yet ;)

[snip]
>`who > /tmp/userin`
>open (USERS, "/tmp/usersin")  or die "can't open $entry: $!\n";
[snip]

I would rather use:
open (USERS, "who |")  or die "can't open $entry: $!\n";
you avoid the backticks and its pretty

[snip]
> $PIDS =`ps -xa | grep $user | grep -v grep | cut -b
-6`
[snip]

If you may be using this on any other OS or a different version of the same
OS you may want to modify this into another open statement with ps -xa
pipeing to it.  It does take longer to do but it winds up being more
portable across more systems.  I have been burned by different versions of
output across different levels of AIX already.

Other than that it works so your a step above the next guy ;)

Cheers,
 Craig




Re: Why can't $I = chop $array[1]

2001-05-24 Thread Me

> n.b. chop() removes the last character; chomp() removes the last
> character only if it's a record separator (defined in $/). Either one
> will return the character chopped.

Nah, chomp() returns number of chars dropped.


> : I just get tired of looking everything up in my Perl book.

You presumably don't mean the Cookbook. I never tire
of looking things up in the Cookbook because it nearly
always hits the spot, and quickly too.





Re: Problems with split

2001-05-24 Thread Me

> [confusion]

Andy,

You really ought to paste in the actual code
causing the problem rather than retyping it.

While you are about it, make sure to include
the code that populates %router_tables.




unsuscribe

2001-05-24 Thread France, James



James D. France
UPMC Health System
Information Systems Division
Email: [EMAIL PROTECTED]
Phone:  412-647-0790
Fax:  412-647-5961




Re: Problems with split

2001-05-24 Thread Adam Turoff

On Thu, May 24, 2001 at 01:21:47PM +0100, Andy Roden wrote:
> 
> Anyone help out...
> 
> %router_tables is something like (1.1.1.1|cisco, 2.2.2.2|juniper etc)
> 
> foreach $i (sort keys %router_tables)
> {
> next if ($i =~ "unknown");
> ($router_table{i},$router_type{$i}) = split(/\|/, 
> $router_tables{i});
> if ($router_table{i} ne "") {
> print SH "\"$router_table{$i}\" ";
> }
> else {
> print SH "\"$router_tables{$i}\" ";
> }
> }
> 
> For some reason, the script doesn't execute the split as I would hope
> (giving $router_table{i} = 1.1.1.1  $router_type{i} = cisco) it just
> returns two blanks (and hence prints out the $router_tables{$i} as its
> told to

You have a few mistakes here, but the biggest one is that
you're using %router_tables as a list, except that it's a hash.
What you meant to say is this:

   my @router_tables = qw(1.1.1.1|cisco 2.2.2.2|juniper);
   my %router_table;
   my %router_type;
   
   foreach $i (@router_tables)
   {
   next if ($i =~ /unknown/);
   ($router_table{$i},$router_type{$i}) = split(/\|/, $i);
   if ($router_table{i} ne "") {
   print SH "\"$router_table{$i}\" ";
   }
   else {
   print SH "\"$i\" ";
   }
   }

But what you *really* meant is this:

   my @router_tables = qw(1.1.1.1|cisco 2.2.2.2|juniper);
   my %router = map {split("\|", $_)} @router_tables;

The keys in %router are the IP address (1.1.1.1, 2.2.2.2), and
the values in %router are the router types (cisco, juniper).
That is, $router{1.1.1.1} eq "cisco".  If you're iterating over
the list of router tables, it would be something like this (I'm 
not sure what this code is supposed to be doing, but here it is):

   foreach my $line (@router_tables) {
next if $line =~ /unknown/;
my ($ip, $type) = split("\|", $line);

if ($ip) {
print SH '"', $ip, '" ';
} else {
print SH '"', $line, '" ';
}
   }

Z.




Re: Problems with split

2001-05-24 Thread Timothy Kimball


: what should be $router_table{$i} ?

Sorry for the typo. Should be $router_tables{$i}.  In the code you
posted, you don't have a dollar sign on the i.

-- tdk



Re: Why can't $I = chop $array[1]

2001-05-24 Thread Timothy Kimball


Me wrote:
: > n.b. chop() removes the last character; chomp() removes the last
: > character only if it's a record separator (defined in $/). Either one
: > will return the character chopped.
: 
: Nah, chomp() returns number of chars dropped.

You're right. I just get tired of looking everything up. ;)

-- tdk



[ADMIN] 999 list members

2001-05-24 Thread Ask Bjoern Hansen

Hi,

The beginners list (and the digest version) now have a total of 999
subscribers[2]. Wow.

Please always think before you write; when you write you are taking
almost a thousand people's time.

If what you write takes just 30 seconds to read[1], that's more than
8 hours(!) of time burned that could have been used writing code. :)

So,

   o) before you write a question please make sure you've checked
  all the FAQs and the documentation you know of.

   o) before you write an answer, make sure you that you really are
  contributing to a solution and doublecheck that noone
  else already gave the same answer.

If your question is about LWP (accessing webpages from Perl), DBI
(accessing databases from Perl) or CGI (you know what that is
:-) ) there are other mailinglists you should use.

Subscribe by sending mail to

  [EMAIL PROTECTED]
  [EMAIL PROTECTED]
  [EMAIL PROTECTED]

They all have digest versions too. You can subscribe to those by
inserting -digest just before -subscribe, for example
[EMAIL PROTECTED]

Kevin, can you include this rant in the FAQ?


enjoy,

ask ([EMAIL PROTECTED])

[1] I'd guestimate it took you (or will take you if you are not yet
done) between 30 seconds and a little more than a minute to read
this mail.

[2] Actually, while I've been writing this mail, 8 more people
subscribed, so that would be 1007 subscribers, but that doesn't
sound nearly as neat. (We were mentioned in the latest perl.com
newsletter).

-- 
ask bjoern hansen, http://ask.netcetera.dk/   !try; do();




Re: [ADMIN] 999 list members

2001-05-24 Thread Kevin Meltzer

On Thu, May 24, 2001 at 07:00:13AM -0700, Ask Bjoern Hansen ([EMAIL PROTECTED]) spew-ed 
forth:
> Kevin, can you include this rant in the FAQ?

Will do.

Cheers,
Kevin

-- 
[Writing CGI Applications with Perl - http://perlcgi-book.com]
"I will have a foreign-handed foreign policy."
-- G.W. Bush, Redwood, CA 09/27/2000



How to send the out put to the browser?

2001-05-24 Thread Thanh To

Hi All,

I just installed ActivePerl version 5.6.1 for Window98 on my machine.
Then, I am trying to learn CGI-Perl, but the problem that I have is the 
outputs of the Perl scripts. I'd like them to go my Netscape or IE browsers, 
as they are supposed to, but they just appeared as following in the dos 
window:

Content-Type: text/html; charset=ISO-8859-1


http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd";>
http://www.w3.org/1999/xhtml"; lang="en-US">A 
Simple Ex
ample
A Simple Example
What's your name? What's the 
combination?
eeniemeenieminiemoeWhat's your favorite color? 
red
green
blue
chartreuse



What do I need to do to put the output to the browsers?
Thanks in advance,

Thanh


_
Get your FREE download of MSN Explorer at http://explorer.msn.com




Re: How to send the out put to the browser?

2001-05-24 Thread Brett W. McCoy

On Thu, 24 May 2001, Thanh To wrote:

> I just installed ActivePerl version 5.6.1 for Window98 on my machine.
> Then, I am trying to learn CGI-Perl, but the problem that I have is the
> outputs of the Perl scripts. I'd like them to go my Netscape or IE browsers,
> as they are supposed to, but they just appeared as following in the dos
> window:

I think you are missing a crucial piece of software -- a web server.

There is a brand new beginners-cgi list (check out http://learn.perl.org)
where this question is now more appropriate; I recommend you subscribe to
it also.

-- Brett





Re: PARSE CLUSTAL

2001-05-24 Thread Pedro A Reche Gallardo


Dear ME, sorry I am making myself not clear. Let's try
in another way.  Here is the script again
#!/usr/sbin/perl
if (!@ARGV) {
    print STDERR "usage: $0 alignment_file
[threshold%]...\n";
    print_sets();
    exit 0;
}
my $FILE   = shift
@ARGV;
my @THRESHOLD;
if (@ARGV) {
    @THRESHOLD = @ARGV;
} else {
    @THRESHOLD = (90, 80, 70, 60,
50);
}
my @ID;
my @ALIGNMENT;
read_alignment($FILE);
$n=@ID;
for ($i=0; $i<$n; $i++){
printf "%-15s %s\n", $ID[$i], join("", @{$ALIGNMENT{$ID[$i]}});
}
sub read_alignment {
    my ($file) = @_;
    my ($id, $line, %alignment);
    local (*TMP);
    open(TMP, "< $file") or die
"can't open file '$file'\n";
    while ($line = ) {
    next   
if $line =~ /^CLUSTAL/;
    if ($line
=~ /^([^  ]+)\s+([-a-zA-Z*.]+) *$/) {
   if (! $alignment{$1})
{
  
# new sequence identifier
   
push (@ID, $1);
 
}
   
#strip spaces,tabs,newlines: extend alignment array
   
$line = $2;
   
$line =~ tr/ \t\n//d;
   
push (@{$ALIGNMENT{$1}}, split("", $line));
    }
    }
close TMP;
}
If the program was working properly
the subroutine read_alignment should be parsing the input file line by
line and holding in the array @ID the  identifier of the sequences
only if the identifier  has not been seen before (sequence identifiers
are in the first column of the input file). However, if I print the elements
of  @ID, this will contain the same sequence identifier repeated as
many times as it appeared in the input file. The statement  "if (!
$alignment{$1})" should have been taking care of this but, at least in
my machine, it is not. The attached file contain an input file, so you
can check what I am saying.
Any help will be welcomed,
 
Pedro Reche
 
-- 
***
PEDRO a. RECHE gallardo, pHD    TL: 617 632 3824 
Scientist, Mol.Immnunol.Foundation, FX: 617 632 3351
Dana-Farber Cancer Institute,   EM: [EMAIL PROTECTED]
Harvard Medical School, URL: http://www.reche.org
44 Binney Street, D610C,
Boston, MA 02115
***
 

CLUSTAL W(1.60) multiple sequence alignment



YPK1SQLSWKRLLMKGYIPPYKPAVS-NSMDTSNFDEEFTR---EKPIDSVVDEYLSESV
YPK2KDISWKKLLLKGYIPPYKPIVK-SEIDTANFDQEFTK---EKPIDSVVDEYLSASI
KPCA_HUMAN  RRIDWEKLENREIQPPFKPKVC--GKGAENFDKFFTR---GQPVLTPPDQLVIANI
KPCZ_HUMAN  RSIDWDLLEKKQALPPFQPQIT-DDYGLDNFDTQFTS---EPVQLTPDDEDAIKRI
KAPAKEVVWEKLLSRNIETPYEPPIQQGQGDTSQFDKYPEEDINYGVQGEDPYADL
KAPCNEVIWEKLLARYIETPYEPPIQQGQGDTSQFDRYPEEEFNYGIQGEDPYMDL
KAPBSEVVWERLLAKDIETPYEPPITSGIGDTSLFDQYPEEQLDYGIQGDDPYAEY
KS6_HUMAN   RHINWEELLARKVEPPFKPLLQ-SEEDVSQFDSKFTR---QTPVDSP-DDSTLSES
KPC1RNINFDDILNLRVKPPYIPEIK-SPEDTSYFEQEFTS---APPTLTPLPSVLTTSQ
KRAC_BOVIN  ASIVWQDVYEKKLSPPFKPQVT-SETDTRYFDEEFTA---QMITITPPDQDDSMEG
SCH9ADIDWEALKQKKIPPPFKPHLV-SETDTSNFDPEFTT---ASTSYMNKHQPMMTAT
KGP1_DROME  LGFDWDGLASQLLIPPFVRPIA-HPTDVRYFDRFPC--DLNEPPDELSGWDA
ARK2_RATKGIDWQYVYLRKYPPPLIPPRGEVNAADAFDIGSFDEEDTKG--IKLLDCDQDLYKNFPL
DBFBAEINFETLRTS--SPPFIPQLD-DETDAGYFDDFTNEEDMAKYADVFKRQNKLSAM
DBF2ADINFSTLRSM--IPPFTPQLD-SETDAGYFDDFTSEADMAKYADVFKRQDKLTAM
   *  *.

YPK1--QKQF
YPK2--QKQF
KPCA_HUMAN  D-QSDF
KPCZ_HUMAN  D-QSEF
KAPA--FRDF
KAPC--MKEF
KAPB--FQDF
KS6_HUMAN   A-NQVF
KPC1--QEEF
KRAC_BOVIN  VDS-ERRPHF
SCH9PLSPAMQAKF
KGP1_DROME  DF
ARK2_RATMISERWQQEV
DBFBVDDSAVDSKL
DBF2VDDSAVSSKL



Re: Is there an alternative to #!/usr/bin/perl

2001-05-24 Thread Paul


--- "Hobson, Neville" <[EMAIL PROTECTED]> wrote:
> I'm writing perl scripts that will be distributed to locations where
> I cannot gaurantee the location of perl. Is there a clean alternative
> to the shebang with the specific perl path? Maybe using an
environment
> variable to locate perl?
> The camel book suggests the following:
> 
> #!/bin/sh --
> eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
>   if 0;

But that's not to find perl -- that in fact assumes it's /usr/bin/perl.

Geez, this one's tricky 




__
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/



Re: PARSE CLUSTAL

2001-05-24 Thread Craig Moynes/Markham/IBM

First I have some questions.
Why is ALIGNMENT not a hash ?  It seems perfect for what you are need.  If
you use ALIGNMENT as a hash, then you can do away with the ID array.

Also you are checking for existence in alignment not ALIGNMENT, this will
be causing problems.

Simplify like this:

mine:
[snip]
#my @ID;# you don't really need this
my %ALIGNMENT;  #  a hash would work much better, look it up if you
need more info
read_alignment($FILE);

foreach my $key ( keys $ALIGNMENT )  #defines key for each key in your
hash
{
 printf "%-15s %s\n", $key, $ALIGNMENT{$key);
}
sub read_alignment {
 my ($file) = @_;
 my ($line);
 local (*TMP);


 open(TMP, "< $file") or die "can't open file '$file'\n";


 while ( $line =  )
 {
  my $key;  #something better perhaps
  next if $line =~ /^CLUSTAL/;

  ( $key, $sequence ) = $line =~ /[\w\-]+/;
  #This should grab the key and the sequence, basically you want to
match any word character and the dash
  # the first match is returned to key and the long sequence is
returned to sequence

  if ( !exists $ALIGNMENT{$key} )
  {
$ALIGNMENT{$key} = "$sequence";
  }


 }

 close TMP
}

Any questions ?



-
Craig Moynes
Internship Student
netCC Development
IBM Global Services, Canada
Tel: (905) 316-3486
[EMAIL PROTECTED]











Interesting? regexp

2001-05-24 Thread Aaron Craig


Here's a reg exp problem that's got me up at night.  I'm looking for 
currency and numbers in various formats.  The currency symbol and the 
actual character code of the number I'm looking for may vary, depending on 
the file I'm looking at, as we're working in Unicode and looking at 
languages from all over the world.  I'm also using utf8.

Basically valid formats would be:
$123
$ 123
123$
123 $

and up to here, I'm okay:

my $sText = "Foo $ 123 bar 123$ hello $123 world 123 $";
my $reNumber   = "\x{0030}-\x{0039}"; # these may be different depending on 
the language, but let's work with English
my $reCurrency = "\\x{0024}|\\x{00a3}"; # just to keep it simple
my @asCurrencies = $sText =~ 
/[$reNumber]?\x{0020}?[$reCurrency]\x{0020}?[$reNumber]?/g;
foreach my $currency (@asCurrencies)
 {
 print "$currency\n";
 }

ok.

I want to add in the text for currency symbols, like "dollar" and "pound", 
so that I match on either a currency symbol or a currency word and grab the 
numbers to the left of to the right.

Here are the strings for those already formatted for utf8:

my $string = 
"(\x{0064}\x{006f}\x{006c}\x{006c}\x{0061}\x{0072}\x{0073})|(\x{0070}\x{006f}\x{0075}\x{006e}\x{0064}\x{0073})";
 
# (dollar)|(pound)

I've tried all sorts of variations on parentheses etc. in the reg exp, to 
no avail.  I've checked the docs on forward and backward checking, and 
messed around with it some, but either that's not what I need, or I haven't 
completely grasped the concept yet.

Any ideas?


Aaron Craig
Programming
iSoftitler.com




Re: PARSE CLUSTAL

2001-05-24 Thread Me

(Fyi: your post came through in a tiny (illegible) font.)



> #!/usr/sbin/perl

I recommend you start your scripts:

#!/usr/sbin/perl -w
use strict;

This will help identify a lot of basic mistakes.




> if ($line =~ /^([^  ]+)\s+([-a-zA-Z*.]+) *$/) {

The [^] bit is the same as [^ ], ie with one space.
It would more typically be written:

\S

The [-a-zA-Z*.] means a minus, or any letter, or an asterisk, or a
period.





>if (! $alignment{$1}) {

$alignment{$i} is never set, so it'll never be true.



> push (@{$ALIGNMENT{$1}}, split("", $line));

$ALIGNMENT{$1} is also never set, so it'll never contain
anything. Note that %alignment and %ALIGNMENT are
not the same hash. (Case is significant in Perl.)



You seem to be mixing up regular arrays (which have
numbered subscripts and are declared with my @array)
and hashes (which have named subscripts and are
declared my %hash). At a glance, you don't need to
use arrays anywhere.

my %hash;
my $bar;
$bar = 'foo';
$hash{$bar} = 'baz';

%hash now contains one element, key 'foo', value 'baz'.

$bar = 'foo';
$hash{$bar} = 'bazzam';

%hash still contains one element, key 'foo', value 'bazzam'.



hth.




Running jobs in the background with backticks

2001-05-24 Thread Cron, Daniel


It seems that when I use backticks to kick off a job in the background, my
perl script waits until the background job finishes.
But it seems that the system command actually kicks things off and moves on.

Here a perl script which demonstrates this behavior:

#!/opt/local/bin/perl -w
use strict;
print "About to execute system\n";
system ("sleep 10 &");
print "Done with system\n";
print "About to execute backticks\n";
`sleep 10 &`;
print "Done with backticks\n";

I really don't understand this behavior.
Can someone explain why this is happening?





Re: Is there an alternative to #!/usr/bin/perl

2001-05-24 Thread Timothy Kimball


Neville hobson wrote:
: I'm writing perl scripts that will be distributed to locations where I
: cannot gaurantee the location of perl. Is there a clean alternative to the
: shebang with the specific perl path? Maybe using an environment variable to
: locate perl?

OK, here's one solution, extracted from the earlier one I wrote about
packaging the script in a module. It's a short script your users can
run that will edit the shebang line and put the eval hack into the script
for you, with their local perl paths.

Suppose this script is called "fix" (note the lack of a shebang):

use ExtUtils::MakeMaker;
ExtUtils::MM_Unix->fixin(shift or die "usage: perl $0 filename\n");

and this script that you want to fix is called "myscript.pl":

#!/usr/local/bin/perl
print "foo!\n";

Then after running this command line on my system:

% perl fix myscript.pl

myscript.pl will looks this:

% more myscript.pl
#!/faxafloi/data1/bin/perl

eval 'exec /faxafloi/data1/bin/perl  -S $0 ${1+"$@"}'
if 0; # not running under some shell
print "foo!\n";

because the first "perl" in my path is /faxafloi/data1/bin/perl. In
other words, "fix" will replace the shebang line with the path of the
perl executable that was used to run "fix".

So you'd need to deliver this "fix" script to your users with
some simple installation instructions.

-- tdk



Re: Interesting? regexp

2001-05-24 Thread Me

> Basically valid formats would be:
> $123
> $ 123
> 123$
> 123 $

This would suggest to me something like:

$CurrencyRegex = '$|foo|bar|baz';
$AmountRegex = '[\d.]+';
$prefixed = qr/($CurrencyRegex)  \s*   ($AmountRegex)  /x;
$postfixed = qr/  ($AmountRegex)   \s*   ($CurrencyRegex)  /x;

($currency, $amount) = $input =~ $prefixed or reverse $input =~
$postfixed;

(Sorry if some syntax or escaping is wrong.)


Also, try adding:

use re "Debug";




Script Review

2001-05-24 Thread Stout, Joel R

Hey,
 
I've started writing Perl a little over a month ago with the help of the
awesome Llama (and this mailing list).  I am only on Chapter 8 so don't
bruise my fragile ego too much with this script review.  It's simple data
manipulation but as you'll see, I need a lot of help with the structure and
overall Perlness.  Any comments appreciated (gulp).
 
Joel
 
#!c:\perl\perl.exe
#Substitute your favorite Shebang line above
 
#Name
# imanet.pl
 
#Description 
# Parsing program made to take part of an 810 message from * Co. and 
# make an xml version.
 
#Usage
# 'imanet.pl input_file'
# Invoked by a program that first separates the original input
# file by commercial invoice (ST-SE).  
 
#Output
# File
#  commerical_invoice_number.xml
# Display
#  'imanet.pl> Parsing ST_number.tmp'
#  'imanet.pl> File Created: commerical_invoice_number.xml'
#  'imanet.pl> Cannot open output file' (error message)
#  'imanet.pl> Cannot close output file' (error message)
 
# JRS 05/22/01
 
use strict;
 
#Parsing/Printing variables 
my ($stno, @lines, $ref, $fill, $addrid, $x, $t, $cfile);
 
#Header variables
my ($cominv, $ship, $refno, $val, $shipdt, $trans, $gwght, $gwghtuom, 
$curr, $gendesc, $clcode, $clname, 
$vncode, $vnname, $vnaddr1, $vnaddr2, $vncity, $vnst, $vnco, $vnzip, 
$cncode, $cnname, $cnaddr1, $cnaddr2, $cncity, $cnst,$cnzip, 
$excode, $exname, $exaddr1, $exaddr2, $excity, $exst, $exco, $exzip, 
$pucode, $puname, $puaddr1, $puaddr2, $pucity, $pust,$puzip,
$po, $podt, $bol, $dirship, $carcode, $carname, $framt, $tcin, $tcout,
$conval, $commamt, $duty, $tax, $dutytax, $royal, $spgood, $terms,
$disc,
$pkinc, $pkexc, $pkgs, $pkgsuom, $pktype, $cargo, 
$ptypex, $poex, $ptypen, $poen, $rel);
 
#Detail arrays
my (@lntype, @pn, @desc, @hs, @qty, @uom, @price, @bxs, @mos, @mval, @rval,
@lnref, @co, @euse);   
 
#Main Parsing Routine 
$cfile = $ARGV[0];
print "imanet.pl> Parsing: $cfile\n";
while (<>) {
 chomp;
 testType ($_);
}
 
#Subroutines
sub testType {
 if (/^BIG/) {
  parseBIG ($_[0]);
 } elsif (/^REF/) {
  parseREF ($_[0]);
 } elsif (/^TDS/) {
  parseTDS ($_[0]);
 } elsif (/^CAD/) {
  parseCAD ($_[0]);
 } elsif (/^ISS/) {
  parseISS ($_[0]);
 } elsif (/^CUR/) {
  parseCUR ($_[0]);
 } elsif (/^NTE/) {
  parseNTE ($_[0]);
 } elsif (/^N1/) {
  parseN1 ($_[0]);
 } elsif (/^N3/) {
  parseN3 ($_[0]);
 } elsif (/^N4/) {
  parseN4 ($_[0]);
 } elsif (/^AMT/) {
  parseAMT ($_[0]);
 } elsif (/^ITD/) {
  parseITD ($_[0]);
 } elsif (/^PKG/) {
  parsePKG ($_[0]);
 } elsif (/^R4/) {
  parseR4 ($_[0]);
 } elsif (/^IT1/) {
  parseIT1 ($_[0]);
 } elsif (/^PID/) {
  parsePID ($_[0]);
 } elsif (/^SE/) {
  printResults();
 }
}
 
sub parseBIG {
 ($ref, $shipdt, $cominv, $podt, $po) = split (/\*/, $_[0]);
}
 
sub parseREF {
 my (@REFln);
 @REFln = split (/\*/, $_[0]);
 $ref = $REFln[1];
 if ($ref eq "SN") {
  $ship = $REFln[2];
 } elsif ($ref eq "PO"){
  $refno = $REFln[2];
 } elsif ($ref eq "BL"){
  $bol = $REFln[2];
 } elsif ($ref eq "PS"){
  $dirship = $REFln[2];
 } elsif ($ref eq "DI"){
  $duty = $REFln[2];
 } elsif ($ref eq "TI"){
  $tax = $REFln[2];
 } elsif ($ref eq "RY"){
  $royal = $REFln[2];
 } elsif ($ref eq "SG"){
  $spgood = $REFln[2];
 } elsif ($ref eq "CC"){
  $cargo = $REFln[2];
 } elsif ($ref eq "RT"){
  $rel = $REFln[2];
 }
}
 
sub parseTDS {
 ($ref, $val) = split (/\*/, $_[0]);
}
 
sub parseCAD {
 ($ref, $trans, $fill, $fill, $carcode, $framt, 
 $fill, $fill, $carname) = split (/\*/, $_[0]);
}
 
sub parseISS {
 ($ref, $pkgs, $pkgsuom, $gwght, $gwghtuom) = split (/\*/, $_[0]);
}
 
sub parseCUR {
 ($ref, $fill, $curr) = split (/\*/, $_[0]);
}
 
sub parseNTE {
 ($ref, $fill, $gendesc) = split (/\*/, $_[0]);
}
 
sub parseN1 {
 my (@N1ln);
 @N1ln = split (/\*/, $_[0]);
 $addrid = $N1ln[1];  #store id as current addr variable
 if ($addrid eq "CL") {  #subsequent lines don't id client type
  $clcode = $N1ln[4];
  $clname = $N1ln[2];
 } elsif ($addrid eq "VN"){
  $vncode = $N1ln[4];
  $vnname = $N1ln[2];
 } elsif ($addrid eq "CN"){
  $cncode = $N1ln[4];
  $cnname = $N1ln[2];
 } elsif ($addrid eq "EX"){
  $excode = $N1ln[4];
  $exname = $N1ln[2];
 } elsif ($addrid eq "PU"){
  $pucode = $N1ln[4];
  $puname = $N1ln[2];
 }
}
 
sub parseN3 {
 my (@N3ln);
 @N3ln = split (/\*/, $_[0]);
 if ($addrid eq "VN"){
  $vnaddr1 = $N3ln[1];
  $vnaddr2 = $N3ln[2];
 } elsif ($addrid eq "CN"){
  $cnaddr1 = $N3ln[1];
  $cnaddr2 = $N3ln[2];
 } elsif ($addrid eq "EX"){
  $exaddr1 = $N3ln[1];
  $exaddr2 = $N3ln[2];
 } elsif ($addrid eq "PU"){
  $puaddr1 = $N3ln[1];
  $puaddr2 = $N3ln[2];
 }
}
 
sub parseN4 {
 my (@N4ln);
 @N4ln = split (/\*/, $_[0]);
 if ($addrid eq "VN"){
  $vncity = $N4ln[1];
  $vnst = $N4ln[2];
  $vnzip = $N4ln[3];
  $vnco = $N4ln[4];
 } elsif ($addrid eq "CN"){
  $cncity = $N4ln[1];
  $cnst = $N4ln[2];
  $cnzip = $N4ln[3];
  #no Consignee Co in documentation
 } elsif ($addrid eq "EX"){
  $excity = $N4ln[1];
  $exst = $N4ln[2];
  $exzip = $N4ln[3];
  $exco =

Re: Running jobs in the background with backticks

2001-05-24 Thread Paul


--- "Cron, Daniel" <[EMAIL PROTECTED]> wrote:
> It seems that when I use backticks to kick off a job in the
> background, my perl script waits until the background job finishes.
> But it seems that the system command actually kicks things off and
> moves on.
[snip]
> I really don't understand this behavior.
> Can someone explain why this is happening?

Beause backtics return the output from the program, of which might be
none until the end of it's execution.

Thus, you can say 
  if($x = `proggie`) { 

and $x will have any output from the program.
system() just runs the program.
If you want it to wait (and you certainly might), you have to do a wait
or waitpid command. 

BTW ==
To quietly reap zombies, try:
   $SIG{CHLD} = sub { wait }; # wait now fires on child death 


__
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/



RE: Is there an alternative to #!/usr/bin/perl

2001-05-24 Thread Scott Thompson

Why not try this:

#!/bin/sh
PERLOC=`which perl`;
eval 'exec $PERLOC -S $0 ${1+"$@"}' if 0;

Or something similar.  Forgive my syntax -- I'm not a sh scripter. :)

++++
|| UNIREZ, Inc.Scott Thompson ||
++---+++
|| Address: 2555 Southwest Grapevine Parkway | Title: Programmer  ||
||  Suite 200| Phone: (817) 416-5800  ||
||  Grapevine, Texas 76051   | Extension: 104 ||
|| Fax: (817) 251-9199   | Cell:  (972) 342-5660  ||
|| Web: http://www.unirez.com/   | Email: [EMAIL PROTECTED]||
++===+++


> -Original Message-
> From: Paul [mailto:[EMAIL PROTECTED]]
> Subject: Re: Is there an alternative to #!/usr/bin/perl
>
> >
> > #!/bin/sh --
> > eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
> >   if 0;
>
> But that's not to find perl -- that in fact assumes it's /usr/bin/perl.
>
> Geez, this one's tricky
>




INTERESTING!!!!

2001-05-24 Thread justin todd

Hi All. 

Just curious if any of you people have had a look at the Perl Version of
ASP? I haven't looked at it in detail but I think it might be a nice new
way to approach web development. Maybe some of you guru's could have a
look and see what you think.

Here is the link with the info.
 
 
http://aspn.activestate.com/ASPN/Reference/Products/ActivePerl/Windows/A
ctiveServerPages.html

Happy trails
Justin
 <> 

 ASPN.url


Re: INTERESTING!!!!

2001-05-24 Thread Brent Michalski


I prefer above all other options HTML::Mason.  Simply, it rocks!

details: http://www.masonhq.com




   
  
justin todd <[EMAIL PROTECTED]>  
  
Sent by:   To: 
"Beginners (E-mail)" <[EMAIL PROTECTED]> 
beginners-return-1956-Brent_Michalski=mastercard.cocc: 
  
[EMAIL PROTECTED] 
Subject: INTERESTING  
   
  
   
  
05/24/01 10:49 AM  
  
   
  
   
  




Hi All.

Just curious if any of you people have had a look at the Perl Version of
ASP? I haven't looked at it in detail but I think it might be a nice new
way to approach web development. Maybe some of you guru's could have a
look and see what you think.

Here is the link with the info.


http://aspn.activestate.com/ASPN/Reference/Products/ActivePerl/Windows/A
ctiveServerPages.html

Happy trails
Justin
 <>
(See attached file: ASPN.url)


 ASPN.url


Installing perl modules under Solaris

2001-05-24 Thread Rivera Alonso, David

Hi!

I'm new in this list, and I'm gonna make a possible stupid question:

I've got a Solaris 7 Sparc machine.
I've installed gcc 2.95.3 with "pkgadd"
Later, I installed perl 5.6.1 with "pkgadd"

Til now, everything was fine...

Then, I needed a couple of perl modules: for example "Digest-MD5"
When I untar it and go into the directory, I do:

#perl Makefile.PL

And the output is full of "file not founds":

Testing alignment requirements for U32... u32align.c:8: stdio.h: No such
file or directory
In file included from u32align.c:10:
/usr/local/lib/perl5/5.6.1/sun4-solaris/CORE/perl.h:426: sys/types.h: No
such file or directory
In file included from u32align.c:10:
/usr/local/lib/perl5/5.6.1/sun4-solaris/CORE/perl.h:457: ctype.h: No such
file or directory
/usr/local/lib/perl5/5.6.1/sun4-solaris/CORE/perl.h:465: locale.h: No such
file or directory
/usr/local/lib/perl5/5.6.1/sun4-solaris/CORE/perl.h:482: setjmp.h: No such
file or directory
/usr/local/lib/perl5/5.6.1/sun4-solaris/CORE/perl.h:488: sys/param.h: No
such file or directory
/usr/local/lib/perl5/5.6.1/sun4-solaris/CORE/perl.h:493: stdlib.h: No such
file or directory

I understand that it's searching for all those "*.h" mentioned in "perl.h".
But, where should they be? I've installed gcc compiler, shouldn't it contain
these files already? do I have to install C libraries or sthg?

I believe it's a very easy issue, but I'm missing something crucial.

many thanks, and best regards from Spain,

DAVID




_
Este mensaje, incluyendo los ficheros que pudiera llevar como anexos, 
puede contener información confidencial. 
Si ha recibido este mensaje por error, le rogamos que borre de su 
sistema inmediatamente el mensaje asi como todas sus copias, incluyendo 
las posibles copias del mismo en su disco duro, notifique al remitente  
y se abstenga de usar, revelar, distribuir a terceros, imprimir o 
copiar ninguna de las partes de este mensaje. Gracias por su 
cooperación 
_ 




Re: Problems with split

2001-05-24 Thread Andy Roden


ok, Appologies to all for not having included the whole thing, but here...

the script is for collecting customer interface stats using snmp, and
I need to destinguish what type of router the customer connects to in
order to have the right MIB. It runs with a cfg file which I have
included, which calls a file containing entries like the following... 

router1=1.1.1.1|cisco
router2=2.2.2.2|juniper
unknown=0.0.0.0|unknown

I've also included most of the main script to show more of what I'm
doing to hopefully clear up and issues about lists/hashs (but that might
still be the problem...) Any info appreciated...

Thanks

Andrew



#!/usr/bin/perl
#
#
$config_file = "configure/monitor.cfg";

# print "Initializing ...\n";
&initialize;

# print "Generating interface-table ...\n";
&mkinterface;

sub initialize
{
#
#   Reading configuration file
#
open (CFG,"$config_file") || die "Can't find configuration file
($config_file)\n";
while ()
{
chomp;
($var,$val) = split("=");
$cfg{$var} = $val;
}
close (CFG);
}
#
#   Reading router database
#
open (CFG,"$cfg{ROUTERS}") || die "Can't open router file $cfg{ROUTERS}\n";
while ()
{
chomp;
($name,$address) = split("=");
$router_tables{$name} = $address;
}
close (CFG);

sub mkinterface
{
open (SH,">$cfg{MKINTERFACE}") || die "Can't create $cfg{MKINTERFACE}\n";
print SH "#!/bin/sh\n";
print SH "# Auto-generated script: ",`date`;
print SH "cat /dev/null > $cfg{INTERFACETABLE}\n";
print SH "for i in ";
foreach $i (sort keys %router_tables)
{
next if ($i =~ "unknown");
($router_table{i},$router_type{$i}) = split(/\|/, $router_tables{i});
if ($router_table{i} ne "") {
print SH "\"$router_table{$i}\" ";
}
else {
print SH "\"$router_tables{$i}\" ";
}
}
print SH "\ndo\n";
print SH "\t$cfg{SNMPINDEX} \$i $cfg{COMMUNITY} >> $cfg{INTERFACETABLE}\n";
print SH "done\n";
close(SH);
}



COMMUNITY=@OU812+
ROUTERS=/home/andrewr/statsprogramme/tarball/monitor/configure/routers
INTERFACETABLE=/home/andrewr/statsprogramme/tarball/monds/cf/apr-interface-table
MKINTERFACE=/home/andrewr/statsprogramme/tarball/monitor/configure/mkinterface
SNMPINDEX=/home/andrewr/statsprogramme/tarball/monitor/configure/snmpindex



Re: INTERESTING!!!!

2001-05-24 Thread Brett W. McCoy

On Thu, 24 May 2001, justin todd wrote:

> Just curious if any of you people have had a look at the Perl Version of
> ASP? I haven't looked at it in detail but I think it might be a nice new
> way to approach web development. Maybe some of you guru's could have a
> look and see what you think.

I've done PerlScript development on NT with IIS & ActiveState Perl.  It's
definitely a good choice if you have to use IIS and don't want to deal
with VBScript.  My biggest complaint is that you can't stick any old thing
into session variables (like you can in Apache::Session), you are stuck
using an OLE variant type.  If you are clever you can flatten your
datatype (I think someone has actually created a Win32 module for this)
and use that for session variables.

While using PerlScript with ASP is way better than doing it with VBScript,
as far as embedded Perl solutions go, I have more fun using Mason
(http://masonhq.com).  Unfortunately, it's primarily targeted for Apache &
mod_perl, but I think it can also be run independently as a CGI, but you
lose the cool Apache & mod_perl stuff.

-- Brett




Weekly list FAQ posting

2001-05-24 Thread casey

NAME
beginners-faq - FAQ for the beginners mailing list

1 -  Administriva
  1.1 - I'm not subscribed - how do I subscribe?

Send mail to <[EMAIL PROTECTED]>

You can also specify your subscription email address by sending email to
(assuming [EMAIL PROTECTED] is your email address):

<[EMAIL PROTECTED]>.

  1.2 -  How do I unsubscribe?

Now, why would you want to do that? Send mail to
<[EMAIL PROTECTED]>, and wait for a response. Once you
reply to the response, you'll be unsubscribed. If that doesn't work,
find the email address which you are subscribed from and send an email
like the following (let's assume your email is [EMAIL PROTECTED]):

<[EMAIL PROTECTED]>

  1.3 - There is too much traffic on this list. Is there a digest?

Yes. To subscribe to the digest version of this list send an email to:

<[EMAIL PROTECTED]>

To unsubscribe from the digest, send an email to:

<[EMAIL PROTECTED]>

  1.4 - Is there an archive on the web?

Yes, there is. It is located at:

http://archive.develooper.com/beginners%40perl.org/

  1.5 - How can I get this FAQ?

This document will be emailed to the list once a month, and will be
available online in the archives, and at http://beginners.perl.org/

  1.6 - I don't see something in the FAQ, how can I make a suggestion?

Send an email to <[EMAIL PROTECTED]> with your suggestion.

  1.7 - Is there a supporting website for this list?

Yes, there is. It is located at:

http://beginners.perl.org/

  1.8 - Who owns this list?  Who do I complain to?

Casey West owns the beginners list. You can contact him at
[EMAIL PROTECTED]

  1.9 - Who currently maintains the FAQ?

Kevin Meltzer, who can be reached at the email address (for FAQ
suggestions only) at the email address in question 1.6

  1.10 - When was this FAQ last updated?

May 23, 2001

2 -  Questions about the 'beginners' list.
  2.1 - What is the list for?

A list for beginning Perl programmers to ask questions in a friendly
atmosphere.

  2.2 - What is this list _not_ for?

* SPAM
* Homework
* Solicitation
* Things that aren't Perl related
* Monkeys
  2.3 - Are there any rules?

Yes. As with most communities, there are rules. Not many, and ones that
shouldn't need to be mentioned, but they are.

* Be nice
* No flaming
* Have fun
  2.4 - What topics are allowed on this list?

Basically, if it has to do with Perl, then it is allowed. You can ask
CGI, networking, syntax, style, etc... types of questions. If your
question has nothing at all to do with Perl, it will likely be ignored.
If it has anything to do with Perl, it will likely be answered.

  2.5 - I want to help, what should I do?

Subscribe to the list! If you see a question which you can give an
idiomatic and Good answer to, answer away! If you do not know the
answer, wait for someone to answer, and learn a little.

  2.6 - Is there anything I should keep in mind while answering?

We don't want to see 'RTFM'. That isn't very helpful. Instead, guide the
beginner to the place in the FM they should R :)

  2.7 - I don't want to post a question if it is in an FAQ. Where should I
look first?

Look in the FAQ! Get acquainted with the 'perldoc' utility, and use it.
It can save everyone time if you look in the Perl FAQs first, instead of
having a list of people refer you to the Perl FAQs :) You can learn
about 'perldoc' by typing:

`perldoc perldoc'

At your command prompt. You can also view documentation online at:

http://www.perldoc.com and http://www.perl.com

3 - Other Resources
  3.1 - What other websites may be useful to a beginner ?

* Perl Home Page - http://www.perl.com
* PerlMonks - http://www.perlmonks.org
* Perldoc - http://www.perldoc.com
* Perl Archives - http://www.perlarchives.com
  3.2 - What resources may be harmful to a beginner?

Anything having to do with the names Matt Wright, or Selena Sol. Why?
You may ask yourself. Well, their scripts are old and have been known to
be buggy, as well as have security issues. They were written in the days
of Perl 4. This means there is no scoping, stricture, warnings, idioms,
or file locking to name a few issues. Because of this, it may be best to
not steer a new Perl programmer to their code. It is easier to learn the
correct way the first time, rather than have to relearn (or reteach) bad
habits that are picked up.

  3.3 - What books would be good?

* Programming Perl, 3rd Ed. by Larry Wall, et al. (O'Reilly)
* Learning Perl, 3rd Ed. by Randal Schwartz, et al. (O'Reilly)
* Perl Cookbook, by Nat Torkington/Tom Christiansen (O'Reilly)
* Mastering Regular Expressions, by Jeffrey Friedl (O'Reilly)
* Effective Perl Programming, by Joseph N. Hall (Addison-Wesley)
* Network Programming with Perl, by Lincoln Stein (Addison-Wesley)
   

Re: Installing perl modules under Solaris

2001-05-24 Thread Stephen P. Potter

Lightning flashed, thunder crashed and "Rivera Alonso, David"  whispered:
| I understand that it's searching for all those "*.h" mentioned in "perl.h".
| But, where should they be? I've installed gcc compiler, shouldn't it contain
| these files already? do I have to install C libraries or sthg?

You need to install the SUNWhea package from your original installation
media.  GCC does not include the system header files.

-spp



Re: Script Review

2001-05-24 Thread Peter Scott

Congratulations.  When you get a bit further on you'll discover how to use 
modules for XML work, but there's nothing wrong with what you're doing 
right now.

I'll just pick on one part here and let others go for the rest:

At 03:33 PM 5/24/01 +, Stout, Joel R wrote:
>sub testType {
>  if (/^BIG/) {
>   parseBIG ($_[0]);
>  } elsif (/^REF/) {
>   parseREF ($_[0]);
>  } elsif (/^TDS/) {
>   parseTDS ($_[0]);
>  } elsif (/^CAD/) {
>   parseCAD ($_[0]);
>  } elsif (/^ISS/) {
>   parseISS ($_[0]);
>  } elsif (/^CUR/) {
>   parseCUR ($_[0]);
>  } elsif (/^NTE/) {
>   parseNTE ($_[0]);
>  } elsif (/^N1/) {
>   parseN1 ($_[0]);
>  } elsif (/^N3/) {
>   parseN3 ($_[0]);
>  } elsif (/^N4/) {
>   parseN4 ($_[0]);
>  } elsif (/^AMT/) {
>   parseAMT ($_[0]);
>  } elsif (/^ITD/) {
>   parseITD ($_[0]);
>  } elsif (/^PKG/) {
>   parsePKG ($_[0]);
>  } elsif (/^R4/) {
>   parseR4 ($_[0]);
>  } elsif (/^IT1/) {
>   parseIT1 ($_[0]);
>  } elsif (/^PID/) {
>   parsePID ($_[0]);
>  } elsif (/^SE/) {
>   printResults();
>  }

Any time you find yourself doing something that feels mindless or 
uncreative, that's a clue that there's a way for Perl to make life easier 
for you.  In this case, observe the considerable repetition.  You could 
simplifiy this using a function dispatch table (you'll really get a kick 
out of references when you learn them):

sub testType {
 my %dispatch = (BIG => \&parseBIG,
 REF => \&parseREF,
 TDS => \&parseTDS,
 CAD => \&parseCAD,
 ISS => \&parseISS,
 CUR => \&parseCUR,
 NTE => \&parseNTE,
 N1  => \&parseN1,
 N3  => \&parseN3,
 N4  => \&parseN4,
 AMT => \&parseAMT,
 ITD => \&parseITD,
 PKG => \&parsePKG,
 R4  => \&parseR4,
 IT1 => \&parseIT1,
 PID => \&parsePID);
 my $prefixes = join '|', keys %dispatch;
 if (/^($prefixes)/) {
 $dispatch{$1}->(shift);
 }
 elsif /^SE/ {
 printResults();
 }
}

This is vulnerable if you put in more strings where one is a prefix of 
another, though, just be aware of that.

Actually, given your naming structure, it would be possible to make it even 
shorter using even more magic, and avoid that potential ordering problem at 
the same time:

sub testType {
 my $parse = "BIG|REF|TDS|CAD|ISS|CUR|NTE|N1|N3|N4|AMT|ITD|PKG|R4|IT1|PID";
 if (/^($parse)/) {
 my $subname = "parse$1";
 goto &$subname;
 }
 elsif (/^SE/) {
 printResults();
 }
}

but that's a bit unfair to you right now :-)

Oh, and add a -w to your shebang line.
--
Peter Scott
Pacific Systems Design Technologies
http://www.perldebugged.com




How to "touch" a file for testing -C

2001-05-24 Thread Mark Folse

I was written a small application to check the date of the files to
process, and sleep until the new days's files arrived. My problem was
testing. Is there someway not in the man pages to "touch" a file so
that the return from -C reflects the new file system date and time?


=

-
Notice: This e-mail is protected by the U.S. Constitution and the U.N. Declaration of 
Human Rights. Unauthorized interception by any public or private agency is an ugly 
sort of work to be in. Does your mother know you spend your days reading other 
people's mail? Would she be proud of you?Please visit: 
http://clubs.yahoo.com/clubs/district41democrats

__
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/



Re: How to "touch" a file for testing -C

2001-05-24 Thread Walt Mankowski

On Thu, May 24, 2001 at 11:00:19AM -0700, Mark Folse wrote:
> I was written a small application to check the date of the files to
> process, and sleep until the new days's files arrived. My problem was
> testing. Is there someway not in the man pages to "touch" a file so
> that the return from -C reflects the new file system date and time?

Why does it have to not be in the man pages?  :-)

$ perldoc -f utime
 utime LIST
 Changes the access and modification times on each
 file of a list of files.  The first two elements of
 the list must be the NUMERICAL access and
 modification times, in that order.  Returns the
 number of files successfully changed.  The inode
 change time of each file is set to the current time.
 This code has the same effect as the "touch" command
 if the files already exist:

 #!/usr/bin/perl
 $now = time;
 utime $now, $now, @ARGV;

-- 
Walter C. Mankowski
Senior Software EngineerMyxa Corporation
phone: (610) 234-2626   fax: (610) 234-2640
email: [EMAIL PROTECTED]http://www.myxa.com




RE: Is there an alternative to #!/usr/bin/perl

2001-05-24 Thread Peter Cornelius

The camel book suggests the following:

#!/bin/sh --
eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
  if 0;

Is this the best alternative and are there situations in which it might not
work?


I haven't tried to script it but what about 'which perl' ?



script that runs all the time to monitor log file

2001-05-24 Thread Chris Lott

I have a simple little perl program that monitors the email log file for
rejected messages (see below). I start the program using "nohup script.pl &"
and it works fine, sending me an email with info about each rejected
message. However, it just dies out randomly after a day or so for no reason
that I can figure. The script is still there as a process, but it doesn't
perform. 

Is there another way I should be approaching this task?

#!/usr/bin/perl

 $maillog = "/var/log/maillog";
 $TAIL = "/usr/bin/tail";

  open(MAILLOG,"$TAIL -f $maillog |") || die("Can't $TAIL -f $maillog");
while($line = ) {
if ($line =~ /blocked/) {
   system("echo '$line' | mail -s 'RBL rejection' foo\@bar.com");
}
 }
 close(MAILLOG);
 exit(1);




Re: Problems with split

2001-05-24 Thread Me

> ok, Appologies to all for not having included the whole thing, but
here...

The script you attached has 'i' in several places where there should be
'$i'.

Search thru it for {i}.





ip addresses and getting them in perl

2001-05-24 Thread David Matthew Monarres

I wrote a program for my friend that will email him
his ip address if it has change while he was go (I
told him that this wasn't a great idea but he said it
was the only way that he could access a home machine
from work if his dsl dropped the connection) Right now
I have a very rough version but it just seems ugly. He
uses LINUX so basically I spawn an ifconfig and parse
through the output. It would seem to me that since
perl has a ton of networking libs that it would have
one to get the ip of a given piece of hardware. I
looked in the camel but didn't find anything that I
thought that I could use. Was I wrong? would CPAN have
something. Thank you in advance.
David Monarres <[EMAIL PROTECTED]>

__
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/



Re: script that runs all the time to monitor log file

2001-05-24 Thread Craig Moynes/Markham/IBM


This is a problem with tail that I have run into as well.

If the file size gets reset the stored location of EOF remains the same
which is a problem. As the file is written too the size is still below that
of what tail is looking at.  You can add a stat check to watch filesize and
reset the counter when the size is smaller than the previous one.

I think there was another issue with using tail, hm.

You can test it out on the command line though to ensure I have my brain in
alignment.

Ohh the other problem ...

Your script will wait for more data from tail, and if the file size is
reset it just sits there.  To solve this I created a controller process
that spawns off the log reader and then the controller monitors the logfile
size, if it drops below the last size it kills off the log reader process
and respawns it.


Any other solutions perl gods ?

-
Craig Moynes
Internship Student
netCC Development
IBM Global Services, Canada
Tel: (905) 316-3486
[EMAIL PROTECTED]



   
   
Chris Lott 
   
   
ector.com>  cc:
   
Subject: script that runs all the time 
to monitor log file
05/24/01 02:28 PM  
   
   
   
   
   



I have a simple little perl program that monitors the email log file for
rejected messages (see below). I start the program using "nohup script.pl
&"
and it works fine, sending me an email with info about each rejected
message. However, it just dies out randomly after a day or so for no reason
that I can figure. The script is still there as a process, but it doesn't
perform.

Is there another way I should be approaching this task?

#!/usr/bin/perl

 $maillog = "/var/log/maillog";
 $TAIL = "/usr/bin/tail";

  open(MAILLOG,"$TAIL -f $maillog |") || die("Can't $TAIL -f
$maillog");
while($line = ) {
if ($line =~ /blocked/) {
   system("echo '$line' | mail -s 'RBL rejection' foo\@bar.com");
}
 }
 close(MAILLOG);
 exit(1);








RE: script that runs all the time to monitor log file

2001-05-24 Thread Peter Cornelius

Is there another way I should be approaching this task?

How about not using tail?  I'm just ripping this off from the 'Perl
Cookbook' but:

for (;;) { #ever and ever 
while ()
# Do your thing
}

sleep $awhile;
seek(MAILLOG, 0, 1);
}
They claim that doing a seek will reset the EOF to the new position if there
is one.  They also have a solution using IO::Handle and its clearerr()
method.  Pretty much the same thing but add a use IO::Handle at the top and
change the seek to MAILLOG->clearerr();

Peter C.



Perl library question

2001-05-24 Thread David Gilden

Hello,

I have moved my subroutines to a second file
and have named it "subs_lib.pl"

In the main file I have:

require "subs_lib.pl";

Is the following equivalent:

use "subs_lib.pl";
-

Secondly do I need:

#!/usr/bin/perl

as the first line in my "subs_lib.pl"

and are Libraries really modules with .pl instead of .pm?

Thank for everyone's help here :)

Thanks

Dave



Re: script that runs all the time to monitor log file

2001-05-24 Thread Walt Mankowski

On Thu, May 24, 2001 at 02:37:18PM -0400, Craig Moynes/Markham/IBM wrote:
> 
> This is a problem with tail that I have run into as well.
> 
> If the file size gets reset the stored location of EOF remains the same
> which is a problem. As the file is written too the size is still below that
> of what tail is looking at.  You can add a stat check to watch filesize and
> reset the counter when the size is smaller than the previous one.
> 
> I think there was another issue with using tail, hm.
> 
> You can test it out on the command line though to ensure I have my brain in
> alignment.
> 
> Ohh the other problem ...
> 
> Your script will wait for more data from tail, and if the file size is
> reset it just sits there.  To solve this I created a controller process
> that spawns off the log reader and then the controller monitors the logfile
> size, if it drops below the last size it kills off the log reader process
> and respawns it.
> 
> 
> Any other solutions perl gods ?

There are several alternatives offered in perlfaq5 (search for 'How do
I do a "tail -f" in perl?'[1]).  Since the solutions there are variations 
on

loop forever
  reposition
  read to eof
  sleep a bit
end loop

they may (although I haven't tested it) get around the problems you
describe.

Walt

1.  Or, alternatively, "perldoc -q tail".

-- 
Walter C. Mankowski
Senior Software EngineerMyxa Corporation
phone: (610) 234-2626   fax: (610) 234-2640
email: [EMAIL PROTECTED]http://www.myxa.com




Re: ip addresses and getting them in perl

2001-05-24 Thread Brett W. McCoy

On Thu, 24 May 2001, David Matthew Monarres wrote:

> I wrote a program for my friend that will email him
> his ip address if it has change while he was go (I
> told him that this wasn't a great idea but he said it
> was the only way that he could access a home machine
> from work if his dsl dropped the connection) Right now
> I have a very rough version but it just seems ugly. He
> uses LINUX so basically I spawn an ifconfig and parse
> through the output. It would seem to me that since
> perl has a ton of networking libs that it would have
> one to get the ip of a given piece of hardware. I
> looked in the camel but didn't find anything that I
> thought that I could use. Was I wrong? would CPAN have
> something. Thank you in advance.

It's part of a standard Perl installation.  Type 'perldoc gethostbyname'
and you will get some documentation on various system calls to do things
like this.  Here's an example based on one from the Perl Cookbook (Recipe
17.8).

use Sys::Hostname;
use Socket;

my $hostname = hostname();

my ($name, $aliases, $addrtype, $length, @addresses) =
  gethostbyname($hostname) or die "Couldn't resolve hostname $hostname: $!";

my @names = ();
push(@names, $name);

foreach my $alias (split(/\s/, $aliases)) { push(@names, $alias) }
foreach my $addr (@addresses) { push(@names, join(".", unpack('C4', $addr))) }

@names should contain the hostname, any aliases and IP address of your
system.

-- Brett




Re: Is there an alternative to #!/usr/bin/perl

2001-05-24 Thread Stephen P. Potter

Lightning flashed, thunder crashed and Peter Cornelius  whispered:
| The camel book suggests the following:
| 
| #!/bin/sh --
| eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
|   if 0;
| 
| Is this the best alternative and are there situations in which it might not
| work?

The camel suggests this for systems that don't properly parse the shebang
line.  It isn't useful if perl isn't in /usr/bin/perl.  If you can be sure
that perl is in the user path somewhere, you can use

eval 'exec perl -S $0 ${1+"$@"}
 if 0;

Again, that's only good if you are sure perl is in the path somewhere.

-spp



Re: ip addresses and getting them in perl

2001-05-24 Thread Kevin Meltzer

For a non-Perl answer.. has he heard of http://www.dyndns.org ? I use their
(free) service for my home connection, and have my own Perl script which
updates their database when needed. 

For my home one, I LWP to my router and get my WAN IP, but that isn't what you
seem to need :)

Anyways.. look at the documentation for gethostbyname, Socket, and I believe
there is a recipe in The Perl Cookbook for this.

However, for sanity sake, I would suggest to your friend that he gets a dyndns
account (there are clients available on their site to update the IP when it
changes) so he can always access his home computer more easily.

Cheers,
Kevin

On Thu, May 24, 2001 at 11:38:35AM -0700, David Matthew Monarres ([EMAIL PROTECTED]) 
spew-ed forth:
> I wrote a program for my friend that will email him
> his ip address if it has change while he was go (I
> told him that this wasn't a great idea but he said it
> was the only way that he could access a home machine
> from work if his dsl dropped the connection) Right now
> I have a very rough version but it just seems ugly. He
> uses LINUX so basically I spawn an ifconfig and parse
> through the output. It would seem to me that since
> perl has a ton of networking libs that it would have
> one to get the ip of a given piece of hardware. I
> looked in the camel but didn't find anything that I
> thought that I could use. Was I wrong? would CPAN have
> something. Thank you in advance.
> David Monarres <[EMAIL PROTECTED]>
> 
> __
> Do You Yahoo!?
> Yahoo! Auctions - buy the things you want at great prices
> http://auctions.yahoo.com/
> 

-- 
[Writing CGI Applications with Perl - http://perlcgi-book.com]
"If you understand what you're doing, you're not learning anything."
-- Abraham Lincoln



Re: ip addresses and getting them in perl

2001-05-24 Thread Stephen P. Potter

Lightning flashed, thunder crashed and "Brett W. McCoy" <[EMAIL PROTECTED]> 
whispered:
| On Thu, 24 May 2001, David Matthew Monarres wrote:
| It's part of a standard Perl installation.  Type 'perldoc gethostbyname'

perldoc -f gethostbyname will work better, since you are looking for a
function inside a manpage.

The problem with this is what name do you use?  This is a DHCP address
(most likely from DSL).  Most ISP don't provide a static name to a machine,
they provide a dynamic name same as the IP address.  gethostbyname won't
work in this case.

I've found a "trick" that works with my RR account that is completely un
perl-related.  In /etc/sysconfig/network, I have HOSTNAME set to "myname".
In /etc/hosts, I have a mapping from that name to an IP address that I know
is on my ISPs address space.  Whenever my system boots, it requests that IP
address.  If it isn't used, it grants it.  So, I almost have a static
address.

-spp




Re: Is there an alternative to #!/usr/bin/perl

2001-05-24 Thread Steve Neu

Perhaps people understand this already, but I wanted to state it,
because I haven't heard it specifically said.  (Redundancy is good in a
learning environment)
The point is that, if you do not know where Perl is located, you likely
cannot run the script without finding Perl.  For this reason, your
"Perl-finding mission" is going to have to take place outside of your
script.  No amount of anything you put in that script is going to do
anything if you cannot find Perl.  Otherwise, you have code that needs to
find Perl so it can run the code that needs to find Perl so it can run the
code that needs to find Perl so it can... etc.
On a Win box with ActivePerl, however, the system will simply see that
the file has the correct extension and run it, ignoring the sh'bang as a
comment.  Though, this is probably not your situation.

Stephen Neu
Internet Development
Characterlink.net
(630) 323-9800 ext. 235




Re: Perl library question

2001-05-24 Thread Paul


--- David Gilden <[EMAIL PROTECTED]> wrote:
> Hello,
> 
> I have moved my subroutines to a second file
> and have named it "subs_lib.pl"
> 
> In the main file I have:
> 
> require "subs_lib.pl";
> 
> Is the following equivalent:
> 
> use "subs_lib.pl";

No. The argument to use must be a bareword.
c.f. perldoc -f use

> -
> 
> Secondly do I need:
> 
> #!/usr/bin/perl
> 
> as the first line in my "subs_lib.pl"

I don't think so -- they are pulled into the same namespace, so it'll
use the main program's shebang. If you put a shebang, I'd expect it to
ignore it as a comment.
 
> and are Libraries really modules with .pl instead of .pm?

Not necessarily. On the one hand, you could require a .pm, while a use
statement pretty much requires .pm, doesn't it?
 
Also, modules tend to expect their own namespace.
require'd files are just parsed like an eval(), so though they *can*
switch namespaces, they often don't.

Somebody give me a reality check on that one?

__
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/



pop up alert

2001-05-24 Thread Sigrid E Kelsey


I would like an alert to pop up everytime someone accesses a certain cgi
script (I'm new at this).  I have commented out my lame attempts that don't
work below, but I think they will show what I'm trying to do.

#! /usr/sbin/perl

#print "
#   alert('MESSAGE');";

if (($ENV{"REMOTE_ADDR"} =~  123.321.321.321) &&
(!($ENV{"REMOTE_ADDR"} =~ /^123\.123\.123\.132))) {
# alert("MESSAGE");
print "Location:blahblah.html\n\n";
} else {
print "Location:blahblahblah.html\n\n";
}

thank you in advance for any help!
Sigrid




Modifying/Deleting lines in a file

2001-05-24 Thread David Blevins

Thanks to everyone for the great input on my last question.  Here's another.

There has to be a better way to modify/delete lines in a file than this.

my $filename = "thefile";
my $lineToDelete = "I'm a bad line, delete me.";

open(FILE, "< $filename");
open(FILE_TMP, "> $filename.tmp");

while(){
next if /$lineToDelete/;
print FILE_TMP;
}

close(FILE);
close(FILE_TMP);
rename( "$filename.tmp", $filename);



David



Re: ip addresses and getting them in perl

2001-05-24 Thread Brett W. McCoy

On Thu, 24 May 2001, Stephen P. Potter wrote:

> perldoc -f gethostbyname will work better, since you are looking for a
> function inside a manpage.

Oops, a typo.

> The problem with this is what name do you use?  This is a DHCP address
> (most likely from DSL).  Most ISP don't provide a static name to a machine,
> they provide a dynamic name same as the IP address.  gethostbyname won't
> work in this case.

But it should still provide you with an IP address, based on the hostname
you pass to it (like what is returned from the hostname() function); this
need not be a FQDN (the Perl Cookbook gives an additional step to force
the retrieval of a FQDN using gethostbyaddr after the call to
address (Class C private, as well), and passing the hostname retrieved
from hostname() yields a correct IP address.

-- Brett





Re: Is there an alternative to #!/usr/bin/perl

2001-05-24 Thread Timothy Kimball


Stephen Neu wrote:
: ...  Otherwise, you have code that needs to
: find Perl so it can run the code that needs to find Perl so it can run the
: code that needs to find Perl so it can... etc.

Or you can run "perl" on a fixer script and have it edit the script for
you.  That's what my solution does. It doesn't find perl, but it makes
you run the perl that you want to use, and replaces shebang with that
the path to that particular perl interpreter.

In fact, it's lifted from what MakeMaker does when you install a module
that contains executable scripts.

-- tdk



Re: pop up alert

2001-05-24 Thread Timothy Kimball


Sigrid Kelsey wrote:
: I would like an alert to pop up everytime someone accesses a certain cgi
: script (I'm new at this).  I have commented out my lame attempts that don't
: work below, but I think they will show what I'm trying to do.
: 
: #! /usr/sbin/perl
: 
: #print "
: #   alert('MESSAGE');";
: 
: if (($ENV{"REMOTE_ADDR"} =~  123.321.321.321) &&
: (!($ENV{"REMOTE_ADDR"} =~ /^123\.123\.123\.132))) {
: # alert("MESSAGE");
: print "Location:blahblah.html\n\n";
: } else {
: print "Location:blahblahblah.html\n\n";
: }

You can have Perl print the Javascript command that causes a popup:

if ($ENV{REMOTE_ADDR} eq '123.321.321.321' ) {
print "\n";
} else {
print "\n";
}

-- tdk



Re: Modifying/Deleting lines in a file

2001-05-24 Thread Timothy Kimball


David Blevins wrote:
: There has to be a better way to modify/delete lines in a file than this.

Time for a one-liner:

perl -ni -e 'print unless /I'm a bad line, delete me\./' thefile

-n loops through the lines of thefile, but doesn't print them unless you ask

-i edits thefile in place

-e means the next thing on the command line is a Perl script

You can also do this in a script:

#!/bin/perl -ni
print unless /I'm a bad line, delete me\./;

-i can also take a string as an argument which becomes the extension of
the original file.  So if you say "perl -ni.bak -e '...' thefile",
thefile will be edited, and the original will be saved in thefile.bak.
I strongly recommend this because it's so easy to screw up an in-place
edit.

-- tdk



Re: Modifying/Deleting lines in a file

2001-05-24 Thread Brett W. McCoy

On Thu, 24 May 2001, David Blevins wrote:

> Thanks to everyone for the great input on my last question.  Here's another.
>
> There has to be a better way to modify/delete lines in a file than this.
>
> my $filename = "thefile";
> my $lineToDelete = "I'm a bad line, delete me.";
>
> open(FILE, "< $filename");
> open(FILE_TMP, "> $filename.tmp");
>
> while(){
> next if /$lineToDelete/;
> print FILE_TMP;
> }
>
> close(FILE);
> close(FILE_TMP);
> rename( "$filename.tmp", $filename);

That's one way to do it, and there's nothing wrong with this way (I will
note you should be testing for failure on your open and print statements).
You can also let Perl handle some of this temp file business by using the
-i and -p command-line options.  It handles the temp file manipulation for
you:

perl -pie 's/\cM//g' myfile

(see the perlrun docs for more info on this)

Alternatively, you can open the file, dump its lines into an array, pull
out the line you don't want, then write back out.  This is not a good idea
if the file is large, though.

-- Brett




Re: pop up alert

2001-05-24 Thread Paul


--- Sigrid E Kelsey <[EMAIL PROTECTED]> wrote:
> 
> I would like an alert to pop up everytime someone accesses a certain
> cgi script (I'm new at this).
> #print "
> #   alert('MESSAGE');";

Not sure why that one wouldn't workbut try this.
Write a small static HTML test page that does what you want, like so:

 foo
 
 Did it pop up?
 

now wrap the cgi you want around that.

 #!perl -w
 print 

problem with a tutorial

2001-05-24 Thread Nichole Bialczyk

i just started learning perl about 2 days ago and i'm trying to work my 
way through a tutorial and it is just impossible to get this to work. the 
same thing happened with a similair script, but i dismissed it as a 
fluke. even the helpdesk on campus can't figure it out. any ideas?

thanks, nichole

#!/usr/bin/perl

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

read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$FORM{$name} = $value;
}

print "Form Output";
print "Results from FORM post\n";

foreach $key (keys(%FORM)) {
print "$key = $FORM{$key}";
}

print "";





Re: problem with a tutorial

2001-05-24 Thread Peter Scott

At 03:39 PM 5/24/01 -0500, Nichole Bialczyk wrote:
>i just started learning perl about 2 days ago and i'm trying to work my
>way through a tutorial and it is just impossible to get this to work. the
>same thing happened with a similair script, but i dismissed it as a
>fluke. even the helpdesk on campus can't figure it out. any ideas?

Well, we could take severe issue with the approach used by the tutorial 
(roll-your-own CGI processing instead of using CGI.pm, no -w or use strict) 
but there's nothing wrong with the script below.  I pasted it into a CGI 
program and pointed a form at it, it works.  Only thing is, it only handles 
POST requests, not GETs.

>thanks, nichole
>
>#!/usr/bin/perl
>
>print "Content-type:text/html\n\n";
>
>read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
>@pairs = split(/&/, $buffer);
>foreach $pair (@pairs) {
> ($name, $value) = split(/=/, $pair);
> $value =~ tr/+/ /;
> $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
> $FORM{$name} = $value;
>}
>
>print "Form Output";
>print "Results from FORM post\n";
>
>foreach $key (keys(%FORM)) {
> print "$key = $FORM{$key}";
>}
>
>print "";

--
Peter Scott
Pacific Systems Design Technologies
http://www.perldebugged.com




Re: problem with a tutorial

2001-05-24 Thread Stephen P. Potter

Exactly what is the problem that you seem to be having?  This is a CGI
script that needs to be run from a web server.  Do you have a web server
that you have cgi-bin access to?  What doesn't work for you?  This worked
just fine for me.

-spp

Lightning flashed, thunder crashed and Nichole Bialczyk <[EMAIL PROTECTED]> whispered
:
| i just started learning perl about 2 days ago and i'm trying to work my 
| way through a tutorial and it is just impossible to get this to work. the 
| same thing happened with a similair script, but i dismissed it as a 
| fluke. even the helpdesk on campus can't figure it out. any ideas?
| 
| thanks, nichole
| 
| #!/usr/bin/perl
| 
| print "Content-type:text/html\n\n";
| 
| read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
| @pairs = split(/&/, $buffer);
| foreach $pair (@pairs) {
| ($name, $value) = split(/=/, $pair);
| $value =~ tr/+/ /;
| $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
| $FORM{$name} = $value;
| }
| 
| print "Form Output";
| print "Results from FORM post\n";
| 
| foreach $key (keys(%FORM)) {
| print "$key = $FORM{$key}";
| }
| 
| print "";
| 
| 



handling flat-file layouts -- pack or sprintf or something else?

2001-05-24 Thread chris brown

Hello,

Looking for style advice here.

I'm trying to populate records into a flat-file layout
for transfer to a mainframe (offtopic: the FAXed file
layout I received says "prior revision: 11/01/81". 
Sweet!).

Anyway, the layout requires that numerics be
zero-filled to the left, so a 3-byte field containing
the number 7 would show as 007 in the file.  The
layout contains only alphanumerics, nothing fancy.

I would prefer to write each record using pack, but I
can't see how to elegantly get pack to zero-fill
without using sprintf.  And I kind of feel like once
I'm using sprintf I might as well ONLY use sprintf for
the whole record.  And *that* doesn't feel very
Perlish to me, so I suspect there's a different
solution.

Thanks in advance for your thoughts!

Chris


__
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/



Re: problem with a tutorial

2001-05-24 Thread Nichole Bialczyk

never mind. for some reason it works now. i think that the server was 
jsut toying with me ;)



RE: Modifying/Deleting lines in a file

2001-05-24 Thread David Blevins


So, as far as editing files in a subroutine of a script, there does not seem
to be an easier or more performant way?

Would it be performant to call the perl command as a subprocess, as in:

`perl -ni -e 'print unless /I'm a bad line, delete me\./' thefile`;


David

> Timothy Kimball wrote:
>
> David Blevins wrote:
> : There has to be a better way to modify/delete lines in a file than this.
>
> Time for a one-liner:
>
> perl -ni -e 'print unless /I'm a bad line, delete me\./' thefile
>
> -n loops through the lines of thefile, but doesn't print them
> unless you ask
>
> -i edits thefile in place
>
> -e means the next thing on the command line is a Perl script
>
> You can also do this in a script:
>
> #!/bin/perl -ni
> print unless /I'm a bad line, delete me\./;
>
> -i can also take a string as an argument which becomes the extension of
> the original file.  So if you say "perl -ni.bak -e '...' thefile",
> thefile will be edited, and the original will be saved in thefile.bak.
> I strongly recommend this because it's so easy to screw up an in-place
> edit.
>
> -- tdk
>




RE: Modifying/Deleting lines in a file

2001-05-24 Thread Brett W. McCoy

On Thu, 24 May 2001, David Blevins wrote:

> So, as far as editing files in a subroutine of a script, there does not seem
> to be an easier or more performant way?
>
> Would it be performant to call the perl command as a subprocess, as in:
>
> `perl -ni -e 'print unless /I'm a bad line, delete me\./' thefile`;

For a simple script, you can use -n and -i in your shebang line.  If you
are doing something more complicated, like lots of sub calls and other
cool Perl things, you may want to create a generic sub to edit the file,
using the temp file method.  It's probably the safest and most scalable
way of doing it.

-- Brett




RE: Modifying/Deleting lines in a file

2001-05-24 Thread Jeff Pinyan

On May 24, David Blevins said:

>So, as far as editing files in a subroutine of a script, there does not seem
>to be an easier or more performant way?
>
>Would it be performant to call the perl command as a subprocess, as in:
>
>`perl -ni -e 'print unless /I'm a bad line, delete me\./' thefile`;

You can make use of -i in your program:

  {
local $^I = "";  # set to something like ".bak" for a backup
local @ARGV = "thefile";  # list of files to edit

while (<>) {
  print unless /delete me/;
}
  }

-- 
Jeff "japhy" Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
Are you a Monk?  http://www.perlmonks.com/ http://forums.perlguru.com/
Perl Programmer at RiskMetrics Group, Inc. http://www.riskmetrics.com/
Acacia Fraternity, Rensselaer Chapter. Brother #734
** I need a publisher for my book "Learning Perl's Regular Expressions" **




IO::Pipe: how to redirect to STDOUT

2001-05-24 Thread Rob McMillin

If I get an IO::Pipe object, how can I use it to redirect STDOUT? I'm in the
process of writing a replacement for the open(FOO,"some_process|") idiom for
a subprocess and because I like debugging, I don't want ctrl-C being sent to
the child process. I see this as

$pipe = IO::Pipe->new();

$pid = fork();
defined($pid) or croak("oops, fork bombed");
if (!$pid)
{
$pipe->writer;
open(STDOUT,">&$pipe") || croak "can't redirect stdout";
exec($cmd);
}
# reader parent continues here

But that's not working.  Any ideas?

BTW -- Graham, I'm cc'ing you on this.  As this seems to me to be pretty
common, assuming there is a correct way to do this, could you maybe include
this in the POD?

---
 [EMAIL PROTECTED] | Dog is my co-pilot.




Unusual Sort question

2001-05-24 Thread Gustho

Below is a sample directory listing of the mail folder
on a Linux box, I would like to sort the same using
the last field (ie. lward, ohara, dray) starting with
the 2nd character (ie from ward , hara and ray) :

-rw--- 1 lward   mail0 May 24  15:43 lward
-rw--- 1 ohara   mail 8303 May 24  15:42 ohara   
-rw--- 1 draymail0 May 24  15:42 dray  

Any Suggestions would be greatly appreciated. TIA





=
Regards,

Gustho

___
Do You Yahoo!?
Get your free @yahoo.ca address at http://mail.yahoo.ca



Re: Unusual Sort question

2001-05-24 Thread Jeff Pinyan

On May 24, Gustho said:

>Below is a sample directory listing of the mail folder
>on a Linux box, I would like to sort the same using
>the last field (ie. lward, ohara, dray) starting with
>the 2nd character (ie from ward , hara and ray) :
>
>-rw--- 1 lward   mail0 May 24  15:43 lward
>-rw--- 1 ohara   mail 8303 May 24  15:42 ohara   
>-rw--- 1 draymail0 May 24  15:42 dray  

A Schwartzian Transform (or maybe even a Guttman-Rosler Transform) seems
like a good idea here.

  @sorted =

# get the original line back
map { $_->[0] }

# sort based on the string
sort { $a->[1] cmp $b->[1] }

# create [ line, string ] array references
map { [ $_, /\S(\S+)$/ ] }

# however you get the directory listing...
qx(ls -la $dir);

A GRT would require one scan through the list first, to find the longest
username.

  @files = qx(ls -la $dir);

  $maxlen = 0;

  # loop over the usernames
  for (map /\S(\S+)$/, @files) {
push @usernames, $_;
$maxlen = length if $maxlen < length;
  }

Now the GRT looks like:

  @sorted =

# get rid of leading sorting string
map { s/^\S+\s+// }

# sort natively -- the signature of the GRT
sort

# build the string of "prefix" . " " . $line
# padding the username properly
map { sprintf "%-${maxlen}s %s", $usernames[$_], $files[$_] }

# the indices of the array, not the actual elements
0 .. $#files;

I hope this sheds some light on an interesting problem.

-- 
Jeff "japhy" Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
Are you a Monk?  http://www.perlmonks.com/ http://forums.perlguru.com/
Perl Programmer at RiskMetrics Group, Inc. http://www.riskmetrics.com/
Acacia Fraternity, Rensselaer Chapter. Brother #734
** I need a publisher for my book "Learning Perl's Regular Expressions" **




Re: Unusual Sort question

2001-05-24 Thread Peter Scott

At 05:59 PM 5/24/01 -0400, Gustho wrote:
>Below is a sample directory listing of the mail folder
>on a Linux box, I would like to sort the same using
>the last field (ie. lward, ohara, dray) starting with
>the 2nd character (ie from ward , hara and ray) :
>
>-rw--- 1 lward   mail0 May 24  15:43 lward
>-rw--- 1 ohara   mail 8303 May 24  15:42 ohara
>-rw--- 1 draymail0 May 24  15:42 dray
>
>Any Suggestions would be greatly appreciated. TIA

my $directory = shift;
@lines = `ls -l $directory`;
shift @lines;   # Total...
@lines = sort { substr((split /\s+/, $a)[8],1) cmp substr((split /\s+/, 
$b)[8],1) } @lines;
print @lines;

Yeah, it's not as efficient as it could be, but you won't notice that 
unless your directories contain more than ten thousand entries or you're 
running on a 386...

--
Peter Scott
Pacific Systems Design Technologies
http://www.perldebugged.com




Sort

2001-05-24 Thread Teresa Raymond

I would like to add sort to an existing script that was written by 
someone else.  I've taken an Intro to Perl class and a CGI-Perl 
class.  I can't understand the script AT ALL and at this point I've 
written a bulletin board program, contact form/auto-email-responder, 
as well as an apartment locator search and database program.  The 
script converts files in Pagemaker / text into html files.  We want 
to output the html files alphabetically, seemed simple but I can't 
make heads or tails of it.

The script is about 700K but I could put it on a web page or send it 
as an attachment if anyone is willing to help me - including anyone 
who wants a fee of say 25.00 dollars.

-Teresa
Teresa Raymond
http://www.mariposanet.com
[EMAIL PROTECTED]



Re: Unusual Sort question

2001-05-24 Thread Jeff Pinyan

On May 24, Jeff Pinyan said:

>Now the GRT looks like:
>
>  @sorted =
>
># get rid of leading sorting string
>map { s/^\S+\s+// }

That should be

 map { s/^\S+\s+//; $_ }

or even

 grep { s/^\S+\s+// }

You can use grep() here since all lines will match that regex.

-- 
Jeff "japhy" Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
Are you a Monk?  http://www.perlmonks.com/ http://forums.perlguru.com/
Perl Programmer at RiskMetrics Group, Inc. http://www.riskmetrics.com/
Acacia Fraternity, Rensselaer Chapter. Brother #734
** I need a publisher for my book "Learning Perl's Regular Expressions" **




RE: Unusual Sort question

2001-05-24 Thread Wagner-David

Here is a shot using map:

my @UnSorted = ();
$UnSorted[0] = '-rw--- 1 lward   mail0 May 24  15:43 lward';
$UnSorted[2] = '-rw--- 1 ohara   mail 8303 May 24  15:42 ohara';  
$UnSorted[1] = '-rw--- 1 draymail0 May 24  15:42 dray'; 

foreach $alt (sort {$a->[1] cmp $b->[1] } map{ [$_, /\s+\w(\w+)$/i ] }
@UnSorted) {
   printf "%-s\n", $alt->[0];
 }

Wags ;)

-Original Message-
From: Gustho [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 24, 2001 15:00
To: [EMAIL PROTECTED]
Subject: Unusual Sort question


Below is a sample directory listing of the mail folder
on a Linux box, I would like to sort the same using
the last field (ie. lward, ohara, dray) starting with
the 2nd character (ie from ward , hara and ray) :

-rw--- 1 lward   mail0 May 24  15:43 lward
-rw--- 1 ohara   mail 8303 May 24  15:42 ohara   
-rw--- 1 draymail0 May 24  15:42 dray  

Any Suggestions would be greatly appreciated. TIA





=
Regards,

Gustho

___
Do You Yahoo!?
Get your free @yahoo.ca address at http://mail.yahoo.ca



RE: Unusual Sort question

2001-05-24 Thread Peter Cornelius

>I would like to sort the same using
> the last field (ie. lward, ohara, dray) starting with
> the 2nd character (ie from ward , hara and ray) :

Check out perldoc sort and perldoc substr.  I think this will do what you
want

@sorted = sort {
$aname = (split /\s+/, $a)[-1];
$bname = (split /\s+/, $b)[-1];
(substr($aname, 1)) cmp (substr($bname, 1)) } ;

change  to whatever is getting you your directory listing or a list or
whatever.

Peter C.




RE: cgi-bin

2001-05-24 Thread King, Jason

justin todd writes ..

>Can anyone tell me if with IIS on NT4.0 you need to create a cgi-bin or
>if you set the file permissions through the IIS Manager?

there are two things that you need to do

1. in the IIS admin the directory that you're using as your scripting
directory needs to have 'Script' access (on the properties sheet for that
directory) .. the common wisdom is to have it as a separate virtual
directory

2. the directory itself needs to have RX (Read, Execute) permissions for the
account that IIS is using to access the files (usually something beginning
with IUSR_)

-- 
  jason king

  In Norway, you may not spay your female dog or cat.  However, you may
  neuter the males of the species. - http://dumblaws.com/



Re: Sort

2001-05-24 Thread Walt Mankowski

On Thu, May 24, 2001 at 06:25:30PM -0500, Teresa Raymond wrote:
> I would like to add sort to an existing script that was written by 
> someone else.  I've taken an Intro to Perl class and a CGI-Perl 
> class.  I can't understand the script AT ALL and at this point I've 
> written a bulletin board program, contact form/auto-email-responder, 
> as well as an apartment locator search and database program.  The 
> script converts files in Pagemaker / text into html files.  We want 
> to output the html files alphabetically, seemed simple but I can't 
> make heads or tails of it.
> 
> The script is about 700K but I could put it on a web page or send it 
> as an attachment if anyone is willing to help me - including anyone 
> who wants a fee of say 25.00 dollars.

Good lord, a 700K script!  Is it all one massive file, or did they at
least split it into smaller, more digestible chunks?  Either way, I'd
personally want a *lot* more than $25 to even think of diving into a
monster of that size.

Perhaps it would be easier to do the sort externally after the program
finishes?

Walt




Re: handling flat-file layouts -- pack or sprintf or something else?

2001-05-24 Thread Stephen P. Potter

Lightning flashed, thunder crashed and chris brown <[EMAIL PROTECTED]> whispered:
| I would prefer to write each record using pack, but I
| can't see how to elegantly get pack to zero-fill
| without using sprintf.  And I kind of feel like once
| I'm using sprintf I might as well ONLY use sprintf for
| the whole record.  And *that* doesn't feel very
| Perlish to me, so I suspect there's a different
| solution.

Nope, pack works on bytes.  If you want to pad your output, you need to use
something like sprintf.  See perlfunc:

   ·   You must yourself do any alignment or
   padding by inserting for example enough
   `'x''es while packing.  There is no way to
   pack() and unpack() could know where the
   bytes are going to or coming from.
   Therefore `pack' (and `unpack') handle
   their output and input as flat sequences
   of bytes.

-spp




Re: handling flat-file layouts -- pack or sprintf or something else?

2001-05-24 Thread Walt Mankowski

On Thu, May 24, 2001 at 10:58:38PM -0400, Stephen P. Potter wrote:
> Lightning flashed, thunder crashed and chris brown <[EMAIL PROTECTED]> whispered:
> | I would prefer to write each record using pack, but I
> | can't see how to elegantly get pack to zero-fill
> | without using sprintf.  And I kind of feel like once
> | I'm using sprintf I might as well ONLY use sprintf for
> | the whole record.  And *that* doesn't feel very
> | Perlish to me, so I suspect there's a different
> | solution.
> 
> Nope, pack works on bytes.  If you want to pad your output, you need to use
> something like sprintf.  See perlfunc:

What exactly feels "unperlish" about sprintf?  Perl is all about using
the right tool for the right job, and sprintf imho is the right tool
for zero-filling.

If you insist on doing it without sprintf, there are some alternatives
in perlfaq4.

Walt



Re: ip addresses and getting them in perl

2001-05-24 Thread David Monarres

Thank you guys, but I thought of gethostbyname() but that really doesn't
solve the problem as I know it. I really do not know howdsl assigns
hostnames, but I know that on my dial-up it would be something like
pool000x.yada.yada.earthlink.net nad it would be different everytime that
the link goes down/up. SO I would have to know the hostname before I look
for the ip. I only will know the interface name before I poll the link.
Does anybody have a perl way to get an ip from a specific interface.
David Monarres 
<[EMAIL PROTECTED]>

ps. sorry if you have already answered this and I missed it, I haven't
slept well in the last few days (finals).




reg ftp

2001-05-24 Thread baby lakshmi

hi
while doing ftp from windows to unix, the file contains ctl M at the end of 
each line. my file is a huge data file. i am not able to delete that. is 
there any better way to delete it.
If anyone can answer this, it wud be helpful to me.
Thank you
Regards
babylakshmi

_
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.