Andrew Gaffney <[EMAIL PROTECTED]> wrote:
: <code>
: package Skyline;
: 
: <big SNIP of other module code>
: 
: sub generate_report_html([EMAIL PROTECTED]@) {
:    my ($title, $columns, $data) = @_;

   Here begins my problems with prototypes. Let's try
this sample script:

sub generate_report_html([EMAIL PROTECTED]@);

my $title        = 'foo';
my @column_names = 1 .. 4;
my @data         = ( [1 .. 4], [5 .. 8] );

generate_report_html $title, @column_names, @data;

sub generate_report_html([EMAIL PROTECTED]@) {
    my ($title, $columns, $data) = @_;
    print "Report Done";
}


    Everything is just fine until I decide to get my
column names from a subroutine:

generate_report_html $title, column_names(), @data;

sub column_names {
    return 1 .. 4;
}

    Now I have to go into a library and find out why
things are failing and repair them. If I repair them,
do I now have a problem with all the other programs
written using that library of sub routines?



    I could massage the output of column_names() to
work with generate_report_html(),

generate_report_html $title, @{ [ column_names() ] }, @data;


    Or I could change the output of column_names(). But
if column_names() is another library sub routine I'm back
to square one.

    I like perl because I tend to not have to jump through
hoops to program. Protoypes limit me too much. I'd rather
not have to plan so far ahead when solving a problem.


HTH,

Charles K. Clarkson
-- 
Mobile Homes Specialist
254 968-8328




































-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to