Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: help please

by demerphq (Chancellor)
on Mar 25, 2002 at 14:46 UTC ( [id://154100]=note: print w/replies, xml ) Need Help??


in reply to help please

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.

Replies are listed 'Best First'.
Re: Re: help please
by IlyaM (Parson) on Mar 25, 2002 at 22:55 UTC
    htm files are to be renamed html.
    Perhaps the rename keyword would be useful, consult perlfunc.

    It is better to use move from File::Copy. It is guaranteed to work across filesystem boundaries.

    --
    Ilya Martynov (http://martynov.org/)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://154100]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2024-04-23 06:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found