Search the web
Sign In
New User? Sign Up
apache-asp · Apache::ASP
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Real people. Real stories. See how Yahoo! Groups impacts members worldwide.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Messages 2247 - 2276 of 2277   Newest  |  < Newer  |  Older >  |  Oldest
Messages: Show Message Summaries   (Group by Topic) Sort by Date v  
#2276 From: Warren Young <warren@...>
Date: Tue Jul 7, 2009 8:48 pm
Subject: Re: File upload problem
warren@...
Send Email Send Email
 
Andrew Koebrick (ADM) wrote:
> Any thoughts on getting them to play well together?

The use of CGI.pm to construct file upload fields is a mere convenience.
   You can do the same thing by writing raw HTML.  It's just uglier than
the corresponding CGI.pm code, is all.

As I said above, all other uses of CGI.pm should have equivalents in
Apache::ASP, so there's really no good reason to use CGI.pm.

---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@...
For additional commands, e-mail: asp-help@...

#2275 From: "Andrew Koebrick (ADM)" <Andrew.Koebrick@...>
Date: Tue Jul 7, 2009 8:01 pm
Subject: RE: File upload problem
Andrew.Koebrick@...
Send Email Send Email
 
It looks like I figured out my problem with the missing $Request->Form data. I
have RequestBinaryRead set to "Off".  Turning this off gives me content in 
$Reqest->Form, but it unfortunately seems to then break CGI.pm.

I had ReqestBinaryRead turned off because of a different problem I was having
back in 2004 with POST data truncation:
  http://www.mail-archive.com/asp@perl.apache.org/msg02159.html


So it looks like at this point CGI.pm and Apache::ASP are at odds.  Any thoughts
on getting them to play well together?

Andrew Koebrick


---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@...
For additional commands, e-mail: asp-help@...

#2274 From: "D. L. Fox" <webdev@...>
Date: Fri Jul 3, 2009 3:34 pm
Subject: Re: File upload problem / $Request->Form problem
webdev@...
Send Email Send Email
 
Probably not what is causing your scenario but...

I once had a scenario similar to this and found the problem was in my
HTML. I needed to use both "id" and "name" attributes for each element
in the form. If I just used one or the other, it wouldn't pass any data
for that element.


Andrew Koebrick (ADM) wrote:

> Any ideas on what could be botching or interfering with the Request object?


---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@...
For additional commands, e-mail: asp-help@...

#2273 From: Warren Young <warren@...>
Date: Thu Jul 2, 2009 8:33 pm
Subject: Re: File upload problem
warren@...
Send Email Send Email
 
Andrew Koebrick (ADM) wrote:
> Can't locate object method "request" via package "Apache"

Have you tried this patch:

http://www.gossamer-threads.com/lists/modperl/asp/89060?search_string=yarrow;#89\
060

?

---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@...
For additional commands, e-mail: asp-help@...

#2272 From: "Andrew Koebrick (ADM)" <Andrew.Koebrick@...>
Date: Thu Jul 2, 2009 6:27 pm
Subject: RE: File upload problem
Andrew.Koebrick@...
Send Email Send Email
 
>> Would I be correct in guessing that this Apache::ASP application is
brand new..?

Well, there have been the usual updates to the perl modules, but I have been
running apache::asp on the site since ~2000.  But as I generally only use
apache::asp to embed the perl, rather than to replace the CGI functionality, it
could be that the problem is longer lasting. I have access data from
$Request->Form before, but not for a long while.

I am assuming the problem related to how apache::asp and mod_perl are
interacting on my system.  For a few asp versions, I had to patch ASP.pm to get
it to run at all (ala this advice:
http://www.gossamer-threads.com/lists/modperl/asp/82238; basically testing for
correct mod_perl version).  But with the latest version of the module, that did
not seem to be necessary.   I suspect it is this because of the error I
mentioned in my first note:

Can't locate object method "request" via package "Apache" at
/home/httpd/html-MBA/Users/InputForms/MetaManager4.html line 93. <--> ,
/usr/local/lib/perl5/site_perl/5.10.0/Apache/ASP.pm line 1522

Anyhow, I will keep digging; perhaps try a reinstall. Thanks for you assistance.

Andrew

---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@...
For additional commands, e-mail: asp-help@...

#2271 From: Warren Young <warren@...>
Date: Wed Jul 1, 2009 9:16 pm
Subject: Re: File upload problem / $Request->Form problem
warren@...
Send Email Send Email
 
Andrew Koebrick (ADM) wrote:
>
> asp title:
> cgi title: test title

Would I be correct in guessing that this Apache::ASP application is
brand new, and hasn't been running successfully for some time in the
same configuration?  If so, I would guess that you don't yet have
Apache::ASP set up correctly.  Try the examples, and the generic
troubleshooting steps you can find in the mailling list archives and the
docs.

---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@...
For additional commands, e-mail: asp-help@...

#2270 From: "Andrew Koebrick (ADM)" <Andrew.Koebrick@...>
Date: Wed Jul 1, 2009 5:07 pm
Subject: RE: File upload problem / $Request->Form problem
Andrew.Koebrick@...
Send Email Send Email
 
Warren,

Thank you for the response.

I had actually tried this syntax:

      if ($Request->{Method} eq 'POST') {
        my $form = $Request->Form;
        # process $form->{stuff} here
      }

But I can not seem to access anything from the form via this method.  In fact
there seems to be little I can get from the Request object.  If I submit my form
and try:
	    print "Request total bytes $Request->{TotalBytes}<br>";
	    print "Request method $Request->{Method}<br>";

I get:
Request total bytes 0
Request method POST

Also when I try to grab any form content via the construct you suggest, I get no
content.  For example, in my form I have a required field 'Title'.  Testing
access to my fields using both CGI and the native asp methods:

	 my $form = $Request->Form;
       my $title = $form->{'Title'};
       my $title2 = $query->param("Title");
	 print "asp title: $title<br>";
	 print "cgi title: $title2<br>";

results in

asp title:
cgi title: test title


Any ideas on what could be botching or interfering with the Request object?

Andrew Koebrick

-----Original Message-----
From: Warren Young [mailto:warren@...]
Sent: Tuesday, June 30, 2009 8:42 PM
To: Apache-ASP List
Subject: Re: File upload problem

