Tk

2003-01-19 Thread Mark Goland
hey gang,

I know this is unrelated, but does anyone know of a good Tk tutorial, or
book ??

Thanx,
Mark


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Out of Memory Working With Large Files

2003-01-19 Thread Nelson Ray
Just as a little background, I am working on a BioInformatics program that
runs on large (about 300 meg) text files.  I am using a filehandle to open
and load it into an array.  Then I use the join command to read the array
into a scalar variable in order to be in a workable form for my
computationally intensive program.  The problem, however, is that the
machine I am working with only has 256 megs of RAM.  I have split the files
into 50-60 meg chunks, but my program still uses all the available physical
memory.  I am quite new to perl and do not know any other methods of working
with the data other than to make it a scalar variable, which requires
loading it into memory.  Does anyone have any solution to my memory woes?  I
would greatly appreciate your help.  Thanks a lot.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Newbie - Perl installation on WinXP

2003-01-19 Thread Anthoni
Hi there Wiggins,

Thank you for your advice, I have heard of Cygwin and tried to visit their
site but it says it can't find the domain. Will try later. I have also heard
of ActiveState. I am wanting to develop pure CGI programs with Perl (when i
finally learn it), is this setup still good for this, getting ActiveState
and CygWin. I suppose installing Apache on my machine will be required as
well. Recommend any distro's like FoxServ, etc?

Regards
Anthoni


