You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Michael Taylor <mi...@ec.gc.ca> on 2004/03/23 17:44:17 UTC

[mp2] migrating mp1 RequestRec::notes() to mp2

I am having problems trying to migrate some Perl code (that I didn't write) from
mod_perl 1 (and libapreq 1) to mod_perl 2 (and libapreq2).

I don't understand why I having problems with this simple code example.

package Example;

use strict;

use mod_perl;
use Apache2;
use Apache::RequestRec;
use Apache::Request;      # libapreq2

sub handler : method {
        my ($class, $r) = @_;
        my $apr = Apache::Request->new($r);

        $apr->notes( 'mm_secure' => 0 );
}

1;


The error is:
[Tue Mar 23 11:41:36 2004] [error] [client 127.0.0.1] Usage:
Apache::RequestRec::notes(obj, val=NULL) at /var/www/perl/Example.pm line 14.


-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: [mp2] migrating mp1 RequestRec::notes() to mp2

Posted by Stas Bekman <st...@stason.org>.
Geoffrey Young wrote:
> 
> Michael Taylor wrote:
> 
>>I am having problems trying to migrate some Perl code (that I didn't write) from
>>mod_perl 1 (and libapreq 1) to mod_perl 2 (and libapreq2).
>>
>>I don't understand why I having problems with this simple code example.
> 
> 
>>        $apr->notes( 'mm_secure' => 0 );
> 
> 
> looks like this syntax is only available via the compat layer.  so, you'll
> want to
> 
>   use Apache::compat;
> 
> in your script and keep things the way they are, or change the code to
> 
>   use APR::Table ();
>   ...
>   $apr->notes->set('mm_secure' => 0);

plus this is documented ;)
http://perl.apache.org/docs/2.0/user/porting/compat.html#C__r_E_gt_notes_

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: [mp2] migrating mp1 RequestRec::notes() to mp2

Posted by Geoffrey Young <ge...@modperlcookbook.org>.

Michael Taylor wrote:
> I am having problems trying to migrate some Perl code (that I didn't write) from
> mod_perl 1 (and libapreq 1) to mod_perl 2 (and libapreq2).
> 
> I don't understand why I having problems with this simple code example.

>         $apr->notes( 'mm_secure' => 0 );

looks like this syntax is only available via the compat layer.  so, you'll
want to

  use Apache::compat;

in your script and keep things the way they are, or change the code to

  use APR::Table ();
  ...
  $apr->notes->set('mm_secure' => 0);

HTH

--Geoff


-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html