[Chicago-talk] Strange file creation

Eric Ellington e.ellington at gmail.com
Thu Oct 5 11:56:28 PDT 2006


Sadly the script gives a list to the makefile sub many times in very
different ways. I am going to go though the debugger for a while and
see where things go bad.

Thanks,

On 10/5/06, Alan Mead <amead at alanmead.org> wrote:
>
>
> Eric Ellington wrote:
>
> >The whole thing is huge, but here is the whole makefile sub. I am
> >thinking that @info is being filled with junk sometimes. Sometimes
> >these files have function names like "Date_Cmp($d ". How can a list be
> >filled with code from the program?
> >
> >sub makefile
> >  {
> >    my($date, $fn, @info) = @_;
> >    my $filename = $fn . $date . '.csv';
> >
> >
>
>
> The filename is being determined by the $date and $fn so it sounds like
> you're calling this function wrong.
>
> Also, I would probably pass \@info when you call and catch it as $info
> (and use it as @$info).
>
> I'd be tempted to use the shift style to retrieve and verify the arguments:
>
> sub makefile
>   {
>     my $date = shift or die "Hey, \$date is empty!";
>     my $fn = shift or die "Hey, \$fn is empty!";
>     my $info = shift or die "Hey, \$info is null";
>
>     my $filename = $fn . $date . '.csv';
>   # ...
>
> Of course, if $date or $fn could ever be zero then you need to check
> more carefully. And if they have garbage, then they will pas this
> test... you could make better checks.
>
> -Alan
>
>
> --
> Alan D. Mead, Ph.D. : amead at alanmead.org : 815-588-3846
>
> Things equal to nothing else are equal to each other.
>
> _______________________________________________
> Chicago-talk mailing list
> Chicago-talk at pm.org
> http://mail.pm.org/mailman/listinfo/chicago-talk
>


-- 
Eric Ellington
e.ellington at gmail.com


More information about the Chicago-talk mailing list