http://qs321.pair.com?node_id=314598


in reply to DBD::CSV - how to install? (FTP only)

The posters above are correct, DBD::CSV requires Text::CSV_XS which needs to be compiled. If you can compile it on a machine of the same platform, you can then upload that.

Or, you can install DBD::AnyData instead. It does not require any XS modules and has a CSV mode that behaves identically to DBD::CSV (except for 1. speed and 2. ability to handle embedded newlines). You will need to install its prerequisites - AnyData (in addition to DBD::AnyData), DBD::File and SQL::Statement, all of which are also pure perl so can just be FTP'd onto the server.

  • Comment on Re: DBD::CSV - how to install? (FTP only)

Replies are listed 'Best First'.
Re: Re: DBD::CSV - how to install? (FTP only)
by lwicks (Friar) on Dec 14, 2003 at 10:40 UTC
    Many thanks for the replies, I shall have a shot with AnyData.

    Sadly never used it, so is anyone here able to help me through the process of installing via FTP and getting it working.?

    ---

    Kia Kaha, Kia Toa, Kia Manawanui!
    Be Strong, Be Brave, Be perservering!
      I've packed everything you'll need for DBD::AnyData (except DBI) into AnyData-Standalone It will allow you to install all of the pre-required modules (all maintained by me, BTW) with only FTP access. Here's the README for AnyData-Standalone:
      AnyData::Standalone -- install AnyData without make or compile
      
      WHAT IT IS (AND ISN'T)
      
       This package includes all of the files needed to install AnyData
       and DBD::AnyData.  It is *only* for extreme cases where you can't
       use CPAN or PPM or manual install (for example if you only have
       FTP access to a server or you are installing onto a PDA or other
       limited environment).  If you are using this package to avoid
       learning how to install modules, please don't do that.  Learn to
       install modules, it will really, really help you in the long run.
      
      HOW TO INSTALL
      
       Unpack this package in the desired location (or unpack it locally and
       then FTP the resulting MyLib directory to the final location).  In
       scripts that call the modules put this at the top:
      
           use lib 'path/MyLib';   # path = wherever you unpacked MyLib
      
       This package does not include DBI.  If you want to use DBD::AnyData,
       you'll need to install DBI separately.  DBI also has a Pure Perl
       version that can be installed without compile or make, see the DBI
       and DBI::PurePerl docs for further info.
      
      WHAT VERSIONS ARE INCLUDED
      
           AnyData        0.08
           DBD::AnyData   0.06
           DBD::File      0.22
           SQL::Statement 1.005
      
      =head1 DOCUMENTATION
       
       The documentation for each module is included with the module, use
       perldoc <module_name> or just read the pod section in a text viewer
       or look up the docs online at http://search.cpan.org/~jzucker/.
      
        Hi again,
        still struggling here, would appreciate it if someone could help me with the below code which fails.

        The below code fails on the line:
        $dbh->func( 'users', 'CSV', 'users.csv' 'ad_catalog');

        Cheers!

        -----------------

        #!/usr/bin/perl -w use strict; require 'html.pl'; use lib './MyLib'; use DBI; my $dbh = DBI->connect('dbi:AnyData(RaiseError=>1):'); $dbh->func( 'users', 'CSV', 'users.csv' 'ad_catalog'); my $sth = $dbh->prepare("SELECT surname FROM users"); $sth->execute(); while (my $row = $sth->fetch) { print "@$row\n"; } # define variables header(); print("<table width='90%'>"); print("<TR valign='top'><TD width='30%'>"); print ("Menu<BR>"); print ("====<BR>"); print ("<a href='create-user.cgi'>Create New User</a><BR>"); print ("Login User<BR>"); print ("User Admin<BR>"); print("</TD>"); print("<TD>"); print ("CREATE USER<BR>"); print ("==========<BR>"); print ("This is where the code to create new users will be place +d"); print ("<P>"); print ("USER VARIABLES<HR>"); my %user_data = qw( id blank first_name blank surname blank date_of_birth blank email blank password blank active blank last_login blank create_date blank earnings blank cash blank judoka_limit blank sensei_limit blank dojo_limit blank team_limit blank rank blank ); open (OUTFILE, ">./user_data/test_user"); while (($a, $b) = each(%user_data)){ print ("Key = $a and its value is $b<BR>"); print OUTFILE ("$a\n$b"); } close (OUTFILE); print ("<HR>USERS ON SYSTEM<HR>"); opendir(USERS, "./user_data"); while ( my $name = readdir(USERS)) { if ($name ne '.' and $name ne '..') { print ("<a href='./user_data/$name'>$n +ame</a><BR>"); } } closedir(USERS); print("</TR>"); print("</table>");
        Kia Kaha, Kia Toa, Kia Manawanui!
        Be Strong, Be Brave, Be perservering!
        FANTASTIC!!

        Sir, you are a scholar and a gentleman!

        ---
        Kia Kaha, Kia Toa, Kia Manawanui!
        Be Strong, Be Brave, Be perservering!

      For the installation:

      1. download the module from CPAN

      2. have a look at the included Makefile.PL for module dependencies (they are in the hashReference with the key PREREQ_PM in the form Modulename => version, and have a look if these prerequisites are installed. If no, start over with that module and so on. If yes, continue with the next step

      3. upload the module via FTP and unpack it to a temporary directory

      4. If you've got acces to a make, you can install the module to your own directory by calling

      perl Makefile.PL PREFIX=/path/to/your/private/modulelib make make test make install

      5. If you have to install more modules, set the environmentvariable PERL5LIB to your /path/to/your/private/modulelib, e.g. in bash: export PERL5LIB=/path/to/your/private/modulelib and start over with step 3.

      6. use your module-lib from your perl-scripts with use lib qw(/path/to/your/private/modulelib/) or the like (sometimes the StandardModule Findbin might also be interesting for you)

      If you don't have access to make, you could try to copy the files to your directories, but that will only work if they are pure perl-modules. If not, you could try to set up a system as similar as your webserver and compile it there, but it is very difficult to get a nearly identical environment; there you better look around for other (already installed) modules that can do the job of persistance, too (e.g. DB_File, Tie::File, ...) or rely on Data::Dumper for persistance. You could also rely to Storable with is a very fast and compact solution, but if this module is updated, it sometimes can't read the data from it's older version

      BTW: if you don't have shell access like telnet or ssh, you could also fire these commands by a cgi-script (or write it to a bash-script and execute it from your cgi. But better care for errors and failure or you will get troubles when using these modules

      Best regards,
      perl -e "s>>*F>e=>y)\*martinF)stronat)=>print,print v8.8.8.32.11.32"