[26113] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 8310 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Aug 9 15:42:09 2005

Date: Tue, 9 Aug 2005 12:42:03 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 9 Aug 2005     Volume: 10 Number: 8310

Today's topics:
        Problem with Gtk2 <guenther.sohler@newlogic.com>
        Problems with Gtk::List <guenther.sohler@newlogic.com>
        scoping question <graham.removethis.t.wood@andthis.oracle.com>
    Re: scoping question <graham.removethis.t.wood@andthis.oracle.com>
    Re: scoping question <tassilo.von.parseval@rwth-aachen.de>
    Re: scoping question <graham.removethis.t.wood@andthis.oracle.com>
        sending a kill to child process <akayesmith@westnet.com.au>
    Re: sending a kill to child process xhoster@gmail.com
    Re: sending a kill to child process <akayesmith@westnet.com.au>
        Simple Question about Scalars <DavidP.Young@btinternet.com>
        Syntax highlighting in perl debugger <mshaw@bangnetcom.com>
        talking to a port, and server daemon: partly OT <jeff@spamalanadingong.com>
    Re: talking to a port, and server daemon: partly OT <sherm@dot-app.org>
    Re: talking to a port, and server daemon: partly OT <jeff@spamalanadingong.com>
    Re: talking to a port, and server daemon: partly OT <sherm@dot-app.org>
    Re: talking to a port, and server daemon: partly OT <jeff@spamalanadingong.com>
    Re: writing binary files <mermadak@yahoo.com>
    Re: writing binary files <john@castleamber.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 09 Aug 2005 12:56:22 +0200
From: Guenther Sohler <guenther.sohler@newlogic.com>
Subject: Problem with Gtk2
Message-Id: <pan.2005.08.09.10.56.22.622020@newlogic.com>

I have a problem with List Widgets in Gtk2-perl

I have simplified my program to this one.
But it still produces a segmentation fault on my sparc sun solaris 2.9 
machine. Do i use it in a wrong way ?

#!/usr/bin/env perl
use Gtk2 '-init'; 
use strict;

my @list_items = ( new Gtk2::ListItem->new_with_label( "test" ) );
my $lst=new Gtk2::List();
$lst->append_items(@list_items);

my $window = new Gtk2::Window( "toplevel" );
$window->add( $lst ) ;
$window->show_all();
Gtk2->main;



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

Date: Fri, 05 Aug 2005 09:37:24 +0200
From: Guenther Sohler <guenther.sohler@newlogic.com>
Subject: Problems with Gtk::List
Message-Id: <pan.2005.08.05.07.37.24.3303@newlogic.com>

I have programmed a small application with Gtk::List
and Gtk::Clist respecively

I I have a graphical vertical list of labels, which I can select.
But during the callback function of "selection_changed" I did not
find out any possibility to get the text or the index of the selection

my approach so far is


	 my ( $gtklist, $frame, $event ) = @_;
	 my @dlist = $gtklist->selection;
	 my $item;
	 foreach $item (@dlist)
	{
	}

How do I get the text from $item ?



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

Date: Fri, 05 Aug 2005 12:08:48 +0100
From: Graham Wood <graham.removethis.t.wood@andthis.oracle.com>
Subject: scoping question
Message-Id: <U2IIe.15$XP5.34@news.oracle.com>

I'm calling find (from File::Find) in a loop inside another subroutine 
and I want to access the value of $scope in the find subroutine.

====================================================================================
sub split_files{
	print_both("splitting files\n");
	foreach $scope (@scopes){
		print_both("\tin $scope\n");
		chdir("$here/$scope"){
			find(\&wanted,'.');
		}	
	}	
	print_both("finished\n");
}

sub wanted{
	push(@{$files{$scope}}, $File::Find::name);
}
====================================================================================

If I use

foreach my $scope (@scopes){
}

The value of scope is not accessible in wanted().  How should I scope 
$scope so that wanted() can see it?

If I use a package in split_files() and $packagename::scope to get the 
value in wanted(), do I then have to change every reference to 
print_both() to $main::print_both() or is there a shorter way to do it?

Thanks

Graham



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

Date: Fri, 05 Aug 2005 12:11:08 +0100
From: Graham Wood <graham.removethis.t.wood@andthis.oracle.com>
Subject: Re: scoping question
Message-Id: <45IIe.16$XP5.27@news.oracle.com>

