how to deparse bytecode

2008-05-20 Thread Loofort
Help me ppl!
A have some perl file qwe.pm. I suppose it compiled to bytecode. It's
binary and starts with following lines:

#! /usr/local/bin/perl
use ByteLoader 0.05;
PLBCi686-linuxNmain::_/usr/local/lib/perl5/5.8.3/i686-linux/Data/
Dumper.pm
`����R��� �5���/
...

Is there any way to read original source of this file?
I'm trying to use perl -MO=Deparse qwe.pm but it outputs nothing.
Any help would be appreciate.


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Installing xls2csv

2008-05-20 Thread John Jack
 
Hi

I hope someone will help me here.

I tried installing xls2csv. However, this conversion tool, requires the
following modules to be installed.
- Locale::Recode
- Spreadsheet::ParseExcel
- Spreadsheet::ParseExcel::FmtUnicode
- Text::CSV_XS
- Unicode::Map

I couldn't get through with CPAN. My server is connected to the net through
our country ISP. Therefore, I have no proxy server set on my LAN.

Can someone help me on what exactly I should do.

Thanks
John 


How to measure the efficiency, load performance of a script?

2008-05-20 Thread timbo
Hi all,

I was just wondering if any general tools / modules exist to help
measure the efficiency of any code.
I know that the Learning Perl books cover the theory but was wanting
to know if there were good measuring methods available.
Its pretty easy to figure out the time a script took to run but
knowing the load on the cpu, the overhead from all the loops 
variables, arrays  hashes, etc would also be nice to know.
Any suggestions appreciated.
Thanks in advance.
t.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: How to measure the efficiency, load performance of a script?

2008-05-20 Thread Richard Lee

timbo wrote:

Hi all,

I was just wondering if any general tools / modules exist to help
measure the efficiency of any code.
I know that the Learning Perl books cover the theory but was wanting
to know if there were good measuring methods available.
Its pretty easy to figure out the time a script took to run but
knowing the load on the cpu, the overhead from all the loops 
variables, arrays  hashes, etc would also be nice to know.
Any suggestions appreciated.
Thanks in advance.
t.


  



perl -d:DProf  ./programname

and then

dprofpp

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: How to measure the efficiency, load performance of a script?

2008-05-20 Thread michael wang
look at perldoc -m Benchmark

On 5/20/08, Richard Lee [EMAIL PROTECTED] wrote:

 timbo wrote:

 Hi all,

 I was just wondering if any general tools / modules exist to help
 measure the efficiency of any code.
 I know that the Learning Perl books cover the theory but was wanting
 to know if there were good measuring methods available.
 Its pretty easy to figure out the time a script took to run but
 knowing the load on the cpu, the overhead from all the loops 
 variables, arrays  hashes, etc would also be nice to know.
 Any suggestions appreciated.
 Thanks in advance.
 t.






 perl -d:DProf  ./programname

 and then

 dprofpp

 --
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 http://learn.perl.org/





Re: Multiline comment in Perl

2008-05-20 Thread Robert Hicks

sivasakthi wrote:

Hi all,


How to comment Multiple lines  in Perl?



Thanks,
Siva





Cheating...but:

http://search.cpan.org/~kane/Acme-Comment-1.02/lib/Acme/Comment.pm

Robert

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




passing args to sub wanted

2008-05-20 Thread oryann9
Greetings, 

I posted this question on perlmonks and received some great help, specifically 
from mirod but his recent suggestion is still not working.


Problem: This code only works when I hard-code the size to
search for in the routine. I try to pass arguments using @_, but it
does not work. How do I pass $size_input so wanted sees and uses it?


Mirod's help: 

You need to pass an additional parameter to wanted. The way to do this is to 
use a closure: File::Find::find({wanted = sub { wanted( $size_input); } }, 
$fs_input ) ;. This way wanted is called by the anonymous sub, and gets passed 
$size_input.
See Why I hate File::Find and how I (hope I) fixed it for more info.



I read the why i hate two and three times and yet still cannot get it to 
work.
thank you in advance! 
http://www.perlmonks.org/?node_id=687008


use strict;
use warnings;
use File::Find;

my ( @root_files, @large_files, %mounts, @mounts, ) ;
use vars qw/*name *dir *prune/ ;
*name   = *File::Find::name ;
*dir= *File::Find::dir ;
*prune  = *File::Find::prune ;


snip
}
else {
print USING LAST ELSE\n;
my $size_input = ( int 25 * ( 1024**2 ) ) ;
$size_input =~ tr /\000//d ;
my $wanted =  make_wanted ( \wanted_1, $size_input ) ;
File::Find::find( $wanted, $fs_input ) ;
print \n;
}

sub wanted_1 {

for my $key ( sort keys %mounts ) {
if ( $fs_input eq $key ) {
@mounts =
grep {$fs_input} @{ $mounts{$key} } ; ###-- HoA --###
}
}

if ( scalar @mounts  0 ) {
die cant search...foobarbay $! ;
}
else {
my ( $size_input ) = shift @_ ;
print $size_input,\n;
my ($dev,$ino,$mode,$nlink,$uid,$gid) ;
(( $dev,$ino,$mode,$nlink,$uid,$gid ) = lstat($_) ) 
 ( $dev = 0 ) 
 !( $File::Find::prune |= ($dev != $File::Find::topdev ) ) 
 ( int(((-s _) + 1023) / 1024 )  $size_input ) 
 push ((@large_files), $name ) ;
}
}

sub make_wanted {

my $wanted = shift ;# get the real wanted function
my @args   = @_;# freeze the arguments
my $sub = sub { $wanted-( @args ); } ;  # generate the anon sub
return $sub ;   # return it
}


print \n,scalar @large_files,\n;
exit;
snip

$size_input is being printed correctly/accurately, but nothing in the array. 


  

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: passing args to sub wanted

2008-05-20 Thread Jenda Krynicky
From:   oryann9 [EMAIL PROTECTED]
 Greetings, 
 
 I posted this question on perlmonks and received some great help,
 specifically from mirod but his recent suggestion is still not
 working. 
 
 
 Problem: This code only works when I hard-code the size to
 search for in the routine. I try to pass arguments using @_, but it
 does not work. How do I pass $size_input so wanted sees and uses it?
 
 
 Mirod's help: 
 
 You need to pass an additional parameter to wanted. The way to do this
 is to use a closure: File::Find::find({wanted = sub { wanted(
 $size_input); } }, $fs_input ) ;. This way wanted is called by the
 anonymous sub, and gets passed $size_input. 
 See Why I hate File::Find and how I (hope I) fixed it for more info.
 
 
 
 I read the why i hate two and three times and yet still cannot get it 
 to work.
 thank you in advance! 
 http://www.perlmonks.org/?node_id=687008
 
 
 use strict;
 use warnings;
 use File::Find;
 
 my ( @root_files, @large_files, %mounts, @mounts, ) ;
 use vars qw/*name *dir *prune/ ;
 *name   = *File::Find::name ;
 *dir= *File::Find::dir ;
 *prune  = *File::Find::prune ;
 
 
 snip
 }
 else {
 print USING LAST ELSE\n;
 my $size_input = ( int 25 * ( 1024**2 ) ) ;
 $size_input =~ tr /\000//d ;
 my $wanted =  make_wanted ( \wanted_1, $size_input ) ;
 File::Find::find( $wanted, $fs_input ) ;
 print \n;
 }
 
 sub wanted_1 {
 
 for my $key ( sort keys %mounts ) {
 if ( $fs_input eq $key ) {
 @mounts =
 grep {$fs_input} @{ $mounts{$key} } ; ###-- HoA --###
 }
 }
 
 if ( scalar @mounts  0 ) {
 die cant search...foobarbay $! ;
 }
 else {
 my ( $size_input ) = shift @_ ;
 print $size_input,\n;
 my ($dev,$ino,$mode,$nlink,$uid,$gid) ;
 (( $dev,$ino,$mode,$nlink,$uid,$gid ) = lstat($_) ) 
  ( $dev = 0 ) 
  !( $File::Find::prune |= ($dev != $File::Find::topdev ) ) 
  ( int(((-s _) + 1023) / 1024 )  $size_input ) 
  push ((@large_files), $name ) ;
 }
 }
 
 sub make_wanted {
 
 my $wanted = shift ;# get the real wanted function
 my @args   = @_;# freeze the arguments
 my $sub = sub { $wanted-( @args ); } ;  # generate the anon sub
 return $sub ;   # return it
 }
 
 
 print \n,scalar @large_files,\n;
 exit;
 snip
 
 $size_input is being printed correctly/accurately, but nothing in the array. 

If $size_input is printed correcly, them it has been passed to the 
wanted_1 fine and the problem is elsewhere.

The condition for the push() looks insanely complex, I bet you made 
a mistake there.

And to tell the truth .. with the number of global variables you have 
I don't understand why didn't you use $size_input as a global 
variable as well.

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]
http://learn.perl.org/