in reply to Re: Multiple File upload script
in thread Multiple File upload script

Andyf

I have used the print statment within the uploadMutiFiles sub routine. I have all of the posted fullpaths from @filehandles as well as all of the posted captions from @descriptions. I removed the umask(000) from the script and can make a few adjustments to the code to accomodate the two variables being used from settings.pl. All they are is directory paths to a temporary directory and the housing directory if the file passes the uploaded byte test.

I am sorry that the code is not the best you have seen, but we all get better over time. I could make the variables that I split global and that way they could be accessed by all subroutines. Is that what you were telling to do by using hashes? Any other comments would be useful. I will try to make some of those changes and let me know if you have further suggestions.

Thanks,

Shawn

Replies are listed 'Best First'.
Re: Re: Re: Multiple File upload script
by andyf (Pilgrim) on May 27, 2004 at 13:15 UTC
    Shawn, If there is one thing you might take to heart I say it should be passing lists and hashes, a generaly more sophisticated way of going about things. No, I did not mean to suggest you use globals. The best analogy for functional programming is to imagine a production line with people all working a product that gets passed along. If you imagine each person is a suboutine/function then they get 'passed' some stuff, and they 'pass back/along' what they have done. What you are saying is...
    Bob, here's the spanner,
    Bob, heres the screwdriver,
    Bob, heres the hammer...

    Instead of just passing Bob the whole toolkit. If you pack all the items you want into a list, and pass the function a reference to that list, you effectively pass the whole bunch of stuff in one go. Of course the codes not bad, I jest. I've seen some _real_ horror in my time, if anything I see indications that you're a good coder limited by a few hangups. It's no worse than my perl code from not too long ago. Initially I thought you had not written the code yourself, and it was a cut n paste from a scripts site, but once I read it I realised you were struggling.
    I also see your background is in C, the move to Perl asks that you 'unlearn' some stuff. It's very forgiving too, and what looks syntactically nice to a C hacker is sometimes ugly in Perl.
    If you don't already have it I strongly recommend the Ram Book (cookbook), meshes perfectly with your level and need for practical snippets.
    have fun
    Andy