Andrew Koebrick (ADM) wrote:
> (http://www.apache-asp.org/cgi.html) that the recommendation is to roll
> back to CGI v2.78.

The docs are just giving that version as a known-working example.  I've
successfully uploaded files to servers running CGI.pm v2.89 and v3.15.

> I end up with an empty file on my server.

Empty, or missing?

If you're expecting to access the actual file-on-disk, rather just read
the data via a file handle, you need to set

	 PerlSetVar FileUploadTemp 1

in your httpd.conf file.  Otherwise, Apache deletes the temp file it
uses to hold the upload.  As an example of why you'd care, my code sets
this configuration variable this because the first thing it does is 'mv'
the file to its new permanent home in the filesystem.

> If I try to read directly from
> request->Form I get the error:

Perl is case-sensitive, and the $ is not optional.  It's
"$Request->Form".  I typically do this at the top of pages that receive
form posts:

      if ($Request->{Method} eq 'POST') {
        my $form = $Request->Form;
        # process $form->{stuff} here
      }

Being able to access the form values via $form saves a lot of typing.

>  my $filename = $query->param("Identifier-upload");

I would only use CGI.pm to set up the file upload form, as described in
the Apache::ASP docs.  I wouldn't continue to use it on the POST
handling side like this.  Apache::ASP has its own mechanisms, which I'd
trust more.  Using the shorthand above, you'd say

	 my $filename = $form->{Identifier-upload};

instead.

> my $upload_filehandle = $query->upload("Identifier-upload");

Again, you're fighting Apache::ASP by doing things through CGI.pm that
Apache::ASP already does.  If you want just the file handle, that's

	 $Request->{FileUpload}{upload_field}->{FileHandle}

...in ASP-speak.  See http://www.apache-asp.org/cgi.html#File%20Upload

If you set the httpd.conf variable as above, the name of the file is in

	 $Request->{FileUpload}{mfile}->{TempFile}

---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@...
For additional commands, e-mail: asp-help@...


---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@...
For additional commands, e-mail: asp-help@...

#2269 From: Warren Young <warren@...>
Date: Wed Jul 1, 2009 1:42 am
Subject: Re: File upload problem
warren@...
Send Email Send Email
 
Andrew Koebrick (ADM) wrote:
> (http://www.apache-asp.org/cgi.html) that the recommendation is to roll
> back to CGI v2.78.

The docs are just giving that version as a known-working example.  I've
successfully uploaded files to servers running CGI.pm v2.89 and v3.15.

> I end up with an empty file on my server.

Empty, or missing?

If you're expecting to access the actual file-on-disk, rather just read
the data via a file handle, you need to set

	 PerlSetVar FileUploadTemp 1

in your httpd.conf file.  Otherwise, Apache deletes the temp file it
uses to hold the upload.  As an example of why you'd care, my code sets
this configuration variable this because the first thing it does is 'mv'
the file to its new permanent home in the filesystem.

> If I try to read directly from
> request->Form I get the error:

Perl is case-sensitive, and the $ is not optional.  It's
"$Request->Form".  I typically do this at the top of pages that receive
form posts:

      if ($Request->{Method} eq 'POST') {
        my $form = $Request->Form;
        # process $form->{stuff} here
      }

Being able to access the form values via $form saves a lot of typing.

>  my $filename = $query->param("Identifier-upload");

I would only use CGI.pm to set up the file upload form, as described in
the Apache::ASP docs.  I wouldn't continue to use it on the POST
handling side like this.  Apache::ASP has its own mechanisms, which I'd
trust more.  Using the shorthand above, you'd say

	 my $filename = $form->{Identifier-upload};

instead.

> my $upload_filehandle = $query->upload("Identifier-upload");

Again, you're fighting Apache::ASP by doing things through CGI.pm that
Apache::ASP already does.  If you want just the file handle, that's

	 $Request->{FileUpload}{upload_field}->{FileHandle}

...in ASP-speak.  See http://www.apache-asp.org/cgi.html#File%20Upload

If you set the httpd.conf variable as above, the name of the file is in

	 $Request->{FileUpload}{mfile}->{TempFile}

---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@...
For additional commands, e-mail: asp-help@...

#2268 From: "Andrew Koebrick (ADM)" <Andrew.Koebrick@...>
Date: Tue Jun 30, 2009 9:50 pm
Subject: File upload problem
Andrew.Koebrick@...
Send Email Send Email
 

I am attempting to implement an upload script and having problems.  I see from the apache::asp documentation (http://www.apache-asp.org/cgi.html) that the recommendation is to roll back to CGI v2.78.  This is not an option in my case- I am locked into 3.43.  I am hoping that somebody can offer suggestions on patching either apache::asp or CGI to get my script to function.  I am adapting the  upload script from here, and it looks pretty straight forward:

http://www.sitepoint.com/article/uploading-files-cgi-perl/

 

Unfortunately, when I run the script, I end up with an empty file on my server.  I have edited CGI.pm to use an appropriate $CGITempFile::TMPDIRECTORY

 

Some other potentially relevant specs: Fedora 10, Apache/2.2.11 (Unix) mod_perl/2.0.4 Perl/v5.10.0

 

Also, as another potential clue, I found which attempting to debug that I seem to have an empty request object… If I try to read directly from request->Form I get the error:

 

Can't locate object method "request" via package "Apache" at /home/httpd/html-MBA/Users/InputForms/Me

taManager4.html line 93. <--> , /usr/local/lib/perl5/site_perl/5.10.0/Apache/ASP.pm line 1522

 

Also, when I attempt to test the upload script from http://www.apache-asp.org/eg/file_upload.asp on my own server, I again seem to be stymied by the missing request object.

 

Many thanks for assisting in sorting this issue out.

 

 

Andrew Koebrick

 

++++++++++++++

Problem script:

 

                        my $safe_filename_characters = "a-zA-Z0-9_.-";

                        my $upload_dir = "$ENV{DOCUMENT_ROOT}/$cfg->{DocumentStore}";

 

                        my $filename = $query->param("Identifier-upload");

                                               

                        if ( !$filename )

                        {

                         print $query->header ( );

                         print "There was a problem uploading your photo (try a smaller file).";

                         exit;

                        }

                       

                        my ( $name, $path, $extension ) = fileparse ( $filename, '\..*' );

                        $filename = $name . $extension;

                        $filename =~ tr/ /_/;

                        $filename =~ s/[^$safe_filename_characters]//g;

                       

                        if ( $filename =~ /^([$safe_filename_characters]+)$/ )

                        {

                         $filename = $1;

                        }

                        else

                        {

                         die "Filename contains invalid characters";

                        }

                       

 

 

                       

                        my $upload_filehandle = $query->upload("Identifier-upload");

                        print "Location $upload_dir/$filename";

                        open ( UPLOADFILE, ">/home/httpd/html-MBA/$filename" ) or die "$!";

                        binmode UPLOADFILE;

                        while ( <$upload_filehandle> )

                        {

                         print UPLOADFILE;

                        }

                       

                        close UPLOADFILE;

 


#2267 From: aura networks <laki.sreekanth@...>
Date: Fri Jun 19, 2009 11:33 am
Subject: Re: Capture sessionID in browser from perl script
laki.sreekanth@...
Send Email Send Email
 
Contents in cookies.dat file:      #LWP-Cookies-1.0
Output: HTTP::Response=HASH(0xafebd0)

Tell me the way to get session-id pls pls...



--
View this message in context:
http://www.nabble.com/Capture-sessionID-in-browser-from-perl-script-tp22822820p2\
4109775.html
Sent from the Apache - Asp mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@...
For additional commands, e-mail: asp-help@...

#2266 From: Sudarshan Soma <sudarshan12s@...>
Date: Fri Jun 19, 2009 6:54 am
Subject: Re: Capture sessionID in browser from perl script
sudarshan12s@...
Send Email Send Email
 
Hi,
The cookies would be stored in the cookie store mentioned, cookies.dat.
You can aswell check errors for every call. In mycase if need not
check the sessionid, but just pass the obtained sessionid embedded in
the further web requests

let me know what u find

thanks
pavan

On Fri, Jun 19, 2009 at 12:10 PM, aura networks<laki.sreekanth@...> wrote:
>
> My Perl code:
>
> #!/usr/bin/perl -w
>
> use HTTP::Cookies;
> use HTTP::Request::Common;
> use LWP::UserAgent;
>
> $ua = new LWP::UserAgent;
> if(! $ua)
> {
>        print "Can not get the page :UserAgent fialed \n";
>        return 0;
> }
>
> my $cookies=new HTTP::Cookies(file=>'./cookies.dat',autosave=>1);
> $ua->cookie_jar($cookies);
> # push does all magic to exrtact cookies and add to header for further reqs.
> useragent should be newer
> push @{ $ua->requests_redirectable }, 'POST';
> $result = $ua->request(POST " http://erail.in http://erail.in ");
> print $result;
> ______________
> Through this program i am not able to capture the Session id/cookie value
> from the opened site(in the script)
> I am getting this output:  HTTP::Response=HASH(0xacc640)
>
> Please suggest me how to capture the session-id....
>
> Thanks,
> Lakshmi Sreekanth
> --
> View this message in context:
http://www.nabble.com/Capture-sessionID-in-browser-from-perl-script-tp22822820p2\
4106307.html
> Sent from the Apache - Asp mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: asp-unsubscribe@...
> For additional commands, e-mail: asp-help@...
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@...
For additional commands, e-mail: asp-help@...

#2265 From: aura networks <laki.sreekanth@...>
Date: Fri Jun 19, 2009 6:40 am
Subject: Re: Capture sessionID in browser from perl script
laki.sreekanth@...
Send Email Send Email
 
My Perl code:

#!/usr/bin/perl -w

use HTTP::Cookies;
use HTTP::Request::Common;
use LWP::UserAgent;

$ua = new LWP::UserAgent;
if(! $ua)
{
	 print "Can not get the page :UserAgent fialed \n";
	 return 0;
}

my $cookies=new HTTP::Cookies(file=>'./cookies.dat',autosave=>1);
$ua->cookie_jar($cookies);
# push does all magic to exrtact cookies and add to header for further reqs.
useragent should be newer
push @{ $ua->requests_redirectable }, 'POST';
$result = $ua->request(POST " http://erail.in http://erail.in ");
print $result;
______________
Through this program i am not able to capture the Session id/cookie value
from the opened site(in the script)
I am getting this output:  HTTP::Response=HASH(0xacc640)

Please suggest me how to capture the session-id....

Thanks,
Lakshmi Sreekanth
--
View this message in context:
http://www.nabble.com/Capture-sessionID-in-browser-from-perl-script-tp22822820p2\
4106307.html
Sent from the Apache - Asp mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@...
For additional commands, e-mail: asp-help@...

#2264 From: aura networks <laki.sreekanth@...>
Date: Fri Jun 19, 2009 6:34 am
Subject: Re: Capture sessionID in browser from perl script
laki.sreekanth@...
Send Email Send Email
 
http://www.nabble.com/file/p24106268/final.pl final.pl
Here i am not getting the Session-id / cookie-value from the browser, just i
am getting the below output:
Output: HTTP::Response=HASH(0xacc640)

Please suggest me how to capture the session-id from the opened site(in the
script)

Thanks,
Lakshmi Sreekanth
--
View this message in context:
http://www.nabble.com/Capture-sessionID-in-browser-from-perl-script-tp22822820p2\
4106268.html
Sent from the Apache - Asp mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@...
For additional commands, e-mail: asp-help@...

#2263 From: Bill Moseley <moseley@...>
Date: Wed Apr 29, 2009 2:41 pm
Subject: Re: DESTROY in cleanup handler
moseley@...
Send Email Send Email
 
Anyone still around that is familiar with Apache::ASP's internals?

On Thu, Apr 23, 2009 at 10:47:42AM -0700, Bill Moseley wrote:
> Is there a purpose for using a cleanup handler (to call DESTROY) in
> Apache::ASP instead of cleaning up at the end of the response handler?
>
> What looks like happened is that due to circular references DESTROY
> was not getting called at the end of the request so that a handler was
> used to explicitly call DESTROY.  But, I'm not clear if there were
> other reasons (e.g. need to keep the Apache::ASP object around after
> the response was completed).  Is there another reason?
>
> The Apache::ASP object holds child objects that reference the
> Apache::ASP parent object.  Those could be weakened.  Also $Session,
> $Application, etc. are not localized when running an .asp page so they
> hold references until the following request when they are set again
> (via InitPackageGlobals).
>
> Thanks,

--
Bill Moseley.
moseley@...
Sent from my iMutt

---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@...
For additional commands, e-mail: asp-help@...

#2262 From: Bill Moseley <moseley@...>
Date: Thu Apr 23, 2009 5:47 pm
Subject: DESTROY in cleanup handler
moseley@...
Send Email Send Email
 
Is there a purpose for using a cleanup handler (to call DESTROY) in
Apache::ASP instead of cleaning up at the end of the response handler?

What looks like happened is that due to circular references DESTROY
was not getting called at the end of the request so that a handler was
used to explicitly call DESTROY.  But, I'm not clear if there were
other reasons (e.g. need to keep the Apache::ASP object around after
the response was completed).  Is there another reason?

The Apache::ASP object holds child objects that reference the
Apache::ASP parent object.  Those could be weakened.  Also $Session,
$Application, etc. are not localized when running an .asp page so they
hold references until the following request when they are set again
(via InitPackageGlobals).

Thanks,


--
Bill Moseley.
moseley@...
Sent from my iMutt

---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@...
For additional commands, e-mail: asp-help@...

#2261 From: Thanos Chatziathanassiou <tchatzi@...>
Date: Thu Apr 9, 2009 9:36 am
Subject: Re: Capture sessionID in browser from perl script
tchatzi@...
Send Email Send Email
 
O/H Sudarshan Soma Ýăńářĺ:
> Thanks a lot. I got the final code now
>
> use warnings;
>
Since this is a mod_perl list, you might want to consider ``use
strict;'' as well (actually you might consider using strict anyhow)
> use HTTP::Cookies;
> use HTTP::Request::Common;
> use LWP::UserAgent;
>
> {
>     $ua = new LWP::UserAgent;
>     if(! $ua) {
>         print "Can not get the page :UserAgent fialed \n";
>         return 0;
>     }
>
I've never had an LWP::UserAgent fail on me at this step, however...
>     my $cookies=new HTTP::Cookies(file=>'./cookies.dat',autosave=>1);
>     $ua->cookie_jar($cookies);
> # push does all magic to exrtact cookies and add to header for further
> reqs. useragent should be newer
>     push @{ $ua->requests_redirectable }, 'POST';
>     $result = $ua->request(POST "http://x.y.z.p",
>             {
>             Username =>'xxx',
>             Password =>'xxx',
>             Submit             =>'Submit'
>             });
>
..if really want to check for failures, maybe fold all the rest in an
``if ($result->is_success)'' block.
>     $resp = $result->content;
>
>  $anotherURI = "http://x.y.z.p/gd";
>     $requestObject = HTTP::Request::Common::GET $anotherURI;
>     $result = $ua->request($requestObject);
>
same here
>     $resp = $result->content;
>
in all, there are numerous things that might go wrong through the
process (e.g. perhaps you didn't really log in successfully), but maybe
this is a throw-away run once script, so if it works for you...


---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@...
For additional commands, e-mail: asp-help@...

#2260 From: Sudarshan Soma <sudarshan12s@...>
Date: Thu Apr 9, 2009 5:23 am
Subject: Re: Capture sessionID in browser from perl script
sudarshan12s@...
Send Email Send Email
 
2009/4/3 Thanos Chatziathanassiou <tchatzi@...>:
> O/H Sudarshan Soma Ýăńářĺ:
>>
>> Thanks a lot . I have a followup query, can anyone please advice me:
>>
>> My application (webser) will set up sessionId in the cookie and sets
>> redirect URL to main page(if login is successfull). In case of
>> browser, this works fine with redirect thread reaches server with the
>> sessionId set and request for main page.
>>
>> Can anyone please let me know how, it can be made to work in perl with
>> redirect URLs.
>>
>> I think this is a basic query , but my intial search didnt help me.
>> Please advice
>>
>
> You really need to familiarize yourself with perldoc (or google for that
> matter ;)
>
> To the matter at hand: redirects should work quite as expected. If they do
> not, then they're probably not HTTP 3xx (see
> http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html) and perhaps you'll
> have to resort to some fancy regex (perldoc perlre) to go to the correct
> URI.
> For HTTP, see ``$ua->max_redirect'' and ``$ua->requests_redirectable'' in
> ``perldoc LWP::UserAgent''. Also take a look in the libwww-perl cookbook
> ``perldoc lwpcook''.
> Someone's bound to have already done what you need.
>>
>> Thanks and Best Regards,
>> Pavan
>>
>> My code till now is:
>>
>>  $ua = new LWP::UserAgent;
>>    if(! $ua) {
>>        return 0;
>>    }
>>
>>    $ua->cookie_jar(HTTP::Cookies->new);
>>    $requestString = "http://x.y.z.w?Username=abc&Password=abc";
>>    $requestObject = HTTP::Request::Common::GET $requestString;
>>    $result = $ua->request($requestObject);
>>    $resp = $result->content;
>>    print "$resp";
>>
>>
>> On Wed, Apr 1, 2009 at 3:20 PM, Thanos Chatziathanassiou <tchatzi@...>
>> wrote:
>>
>>>
>>> O/H Sudarshan Soma Ýăńářĺ:
>>>
>>>>
>>>> Hi All,
>>>> I have a requirement to test webserver using perl scripts. The
>>>> webserver creates a sessionId after successfull authentication. Hence
>>>> for futher requests to the webserver, i need to send the sessionId
>>>> which is set in the browser/client . Can anyone please let me know how
>>>> can i do this.
>>>>
>>>> Myperl script is something like this:
>>>>
>>>> $requestString = "http://x.y.x.w"
>>>> $request = HTTP::Request->new(GET => $requestString);
>>>> $request->authorization_basic($userid, $passwd);
>>>> $request->push_header(Cookie => "SESSIONID=?????; path=/;"); ------>
>>>> capture session id from browser
>>>>
>>>>
>>>
>>> rather:
>>> ---8<---
>>> use HTTP::Cookies;
>>> use HTTP::Request::Common;
>>> use LWP::UserAgent;
>>>
>>> $ua = LWP::UserAgent->new;
>>> $requestString = "http://x.y.x.w";
>>> $ua->cookie_jar(HTTP::Cookies->new);
>>> $result = $ua->request(HTTP::Request::Common::GET $requestString));
>>> $ua->cookie_jar->extract_cookies($res);
>>> #session id is now in the cookie jar. ``perldoc HTTP::Cookies''
>>> #to read it
>>> $anotherURI = "http://x.y.x.w/whatever";
>>> $requestObject = HTTP::Request::Common::GET $anotherURI;
>>> #automatically add the cookies (including the session-id) to this
>>> request..
>>> $ua->cookie_jar->add_cookie_header($requestObject);
>>> $result = $ua->request($requestObject);
>>>
>>> ---8<---
>>>
>>>
>>>>
>>>> Best Regards,
>>>> Pavan
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: asp-unsubscribe@...
>>>> For additional commands, e-mail: asp-help@...
>>>>
>>>>
>>>>
>>>
>>>
>
>


Thanks a lot. I got the final code now

use warnings;

use HTTP::Cookies;
use HTTP::Request::Common;
use LWP::UserAgent;

{
     $ua = new LWP::UserAgent;
     if(! $ua) {
         print "Can not get the page :UserAgent fialed \n";
         return 0;
     }

     my $cookies=new HTTP::Cookies(file=>'./cookies.dat',autosave=>1);
     $ua->cookie_jar($cookies);
# push does all magic to exrtact cookies and add to header for further
reqs. useragent should be newer
     push @{ $ua->requests_redirectable }, 'POST';
     $result = $ua->request(POST "http://x.y.z.p",
             {
             Username =>'xxx',
             Password =>'xxx',
             Submit             =>'Submit'
             });
     $resp = $result->content;

  $anotherURI = "http://x.y.z.p/gd";
     $requestObject = HTTP::Request::Common::GET $anotherURI;
     $result = $ua->request($requestObject);
     $resp = $result->content;

---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@...
For additional commands, e-mail: asp-help@...

#2259 From: Thanos Chatziathanassiou <tchatzi@...>
Date: Fri Apr 3, 2009 2:25 pm
Subject: Re: Capture sessionID in browser from perl script
tchatzi@...
Send Email Send Email
 
O/H Sudarshan Soma Ýăńářĺ:
> Thanks a lot . I have a followup query, can anyone please advice me:
>
> My application (webser) will set up sessionId in the cookie and sets
> redirect URL to main page(if login is successfull). In case of
> browser, this works fine with redirect thread reaches server with the
> sessionId set and request for main page.
>
> Can anyone please let me know how, it can be made to work in perl with
> redirect URLs.
>
> I think this is a basic query , but my intial search didnt help me.
> Please advice
>
You really need to familiarize yourself with perldoc (or google for that
matter ;)

To the matter at hand: redirects should work quite as expected. If they
do not, then they're probably not HTTP 3xx (see
http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html) and perhaps
you'll have to resort to some fancy regex (perldoc perlre) to go to the
correct URI.
For HTTP, see ``$ua->max_redirect'' and ``$ua->requests_redirectable''
in ``perldoc LWP::UserAgent''. Also take a look in the libwww-perl
cookbook ``perldoc lwpcook''.
Someone's bound to have already done what you need.
> Thanks and Best Regards,
> Pavan
>
> My code till now is:
>
>   $ua = new LWP::UserAgent;
>     if(! $ua) {
>         return 0;
>     }
>
>     $ua->cookie_jar(HTTP::Cookies->new);
>     $requestString = "http://x.y.z.w?Username=abc&Password=abc";
>     $requestObject = HTTP::Request::Common::GET $requestString;
>     $result = $ua->request($requestObject);
>     $resp = $result->content;
>     print "$resp";
>
>
> On Wed, Apr 1, 2009 at 3:20 PM, Thanos Chatziathanassiou <tchatzi@...>
wrote:
>
>> O/H Sudarshan Soma Ýăńářĺ:
>>
>>> Hi All,
>>> I have a requirement to test webserver using perl scripts. The
>>> webserver creates a sessionId after successfull authentication. Hence
>>> for futher requests to the webserver, i need to send the sessionId
>>> which is set in the browser/client . Can anyone please let me know how
>>> can i do this.
>>>
>>> Myperl script is something like this:
>>>
>>> $requestString = "http://x.y.x.w"
>>> $request = HTTP::Request->new(GET => $requestString);
>>> $request->authorization_basic($userid, $passwd);
>>> $request->push_header(Cookie => "SESSIONID=?????; path=/;"); ------>
>>> capture session id from browser
>>>
>>>
>> rather:
>> ---8<---
>> use HTTP::Cookies;
>> use HTTP::Request::Common;
>> use LWP::UserAgent;
>>
>> $ua = LWP::UserAgent->new;
>> $requestString = "http://x.y.x.w";
>> $ua->cookie_jar(HTTP::Cookies->new);
>> $result = $ua->request(HTTP::Request::Common::GET $requestString));
>> $ua->cookie_jar->extract_cookies($res);
>> #session id is now in the cookie jar. ``perldoc HTTP::Cookies''
>> #to read it
>> $anotherURI = "http://x.y.x.w/whatever";
>> $requestObject = HTTP::Request::Common::GET $anotherURI;
>> #automatically add the cookies (including the session-id) to this request..
>> $ua->cookie_jar->add_cookie_header($requestObject);
>> $result = $ua->request($requestObject);
>>
>> ---8<---
>>
>>
>>> Best Regards,
>>> Pavan
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: asp-unsubscribe@...
>>> For additional commands, e-mail: asp-help@...
>>>
>>>
>>>
>>


---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@...
For additional commands, e-mail: asp-help@...

#2258 From: Sudarshan Soma <sudarshan12s@...>
Date: Fri Apr 3, 2009 2:05 pm
Subject: Re: Capture sessionID in browser from perl script
sudarshan12s@...
Send Email Send Email
 
Thanks a lot . I have a followup query, can anyone please advice me:

My application (webser) will set up sessionId in the cookie and sets
redirect URL to main page(if login is successfull). In case of
browser, this works fine with redirect thread reaches server with the
sessionId set and request for main page.

Can anyone please let me know how, it can be made to work in perl with
redirect URLs.

I think this is a basic query , but my intial search didnt help me.
Please advice

Thanks and Best Regards,
Pavan

My code till now is:

   $ua = new LWP::UserAgent;
     if(! $ua) {
         return 0;
     }

     $ua->cookie_jar(HTTP::Cookies->new);
     $requestString = "http://x.y.z.w?Username=abc&Password=abc";
     $requestObject = HTTP::Request::Common::GET $requestString;
     $result = $ua->request($requestObject);
     $resp = $result->content;
     print "$resp";


On Wed, Apr 1, 2009 at 3:20 PM, Thanos Chatziathanassiou <tchatzi@...> wrote:
> O/H Sudarshan Soma Ýăńářĺ:
>>
>> Hi All,
>> I have a requirement to test webserver using perl scripts. The
>> webserver creates a sessionId after successfull authentication. Hence
>> for futher requests to the webserver, i need to send the sessionId
>> which is set in the browser/client . Can anyone please let me know how
>> can i do this.
>>
>> Myperl script is something like this:
>>
>> $requestString = "http://x.y.x.w"
>> $request = HTTP::Request->new(GET => $requestString);
>> $request->authorization_basic($userid, $passwd);
>> $request->push_header(Cookie => "SESSIONID=?????; path=/;"); ------>
>> capture session id from browser
>>
>
> rather:
> ---8<---
> use HTTP::Cookies;
> use HTTP::Request::Common;
> use LWP::UserAgent;
>
> $ua = LWP::UserAgent->new;
> $requestString = "http://x.y.x.w";
> $ua->cookie_jar(HTTP::Cookies->new);
> $result = $ua->request(HTTP::Request::Common::GET $requestString));
> $ua->cookie_jar->extract_cookies($res);
> #session id is now in the cookie jar. ``perldoc HTTP::Cookies''
> #to read it
> $anotherURI = "http://x.y.x.w/whatever";
> $requestObject = HTTP::Request::Common::GET $anotherURI;
> #automatically add the cookies (including the session-id) to this request..
> $ua->cookie_jar->add_cookie_header($requestObject);
> $result = $ua->request($requestObject);
>
> ---8<---
>
>>
>>
>> Best Regards,
>> Pavan
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: asp-unsubscribe@...
>> For additional commands, e-mail: asp-help@...
>>
>>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@...
For additional commands, e-mail: asp-help@...

#2257 From: Thanos Chatziathanassiou <tchatzi@...>
Date: Wed Apr 1, 2009 9:50 am
Subject: Re: Capture sessionID in browser from perl script
tchatzi@...
Send Email Send Email
 
O/H Sudarshan Soma έγριψξ:
> Hi All,
> I have a requirement to test webserver using perl scripts. The
> webserver creates a sessionId after successfull authentication. Hence
> for futher requests to the webserver, i need to send the sessionId
> which is set in the browser/client . Can anyone please let me know how
> can i do this.
>
> Myperl script is something like this:
>
> $requestString = "http://x.y.x.w"
> $request = HTTP::Request->new(GET => $requestString);
> $request->authorization_basic($userid, $passwd);
> $request->push_header(Cookie => "SESSIONID=?????; path=/;"); ------>
> capture session id from browser
>
rather:
---8<---
use HTTP::Cookies;
use HTTP::Request::Common;
use LWP::UserAgent;

$ua = LWP::UserAgent->new;
$requestString = "http://x.y.x.w";
$ua->cookie_jar(HTTP::Cookies->new);
$result = $ua->request(HTTP::Request::Common::GET $requestString));
$ua->cookie_jar->extract_cookies($res);
#session id is now in the cookie jar. ``perldoc HTTP::Cookies''
#to read it
$anotherURI = "http://x.y.x.w/whatever";
$requestObject = HTTP::Request::Common::GET $anotherURI;
#automatically add the cookies (including the session-id) to this request..
$ua->cookie_jar->add_cookie_header($requestObject);
$result = $ua->request($requestObject);

