Yagna, my best advice is to use Catalyst to get this functionality nicely.
You include Catalyst::Plugin::Authentication just like it says in the Catalyst Tutorial.
You basically end up leading off each templated page that you want restricted to logged-in users with this:
[% IF c.user_exists %]
...the rest of your content here...
[% END %]
Your home page or whatever you want to call it won't include this code at the head, so users who haven't logged in yet can see the content that you've not restricted. It works nicely without a lot of fuss. Have fun!