HTML to Image Module?

2006-10-06 Thread Raphael Brunner
Dear Users

does anyone know a perl-Module which can make a image (png/jpg/...) from
a website?

Thanks a lot for all ideas...

Greetings, Raphael

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




Re: check for duplicate files that are truncated

2006-10-06 Thread John W. Krahn
Eric Waguespack wrote:
> Hi,

Hello,

> I am new to the list, so I apologise if I do anything wrong :)
> 
> I made the script below to check files that are duplicates but I only
> want to check the first few bytes (perhaps 1-10k, depending on false
> positives)
> 
> I would like to convert it to native perl, can someone give me some
> pointers?
> 
> thanks
> 
> $ cat _md5_head.pl
> 
> #!/usr/bin/perl
> # usage:
> # find -type f -size +1000c -exec perl _md5_head.pl {} \; | sort -n |
> uniq -w32 -D
> 
> $file = shift @ARGV;
> $hash = `head -c 1000 $file | md5sum | cut -f1 -d " "`;
> chomp $hash;
> print $hash, "\t", $file, "\n";

This is untested but it should work:

#!/usr/bin/perl
use warnings;
use strict;
use File::Find;
use Digest::MD5;

use constant BUF_SIZ => 1_000;

my $dir = shift || '.';

my %files;
find sub {
stat;
return unless -f _ or -s _ >= BUF_SIZ;

open my $fh, '<:raw', $_ or do {
warn "Cannot open '$File::Find::name' $!";
return;
};

read $fh, my $data, BUF_SIZ or do {
warn "Cannot read '$File::Find::name' $!";
return;
};

push @{ $files{ Digest::MD5->new->add( $data )->hexdigest } },
$File::Find::name;

}, $dir;


for my $chk_sum ( sort keys %files ) {
next if @{ $files{ $chk_sum } } == 1; # skip non-duplicates
for my $file ( @{ $files{ $chk_sum } } ) {
print "$chk_sum\t$file\n";
}
}

__END__



John
-- 
Perl isn't a toolbox, but a small machine shop where you can special-order
certain sorts of tools at low cost and in short order.   -- Larry Wall

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




check for duplicate files that are truncated

2006-10-06 Thread Eric Waguespack

Hi, I am new to the list, so I apologise if I do anything wrong :)

I made the script below to check files that are duplicates but I only
want to check the first few bytes (perhaps 1-10k, depending on false
positives)

I would like to convert it to native perl, can someone give me some pointers?

thanks

$ cat _md5_head.pl

#!/usr/bin/perl
# usage:
# find -type f -size +1000c -exec perl _md5_head.pl {} \; | sort -n |
uniq -w32 -D

$file = shift @ARGV;
$hash = `head -c 1000 $file | md5sum | cut -f1 -d " "`;
chomp $hash;
print $hash, "\t", $file, "\n";

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




Re: scalar in array name?

2006-10-06 Thread Dr.Ruud
"Kenton Brede" schreef:

> I've done some searching and can't find an answer to this.  I'd like
> to use a scalar variable in an array name.  Something like "@$scalar"
> I've tried different permutations like "[EMAIL PROTECTED]", "@"$scalar""
> "@\$scalar" and none of them work.
>
> What I'm trying to do is come up with a way to slurp ARGV variables in
> and if a match is found in @list, then print out the matching array,
> either @rhel or @all.  The following code is an example.
>
> --
-
> #!/usr/bin/perl
> use warnings;
> use strict;
>
> my $first_arg = "$ARGV[0]";

Why the quotes?


