Nope. I had the ; in the code, just didn't put it in the example here.
This is what the real code looks like:
[!
use DBI;
use DBD::mysql;
$connect_string = "DBI:mysql:topconlaser";
$Persistent::dbc = DBI->connect($connect_string, "*****", "*****");
use CGI;
# use cart_support;
!]
[-
use cart_support;
$cgi = new CGI();
$cart_id = $cgi->cookie('cart_id');
$items_deleted = "";
-]
Steve Wilder
Matrix Interactive, Inc.
http://www.matrixinteractive.net/
Desk: 248.814.8235
Cell: 248.894.3128
Fax : 248.814.8236
-----Original Message-----
From: Gerald Richter [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 08, 2001 2:51 PM
To: Steve Wilder; Embperl
Subject: Re: Scope of a an external package
Hi,
>
> I just upgraded Embperl to 1.3.0 from 1.2.9. With the previous version,
I
> was able to create an external package, and invoke the use command inside
a
> [! !] block. Then I could call a subroutine from within normal [- -] or
[+
> +] blocks.
>
> But, with 1.3.0, if I put the "use cart_support.pm" inside a [! !]
block,
> I getting errors like the following...
> Error in Perl code: Can't use global @_ in "my" at
> /usr/local/apache/lib/perl/cart_support.pm line 446.
>
Looks like you missing the semikolon after use. For whatever reason after
the use Perl want's the semikolon, while it isn't necessary for all other
statements. Try
[! use cart_support.pm ; !]
>
> I would rather not have to import/compile this package on every
invocation
> of the page, how can I get it back into the [! !] block?
>
Also is you would do it in a [- -] block, Perl itself compiles modules that
are included via use only once, so there is only a very small overhead for
perl to see if the module has already compiled. Anyway there is no need to
put it into a [- -] block.
Gerald
-------------------------------------------------------------
Gerald Richter ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting
Post: Tulpenstrasse 5 D-55276 Dienheim b. Mainz
E-Mail: [EMAIL PROTECTED] Voice: +49 6133 925131
WWW: http://www.ecos.de Fax: +49 6133 925152
-------------------------------------------------------------
BEGIN:VCARD
VERSION:2.1
N:Wilder;Steve
FN:Steve Wilder
ORG:Matrix Interactive, Inc.
TITLE:President
TEL;WORK;VOICE:(248) 814-8235
TEL;CELL;VOICE:(248) 894-3128
TEL;WORK;FAX:(248) 814-8236
EMAIL;PREF;INTERNET:[EMAIL PROTECTED]
REV:20010203T060545Z
END:VCARD
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]