Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Re: Perl record types

by naChoZ (Curate)
on Jan 17, 2008 at 14:28 UTC ( #662885=note: print w/replies, xml ) Need Help??

in reply to Perl record types

Parse::CSV would really fit the bill, I even demonstrated using a pipe sep over here.

But if you're stuck without using modules, you could probably rig sub up to do what you want easily. This just reads a text file of values in the form of:


my $config = read_config({ filename => 'some_config_file' }); # {{{ read_config # sub read_config { my $args = shift; die "No configuration file specified\n" unless defined $args->{filename}; open my $conf_fh, '<', $args->{filename} or die "Error opening conf file...$!\n\n"; my $conf = {}; for (<$conf_fh>) { chomp; # use '=' as the separator if ( $_ =~ m/[=]/ ) { # skip these lines s/#.*//; s/^\s+//; s/\s+$//; next unless length $_; my ( $key, $value ) = split( /\s*=\s*/, $_, 2 ); $config->{$key} = $value; } } close $conf_fh; return $conf; } # }}}


Therapy is expensive. Popping bubble wrap is cheap. You choose.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://662885]
[Corion]: Oof - "Anyway, if it is not obvious, please keep this discussion entirely confidential for now.", as seen on a public mailing list ;)
[Discipulus]: uh no choroba.. i do not practice much with online putyour image sites:can you suggest one (that possibly remove the pic after few days)?
[choroba]: Corion a bug report?
[choroba]: I have no idea :-( I used to post to, but they don't seem to feature "private" pictures in the free version now
[Discipulus]: dazz i'm not an experts but i think it would be possible
[Corion]: dazz: I think Image::Magick can "read" from an in-memory filehandle
[Corion]: choroba: No, some general admin discussion of how to handle (company) user accounts
[Discipulus]: might be it is necessary to pass the pic data like MIME::Base64:: encode( data..
[Discipulus]: if you have a jpeg data: or as wise Corion said IM ca n read directly your handle

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (10)
As of 2017-03-27 07:53 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (317 votes). Check out past polls.