---8<---

>
>
> Best Regards,
> Pavan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: asp-unsubscribe@...
> For additional commands, e-mail: asp-help@...
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@...
For additional commands, e-mail: asp-help@...

#2256 From: Sudarshan Soma <sudarshan12s@...>
Date: Wed Apr 1, 2009 9:24 am
Subject: Capture sessionID in browser from perl script
sudarshan12s@...
Send Email Send Email
 
Hi All,
I have a requirement to test webserver using perl scripts. The
webserver creates a sessionId after successfull authentication. Hence
for futher requests to the webserver, i need to send the sessionId
which is set in the browser/client . Can anyone please let me know how
can i do this.

Myperl script is something like this:

$requestString = "http://x.y.x.w"
$request = HTTP::Request->new(GET => $requestString);
$request->authorization_basic($userid, $passwd);
$request->push_header(Cookie => "SESSIONID=?????; path=/;"); ------>
capture session id from browser



Best Regards,
Pavan

---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@...
For additional commands, e-mail: asp-help@...

#2255 From: Thanos Chatziathanassiou <tchatzi@...>
Date: Fri Mar 27, 2009 6:31 pm
Subject: Re: using memcached as a StateDB.. getting there
tchatzi@...
Send Email Send Email
 
O/H Gregory S. Youngblood έγριψξ:
> I, for one, am interested, though I haven't been able to do much or get
> involved.
>
> "Namespace" - I suggest making this an option that is user tunable, but pick
> a good default value that hopefully won't need to be tweaked all the time.
>
It would vaguely resemble ``StateDir''. Each separate StateDir signifies
a unique application.
Thus far, using StateDir in shmfs/tmpfs I'd use
/dev/shm/apache/website1 and /dev/shm/apache/website2 for two separate
applications. Something similar would apply to using a single memcached
for multiple applications, no ?
Of course, the default StateDir ``.state'' would mix things up a bit.
> "Lock/Unlock" - Each individual operation of memcached is atomic.. if two
> processes attempt to write to one location at the same time, they will be
> serialized and one will not corrupt the other. The problem is you don't
> necessarily know which one will actually win. This means you can't guarantee
> state if you don't do locking to ensure the right one wins.
Well, the original point of Lock and UnLock was to avoid corrupting the
on-disk files, but your point is valid..
> Consider an
> incrementing counter. Assuming you do a get to read the value, increment it
> by one, and then do a set to save it; each individual operation is safe
> (get, set), but not the combination (get+set). If two hit at the same time,
> the number would increment by 1 and not by 2 (one for each). I'd worry that
> making lock and unlock a no-op would create new problems, especially as site
> volume increases and chances of simultaneous updates increase.
>
Each user gets his own key (session-id in Apache::ASP) to write, apart
from the generic ``application''.
The case you're describing isn't handled in Apache::ASP already and it's
probably because the developer (end user in our case) should concern
himself with that.
But we can work on that one too if you feel so inclined.
> "No list of keys" - Usually I know what keys I'm stuffing into memcacheb and
> I don't need to walk through the keys, or if I do I have a place outside of
> memcache that has the keys to lookup. This one could get tricky. How would
> you keep the list of keys in a second entry intact, especially if two
> processes wanted to add a key at the same time?
>
According to perltie, tying hashes pretty much expects ``FIRSTKEY'' and
``NEXTKEY'' to work. But this is an inadequacy of Cache::Memcached::Tie
which we may or may not address.
I was (indirectly) asking Josh if these are actually needed for
Apache::ASP Sessions to work, seeing that they're defined in
Apache::ASP::Session but never actually called - not from within
Apache::ASP at least. But someone is bound to have used / wants to use
keys(%$Session) already..
> Other thoughts/suggestions:
>
> Having not looked at your code or design this may not be applicable, but
> consider making this generic, something that memcache or another cache
> engine could be plugged into. If you're interested, and my time permits, I'd
> be interested in working on part of this with you.
>
The thing is, Apache::ASP::State is too tightly bound to on-disk dbm
files and would require a major rewrite to facilitate other storage
engines. I suspect that's what held Josh from implementing
Apache::Session storage. Come to think of it, there already is an
Apache::Session::Memcached thing out there, so perhaps we should focus
on making Apache::ASP::State work with an Apache::Session and friends
back-end instead of hacking around.
I'd feel more comfortable if we had help from the original author of
Apache::ASP for this (or at least his blessing ;)
Let's think this through the weekend and decide on Monday.

