princepawn has asked for the wisdom of the Perl Monks concerning the following question:
and turn it into a hohohohohohoh:File: 02packages.details.txt URL: http://www.perl.com/CPAN/modules/02packages.details.txt Description: Package names found in directory $CPAN/authors/id/ Columns: package name, version, path Intended-For: Automated fetch routines, namespace documentation. Written-By: mldistwatch (v 2.343) by Andreas.Koenig@anima.de Line-Count: 14257 Last-Updated: Mon, 28 Oct 2002 14:53:05 GMT A::B undef M/MA/MARCEL/Devel-SearchINC-0 +.01.tar.gz Aardvark undef D/DU/DUNCAND/CGI-Portable-0.4 +7.tar.gz abbreviation 0.02 M/MI/MIYAGAWA/abbreviation-0. +02.tar.gz ABI 0.01 M/MA/MALAY/ABI-0.01.tar.gz about undef S/SH/SHERWOOD/xisofs-1.3.tar. +gz Ace 1.83 L/LD/LDS/AcePerl-1.83.tar.gz Ace::Browser::AceSubs 1.21 L/LD/LDS/AcePerl-1.83.tar.gz Ace::Browser::GeneSubs undef L/LD/LDS/AcePerl-1.83.tar.gz Ace::Browser::SearchSubs undef L/LD/LDS/AcePerl-1.83.tar.gz Ace::Browser::SiteDefs undef L/LD/LDS/AcePerl-1.82.tar.gz Ace::Browser::TreeSubs undef L/LD/LDS/AcePerl-1.83.tar.gz Ace::Freesubs 1.00 L/LD/LDS/AcePerl-1.83.tar.gz Ace::Graphics::Fk undef L/LD/LDS/AcePerl-1.82.tar.gz Ace::Graphics::Glyph undef L/LD/LDS/AcePerl-1.82.tar.gz Ace::Graphics::Glyph::anchored_arrow undef L/LD/LDS/AcePerl-1.82.tar. +gz Ace::Graphics::Glyph::arrow undef L/LD/LDS/AcePerl-1.82.tar.gz Ace::Graphics::Glyph::box undef L/LD/LDS/AcePerl-1.83.tar.gz
my $data_line = qr/(\S+)\s+\S+\s+\S+\d+.tar.gz/; use vars qw(%pkg); sub build { my $file = shift; use FileHandle; my $fh = new FileHandle $file or die "couldnt open: $!"; while (<$fh>) { next unless /$data_line/; my $pkg = $1; my @tree_struct = split '::', $pkg; @tree_struct = map { "'$_'" } @tree_struct; my $join = join '}{', @tree_struct ; $join = "{$join}"; my $eval = "\$pkg$join = '$pkg'"; warn $eval; eval $eval; } use Data::Dumper; warn Dumper(\%pkg); }
But I am leery of using eval and think that there must be some more structural as opposed to string-based method of creating my hohohohohohohoh
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to dynamically (yet structurally) creat a hohohohoh
by fruiture (Curate) on Oct 28, 2002 at 18:08 UTC | |
|
Re: How to dynamically (yet structurally) creat a hohohohoh
by tye (Sage) on Oct 28, 2002 at 20:25 UTC | |
|
Re: How to dynamically (yet structurally) creat a hohohohoh
by broquaint (Abbot) on Oct 28, 2002 at 18:05 UTC | |
|
[OT] Re: How to dynamically (yet structurally) creat a hohohohoh
by belden (Friar) on Oct 28, 2002 at 22:53 UTC |