There's a syntax error in the code but I'm hoping the question still 
makes sense.

Graham

Graham Wood wrote:

> I'm calling find (from File::Find) in a loop inside another subroutine 
> and I want to access the value of $scope in the find subroutine.
> 
> ==================================================================================== 
> 
> sub split_files{
>     print_both("splitting files\n");
>     foreach $scope (@scopes){
>         print_both("\tin $scope\n");
>         chdir("$here/$scope"){
>             find(\&wanted,'.');
>         }   
>     }   
>     print_both("finished\n");
> }
> 
> sub wanted{
>     push(@{$files{$scope}}, $File::Find::name);
> }
> ==================================================================================== 
> 
> 
> If I use
> 
> foreach my $scope (@scopes){
> }
> 
> The value of scope is not accessible in wanted().  How should I scope 
> $scope so that wanted() can see it?
> 
> If I use a package in split_files() and $packagename::scope to get the 
> value in wanted(), do I then have to change every reference to 
> print_both() to $main::print_both() or is there a shorter way to do it?
> 
> Thanks
> 
> Graham
> 



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

Date: Fri, 5 Aug 2005 13:30:35 +0200
From: "Tassilo v. Parseval" <tassilo.von.parseval@rwth-aachen.de>
Subject: Re: scoping question
Message-Id: <slrndf6jer.vc.tassilo.von.parseval@localhost.localdomain>

Also sprach Graham Wood:

> I'm calling find (from File::Find) in a loop inside another subroutine 
> and I want to access the value of $scope in the find subroutine.
>
>====================================================================================
> sub split_files{
> 	print_both("splitting files\n");
> 	foreach $scope (@scopes){
> 		print_both("\tin $scope\n");
> 		chdir("$here/$scope"){
> 			find(\&wanted,'.');
> 		}	
> 	}	
> 	print_both("finished\n");
> }
>
> sub wanted{
> 	push(@{$files{$scope}}, $File::Find::name);
> }
>====================================================================================
>
> If I use
>
> foreach my $scope (@scopes){
> }
>
> The value of scope is not accessible in wanted().  How should I scope 
> $scope so that wanted() can see it?

$scope can easily remain a lexical if you fix the call to find():

    foreach my $scope (@scopes) {
        ...
        find(sub { wanted($scope) }, '.');
    }

Additionally, wanted() now receives one parameter:

    sub wanted {
        my $scope = shift;
        push @{ $files{$scope} }, $File::Find::name;
    }
    
> If I use a package in split_files() and $packagename::scope to get the 
> value in wanted(), do I then have to change every reference to 
> print_both() to $main::print_both() or is there a shorter way to do it?

You can put print_both() into that other package and have it export this
function via the Exporter mechanism. Or more easily, alias
main::print_both:

    *packagename::print_both = \&main::print_both;

Now print_both() lives both in 'main' and in 'packagename'.

Tassilo
-- 
use bigint;
$n=71423350343770280161397026330337371139054411854220053437565440;
$m=-8,;;$_=$n&(0xff)<<$m,,$_>>=$m,,print+chr,,while(($m+=8)<=200);


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

Date: Fri, 05 Aug 2005 13:41:45 +0100
From: Graham Wood <graham.removethis.t.wood@andthis.oracle.com>
Subject: Re: scoping question
Message-Id: <1qJIe.20$XP5.104@news.oracle.com>

Tassilo v. Parseval wrote:

> Also sprach Graham Wood:
> 
> 
>>I'm calling find (from File::Find) in a loop inside another subroutine 
>>and I want to access the value of $scope in the find subroutine.
<snip>

> $scope can easily remain a lexical if you fix the call to find():
> 
>     foreach my $scope (@scopes) {
>         ...
>         find(sub { wanted($scope) }, '.');
>     }
> 
> Additionally, wanted() now receives one parameter:
> 
>     sub wanted {
>         my $scope = shift;
>         push @{ $files{$scope} }, $File::Find::name;
>     }
>     
> 

Thanks Tassilo, working now.

Graham



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

Date: Sat, 06 Aug 2005 11:26:13 +1000
From: AdamKaye-Smith <akayesmith@westnet.com.au>
Subject: sending a kill to child process
Message-Id: <42f41361@quokka.wn.com.au>

Hello ,


I am trying to run a shell process from perl program and giving it a 
time limit to run in.

