http://qs321.pair.com?node_id=169390

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

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: How to find out the calling URL??
by Juerd (Abbot) on May 26, 2002 at 14:41 UTC

    I don't want my script to be executed directly bu user. Is there any way by which i can find out the calling url in PERL.

    I assume you're a CGI programmer. You can use $ENV{HTTP_REFERER}, but that will not always work as expected. Actually, there is _no_ way to be sure.

    Oh, and there is no PERL. Perl is the language, perl the interpreter.

    Mail address: umer911@yahoo.com

    If you ask your question over here, you will get the answers over here. The mail address is just bait for spamrobots now.

    - Yes, I reinvent wheels.
    - Spam: Visit eurotraQ.
    

      Oh, and there is no PERL

      Of course there is, otherwise why would there be this? ;-)

      And the best quote from the docs...

      Unfortunately there is no documentation for PERL (believe me I've looked everywhere). Therefore, the best thing to do is to go straight to comp.lang.perl.misc and ask your questions there.

      Guess a few of them got lost and found their way here instead.

      what so wrong about calling perl: PERL. that guy must be new in perl and trying to solve his problem instead of learning it. that's why there is perl. do it quickly without spending hours learning it

        what so wrong about calling perl: PERL

        I think perlfaq1 describes this rather clearly. What part of it do you not understand?

        that guy must be new in perl and trying to solve his problem instead of learning it.

        As far as I know, the focus here is learning, not solving problems. Through learning, one can eventually solve many problems, but acquiring knowledge usually comes before using that knowledge.

        do it quickly without spending hours learning it

        Asking for help without being willing to learn is imnsho abuse of our services. Those who do not want to learn should hire a programmer. See also http://juerd.nl/perl_needhelp.

        Juerd # { site => 'juerd.nl', plp_site => 'plp.juerd.nl', do_not_use => 'spamtrap' }

        what so wrong about calling perl: PERL

        Learn how to spell and you will go far in life. -Old Perl Monk Proverb

Re: How to find out the calling URL?
by cjf (Parson) on May 26, 2002 at 15:05 UTC

    Are you looking for the current working directory or the referrer? The working directory can be found in $ENV{'PWD'};

    Please clarify your question so we can answer it.

Re: How to find out the calling URL??
by JayBonci (Curate) on May 26, 2002 at 20:10 UTC
    What may be more accurate than the referrer is the virtual_host and the script_name. If you're using CGI.pm, then there's always this:
    return $query->virtual_host()." - ".$query->script_name();
    Where $query is your CGI object. I got this from the perl CGI documentation located here. Of couse I could be way off for what you need. If you add a little more description of your situation and some code, we may be able to assist you further.

        --jb
Re: How to find out the calling URL??
by mrbbking (Hermit) on May 27, 2002 at 12:34 UTC
    You can use server authentication of the user (via .htaccess, if you're using Apache). Once a user is authenticated by the server, you can get at the REMOTE_USER environment variable.