"Wiggins D'Anconia" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Many Windows perl'ers advocate ActiveState's ActivePerl which is very
> fine, I would suggest using Cygwin (http://www.cygwin.com) if you wanted
> to most closely simulate the linux environment under windows. It comes
> with a nice installer, and will give you many of the command line
> utilities you will be using under Linux.  As a 90% Linux (8% Mac OS X,
> 2% Win NT (work)) I depend on having Cygwin installed under NT.
>
> http://danconia.org
>
> Anthoni wrote:
> > Hi there Coders,
> >
> > I am totally new to Perl programming, but know the following languages.
> > Java, Visual Basic and Pascal / Delphi. I also know a smidgin of C. I
have
> > ordered a book from Amazon that will teach me, but before it arrives I
would
> > like to dabble a bit.
> >
> > I have some webspace on a Unix / Linux server that has the Apache server
> > installed. I am running WinXP for the time being (Hoping to get Lindows
> > Linux Distro). What I want to know is what is the best method for
getting
> > Perl up and running on WinXP box that will allow me to then upload to my
> > webspace on the Linux box? I would like to simply code on my XP box,
then
> > just upload to my server (with as little alterations as possible of
course
> > :)
> >
> > Kind Regards
> > Anthoni
> >
> >
> >
>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Out of Memory Working With Large Files

2003-01-19 Thread Rob Dixon
Hi Nelson

Nelson Ray wrote:
> Just as a little background, I am working on a BioInformatics program
> that runs on large (about 300 meg) text files.  I am using a
> filehandle to open and load it into an array.  Then I use the join
> command to read the array into a scalar variable in order to be in a
> workable form for my computationally intensive program.

My first thought is that you're wasting space here by duplicating the
file's contents into both the array and the scalar. Just read directly
into the scalar (by enabling 'slurp' mode) like this:

my $contents;
{
local $/;
open FILE, "< file.txt";
$contents = ;
close FILE;
}

> The problem,
> however, is that the machine I am working with only has 256 megs of
> RAM.  I have split the files into 50-60 meg chunks, but my program
> still uses all the available physical memory.

If you can split it into chunks, then you can read and process the
entire file in chunks from Perl. It's very unusual to need all of the
file in memory at one time, and if you can go as far as processing
individual lines then just use:

open FILE, "< file.txt";

while ()
{
:# $_ is the current line
:# $. is the current line number
}

close FILE;

> I am quite new to perl
> and do not know any other methods of working with the data other than
> to make it a scalar variable, which requires loading it into memory.

There are many ways. Can you tell us more about the problem that you
need to solve, then we'll be able to help better?

> Does anyone have any solution to my memory woes?  I would greatly
> appreciate your help.  Thanks a lot.

Cheers,

Rob




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Can somebody send me RFC numbers of POP3 & SMTP

2003-01-19 Thread LRMK
can somebody send me RFC numbers of POP3 & SMTP



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Can somebody send me RFC numbers of POP3 & SMTP

2003-01-19 Thread Jenda Krynicky
From:   "LRMK" <[EMAIL PROTECTED]>
> can somebody send me RFC numbers of POP3 & SMTP

http://www.faqs.org/rfcs/
SMTP = 2821
POP3 = 1939
MIME = 2045-2049

Jenda
P.S.: I't possible that one of those is already obsoleted by a higher 
number. You'll find that info on that site.

Jenda
= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: How 'global' are STDIN/STDOUT/STDERR?

2003-01-19 Thread Jenda Krynicky
From:   "Beau E. Cox" <[EMAIL PROTECTED]>
> I am developing a perl 5.8 application using the
> new threading model. I use this technique
> (thanks Jenda!) to dup STDIN to a temp file handle:
>   ...
>   open SAVIN, '<&STDIN';
>   open (STDIN,'<&' . $tmpfh->fileno) or die "...";
>   my $out = `some-command 2>&1`;
>   open STDIN, '<&SAVIN';
>   close $tmpfh;
>   ...
> in various threads. All works - the command run
> reads from STDIN and output to STDOUT (maybe
> STDERR also). I get the output in $out.
> 
> My question: how 'global' is STDIN? Must I place
> a lock on some dummy shared variable when using
> STDIN in a thread, in other words, will all
> threads 'see' the dup of STDIN?

I'm afraid the behaviour of "dup"ing may be operating system 
dependent. Therefore it might be better to use either the 
select(OTHER) or local(*STDOUT) way.

I tried the attached script on my computer (Win2k server) and all 
three ways behaved well (the redirection was thread specific) in both 
Active Perl 631 and 804.

HTH, Jenda
P.S.: For those not aware of that: fork() creates a new THREAD, not a 
new process under Windows. I wanted to test this on both 5.6.1 (6xx) 
and 5.8 (8xx) therefore I had to use this way of creating threads. 
The threads.pm was not available with 5.6.1. If you use a different 
OS you will want to convert the code to the threads.pm style.

And yes, you are right, I've never worked with threads.pm. I wrote 
several multithreaded windows services using fork() so it was easier 
for me to write the code like this.
= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery



use strict;
$|=1;
print "Before fork() : $$\n";

my $pid = fork();
if (!defined $pid) {
print "failed to fork()\n";
} elsif ($pid) {
print "parent started : $$\n";
sleep(1); # to make sure both threads had time to print the "started" message
parent_select();
#   parent_local();
#   parent_dup();
print "parent finished : $$\n";
} else {
print "child started : $$\n";
sleep(1); # to make sure both threads had time to print the "started" message
child();
print "child finished : $$\n";
}

sub child {
sleep(2);
print "NOT redirected child : $$\n";
sleep(4);
}

sub parent_select { # thread-local
{ # redirect
open my $OUT, '> test.txt' or die "Can't write to test.txt : $!\n";
select($OUT);
print "redirected parent : $$\n";
sleep(4);
select(STDOUT);
close $OUT;
} # redirect back
}

sub parent_local { # thread-local
{ # redirect
local *STDOUT;
open STDOUT, '> test.txt' or die "Can't write to test.txt : $!\n";
print "redirected parent : $$\n";
sleep(4);
close STDOUT;
} # redirect back
}

sub parent_dup { # thread-local
{ # redirect
open my $OUT, '>&STDOUT' or die "Can't dup STDOUT : $!\n";
close(STDOUT);
open STDOUT, '> test.txt' or die "Can't write to test.txt : $!\n";
print "redirected parent : $$\n";
sleep(4);
close(STDOUT);
#   open STDOUT, ">&", $OUT or die "Can't restore STDOUT : $!\n"; # 5.8 
only
open STDOUT, ">&" . fileno($OUT) or die "Can't restore STDOUT : $!\n";
close $OUT;
} # redirect back
}


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


scalar number or string?

2003-01-19 Thread Jacques Lederer
Hello,
When you write
$calc=3+5-2;
print $calc."\n";
you get 6. (number, not the string "3+5-2")
When you write
while () {
$calc=$_;
print $calc."\n";
last;
}
if you run that last one and type 3+5-2, you get 3+5-2.(string "3+5-2", not the number 
6)
Why is it so? And how can I get it to calculate the thing?
I have gone through all of the perldoc perlfaqs. Maybe the answer is so simple that I 
don't see it. I am just trying to build a simple calculator. I have found a rather 
complicate solution which works, but there must be a very simple solution, isn't it?

Jacques L


Re: scalar number or string?

2003-01-19 Thread Mystik Gotan
Aye. I once made a simple program, just for calculating + and *. I had no 
problem with that. Which means somethin' like:

#!usr/bin/perl

print "Enter a number.";
$number = ;
# *ing by 2 (can't get to the right word)
$result = $number * 2;
print "Aye, the result is" . $result;

Which you could do some tests with.

Bob




From: "Jacques Lederer" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Subject: scalar number or string?
Date: Sun, 19 Jan 2003 18:44:31 +0100

Hello,
When you write
$calc=3+5-2;
print $calc."\n";
you get 6. (number, not the string "3+5-2")
When you write
while () {
$calc=$_;
print $calc."\n";
last;
}
if you run that last one and type 3+5-2, you get 3+5-2.(string "3+5-2", not 
the number 6)
Why is it so? And how can I get it to calculate the thing?
I have gone through all of the perldoc perlfaqs. Maybe the answer is so 
simple that I don't see it. I am just trying to build a simple calculator. 
I have found a rather complicate solution which works, but there must be a 
very simple solution, isn't it?

Jacques L


_
Ontvang je Hotmail & Messenger berichten op je mobiele telefoon met Hotmail 
SMS http://www.msn.nl/jumppage/


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: scalar number or string?

2003-01-19 Thread Paul Johnson
On Sun, Jan 19, 2003 at 06:44:31PM +0100, Jacques Lederer wrote:

> Hello,
>
> When you write
>
> $calc=3+5-2;
> print $calc."\n";
>
> you get 6. (number, not the string "3+5-2")
>
> When you write
>
> while () {
> $calc=$_;
> print $calc."\n";
> last;
> }
>
> if you run that last one and type 3+5-2, you get 3+5-2.(string
> "3+5-2", not the number 6)
>
> Why is it so? And how can I get it to calculate the thing?
>
> I have gone through all of the perldoc perlfaqs. Maybe the answer is
> so simple that I don't see it. I am just trying to build a simple
> calculator. I have found a rather complicate solution which works, but
> there must be a very simple solution, isn't it?

The input you get is a string.  If you want to treat it as a Perl
expression you need C.

  $calc = eval;

This does what you want, plus a lot more.

Be careful not to type "unlink <*>" for example.

Another option is to write the parsing code yourself.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: scalar number or string?

2003-01-19 Thread Jenda Krynicky
From: Paul Johnson <[EMAIL PROTECTED]>
> On Sun, Jan 19, 2003 at 06:44:31PM +0100, Jacques Lederer wrote:
> > When you write
> >
> > $calc=3+5-2;
> > print $calc."\n";
> >
> > you get 6. (number, not the string "3+5-2")
> >
> > When you write
> >
> > while () {
> > $calc=$_;
> > print $calc."\n";
> > last;
> > }
> >
> > if you run that last one and type 3+5-2, you get 3+5-2.(string
> > "3+5-2", not the number 6)
> >
> > Why is it so? And how can I get it to calculate the thing?
> 
> The input you get is a string.  If you want to treat it as a Perl
> expression you need C.
> 
>   $calc = eval;
> 
> This does what you want, plus a lot more.
> 
> Be careful not to type "unlink <*>" for example.

I guess that if you only want to evaluate some basic math there it'll 
be easiest to do this:

$calc = ;
# remove everything except numbers, dots, +, -, *, / and ( )
$calc =~ tr{0-9+\-*/.() }{}dc;
$result = eval $calc;
die "Incorrect expression: $calc\n\t$@\n"
if $@;
print "Result: $result\n";

If you want to warn the user that the expression contained something 
you did not want you can do this:

$calc = ;
# we have to strip the newline at the end of the entered data!
chomp($calc); 
# remove everything except numbers, dots, +, -, *, / and ( )
if ($calc =~ tr{0-9+\-*/.() }{}dc) {
die "You can only enter numbers, +, -, *, /, ., ( and )\n";
}
$result = eval $calc;
die "Incorrect expression: $calc\n\t$@\n"
if $@;
print "Result: $result\n";

HTH, Jenda
= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: CSV File Creation

2003-01-19 Thread R. Joseph Newton
"Is a CSV a comma delimited list. If so when creating a CSV how does one cope with
fields that have commas in them.[?]"

Hi Colin,

Sorry for the late response.  I forgot the solution I had come up with earlier.  I 
used in a project that I tabled while I was working on another one.  Try(on the 
loading end):


sub DataPrint {
  my($Handle, $key, $hashref) = @_;
  my $Data = $contents{$key};
  $Data =~ (s/,/%2C/);
  print $Handle "$Data,";
}

used as in:
  DataPrint(NEWMEMBER, 'MemberName', \%contents);
I developed it particularly for name fields, since that is where people from 
militaristic or bereaucratic backgrounds would be likely to use the "Last, Fist M" 
format.  It does rquire on the other end, that fields be scanned with the usual CGI 
query string translation for special characters:

   $value =~ s/%([a-fA-F0-9][a-fA-f0-9])/pack("C", hex($1))/eg;

or the equivalent in whatever language you use to read the data.

Joseph


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Fw: pid

2003-01-19 Thread Jacques Lederer

- Original Message -
From: "Jacques Lederer" <[EMAIL PROTECTED]>
To: "Paul Johnson" <[EMAIL PROTECTED]>
Sent: Sunday, January 19, 2003 8:32 PM
Subject: Re: pid


> OK. Thanks very much, the eval thing does work.
> I have another one now, on another subject. On a linux box, I am trying to
> get a simple way to get automatically the pid of a process that I am
> starting. You will say this is very easy, with open or fork. However the
> problem is that I have to start a series of processes: "cd my_directory;
> cmd" What I need is the pid of "cmd", and not the pid of "cd
my_directory".
> And if I do something like
> system "cd my_directory";
> $pid = open ("cmd |"); then the "cd  my directory" is useless, because
this
> is now another shell, and "cmd" doesn't work as it is not being executed
in
> my_directory.  :-(
> Then the next situation is when "cmd" is actually a script in which there
is
> a command like
> "java -jar stuff.jar args this and that &", and what I want is the pid of
> this java. (when there are already other java processes running on the
box)
> I have solved the problem in a rather circumvoluted and complicated way
that
> works, however again I do feel I may have missed a simple easy way to do
it.
> What I mean is not to manually get the pid with ps -ef, but to
automatically
> get it so it can be used in a script.which I can then use to check the
satus
> of or kill the process.
>
> Jacques L
>

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: scalar number or string?

2003-01-19 Thread Oblak, Sasha
You have to compile the input.  Try using eval.

It should look something like:

while () {
$calc= eval $_;
print $calc."\n";
last;
}

But, don't forget to catch errors.

Sasha

> -Original Message-
> From: Jacques Lederer [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, January 19, 2003 12:45 PM
> To: [EMAIL PROTECTED]
> Subject: scalar number or string?
> 
> 
> Hello,
> When you write
> $calc=3+5-2;
> print $calc."\n";
> you get 6. (number, not the string "3+5-2")
> When you write
> while () {
> $calc=$_;
> print $calc."\n";
> last;
> }
> if you run that last one and type 3+5-2, you get 
> 3+5-2.(string "3+5-2", not the number 6)
> Why is it so? And how can I get it to calculate the thing?
> I have gone through all of the perldoc perlfaqs. Maybe the 
> answer is so simple that I don't see it. I am just trying to 
> build a simple calculator. I have found a rather complicate 
> solution which works, but there must be a very simple 
> solution, isn't it?
> 
> Jacques L
> 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: scalar number or string?

2003-01-19 Thread R. Joseph Newton
"...if you run that last one and type 3+5-2, you get 3+5-2.(string "3+5-2", not the
number 6)"   --Jacques

Hi Jacques,

Well, this is about data types.  Unfortunately, Perl tends to haze up the issue by 
doing away with explicit types and doing everything implicitly.  In a programming, as 
opposed to scripting, language, the assignment statements would have equivalents:

$calc=3+5-2;
int calc = 3 + 5 + 2;

$calc=$_;
string calc = $_;

Joseph


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: scalar number or string?

2003-01-19 Thread R. Joseph Newton
And how can I get it to calculate the thing?

print eval($calc) ."\n";
Hi Jacques,

Sorry.  In my previous post, I answered your first question, but offered no solution.

Joseph


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Out of Memory Working With Large Files

2003-01-19 Thread John W. Krahn
Nelson Ray wrote:
> 
> Just as a little background, I am working on a BioInformatics program that
> runs on large (about 300 meg) text files.  I am using a filehandle to open
> and load it into an array.  Then I use the join command to read the array
> into a scalar variable in order to be in a workable form for my
> computationally intensive program.  The problem, however, is that the
> machine I am working with only has 256 megs of RAM.  I have split the files
> into 50-60 meg chunks, but my program still uses all the available physical
> memory.  I am quite new to perl and do not know any other methods of working
> with the data other than to make it a scalar variable, which requires
> loading it into memory.  Does anyone have any solution to my memory woes?  I
> would greatly appreciate your help.  Thanks a lot.

Have you had a look at the bioperl web page (http://bioperl.org/)?  Or
O'Reilly's page on Bioinformatics (http://bio.oreilly.com/)?



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Out of Memory Working With Large Files

2003-01-19 Thread John W. Krahn
Rob Dixon wrote:
> 
> Nelson Ray wrote:
> > Just as a little background, I am working on a BioInformatics program
> > that runs on large (about 300 meg) text files.  I am using a
> > filehandle to open and load it into an array.  Then I use the join
> > command to read the array into a scalar variable in order to be in a
> > workable form for my computationally intensive program.
> 
> My first thought is that you're wasting space here by duplicating the
> file's contents into both the array and the scalar. Just read directly
> into the scalar (by enabling 'slurp' mode) like this:
> 
> my $contents;
> {
> local $/;
> open FILE, "< file.txt";

You should _always_ verify that the file opened successfully.

> $contents = ;
> close FILE;
> }

my $contents = do {
open my $fh, 'file.txt' or die "Cannot open 'file.txt' $!";
local $/; <$fh> };



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: CSV File Creation

2003-01-19 Thread R. Joseph Newton
A slightly corrected version of my _CSV with commas in the fields_ solution:

sub DataPrint {
  my($Handle, $key, $hashref) = @_;
  my $Data = $$hashref{$key};
  $Data =~ (s/,/%2C/g);
  print $Handle "$Data,";
}

Joseph


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Out of Memory Working With Large Files

2003-01-19 Thread Rob Dixon
John W. Krahn wrote:
> Rob Dixon wrote:
>>
>> Nelson Ray wrote:
>>> Just as a little background, I am working on a BioInformatics
>>> program that runs on large (about 300 meg) text files.  I am using a
>>> filehandle to open and load it into an array.  Then I use the join
>>> command to read the array into a scalar variable in order to be in a
>>> workable form for my computationally intensive program.
>>
>> My first thought is that you're wasting space here by duplicating the
>> file's contents into both the array and the scalar. Just read
>> directly into the scalar (by enabling 'slurp' mode) like this:
>>
>> my $contents;
>> {
>> local $/;
>> open FILE, "< file.txt";
>
> You should _always_ verify that the file opened successfully.

Sure, but that's not what the question was about. You should always add
'use strict' and 'use warnings' too, but I didn't put that in either.

>
>> $contents = ;
>> close FILE;
>> }
>
> my $contents = do {
> open my $fh, 'file.txt' or die "Cannot open 'file.txt' $!";
> local $/; <$fh> };

Yes, so would I. But it's more likely to confuse than assist I think.

Cheers,

Rob




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Need Help

2003-01-19 Thread perl
Ok, found out why I am getting this error...
Premature end of script headers

What does that mean??

Anyone?


This file works on my computer but when I upload it to a unix system and
try it from the internet it gives me a 500 error.  Can anyone tell me what
the problem is??  Still new at perl.

Thanks


  #!/usr/bin/perl 
  use CGI qw(:all);
use strict;

print header;
  print "Directory to search: ";
  my $dir=; chomp $dir;
   my $dir="/home/lender/nameofdirectory/blankpage";

  my($file);

  opendir(DH, $dir) || die "Cannot open $dir: $!";
  while ($file=readdir DH) {
  next if (-d "$dir/$file");
  if (! open(F, "$dir/$file") ) {
  warn "Cannot search $file: $!";
  next;
  }
open(DEST, "> $file") || die "$!";
  while(defined($a=)){
$a=~ s/blankpage/newsite/;
print DEST $a;
}
close(DEST);
  close(F);
  }
  closedir(DH);



-Original Message-
From: [EMAIL PROTECTED]
Sent: Sun, 19 Jan 2003 12:40:31 EST
Subject: (No subject)


This file works on my computer but when I upload it to a unix system and
try it from the internet it gives me a 500 error.  Can anyone tell me what
the problem is??  Still new at perl.

Thanks


  #!/usr/bin/perl 
  use CGI qw(:all);
use strict;

print header;
  print "Directory to search: ";
  my $dir=; chomp $dir;
   my $dir="/home/lender/nameofdirectory/blankpage";

  my($file);

  opendir(DH, $dir) || die "Cannot open $dir: $!";
  while ($file=readdir DH) {
  next if (-d "$dir/$file");
  if (! open(F, "$dir/$file") ) {
  warn "Cannot search $file: $!";
  next;
  }
open(DEST, "> $file") || die "$!";
  while(defined($a=)){
$a=~ s/blankpage/newsite/;
print DEST $a;
}
close(DEST);
  close(F);
  }
  closedir(DH);




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




compare multiple lines

2003-01-19 Thread Mertens Bram
Hi,

I have a bookmark-file from opera6.11 that contains a lot of duplicate
entries.

I would like to be able to remove all duplicate entries without
destroying the structure of the file.

I have tried this with a set of scripts that converted the file into a
format that could be sent through 'uniq' but somewhere the structure got
mangled up and all my folder-settings were lost.

An opera bookmark file has the fillowing syntax:
--begin-of-file--
Opera Hotlist version 2.0
Options: encoding = utf8, version=3

#FOLDER
NAME=software
CREATED=1025797561
ORDER=0

#URL
NAME=Arachnophilia Home Page
URL=http://www.arachnoid.com/arachnophilia/
CREATED=976878001
VISITED=1025962454
ORDER=0
-

#FOLDER
...
-

--end-of-file
The lines at the top can be easily copied should they get lost, they're
not much of a concern to me.  But all '#FOLDER' blocks and all empty
lines and lines containing a single '-' should be preserved.

The values of 'CREATED' and 'VISITED' can be ignored for the comparison
and the value of 'ORDER' should be reset to 'ORDER='. (This way Opera
will regenerate the value of ORDER when the file is loaded)

An additional problem I discovered yesterday is that Murphy's law
applies even to Opera's bookmark file... The bookmarks are sorted
alphabetically, but only on name, so I found some blocks like:
NAME=tripod
URL=http://www.tripod.com
...
NAME=tripod
URL=http://www.tripod.lycos.com
...
NAME=tripod
URL=http://www.tripod.com
...
NAME=tripod
URL=http://www.tripod.lycos.com
...

So the script would have to look back 2 blocks...

So the script should be able to read several lines into a couple of
variables and modify and compare those variables to determine which
lines can be deleted...

Any suggestions?

TIA
-- 
 #  Mertens Bram "M8ram"  <[EMAIL PROTECTED]>  Linux User #249103  #
 # Red Hat Linux release 7.3 (Valhalla) kernel 2.4.18-3 i686 128MB RAM #
 #  11:24pm up 9 days, 3:38, 1 user, load average: 0.75, 0.89, 0.73 #


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: compare multiple lines

2003-01-19 Thread Wagner, David --- Senior Programmer Analyst --- WGO
Mertens Bram wrote:
> Hi,
> 
> I have a bookmark-file from opera6.11 that contains a lot of duplicate
> entries.
> 
> I would like to be able to remove all duplicate entries without
> destroying the structure of the file.
> 
> I have tried this with a set of scripts that converted the file into a
> format that could be sent through 'uniq' but somewhere the structure
> got mangled up and all my folder-settings were lost.
> 
> An opera bookmark file has the fillowing syntax:
> --begin-of-file--
> Opera Hotlist version 2.0
> Options: encoding = utf8, version=3
> 
> #FOLDER
> NAME=software
> CREATED=1025797561
> ORDER=0
> 
> #URL
> NAME=Arachnophilia Home Page
> URL=http://www.arachnoid.com/arachnophilia/
> CREATED=976878001
> VISITED=1025962454
> ORDER=0
> -
> 
> #FOLDER
> ...
> -
> 
> --end-of-file
> The lines at the top can be easily copied should they get lost,
> they're not much of a concern to me.  But all '#FOLDER' blocks and
> all empty lines and lines containing a single '-' should be preserved.
> 
> The values of 'CREATED' and 'VISITED' can be ignored for the
> comparison and the value of 'ORDER' should be reset to 'ORDER='.
> (This way Opera will regenerate the value of ORDER when the file is
> loaded) 
> 
> An additional problem I discovered yesterday is that Murphy's law
> applies even to Opera's bookmark file... The bookmarks are sorted
> alphabetically, but only on name, so I found some blocks like:
>   NAME=tripod
>   URL=http://www.tripod.com
> ...
>   NAME=tripod
>   URL=http://www.tripod.lycos.com
> ...
>   NAME=tripod
>   URL=http://www.tripod.com
> ...
>   NAME=tripod
>   URL=http://www.tripod.lycos.com
> ...
> 
> So the script would have to look back 2 blocks...

It appears that it should not be too hard to do this.  I would
rather see a file with a few more entries for Folders and URL's.  

Are there other fields which you do not have in the defining of
either Folders and URL's?

Do you take the first occurance of a URL or the last?

How does a NAME get set? Could name be 'atripod' and another be
'ztripod' for www.tripood.com?

More info and I believe the list should be able to assis you in the
cleanup.

Wags ;)


**
This message contains information that is confidential
and proprietary to FedEx Freight or its affiliates.
It is intended only for the recipient named and for
the express purpose(s) described therein.
Any other use is prohibited.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: compare multiple lines

2003-01-19 Thread Rob Dixon
Mertens Bram wrote:
> Hi,
>
> I have a bookmark-file from opera6.11 that contains a lot of duplicate
> entries.
>
> I would like to be able to remove all duplicate entries without
> destroying the structure of the file.

This is something that you could do to any level of complexity. First of
all, hashes are good for finding duplicates. I would scan the file for
all 'URL=' lines and increment the value of a hash keyed on that URL.
For instance:

my %urls;
open BMK, "< Opera6.adr" or die "Unable to open bookmarks: $!";
while ()
{
chomp;
next unless /URL=(.+)/;
$urls{$1}++;
}
close BMK;

foreach (sort keys %urls) { print "$_\n" if $urls{$_} > 1 };

Which will list all of the URLs which occur more than once. You can use
this list to edit the file manually, or you may want to go on to improve
the script to where it will digest the entire file and generate a new
one.

Get it working this far first!

Cheers,

Rob




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Counting words in a line?

2003-01-19 Thread Steven Jackson
Hi,

this is my first post, so go ahead, call me a newbie.

How do I count the number of words in a line?  I need to convert some
astronomy data which has floats, integers and commas in the string and
massage this data into something more palatable to the application.

Cheerio,

Steve
Scotty, I need warp speed in three minutes or we're all dead. 
-- Captain Kirk, The Wrath of Kahn 

-- 
  Steven Jackson
  [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Counting words in a line?

2003-01-19 Thread Wagner, David --- Senior Programmer Analyst --- WGO
Steven Jackson wrote:
> Hi,
> 
> this is my first post, so go ahead, call me a newbie.
> 
> How do I count the number of words in a line?  I need to convert some
> astronomy data which has floats, integers and commas in the string and
> massage this data into something more palatable to the application.
> 
> Cheerio,
> 
> Steve
A picture or in this case, what a line looks like and what you
trying to do would be much more helpful?

Wags ;)


**
This message contains information that is confidential
and proprietary to FedEx Freight or its affiliates.
It is intended only for the recipient named and for
the express purpose(s) described therein.
Any other use is prohibited.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Counting words in a line?

2003-01-19 Thread Tim Musson
Hey Steven, 

My MUA believes you used MIME::Lite 1.2  (F2.71; T1.001; A1.51; B2.12; Q2.03)
to write the following on Sunday, January 19, 2003 at 7:24:01 PM.

SJ> How do I count the number of words in a line?  I need to convert
SJ> some astronomy data which has floats, integers and commas in the
SJ> string and massage this data into something more palatable to the
SJ> application.

Type the following at a command prompt;
perldoc -q "How do I process each word on each line?"

You might also find the Perl Cookbook from O'Reilly useful
http://www.oreilly.com/catalog/cookbook/

-- 
Tim Musson
Flying with The Bat! eMail v1.62 Christmas Edition
Windows 2000 5.0.2195 (Service Pack 2)
use Perl; \ program \ fulfillment


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Counting words in a line?

2003-01-19 Thread Toby Stuart


> -Original Message-
> From: Steven Jackson [mailto:[EMAIL PROTECTED]]
> Sent: Monday, January 20, 2003 11:24 AM
> To: [EMAIL PROTECTED]
> Subject: Counting words in a line?
> 
> 
> Hi,
> 
> this is my first post, so go ahead, call me a newbie.
> 
> How do I count the number of words in a line?  I need to convert some
> astronomy data which has floats, integers and commas in the string and
> massage this data into something more palatable to the application.
> 
>

Depends on what you define as a word.
Nonetheless, here's a way:


use strict;

my $s = 'hi there how are you';
my @w = ($s =~ /\w+/g);
print $#w+1;


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




How to use ATL COM components in perl

2003-01-19 Thread Pankaj Kapare
Hi,
   Can anybody tell me how to use perl components in perl.
Pankaj.



RE: How to use ATL COM components in perl

2003-01-19 Thread Toby Stuart


> -Original Message-
> From: Pankaj Kapare [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, January 19, 2003 2:00 AM
> To: [EMAIL PROTECTED]
> Subject: How to use ATL COM components in perl
> 
> 
> Hi,
>Can anybody tell me how to use perl components in perl.
> Pankaj.
> 

See the following modules:

Win32::OLE  
Win32::API

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: How to use ATL COM components in perl

2003-01-19 Thread Toby Stuart


> -Original Message-
> From: Toby Stuart [mailto:[EMAIL PROTECTED]]
> Sent: Monday, January 20, 2003 3:26 PM
> To: '[EMAIL PROTECTED]'
> Subject: RE: How to use ATL COM components in perl
> 
> 
> 
> 
> > -Original Message-
> > From: Pankaj Kapare [mailto:[EMAIL PROTECTED]]
> > Sent: Sunday, January 19, 2003 2:00 AM
> > To: [EMAIL PROTECTED]
> > Subject: How to use ATL COM components in perl
> > 
> > 
> > Hi,
> >Can anybody tell me how to use perl components in perl.
> > Pankaj.
> > 
> 
> See the following modules:
> 
>   Win32::OLE  
>   Win32::API
> 

Further to the above.

To access an OLE/COM servers properties/methods see the following trivial
program as an example

It should be noted that Win32::OLE only supports the IDispatch interface ie.
custom interfaces are not supported.  Learn more in the Win32::OLE docs.


use strict;
use Win32::OLE;

my $obj = new Win32::OLE("MyObject.Class");

# Set a property
$obj->{MyProperty} = 1;

# Call a method
$obj->MyMethod();

# Destroy the object
undef $obj;




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Need Help

2003-01-19 Thread Wiggins d'Anconia
Try this:

perldoc -q 'My CGI script runs from the command line but not the browser'

Which is found here:

perldoc perlfaq9

http://danconia.org

[EMAIL PROTECTED] wrote:

Ok, found out why I am getting this error...
Premature end of script headers

What does that mean??

Anyone?


This file works on my computer but when I upload it to a unix system and
try it from the internet it gives me a 500 error.  Can anyone tell me what
the problem is??  Still new at perl.





--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




building a userspace Perl

2003-01-19 Thread David Nicely
Hi,

I am building perl for use with mod_perl on a chroot httpd. It needs to not be 
linked to any system library's, but I'm missing something in the config becouse it is 
still linking to /usr/lib/libc.so.28.5 .

I'm not sure where in the configure script to tell it not to do this.

I got it to staticly build libc.a, libm.a and libutil.a by defining the path to them 
instead of using the options -lm -lc -lutil, but adding libc.so.28.5 on the same line 
doesnt seem to work.

any input is appreciated.

thanks

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]