To do this I use the perl function - alarm to set of a timer and when my 
program gets the %SIG{ALRM} signal it initiates a kill which is sent to 
all processes in the group ie kill 1 ,(-$$). This all works as expected.

The problem is that this also kills my main perl program.

I attempt to make the main perl program ignore the kill signal by doing 
the following :

local $SIG{HUP} = 'IGNORE';


but when I do this the child process also ignores the kill signal

here is the test program:

#!/usr/bin/perl -w

    $SIG{HUP} = 'DEFAULT';


  eval {
    local $SIG{HUP} = 'IGNORE';
    local $SIG{ALRM} = sub { kill 1 , (-$$) ;  print "got rid of 
them\n";  };
    alarm 6;
    system ("sleep 30 ");
    alarm 0;
     };
    $SIG{HUP} = 'DEFAULT';

    print "going from here\n";



How can I get this program to time out the system called process, 
without timing out the main perl program.

I am running this under Fedora Core 4 op sys.


At my wits end,


Adam


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

Date: 06 Aug 2005 03:06:49 GMT
From: xhoster@gmail.com
Subject: Re: sending a kill to child process
Message-Id: <20050805230649.275$Yk@newsreader.com>

AdamKaye-Smith <akayesmith@westnet.com.au> wrote:
> Hello ,
>
> I am trying to run a shell process from perl program and giving it a
> time limit to run in.
>
> To do this I use the perl function - alarm to set of a timer and when my
> program gets the %SIG{ALRM} signal it initiates a kill which is sent to
> all processes in the group ie kill 1 ,(-$$). This all works as expected.
>
> The problem is that this also kills my main perl program.
>
> I attempt to make the main perl program ignore the kill signal by doing
> the following :
>
> local $SIG{HUP} = 'IGNORE';
>
> but when I do this the child process also ignores the kill signal

The child process inherits the parents sig handlers.


>
> here is the test program:
>
> #!/usr/bin/perl -w
>
>     $SIG{HUP} = 'DEFAULT';
>
>   eval {
>     local $SIG{HUP} = 'IGNORE';
>     local $SIG{ALRM} = sub { kill 1 , (-$$) ;  print "got rid of
> them\n";  };

What if you put the local $SIG{HUP} = 'IGNORE'; inside the ALRM handler
sub?

Or just do a fork and exec, then the parent will have the exact pid
it needs for doing the kill.

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB


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

Date: Sat, 06 Aug 2005 14:45:29 +1000
From: AdamKaye-Smith <akayesmith@westnet.com.au>
Subject: Re: sending a kill to child process
Message-Id: <42f44215$1@quokka.wn.com.au>

Put the IGNORE inside the ALRM handler and works beautifully.


Thank-you very much

Adam


xhoster@gmail.com wrote:
> AdamKaye-Smith <akayesmith@westnet.com.au> wrote:
> 
>>Hello ,
>>
>>I am trying to run a shell process from perl program and giving it a
>>time limit to run in.
>>
>>To do this I use the perl function - alarm to set of a timer and when my
>>program gets the %SIG{ALRM} signal it initiates a kill which is sent to
>>all processes in the group ie kill 1 ,(-$$). This all works as expected.
>>
>>The problem is that this also kills my main perl program.
>>
>>I attempt to make the main perl program ignore the kill signal by doing
>>the following :
>>
>>local $SIG{HUP} = 'IGNORE';
>>
>>but when I do this the child process also ignores the kill signal
> 
> 
> The child process inherits the parents sig handlers.
> 
> 
> 
>>here is the test program:
>>
>>#!/usr/bin/perl -w
>>
>>    $SIG{HUP} = 'DEFAULT';
>>
>>  eval {
>>    local $SIG{HUP} = 'IGNORE';
>>    local $SIG{ALRM} = sub { kill 1 , (-$$) ;  print "got rid of
>>them\n";  };
> 
> 
> What if you put the local $SIG{HUP} = 'IGNORE'; inside the ALRM handler
> sub?
> 
> Or just do a fork and exec, then the parent will have the exact pid
> it needs for doing the kill.
> 
> Xho
> 


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

Date: Tue, 9 Aug 2005 18:14:32 +0100
From: "David Young" <DavidP.Young@btinternet.com>
Subject: Simple Question about Scalars
Message-Id: <ddao9p$pos$1@vins1.reading.ac.uk>

Hello all,

Quite new to Perl and I have a really simple question .... I have a scalar
varible which could contain a string of a numberic value ....

How can I tell if a scalar contains a string or a value?

Yours,

David




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

Date: Fri, 5 Aug 2005 20:51:16 +0000 (UTC)
From: Mark Shaw <mshaw@bangnetcom.com>
Subject: Syntax highlighting in perl debugger
Message-Id: <dd0jg4$23u$1@reader2.panix.com>

How does one turn OFF the syntax highlighting in the perl
debugger?

I'm running 5.8.0 under linux.

Thanks!

-- 
Mark Shaw
========================================================================
"Labor to keep alive in your breast that little spark of        mnshaw@
celestial fire called conscience."   - George Washington       gmail.com


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

Date: Mon, 08 Aug 2005 06:37:26 GMT
From: Jeff Thies <jeff@spamalanadingong.com>
Subject: talking to a port, and server daemon: partly OT
Message-Id: <G4DJe.2504$Je.1375@newsread2.news.atl.earthlink.net>

I have to hook up a credit card processor (SERVEBASE) for a website (perl).

   The way servebase works is that you send them name data pairs, either
on the query string or using POST to their website script.

  SERVEBASE sends back XML on the *same* port.  Parsing the XML doesn't
bother me, talking back and forth on the port does.

  It looks me that sending the request is not difficult, should I
probably use:

IO::Socket::INET; and tcp instead of udp

   Something else?

Now for the more OT stuff:

  How do I setup a daemon to dump this back to the database? This will
be on a linux box and probably later a FreeBSD. Some flavor of Apache, I
would think.

   What port should I use?

   Identical post on alt.perl which I saw too late has fallen into disuse.

   Cheers,
Jeff


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

Date: Mon, 08 Aug 2005 09:34:47 -0400
From: Sherm Pendley <sherm@dot-app.org>
Subject: Re: talking to a port, and server daemon: partly OT
Message-Id: <m2wtmwsgaw.fsf@Sherm-Pendleys-Computer.local>

Jeff Thies <jeff@spamalanadingong.com> writes:

> I have to hook up a credit card processor (SERVEBASE) for a website (perl).
>
>    The way servebase works is that you send them name data pairs, either
> on the query string or using POST to their website script.
>
>   SERVEBASE sends back XML on the *same* port.  Parsing the XML doesn't
> bother me, talking back and forth on the port does.
>
>   It looks me that sending the request is not difficult, should I
> probably use:
>
> IO::Socket::INET; and tcp instead of udp
>
>    Something else?

You're sending a request to an HTTP server? Don't re-invent the wheel, just
use LWP.

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


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

Date: Mon, 08 Aug 2005 16:35:38 GMT
From: Jeff Thies <jeff@spamalanadingong.com>
Subject: Re: talking to a port, and server daemon: partly OT
Message-Id: <uRLJe.5189$ns.151@newsread1.news.atl.earthlink.net>

Sherm Pendley wrote:
> Jeff Thies <jeff@spamalanadingong.com> writes:
> 
> 
>>I have to hook up a credit card processor (SERVEBASE) for a website (perl).
>>
>>   The way servebase works is that you send them name data pairs, either
>>on the query string or using POST to their website script.
>>
>>  SERVEBASE sends back XML on the *same* port.  Parsing the XML doesn't
>>bother me, talking back and forth on the port does.
>>
>>  It looks me that sending the request is not difficult, should I
>>probably use:
>>
>>IO::Socket::INET; and tcp instead of udp
>>
>>   Something else?
> 
> 
> You're sending a request to an HTTP server? Don't re-invent the wheel, just
> use LWP.

   No, they read the port that it was sent on and send it back to that 
same port. I didn't understand that for a long time as I kept asking 
them how do I set the *path* that I recieve their response and they said 
port not path.

   Now maybe, I'm missing something here, but I'm thinking that I 
probably *don't* want to be listing on the web port (80) for their 
response. Or am I wrong?

   Jeff
> 
> sherm--
> 


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

Date: Mon, 08 Aug 2005 14:51:11 -0400
From: Sherm Pendley <sherm@dot-app.org>
Subject: Re: talking to a port, and server daemon: partly OT
Message-Id: <m2pssoi7og.fsf@Sherm-Pendleys-Computer.local>

Jeff Thies <jeff@spamalanadingong.com> writes:

> Sherm Pendley wrote:
>> Jeff Thies <jeff@spamalanadingong.com> writes:
>>
>>>   The way servebase works is that you send them name data pairs, either
>>>on the query string or using POST to their website script.
>>>
>>>  SERVEBASE sends back XML on the *same* port.  Parsing the XML doesn't
>>>bother me, talking back and forth on the port does.
>>>
>>>  It looks me that sending the request is not difficult, should I
>>>probably use:
>>>
>>>IO::Socket::INET; and tcp instead of udp
>>>
>>>   Something else?
>> You're sending a request to an HTTP server? Don't re-invent the
>> wheel, just
>> use LWP.
>
>    No, they read the port that it was sent on and send it back to that
>    same port. I didn't understand that for a long time as I kept
>    asking them how do I set the *path* that I recieve their response
>    and they said port not path.
>
>    Now maybe, I'm missing something here, but I'm thinking that I
>    probably *don't* want to be listing on the web port (80) for their
>    response. Or am I wrong?

I think you're missing a *lot* here. What you're describing is generally not
how these services work. You don't listen on anything at all. You establish
an HTTP connection, send a request, and then get a response back on the same
connection.

What's more, HTTP isn't limited to a particular port. Port 80 is simply the
default that's attempted if no other port is specified.

Don't they provide any example scripts or documentation you can refer to???

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


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

Date: Mon, 08 Aug 2005 21:36:37 GMT
From: Jeff Thies <jeff@spamalanadingong.com>
Subject: Re: talking to a port, and server daemon: partly OT
Message-Id: <FfQJe.2641$RZ2.1077@newsread3.news.atl.earthlink.net>

>>>You're sending a request to an HTTP server? Don't re-invent the
>>>wheel, just
>>>use LWP.
>>
>>   No, they read the port that it was sent on and send it back to that
>>   same port. I didn't understand that for a long time as I kept
>>   asking them how do I set the *path* that I recieve their response
>>   and they said port not path.
>>
>>   Now maybe, I'm missing something here, but I'm thinking that I
>>   probably *don't* want to be listing on the web port (80) for their
>>   response. Or am I wrong?
> 
> 
> I think you're missing a *lot* here. What you're describing is generally not
> how these services work.


I would agree. I've done 9 or 10 of these, LinkPoint, PROTEX, PayFlow 
Pro, eSELECT...

  You don't listen on anything at all. You establish
> an HTTP connection, send a request, and then get a response back on the same
> connection.
> 
> What's more, HTTP isn't limited to a particular port. Port 80 is simply the
> default that's attempted if no other port is specified.
> 
> Don't they provide any example scripts or documentation you can refer to???

55 page manual, no example scripts, and I've asked.

It seems a little crazy, my integration contact is sending autorespond 
emails that he's out till the 18th!

   So does this port stuff (they are ASP, MS partner) seem just weird, 
or completely improbable.

  Thanks for listening to this babble.

   Cheers,
Jeff
> 
> sherm--
> 


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

Date: Fri, 5 Aug 2005 23:43:30 -0700
From: "mermadak" <mermadak@yahoo.com>
Subject: Re: writing binary files
Message-Id: <q_YIe.76003$ro.44871@fed1read02>


> Python or Perl, since your post referred to Python :-D

Perl... preferrably. My point there is that I am grasping at straws at this 
point...

I looked at the pack function that was also recommended but I am not sure 
how to use it. Could anyone possibly give me an example? Mainly it looks as 
though my data can only contain strings, floating point decimals, or fixed 
point decimals but not a combination there of. My data is ASCII format but 
would it be considered string data even though a data string may look like 
"2005-08-05, 13:36:06, 3236.453232, 11123.456, 0.0, 21, 224.332" for 
purposes of conversion to raw binary format? Also, the function says it 
calls for a TEMPLATE variable to be passed to it. Is this required? And this 
looks as though it would require a template character to be passed for every 
character in the file??? This seems like it will be very processor intensive 
as well as nearly impractical from a code writing perspective, as I would 
have to build an array of the TEMPLATE characters and then build a 
comparison function to check which character matches the TEMPLATE 
designation and then convert each character to binary at that point. Am I 
way off base here? Just seems like there would be a more practical way to 
achieve this.

> Yup, your computer probably has 100 times as much memory.

True... but what does that have to do with process intensity and the 
capabilities of the tools?

> If a C++ program would hang on 5MB files, how can programs handle 10M
> MP3 files, or 700 MB movies?

I agree with your point. Admittedly it was probably due to poor programming. 
I have only been coding for 3 years now and only part time at that. But I 
would be glad to send you the programs I was working on and see if you make 
them work. ;-) Although, I did finally get that covered with Perl so it not 
much of a concern at the moment.

> Again: 5MB is not much. My best guess is that you should rethink your
> algoritm(s).

Agreed, see above. Thank you for pointing out all of the obvious problems 
here. Perhaps you would be so kind as to make some suggestions on how I 
could actually accomplish this now? 




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

Date: 6 Aug 2005 17:31:12 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: writing binary files
Message-Id: <Xns96AA7F3E5BFAEcastleamber@130.133.1.4>

"mermadak" <mermadak@yahoo.com> wrote:

> 
>> Python or Perl, since your post referred to Python :-D
> 
> Perl... preferrably. My point there is that I am grasping at straws at
> this point...
> 
> I looked at the pack function that was also recommended but I am not
> sure how to use it. Could anyone possibly give me an example? Mainly
> it looks as though my data can only contain strings, floating point
> decimals, or fixed point decimals but not a combination there of. My
> data is ASCII format but would it be considered string data even
> though a data string may look like "2005-08-05, 13:36:06, 3236.453232,
> 11123.456, 0.0, 21, 224.332" for purposes of conversion to raw binary
> format?

A better question is: is compression really required? What is causing 
the current problem(s). I am sure it's not managing 5 MB of data, which 
is on a recent PC close to nothing.

> Also, the function says it calls for a TEMPLATE variable to be
> passed to it. Is this required?

The whole idea of pack is that it packs data according to a TEMPLATE, so 
guess :-)

> And this looks as though it would
> require a template character to be passed for every character in the
> file???

More or less, yes.

> This seems like it will be very processor intensive as well as
> nearly impractical from a code writing perspective, as I would have to
> build an array of the TEMPLATE characters and then build a comparison
> function to check which character matches the TEMPLATE designation and
> then convert each character to binary at that point. Am I way off base
> here? Just seems like there would be a more practical way to achieve
> this.

Yup: the most practical problem is: find the real bottle neck of your 
problem. If you just require compression, use a compression solution. 
Pack indeed needs to "know" what is in the string you want to be packed. 
So if you want to pack a date followed by 3 floats on line 1 and 4 
floats and a fixed number on line 2, you have to provide the correct 
template to pack. 

>> Yup, your computer probably has 100 times as much memory.
> 
> True... but what does that have to do with process intensity and the 
> capabilities of the tools?

That there shouldn't be any problem reading 5 MB of data into memory and 
use it.

Regarding pack: if your lines don't follow a fixed format (e.g. a date 
followed by exactly 5 floats, and 2 fixed point nrs), you already have 
to do some parsing in your program. You can use the same parsing set up 
to compress/convert your data to binary. If you only want to use the 
output in Perl, you might consider writing out the compact version using 
Storable.

If you have access to the program that creates those "big" files, and 
it's written in Perl, you just have to tweak the output part, since that 
part decides the structure of the output file. If it's not written in 
Perl, you have to create a compatible binary output format (which is not 
that hard). However, I recommend, especially if your files are around 5 
MB, to stick with ASCII. It's human readable :-)

>> If a C++ program would hang on 5MB files, how can programs handle 10M
>> MP3 files, or 700 MB movies?
> 
> I agree with your point. Admittedly it was probably due to poor
> programming. I have only been coding for 3 years now and only part
> time at that. But I would be glad to send you the programs I was
> working on and see if you make them work. ;-)

No problem. I do such things professionally (ie. for money ;-) ). It 
might save you a lot of time and trouble.

> Although, I did finally
> get that covered with Perl so it not much of a concern at the moment.
> 
>> Again: 5MB is not much. My best guess is that you should rethink your
>> algoritm(s).
> 
> Agreed, see above. Thank you for pointing out all of the obvious
> problems here. Perhaps you would be so kind as to make some
> suggestions on how I could actually accomplish this now? 

If handling 5 MB of data is a problem for your program, why is it a 
problem?

-- 
John                   Small Perl scripts: http://johnbokma.com/perl/
               Perl programmer available:     http://castleamber.com/
            Happy Customers: http://castleamber.com/testimonials.html
                        


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

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


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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

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

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


------------------------------
End of Perl-Users Digest V10 Issue 8310
***************************************


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