File::Path::Populate

2004-05-05 Thread Eric Wilhelm
Hi,

I'm looking for a module which would operate similar to the following example.  
If anyone has suggestions or feedback, I'd like to hear them.  (I'd really 
like to here "it's already been solved".)

In the event that it hasn't been solved, suggestions on the name and interface 
are just as welcome.

It seems like a fairly generic problem.  I'm actually planning on using it as 
a component in an image organizational system this week and a cad application 
sometime in the near future.  Basically, you have some table of values, and 
want to make some set of those values into the directory names in a nested 
directory tree, possibly using one of them to create the filename at the end.

I've only shown string data in this example, but I've also considered a 
filename (which would copy it to said location in the tree.)  Probably also a 
subroutine ref interface (which would call the referenced subroutine with the 
resultant filename as an argument.)

Thanks,
Eric

NAME
File::Path::Populate - Populate a directory hierarchy with data.

SYNOPSIS
  my $fpp = File::Path::Populate->new(base => $basedir);
  my @header = qw(farmer_name geese chickens ducks);
  $fpp->header([EMAIL PROTECTED]);
  my @table = (
["dan", 7, 3, 2],
["joe", 0, 5, 2],
);
  $fpp->values([EMAIL PROTECTED]);
  my @structure = qw(
ducks
geese
chickens
/
farmer_name
.txt
);
  $fpp->hierarchy([EMAIL PROTECTED]);
  my @data = (
"Mr. Farmer Dan",
"Just call me Joe"
);
  $fpp->populate([EMAIL PROTECTED]);

This gives the following tree under $basedir:

  .
  `-- 2
  |-- 0
  |   `-- 5
  |   `-- joe.txt
  `-- 7
  `-- 3
  `-- dan.txt

The file 2/0/5/joe.txt would contain the text "Just call me Joe", while
2/7/3/dan.txt reads "Mr. Farmer Dan".



-- 
"It works better if you plug it in!" 
--Sattinger's Law



Re: [RFC] - New module proposal: JavaScript::DebugConsole

2004-05-05 Thread jason scott gessner
HTTP::Recorder has a console feature that you may want to check out as 
well.  I know that Linda hasn't made it a separate module, but the two 
of you may have an interesting possibility to combine features.

-jason scott gessner
[EMAIL PROTECTED]
On May 5, 2004, at 9:23 AM, Enrico Sorcinelli wrote:

Hi all,

I packaged some my old and simple functions inside a Perl module (I 
was tired to
do cut&paste each time :-) ) to generate the necessary JavaScript code 
in order
to open a popup window with custom text and typical web development 
useful infos
(like form params, env vars, HTTP headers and so on).

For example:

my $jdc = new JavaScript::DebugConsole( %args );
$js_code_to_put_in_html_page = $jdc->debugConsole(
content => $content,
title => $title',
auto_open => 1 );
$link_to_open_popup = $jdc->link;
(There are also other methods and properties).

Of course before coding, I've searched similar modules over CPAN with 
no
significant results.
So, I'm considering to put it on CPAN. It will be useful? It is a good 
name?
Maybe CGI::JavaScript::DebugConsole, JavaScript::Popup*, 
JavaScript::*, [...]
sounds better?

Any suggestions and/or criticisms are welcome.

Thanks in advance.

by

	- Enrico



[RFC] - New module proposal: JavaScript::DebugConsole

2004-05-05 Thread Enrico Sorcinelli
Hi all,

I packaged some my old and simple functions inside a Perl module (I was tired to
do cut&paste each time :-) ) to generate the necessary JavaScript code in order
to open a popup window with custom text and typical web development useful infos
(like form params, env vars, HTTP headers and so on).

For example:

my $jdc = new JavaScript::DebugConsole( %args );
$js_code_to_put_in_html_page = $jdc->debugConsole( 
content => $content, 
title => $title', 
auto_open => 1 );
$link_to_open_popup = $jdc->link;

(There are also other methods and properties).

Of course before coding, I've searched similar modules over CPAN with no
significant results.
So, I'm considering to put it on CPAN. It will be useful? It is a good name?
Maybe CGI::JavaScript::DebugConsole, JavaScript::Popup*, JavaScript::*, [...]
sounds better?

Any suggestions and/or criticisms are welcome.

Thanks in advance.

by

- Enrico 


RE: too many tests?

2004-05-05 Thread Orton, Yves
Title: RE: too many tests?






> This works fine up to 5 char combinations... but when you get 
> to the over 900.000 tests for the 6 char ones... argh ;-\
> 
> My computer simply froze (2)... and a message stating 
> something like "Enormous test number seen" kept displaying.
> 
> So... is this normal? How would you normally test this kind of thing?


Yes it normal more or less. 


Normally you would do a proof on something like this. And you would work through the code and ensure that it actually does what the proof says it must.

Think about it, any other approach would require an infinite number of tests.


Yves






too many tests?

2004-05-05 Thread Jose Alves de Castro
Yesterday, just for fun, I coded a module to convert between arabic and
roman numbers (I know there are quite a few, but hey, it was just for
fun).

Once I was done, I couldn't contend myself and I coded a function to
validate if a roman number is indeed a roman number... I did that with a
regex.

Now... wanting to test that function, I did some (1) tests like:

is(validate_roman('XVII'),1);
is(validate_roman('CXXIII'),1);

But I just couldn't stop there... I had to test things like:

isnt(validate_roman('LL'),1);

So what I did was generate all possibles combinations of qw(M D C L X V
I) up to 6 chars, remove the good ones and test them up...

This works fine up to 5 char combinations... but when you get to the
over 900.000 tests for the 6 char ones... argh ;-\

My computer simply froze (2)... and a message stating something like
"Enormous test number seen" kept displaying.

So... is this normal? How would you normally test this kind of thing?


Regards,

jac

(1) - Actually, not just "some"... I tested everything from 1 to 5000
:-|

(2) - I managed to do those tests by separating them in different files 

-- 
Josà Alves de Castro <[EMAIL PROTECTED]>
Telbit - Tecnologias de InformaÃÃo



too many tests?

2004-05-05 Thread Jose Alves de Castro
Yesterday, just for fun, I coded a module to convert between arabic and
roman numbers (I know there are quite a few, but hey, it was just for
fun).

Once I was done, I couldn't contend myself and I coded a function to
validate if a roman number is indeed a roman number... I did that with a
regex.

Now... wanting to test that function, I did some (1) tests like:

is(validate_roman('XVII'),1);
is(validate_roman('CXXIII'),1);

But I just couldn't stop there... I had to test things like:

isnt(validate_roman('LL'),1);

So what I did was generate all possibles combinations of qw(M D C L X V
I) up to 6 chars, remove the good ones and test them up...

This works fine up to 5 char combinations... but when you get to the
over 900.000 tests for the 6 char ones... argh ;-\

My computer simply froze (2)... and a message stating something like
"Enormous test number seen" kept displaying.

So... is this normal? How would you normally test this kind of thing?


Regards,

jac

(1) - Actually, not just "some"... I tested everything from 1 to 5000
:-|

(2) - I managed to do those tests by separating them in different files 


-- 
Josà Alves de Castro <[EMAIL PROTECTED]>
Telbit - Tecnologias de InformaÃÃo