Best Regards,
Thanos Chatziathanassiou



---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@...
For additional commands, e-mail: asp-help@...

#2254 From: "Gregory S. Youngblood" <greg@...>
Date: Fri Mar 27, 2009 4:52 pm
Subject: RE: using memcached as a StateDB.. getting there
greg@...
Send Email Send Email
 
I, for one, am interested, though I haven't been able to do much or get
involved.

"Namespace" - I suggest making this an option that is user tunable, but pick
a good default value that hopefully won't need to be tweaked all the time.

"Lock/Unlock" - Each individual operation of memcached is atomic.. if two
processes attempt to write to one location at the same time, they will be
serialized and one will not corrupt the other. The problem is you don't
necessarily know which one will actually win. This means you can't guarantee
state if you don't do locking to ensure the right one wins. Consider an
incrementing counter. Assuming you do a get to read the value, increment it
by one, and then do a set to save it; each individual operation is safe
(get, set), but not the combination (get+set). If two hit at the same time,
the number would increment by 1 and not by 2 (one for each). I'd worry that
making lock and unlock a no-op would create new problems, especially as site
volume increases and chances of simultaneous updates increase.

"No list of keys" - Usually I know what keys I'm stuffing into memcacheb and
I don't need to walk through the keys, or if I do I have a place outside of
memcache that has the keys to lookup. This one could get tricky. How would
you keep the list of keys in a second entry intact, especially if two
processes wanted to add a key at the same time?

