Hello everyone, Most modules I run across have a BEGIN block containing some variable declarations, module loaders etc. Although I understand what BEGIN is (code being evaluated immediately after it is parsed), I miss the point of the excercise. For example:
package csv_generator; use Text::CSV_XS; our $ERROR; sub new { my $class = shift; return (bless {}, $class); } sub add_line { my $self = shift; push @{$self->{pending}}, [EMAIL PROTECTED]; return 1; } sub wrap_csv { my $self = shift; my $csv = Text::CSV_XS->new; my @result; foreach my $line @{$self->{pending}} { $csv->combine (@{$line}); push @result, $csv->string(); } return (join ("\n", @result)); } Where would BEGIN come to play? P.S. I know the above code is messy, without any error checking, and I might even have a typo somewhere. It is just for illustration purposes. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>