perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sally Li <sallyl...@yahoo.com>
Subject need help: use my own perl class (pachage or module) in embperl
Date Sun, 15 Sep 2002 17:42:57 GMT
I am a new user of embperl. I am writing a web-based
application using embperl. Since I have developed some
classes in perl it will be convenient to reuse them
for the application development. However, failed due
to my class. Here is a test. The structure is based on
the manual example in embperl. The class ConnectDB.pm
is placed in foo/ dir, same as base.htm.

Also, I set a path to this dir.

Could any one tell me where I should put ConnectDB.pm
(my class)? 

Thanks.

Sally


[!
 
 sub new
    {
    my $self = shift ; 

    # here we attach some data to the request object
    $self -> {fontsize} = 20 ;
    }

 # Here we give a default title
 sub title { 'Title not given' } ;


 !]


 [-
  
 # get the request object of the current request
 $req = shift ;


 # here we call the method new
 $req -> new ; 

 -]

 <html>
 
 <title>test [#+ $req -> title +#]</title>

 <head>
    [- $a = 5 -]  [- $b = 6 if ($a == 5) -]
    [+ $a +]  [+ $array[$b] +] [+ "A is $a" +]

 </head>
 <body>
[+ $req -> title +]

<p>begin of  testing perl class</p> 
[! use ConnectDB !] 
[-
  my $a=ConnectDB->new();
  my $b=$a->getConnected("database","usr","passwd");
  my $famID=$a->fetchFamilyID("something");
-]

<p> $famID [+$famID +]</p>



<p> end of testing  perl class</p>

 [- Execute ('head.htm') -]
 [- Execute ('*') -]
 [#- Execute ('foot.htm') -#]
 </body>
 </html>




__________________________________________________
Do you Yahoo!?
Yahoo! News - Today's headlines
http://news.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Mime
View raw message