Other thoughts/suggestions:

Having not looked at your code or design this may not be applicable, but
consider making this generic, something that memcache or another cache
engine could be plugged into. If you're interested, and my time permits, I'd
be interested in working on part of this with you.

Greg

> -----Original Message-----
> From: Thanos Chatziathanassiou [mailto:tchatzi@...]
> Sent: Thursday, March 26, 2009 5:33 AM
> Cc: 'asp@...'
> Subject: Re: using memcached as a StateDB.. getting there
>
> (ignoring the fact that no-one seems interested)
>
> I came accross Cache::Memcached::Tie which pretty much does most of the
> work, however I'm having some issues - actually design decisions:
> - I suppose StateDir should equal ``namespace'' in memcached parlance.
> Do we want to make this transparent to the end user or add a
> configuration option ?
> - memcached has no concept of Lock(), UnLock() and some stuff I haven't
> figured out yet. Add no-ops for these to Cache::Memcached::Tie or is
> there some more elegant way to bypass them inside Apache::ASP ?
> - It seems there's no obvious way to enumerate keys in memcached
> (FIRSTKEY  NEXTKEY). Perhaps keep a separate index of keys inside
> memcached and add methods that use those (?)
> - memcached needs a few extra configuration options. Most important is
> obviously ``servers'', but also ``compress_threshold'' and ``debug''
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: asp-unsubscribe@...
> For additional commands, e-mail: asp-help@...
>
>
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 8.0.238 / Virus Database: 270.11.26/2020 - Release Date:
> 03/25/09 07:16:00


