Despite agreeing with Snuggle
regarding Homework you have at least been honest (most arent) and have made an attempt (even if it is a partial attempt.) So heres some thoughts...
The script is to take as an argument a directory. It is to search the directory's files and perform the following.
This sounds much like what File::Find takes as a parameter and what it is used for
- htm files are to be renamed html.
Perhaps the rename keyword would be useful, consult perlfunc.
- any references to http within an htm/html file are to be changed to https.
Personally I would do this with HTML::TreeBuilder or alternately with HTML::TokeParser theres an excellent tutorial on using the later here<super>(fixed link sorry.)</super>
- any html tags within html files are to be converted to upper case
Sounds like learning one of the HTML modules really could pay off...
- (you may assume that <>s are used exclusively to identify html tags)
this may be true for your assignment but is patently and absolutely not true of real life. Impress your teacher use one of the HTML modules
- record in a log file each file that has been modified.
Might want to look up print open and close in perlfunc as well.
- Additional tasks for additional credit
- Your script is to work recursively through any sub-directories.
Yup, the time you took to learn File::Find is gunna score you bunch of bonus points on this one boy...
- Your script will not convert to upper case any SRC attributes of a tag.
Strange how learning one of the HTML modules will pay off in the long run isnt it?
- Your log file will record each tag converted by your program.
Hmm, youll have lots of time to figure out the best way to do this because of the well spent time you put into learning the HTML modules.
- Data validation (really this should be part of the main spec!!!!)
Hmm, aftering mastering a couple of modules validating a path (the only user input) shouldn't be any trouble at all!
Ok its a little tongue in cheek, but I think you get the idea... ;-)
Good luck! And dont forget to use strict and warnings, to have a read through perlfunc, and perhaps perlopentut
Yves / DeMerphq
Writing a good benchmark isnt as easy as it might look.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
Outside of code tags, you may need to use entities for some characters:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||