printing out the current URL for current ASP page in Perl

Discussion in 'Perl Misc' started by Jack, Dec 22, 2008.

  1. Jack

    Jack Guest

    Hi I am using ASP and Perl and printing the hash %ENV does nothing, as
    does $ENV{URLVARIABLES} (With URLVARIABLES being anything..

    Any ideas would be great.

    Thank you,

    Jack
    Jack, Dec 22, 2008
    #1
    1. Advertising

  2. Jack <> wrote:
    >Hi I am using ASP and Perl and printing the hash %ENV does nothing,


    Well, there could be a few reasons:
    - %ENV is empty. This is possible but highly unlikely unless you
    deliberately emptied it.
    - print() has a bug. While not completely impossible this is extremely
    unlikely and would require quite some supporting evidence.
    - you are looking at the wrong place, i.e. you are not looking where
    print() is printing.

    You might also be print()ing to a closed file handle, but in that case
    you would get an error message "print() on closed filehandle" instead of
    nothing.

    jue
    Jürgen Exner, Dec 22, 2008
    #2
    1. Advertising

  3. Jack wrote:
    > Subject: printing out the current URL for current ASP page in Perl
    >
    > I am using ASP and Perl and printing the hash %ENV does nothing, as
    > does $ENV{URLVARIABLES} (With URLVARIABLES being anything..


    I have no idea how you pick the environment in ASP. If it had been a
    Perl CGI script you would have been able to say:

    print "http://$ENV{HTTP_HOST}$ENV{REQUEST_URI}\n";

    And to print the whole %ENV var:

    print "$_ = $ENV{$_}\n" for keys %ENV;

    --
    Gunnar Hjalmarsson
    Email: http://www.gunnar.cc/cgi-bin/contact.pl
    Gunnar Hjalmarsson, Dec 22, 2008
    #3
  4. Jürgen Exner <> wrote:
    > Jack <> wrote:
    >>Hi I am using ASP and Perl and printing the hash %ENV does nothing,

    >
    > Well, there could be a few reasons:


    [ snip some reasons ]

    > You might also be print()ing to a closed file handle, but in that case
    > you would get an error message "print() on closed filehandle" instead of

    ^^^^^^^^^^^^^
    > nothing.



    That is a _warning_ message, so you'd get nothing if warnings
    were not enabled.

    (But warnings should always be enabled when developing Perl code.)


    --
    Tad McClellan
    email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
    Tad J McClellan, Dec 22, 2008
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jon B
    Replies:
    7
    Views:
    7,501
    =?Utf-8?B?SmFzb25DaG9p?=
    Jan 30, 2006
  2. Christine Mayer

    JSTL - printing the current host url

    Christine Mayer, Sep 24, 2007, in forum: Java
    Replies:
    4
    Views:
    15,147
    Manish Pandit
    Sep 24, 2007
  3. mvr
    Replies:
    1
    Views:
    133
    Aaron Bertrand - MVP
    Feb 9, 2004
  4. Replies:
    3
    Views:
    377
  5. Replies:
    1
    Views:
    290
    Thomas 'PointedEars' Lahn
    Mar 19, 2008
Loading...

Share This Page