Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

The Community Poll

1 view
Skip to first unread message

Tobias Martinsson

unread,
Dec 7, 1999, 3:00:00 AM12/7/99
to
The Community Poll for PerlScript indicates that you want to see
scripts. What type of scripts would you specifically like to see?

--
Tobias


Sent via Deja.com http://www.deja.com/
Before you buy.

pko...@my-deja.com

unread,
Dec 9, 1999, 3:00:00 AM12/9/99
to
How about some ActiveX Data Object examples. From
simple to complex. ASP in a Nutshell has a great
chapter on this subject but, all of the examples
are in VBScript.

Pat

In article <82hpot$c4f$1...@nnrp1.deja.com>,

Tobias Martinsson

unread,
Dec 14, 1999, 3:00:00 AM12/14/99
to

> How about some ActiveX Data Object examples. From
> simple to complex. ASP in a Nutshell has a great
> chapter on this subject but, all of the examples
> are in VBScript.

Yes. Where would you like to start? :) It's quite a large topic - much
larger than what appears at first glance. I suppose that as most know,
there are in ADO 2.1 (current public version) two primary objects you
want to use: Connection and Recordset.

ADO is a frontend for _any_ type of data store. Not only databases, but
emailsystems and filesystems can be altered with it, too, provided that
a "data provider" is available. ADO is a wrapper around the OLE DB
layer, which is a set of COM interfaces for general access to any type
of data store. OLE DB, however, can only be accessed through C++, so
ADO is there to give a simple and stabile access for all other
languages - Perl/PerlScript included.

Every object that works with an external data store such as a database
will use the Connection object, either implicitly or explicitly. It is
common to instantiate a Connection object by hand and connect it to a
data-store that is being pointed to by a System DSN, for example.

$conn = $Server->CreateObject("ADODB.Connection");
$conn->Open("Nortwind");
$recordset = $conn->Execute("Products");

while(! $recordset->{EOF} ) {
$Response->Write( $recordset->Fields(0)->{Value} );
$recordset->Movenext();
}

$recordset->close();
$conn->close();

The above opens up a system DSN named "Northwind" and in the execute
call it gives the name of a table in the database, which is a valid
query that will return all records in that table. Then the recordset is
looped until the end of it (end of file=EOF). The movenext-method
simply moves to the next record in the recordset. Note that only one
field is printed, and it is the first field (index starts at 0). It is
perfectly valid to use the actual name of the field instead of an
integer-index.

Well, that's a simple starter for anyone unfamiliar with ADO.

By the way, there's a book for Perl and PerlScript on ASP 3 and ADO 2.5
coming shortly after the release of Windows 2000 next year. It puts
most of the weight on ADO 2.5, in detail (hundred thirty-forty
something pages, I guess), for Perl and PerlScript. I'll keep you all
posted.

Richard A. Lowe

unread,
Dec 21, 1999, 3:00:00 AM12/21/99
to
Frist, I'd love to see some ports of some well-known and handy VB and
JScript ASP ;)

Maybe if I post some stuff (or even attempt a translation or two
myself) that would get the ball rolling.

Second, just the opposite, I'd be interested in seeing the totally
unique abilities of Perlscript - what kind of funky stuff can it do???

R.

In article <834k99$e33$1...@nnrp1.deja.com>,

Tobias Martinsson

unread,
Dec 22, 1999, 3:00:00 AM12/22/99
to
Hi Richard,

> Frist, I'd love to see some ports of some well-known and handy VB and
> JScript ASP ;)

I admit that I once began porting a message forum application from
VBScript to PerlScript, and I noticed there were about 500 lines of code
that was not needed, so I got very turned off. Needless to say, porting
a lot of code is something that is time-consuming although you can try
the script converter at http://come.to/fastnet/ under the section
"Perl". I've not tried it, but it will probably save some time.

> Maybe if I post some stuff (or even attempt a translation or two
> myself) that would get the ball rolling.

See how the translations go, and if you need any help there, it's much
easier to assist since the code is then isolated. What type of scripts
do you feel needs to be ported to PerlScript?

> Second, just the opposite, I'd be interested in seeing the totally
> unique abilities of Perlscript - what kind of funky stuff can it do???

An overlook of all the modules available
(http://www.activestate.com/packages/) will give an idea of several
unique abilities that belongs to Perl and PerlScript, and that is doable
directly from the language itself. When installing ActivePerl from
http://www.activestate.com, you will when reading the documentation
(in your Perl/HTML/ directory) notice that a lot of modules are
included, and that is just the way Perl is structured and organized.
With modules you can draw graphics in the browser, graph statistic data,
manipulate graphics, send email, receive email, ftp, read newsgroups,
open remote webpages, parse XML, and build a web-browser. :) Also unique
is that you can write modules based on C-code, and use the modules from
Perl, thus many modules that you will see have been based on just that.
There are also interesting systems administration capabilities of Perl
and PerlScript that are useful for managing and monitoring systems. You
can read about the Win32::AdminMisc module at roth.net, for example.
There is Win32::Service included with ActivePerl, as well, for viewing
and managing Windows-services such as the IIS webserver. From the
language itself, you can also perform system-calls and capture the
output, regular expressions, filesystem handling, very in-depth
stringhandling, and as mentioned there is also an interface to the C
socket-library so that you can do socket programming - which is the
basis of all email, ftp, and nntp applications. The language itself
supports both a plain style of programming and an object-oriented
programming model. It is not as object-obsessed as VBScript since for
example the VBS filesystemobject, VBS regular expression object, and VBS
dictionary object are based on the success of Perl which has all that
built into the language as built-in funtions. Also worth mentioning, the
data types in Perl are very easy to deal with since there essentially
only is one data type, incidentally, what language built a similar
data-type named Variant? ;-)

Tobias

pko...@my-deja.com

unread,
Dec 23, 1999, 3:00:00 AM12/23/99
to
Tobias,

Thanks for the reply, and sorry I haven’t replied sooner. I’ve been
doing a lot of traveling lately.

I was interested in more complex examples (albeit I was vague on my
original post) for accessing data stored in a relational database, in
particular SQL Server or Access.

For example, I needed to filter a Recordset a few months back, so I
used the VBScript example in ASP in a Nutshell. I converted to
PerlScript, but it took me 5 hours to get it working.

Shortly thereafter, I need to break pages up logically, and someone
made a reference to a perlscripters.com article, which helped
immensely. Mostly due to the fact everything was written in
PerlScript. I had the whole thing working within an hour.

Some examples on some of the lesser used ADO Properties or Methods
would be helpful. For example, Recordset Properties: Bookmark,
MaxRecords, MarshalOptions, Recordset Methods: Addnew, Clone, GetRows,
NextRecordset, Requery, Resync, Update, UpdateBatch

I don’t see anybody using these in the newsgroups I participate in
which includes aspsqlserver7 which gets a lot of traffic. Are they
unnecessary or most people haven't taken the time to learn how to use
them?

Pat

0 new messages