---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@...
For additional commands, e-mail: asp-help@...

#2253 From: Thanos Chatziathanassiou <tchatzi@...>
Date: Thu Mar 26, 2009 12:33 pm
Subject: Re: using memcached as a StateDB.. getting there
tchatzi@...
Send Email Send Email
 
(ignoring the fact that no-one seems interested)

I came accross Cache::Memcached::Tie which pretty much does most of the
work, however I'm having some issues - actually design decisions:
- I suppose StateDir should equal ``namespace'' in memcached parlance.
Do we want to make this transparent to the end user or add a
configuration option ?
- memcached has no concept of Lock(), UnLock() and some stuff I haven't
figured out yet. Add no-ops for these to Cache::Memcached::Tie or is
there some more elegant way to bypass them inside Apache::ASP ?
- It seems there's no obvious way to enumerate keys in memcached
(FIRSTKEY  NEXTKEY). Perhaps keep a separate index of keys inside
memcached and add methods that use those (?)
- memcached needs a few extra configuration options. Most important is
obviously ``servers'', but also ``compress_threshold'' and ``debug''


---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@...
For additional commands, e-mail: asp-help@...

#2252 From: Thanos Chatziathanassiou <tchatzi@...>
Date: Fri Feb 20, 2009 2:04 pm
Subject: using memcached as a StateDB
tchatzi@...
Send Email Send Email
 
