barney has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to create a small horoscope site for a college project but i am very new to PERL. I want to know how best to go about it. The user will enter there month and day of birth through a html form eg. april 20th. I am presuming that I should assign these dates some kind of value from which the cgi script can work out what star signs info to return to the users browser. How do i do this and what is the best way to store the horoscopes on the server? Thanks Barney PS. The best answer I got from the other forums I tried was 'look in your crystal ball'.

Replies are listed 'Best First'.
Re: date info return
by trs80 (Priest) on Jan 18, 2002 at 20:56 UTC
    There is already a module on CPAN (Comprehensive Perl
    Archive Network) that handles dates to zodiac signs

    Date::Horoscope
    My favorite CPAN search engine will find it for you.
Re: date info return
by stefan k (Curate) on Jan 18, 2002 at 21:00 UTC
    You'll probably won't get much more response on this site than 'look in your crystal ball' because you're question is not very good.
    (Update Obviously I was wrong since while typing there was a better answer *grin*. Still I think that my claim holds...)
    Before you post you should at least have some kind of vision what your programm shall do and what it will be coded like. What I am trying to say is that the Monks around here can't teach you programming, we can just help you with sub-problems and review the code you already have.

    So, you'll probably want to read the documentation to 2 of the major perl standard modules: CGI and Date::Calc. If you do a search here you'll find LOTS of ressources to this concern.

    Regards... Stefan
    you begin bashing the string with a +42 regexp of confusion

Re: date info return
by silent11 (Vicar) on Jan 19, 2002 at 01:01 UTC
    This hasn't been tested but maybe it can give you something to start with.
    #!/usr/bin/perl use CGI qw:/standard/; @year = qw(January Feb Mar Apil May June July Aug Sept Oct Nov Dec); $month = param('month'); $day = param('day'); print header; print " <form><select name=month size=12>"; for (@year) { print "<option value=$_>$_</option>\n"; } print "</select>"; print "<select name=day>"; for (1..31) { print "<option value=$_>$_\n"; } print "</select><input type=submit ></form>"; if (param('month')) { if (($month eq 'January') && ($day > 20) || ($month eq 'Feb') && ($day + < 20)) { print " You are an Aquarius"; } # and so forth for the rest of the months... }