swampyankee has asked for the wisdom of the Perl Monks concerning the following question:

The world of Fortran has fsplit, which splits Fortran source into individual subroutines or functions (they're different in Fortran, which is neither here nor there).

My question is, then, is there a similar program available for Perl? I am not terribly concerned with anonymous subs, nor am I terribly concerned with cases like

{ my %private_hash; sub build_data { # do magical stuff on %private_hash } sub get_item { my $item = shift; if(exists($private_hash{$item})){ return $private_hash{$item}; } else{ return undef; } } }

Thanks in advance!


grammar correction


<update: 13 Sept 2006>

Having the fairly typical combination of hubris and laziness of a Perl code walloper, I've decided to build my own solution.

Right now, my idea is to

</update: 13 Sept 2006>

emc

Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.

Albert Einstein

Replies are listed 'Best First'.
Re: Program to split a Perl program into subs
by Fletch (Bishop) on Sep 06, 2006 at 18:13 UTC

    If it doesn't do exactly what you want already perhaps you could tweak AutoSplit? That does have certain formatting expectations about the source though (I believe; been a while since I've mucked with it). There's also PPI if you have fancier needs.

      Thanks. I didnt' think of AutoSplit and had barely heard of PPI.

      emc

      Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.

      Albert Einstein
Re: Program to split a Perl program into subs
by planetscape (Chancellor) on Sep 07, 2006 at 15:55 UTC

      Thanks.

      emc

      Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.

      Albert Einstein