I'm toying with idea presently, but it would make for a great step up
from MLDBM and company.
And although Apache::ASP::State makes quite a few assumptions about the
StateDB being a file, I think I could add memcached as a back end
without making it way to ugly (interface via Cache::Memcached(::Fast),
of course).
It sure beats having StateDB on ramdisk with NFS for clusters....

What do you think ?


---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@...
For additional commands, e-mail: asp-help@...

#2251 From: Rock the Kazbah <momex2000@...>
Date: Tue Nov 25, 2008 5:31 pm
Subject: Content-Type header
momex2000@...
Send Email Send Email
 
Hi,

Back in June 2006, I asked about the content-type header as it relates to a form post from a mobile phone browser. The original message that I sent can be seen here: http://mail-archives.apache.org/mod_mbox/perl-asp/200606.mbox/%3CBAY113-F338CCAE926ACAC394078A3BF7A0@...%3E

In a nutshell, in most situations, the browser will send the content-type header as 'application/x-www-form-urlencoded' but some browsers under certain circumstances, add additional information at the end of the content-type header string. In particular, Firefox 3 is sending 'application/x-www-form-urlencoded; charset=UTF-8' when a POST request is initiated through AJAX. This causes the form elements being submitted in AJAX to be ignored.

I manually did a change on the Apache::ASP::Request module to correct this problem, changing the line

     if($headers_in->get('Content-Type') eq 'application/x-www-form-urlencoded')