> my @list = ("all", "rhel");
> my @rhel = ("server1", "server3", "server4");
> my @all = ("server2", "server5", server7");
>
> foreach my $list_name (@list) {
> if ( $list_name eq $first_arg ) {
> print "@$first_arg";
> }
> }
> --
-

Dispatch:

  my %list =
  (
all  => [EMAIL PROTECTED],
rhel => [EMAIL PROTECTED],
  )

-- 
Affijn, Ruud

"Gewoon is een tijger."



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




Re: scalar in array name?

2006-10-06 Thread Ricardo SIGNES
* Kenton Brede <[EMAIL PROTECTED]> [2006-10-06T11:38:49]
> I've done some searching and can't find an answer to this.  I'd like
> to use a scalar variable in an array name.  Something like "@$scalar"
> I've tried different permutations like "[EMAIL PROTECTED]", "@"$scalar""
> "@\$scalar" and none of them work.

What you're talking about is a symbolic reference.  The canonical reference for
why /not/ to do this is here:

  http://perl.plover.com/varvarname.html

> my $first_arg = "$ARGV[0]";
> my @list = ("all", "rhel");
> my @rhel = ("server1", "server3", "server4");
> my @all = ("server2", "server5", server7");
> 
> foreach my $list_name (@list) {
>if ( $list_name eq $first_arg ) {
>print "@$first_arg";
>}
> }

Use a hash instead:

  my $first_arg = $ARGV[0];

  my %group = (
rhel => [ 'server1', 'server3', 'server4' ],
all  => [ 'server2', 'server5', 'server7' ],
  );

  my @servers = @{ $group{ $first_arg } };
  print "@servers";

-- 
rjbs

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




scalar in array name?

2006-10-06 Thread Kenton Brede

I've done some searching and can't find an answer to this.  I'd like
to use a scalar variable in an array name.  Something like "@$scalar"
I've tried different permutations like "[EMAIL PROTECTED]", "@"$scalar""
"@\$scalar" and none of them work.

What I'm trying to do is come up with a way to slurp ARGV variables in
and if a match is found in @list, then print out the matching array,
either @rhel or @all.  The following code is an example.
Thanks for any help,
Kent

---
#!/usr/bin/perl
use warnings;
use strict;

my $first_arg = "$ARGV[0]";
my @list = ("all", "rhel");
my @rhel = ("server1", "server3", "server4");
my @all = ("server2", "server5", server7");

foreach my $list_name (@list) {
   if ( $list_name eq $first_arg ) {
   print "@$first_arg";
   }
}
---

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




canonpath

2006-10-06 Thread Derek B. Smith
I dont understand what the point of canonpath is here:
It seems to me canonpath only appply so links.

##-- Show me all installed Modules --##
use File::Find 'find';
use File::Spec::Functions;
  print "Your installed modules on $^O are:\n";
  print "-" x 38,"\n";
  find { wanted => sub { print canonpath "$_\n" if
/\.pm\z/ }, 
 no_chdir => 1}, 
  @INC;

#canonpath

I tried code with/out canonpath and the output is the
same.

I then lookup canonpath on CPAN and it tells me

*** No physical check on the filesystem, but a logical
cleanup of a path.

$cpath = File::Spec->canonpath( $path ) ;

Note that this does *not* collapse x/../y sections
into y. This is by design. If /foo on your system is a
symlink to /bar/baz, then /foo/../quux is actually
/bar/quux, not /quux as a naive ../-removal would give
you. If you want to do this kind of processing, you
probably want Cwd's realpath() function to actually
traverse the filesystem cleaning up paths like this.

thank you
derek


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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




Re: using backticks

2006-10-06 Thread John W. Krahn
john wright wrote:
> Hi All,

Hello,

> i am getting error "The system cannot find the path specified" while running 
> below lines code.
> 
> $dirname = "util";
> $path = ` cd $dirname ; pwd`
> print ("$path");
> 
> can anybody help me to get output of pwd in the variable $path.

use Cwd;

my $dirname = 'util';
chdir $dirname or die "Cannot 'chdir $dirname' $!";
my $path = getcwd;
print $path;



John
-- 
Perl isn't a toolbox, but a small machine shop where you can special-order
certain sorts of tools at low cost and in short order.   -- Larry Wall

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




Re: using backticks

2006-10-06 Thread Rob Dixon

john wright wrote:
>
> i am getting error "The system cannot find the path specified" while running
> below lines code.
>
> $dirname = "util"; $path = ` cd $dirname ; pwd` print ("$path");
>
> can anybody help me to get output of pwd in the variable $path.

Hi John

It's best to do things in Perl if at all possible:

  use strict;
  use warnings;

  use Cwd;

  chdir 'util' or die $!;
  my $path = cwd;
  print "$path\n";

HTH,

Rob

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




using backticks

2006-10-06 Thread john wright
Hi All,
  i am getting error "The system cannot find the path specified" while running 
below lines code.
  
  $dirname = "util";
  $path = ` cd $dirname ; pwd`
  print ("$path");
  
  can anybody help me to get output of pwd in the variable $path.
  
  Thank
  
  
 __
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Re: CGI bug

2006-10-06 Thread W.P.Nijhof

Rob Dixon wrote:

values after the script has been called once you'll have to do it
manually:

 param('hidden_name','new','values','here');


You can also do this:

$q->hidden( -name=>'x', -value=>$x, -override=>1 )

WayPay


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