i need our help, currently i have program written in php3 and now my
provider dosn´t accept access to a sql database.
Can i port a php like program who use sql to a perl program without sql
access (alternate txt file store)
Hope anyone can help me!
best regards,
Harry
Not that I want to discourage you from using Perl, but....
Wouldn't it be easier to convert your existing PHP program to use text
files, instead of also changing programming languages?
Better yet, switch to a web host that will continue to provide you with SQL
database capabilities. Email me and I can recommend one that offers PHP,
Perl and MySQL, plenty of email and disk space, for just $8 a month -- I've
been using them for years.
> Can i port a php like program who use sql to a perl program
sure.
> without sql access (alternate txt file store)
sure. you could use straight text files with perl's built-in operators, or you
could use the DBI and SQL::Statement perl modules, although SQL::Statement
doesn't (yet) provide *all* the functionality of a real sql rdbms...
hth-
--
Michael Budash
Michael Budash Consulting
mbu...@sonic.net
: i need our help, currently i have program written in php3 and now my
: provider dosn´t accept access to a sql database.
: Can i port a php like program who use sql to a perl program without sql
: access (alternate txt file store)
Perl has a module called DBI that provides access to databases. Each
database has a DBD (driver). There are DBD's that allow you to use SQL
with flat files and other formats that do not require a database server,
such as XBase (i.e. DBase).
If those DBD drivers support your SQL then you could reuse your SQL. I do
not know how complex the SQL can be with these drivers. If you do basic
selects, updates, etc, then you should be ok. If you do complex joins etc
then they may not work. (I have not used those DBD modules much myself,
just enough to know they exist and work.)
As for transforming PHP into perl, one of the various template modules may
help you there. Some of them allow you to creates files that are similar
in style to php, and then its just a case of changing the php code into
perl, that doesn't look too hard, though I'm no php expert (at all!).
So, on CPAN, (www.CPAN.org ?) lookup the DBI/DBD modules, and also
template modules.
--
Want to access the command line of your CGI account? Need to debug your
installed CGI scripts? Transfer and edit files right from your browser?
What you need is "ispy.cgi" - visit http://nisoftware.com/ispy.cgi
Given that his web provider doesn't provide SQL capability, it is highly
doubtful they have DBI and/or DBD drivers installed.
>i need our help, currently i have program written in php3 and now my
>provider dosn´t accept access to a sql database.
Who wrote the program in the first place? Wouldn't it be easier to
switch providers?
>Can i port a php like program who use sql to a perl program without sql
>access (alternate txt file store)
Of course you can. You can port it to Cobol or Fortran for all I care.
But I doubt if it will be easy. Well...
What kind of program is it? If it needs to mainly read the database, not
update, it can be done, even with data running in the megabytes
(although I'd split the data over tens of files, for speed of access).
Since PHP is mainly a script embedded in a html-ish page, it'd be
easiest of your program structure remained more or less the same, i.e.
make use of a templating system, such as HTML::Template (available from
CPAN, <http://search.cpan.org/search?dist=HTML-Template>, see the docs
to see if you can make sense of it).
I think I've recently read that there would be a JIT compiler for it,
which could speed it up quite a bit.
<http://search.cpan.org/search?dist=HTML-Template-JIT>. Oh. I see that
it makes use of Inline::C. I bet you won't be able to use that, either.
There are alternatives. Most need mod_perl to really work well, such as
Mason. Urm... I've read an article comparing (some of the) available
templating modules on a perl related webite, somewhere. Let's see... I
think this is the one:
<http://www.perl.com/pub/a/2001/08/21/templating.html>
--
Bart.
> "Malcolm Dew-Jones" <yf...@vtn1.victoria.tc.ca> wrote in message
> news:3c1a...@news.victoria.tc.ca...
> > Harry (h...@totalmail.com) wrote:
> >
> > : i need our help, currently i have program written in php3 and now my
> > : provider dosn´t accept access to a sql database.
> >
> > Perl has a module called DBI that provides access to databases. Each
> > database has a DBD (driver). There are DBD's that allow you to use SQL
> > with flat files and other formats that do not require a database server,
> > such as XBase (i.e. DBase).
>
> Given that his web provider doesn't provide SQL capability, it is highly
> doubtful they have DBI and/or DBD drivers installed.
So he might need to ask for them or install them himself.
Hint:
perldoc -q lib
Jon
--
Two are better than one, because they have a good return for their
work: If one falls down, his friend can help him up... Though one
may be overpowered, two can defend themselves. A cord of three
strands is not quickly broken. -- Ecclesiastes 4:9,12 (NIV)
>> Given that his web provider doesn't provide SQL capability, it is highly
>> doubtful they have DBI and/or DBD drivers installed.
>
>So he might need to ask for them or install them himself.
It's highly unlikely that the ISP will accept them. You can't use DBI
without some form of SQL server -- except for emulation as with
DBD::Anydata. And then, I don't see the point in using that. If all is
in RAM anyway, why not use a plain perl grep() instead of an SQL
"SELECT"?
--
Bart.
How would you do an UPDATE? DBD::RAM or DBD::CSV are servicable
substitutes if you already have SQL or plan to move to a real database
server. Of course having Oracle would be better. :)