to

    if($headers_in->get('Content-Type') =~ m|^application/x-www-form-urlencoded|) {

which solved the problem. However, as the change wasn't bundled into Apache::ASP back then, I'm wondering if there's something else I should be doing to solve this problem?

Thanks for any feedback.

.rw



Win a trip with your 3 best buddies. Enter today.

#2250 From: "Tsirkin Evgeny" <tsirkin@...>
Date: Sun Nov 16, 2008 9:04 pm
Subject: Re: Undefined subroutine error
tsirkin@...
Send Email Send Email
 
Well you probably already thought of this but:
It appears that the global.asa (and thus Example::Image.pm) get
compiled into different
packages then templates/masthead.tmpl.
Do you have UniquePackages 0 or 1 ?
Maybe this is caused by a template package you are using ,is this an
asp script or another one?
If the problem actually _ is _ the different packages then you can of
cause solve it with
PerlRequire / startup script or something like that.
Thanks
Evgeny

On Tue, Nov 11, 2008 at 3:01 AM, Roberto C. SĂĄnchez
<roberto@...> wrote:
> MP gurus,
>
> I recently deployed a site using Apache::ASP.  I am running up against
> a problem that has left me scratching my head.  The site works fine on
> the development server.  However, on the production server, my error_log
> fills with these messages:
>
> [Mon Nov 10 19:44:59 2008] [error] [asp] [7796] [error] Undefined subroutine
&Apache::ASP::Compiles::__ASP__srv_http_www_e_ample_com__x::get_image_data
called at /srv/http/www.example.com/templates/masthead.tmpl line 2. <--> ,
/usr/share/perl5/Apache/ASP.pm line 1521
>
> (I have attached the complete error log output, with debugging enabled,
> for a failed request to this email.)
>
> The odd thing is that it is apparently intermittent.  Sometimes, the
> error happens and a 500 error page is returned.  Other times, the page
> loads as expected.
>
> Both servers (development and production) are running Debian Etch with
> Apache 2.2.3, mod_perl 2.0.2, and Apache::ASP 2.59 (all stock versions
> shipped with Debian Etch).
>
> The code that is generating the error is this:
>
> <%
> my %img_data = get_image_data('masthead.png');
> %>
>
> My DocumentRoot is /srv/http/www.example.com and I have a directory
> called /srv/http/www.example.com/Example which has my Perl modules in
> it.  One of the modules is called Image.pm and it has a function called
> get_image_data().  In my global.asa I have "use Example::Image;".
>
> Something that also does not make sense to me is that if I change the
> document root to something like /srv/http/example or /srv/http/site,
> then the error appears to never happen.  I have tested this by using
> both alternate document roots for about two weeks each and it appears to
> not have a problem in either case.
>
> There are two very strange things about this whole situation.  On the
> (nearly) identically configured development server, I never get the
> above error.  I have another site (one that is actually in production,
> as opposed to the example site) that uses a similar scheme on the same
> production server and it does not have this problem.
>
> Regards,
>
> -Roberto
>
> --
> Roberto C. SĂĄnchez
> http://people.connexer.com/~roberto
> http://www.connexer.com
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (GNU/Linux)
>
> iD8DBQFJGNlw5SXWIKfIlGQRAp2tAJ4hc3UfDt0LszN/6UTrRSErMtmnhACgv2j8
> s4zfI5IlVrRykSFjU2X3gi0=
> =O++Q
> -----END PGP SIGNATURE-----
>
>

#2249 From: Roberto C. Sánchez <roberto@...>
Date: Wed Nov 12, 2008 9:28 pm
Subject: Re: Undefined subroutine error
roberto@...
Send Email Send Email
 
On Wed, Nov 12, 2008 at 09:18:21AM -0800, Skylos wrote:
> Apache::Asp caches subroutine compiles within processes.
>
> Kill all running apache processes to delete their cache.  (you don't
> strictly have to restart to do this (killing workers and letting apache
> restart them works too) but its easier)
>
> It works when it hits one that loaded the module version that has the
> method.
>
> It doesn't work when it hits one that loaded the module version that doesn't
> have the method.
>
> I restart apache obsessively when modifying and testing modules for exactly
> this reason.
>
> You can also ameliorate this problem by lowering the number of requests a
> process handles before restarting, at the expense of cache hits.
>
Thing is that this is happening to me on a production setup.  I am not
changing anything.  Even completely stopping Apache and starting it
fresh does not alleviate the problem.  Something really strange is that
when I serve the content from a DocumentRoot of /srv/http/example, I
*never* get the error.  However, when I use a DocumentRoot of
/srv/http/www.example.com, I do get the error from intermittently to
constantly.

Regards,

-Roberto

--
Roberto C. Sánchez
http://people.connexer.com/~roberto
http://www.connexer.com

#2248 From: Skylos <skylos@...>
Date: Wed Nov 12, 2008 5:18 pm
Subject: Re: Undefined subroutine error
skylos@...
Send Email Send Email
 
Apache::Asp caches subroutine compiles within processes.

Kill all running apache processes to delete their cache.  (you don't strictly have to restart to do this (killing workers and letting apache restart them works too) but its easier)

It works when it hits one that loaded the module version that has the method.

It doesn't work when it hits one that loaded the module version that doesn't have the method.

I restart apache obsessively when modifying and testing modules for exactly this reason.

You can also ameliorate this problem by lowering the number of requests a process handles before restarting, at the expense of cache hits.

Skylos


On Mon, Nov 10, 2008 at 5:01 PM, Roberto C. Sánchez <roberto@...> wrote:
MP gurus,

I recently deployed a site using Apache::ASP.  I am running up against
a problem that has left me scratching my head.  The site works fine on
the development server.  However, on the production server, my error_log
fills with these messages:

[Mon Nov 10 19:44:59 2008] [error] [asp] [7796] [error] Undefined subroutine &Apache::ASP::Compiles::__ASP__srv_http_www_e_ample_com__x::get_image_data called at /srv/http/www.example.com/templates/masthead.tmpl line 2. <--> , /usr/share/perl5/Apache/ASP.pm line 1521

(I have attached the complete error log output, with debugging enabled,
for a failed request to this email.)

The odd thing is that it is apparently intermittent.  Sometimes, the
error happens and a 500 error page is returned.  Other times, the page
loads as expected.

Both servers (development and production) are running Debian Etch with
Apache 2.2.3, mod_perl 2.0.2, and Apache::ASP 2.59 (all stock versions
shipped with Debian Etch).

The code that is generating the error is this:

<%
my %img_data = get_image_data('masthead.png');
%>

My DocumentRoot is /srv/http/www.example.com and I have a directory
called /srv/http/www.example.com/Example which has my Perl modules in
it.  One of the modules is called Image.pm and it has a function called
get_image_data().  In my global.asa I have "use Example::Image;".

Something that also does not make sense to me is that if I change the
document root to something like /srv/http/example or /srv/http/site,
then the error appears to never happen.  I have tested this by using
both alternate document roots for about two weeks each and it appears to
not have a problem in either case.

There are two very strange things about this whole situation.  On the
(nearly) identically configured development server, I never get the
above error.  I have another site (one that is actually in production,
as opposed to the example site) that uses a similar scheme on the same
production server and it does not have this problem.

Regards,

-Roberto

--
Roberto C. Sánchez
http://people.connexer.com/~roberto
http://www.connexer.com

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFJGNlw5SXWIKfIlGQRAp2tAJ4hc3UfDt0LszN/6UTrRSErMtmnhACgv2j8
s4zfI5IlVrRykSFjU2X3gi0=
=O++Q
-----END PGP SIGNATURE-----



#2247 From: Roberto C. Sánchez <roberto@...>
Date: Wed Nov 12, 2008 11:03 am
Subject: Re: Undefined subroutine error
roberto@...
Send Email Send Email
 
Warren Young wrote:

> Roberto C. Sánchez wrote:
> >
> > [Mon Nov 10 19:44:59 2008] [error] [asp] [7796] [error] Undefined subroutine
> &Apache::ASP::Compiles::__ASP__srv_http_www_e_ample_com__x::get_image_data
> called at /srv/http/www.example.com/templates/masthead.tmpl line 2. <--> ,
> /usr/share/perl5/Apache/ASP.pm line 1521
>
> Don't know if this will help, but try "rm -rf /tmp/asp". (Assuming
> you're using the default State DB setup.) Then restart Apache. If the
> state DB gets junk in it or application development causes old,
> incompatible versions of data structures to try to load, it can cause
> weirdness like this.

I am using this setting:

PerlSetVar NoState 1

So, I don't think your suggestion will help.

Regards,

-Roberto

--
Roberto C. Sánchez
http://people.connexer.com/~roberto
http://www.connexer.com

Messages 2247 - 2276 of 2277   Newest  |  < Newer  |  Older >  |  Oldest
Advanced
Add to My Yahoo!      XML What's This?

Copyright Š 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help