[19828] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 2023 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Oct 27 18:05:44 2001

Date: Sat, 27 Oct 2001 15:05:13 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <1004220312-v10-i2023@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sat, 27 Oct 2001     Volume: 10 Number: 2023

Today's topics:
    Re: [NEWBIE] How to work with a FoxPro database with Pe <gellyfish@gellyfish.com>
    Re: DBI/CSV Q <jeff@vpservices.com>
        GGI param/regex difficulties <paullyb8@fnol.net>
    Re: Hello all. <gellyfish@gellyfish.com>
    Re: How to delete the last link <stuart@otenet.gr>
    Re: How to delete the last link <stuart@otenet.gr>
    Re: How to delete the last link <gellyfish@gellyfish.com>
    Re: How to delete the last link <jurgenex@hotmail.com>
    Re: How to delete the last link <gellyfish@gellyfish.com>
    Re: How to delete the last link <gellyfish@gellyfish.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 27 Oct 2001 17:17:04 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: [NEWBIE] How to work with a FoxPro database with Perl ?...
Message-Id: <9req6g$8t$4@neptunium.btinternet.com>

In comp.lang.perl.modules Keith Harrison <kharrison@icshq.com> wrote:
> Check out the book Programming the Perl DBI by Descartes & Bunce.
> 
>> Hello,
>> 
>> Does anyone over here know how (if it's possible) to work with FoxPro
>> databases with Perl ?... Every suggestion is welcome.
>> 

More specifically you should be able to use DBI and DBD::XBase to do this
unless the FoxPro database format has changed in recent years - this has
some restrictions with respect to indexes but otherwise it works fine.

/J\
-- 
Jonathan Stowe                      |
<http://www.gellyfish.com>          |      This space for rent
                                    |


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

Date: Sat, 27 Oct 2001 10:57:44 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: DBI/CSV Q
Message-Id: <3BDAF598.45DA0A4D@vpservices.com>

[Mike, don't mean to keep lecturing you on netiquette, but it usually
ain't polite to send a personal email as a response to a newsgroup
posting, and also there are other folks out there who could benefit from
the answers to your questions so post your replies here unless it's
actually a personal message]

> Michael Cook wrote in email:
> >

> Thanks for the reply! I should have clarified a bit more. I went
> so far as to replace the variable with a hard coded number & it fails.

Yeah, I noticed, but the other stuff was pretty glaring.

> I will clean up the other stuff you pointed out, thanks!
>  Here's the down & dirty:
>
> $dbpath = './db';
> $db = 'pipes';
> $dbh =
> DBI->connect("DBI:CSV:f_dir=$dbpath;csv_sep_char=:",,,{RaiseError=>1});
> $dbh->do( qq{
>             DELETE FROM $db
>              WHERE productnumber = '1004'
>            } );
>
> You see the 1004 is coded in, not dependent on the varaiable
> interpretation & it still fails to delete that row.

Ok, three comments: first, this is what you should have posted the first
time, a nice trimmed down example of the problem without all the other
stuff, second the RaiseError in your connection string is your main way
of finding problems (use DBI-trace only when you have eliminated
everything else), and third -- as I mentioned last time, this code is
fine, there are no problems with it.

So if your code is ok and DBI and DBD::CSV are ok (which we're pretty
darn sure they are), then what remains to be not ok is your data.  I
tried looking at your cat output of "pipes" but the line breaks made it
impossible to read so I can only guess at what the problem is -- could
be a matter of line endings, or a missing field separator somewhere. 
Does "SELECT * FROM $db WHERE productnumber = '1004'" work?  If not, I'd
suggest starting with a simpler file and do some testing and hard look
at your data file. If the select (on that same exact field) works but
the delete doesn't, then we need to turn to OS and version issues so if
that is the case, tell us your platform and versions of the various
involved software.

Good luck!

-- 
Jeff



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

Date: Sat, 27 Oct 2001 14:09:54 -0400
From: "Paul Bruno" <paullyb8@fnol.net>
Subject: GGI param/regex difficulties
Message-Id: <3bdaf9eb_1@news.starnetinc.com>

Hello,

I'm running a Perl script which uses the CGI.pm module on a Linux server.
My test development machine is a Win98 box here.  I'm taking info from a
<input type='text'> and <textarea> and inserting it into an XML db-like
file.  I use method='POST' to send it to my receiving script, which then, in
turn, splits on /\n\n/ for the <textarea> field to get the paragraphs and
puts these separate pieces of text into the XML file using XML::DOM.

However, when the script splits on 2 newlines, it doesn't find a delimiter,
and puts all the data into one array element.  However, when I changed my
pattern to /\n\s*\n/, it matched my test data fine.  But, because in my test
data in the <textarea> I only typed two newlines, and nothing else, to
separate the data, I'm not sure exactly why it is matching on latter pattern
above, and not the former.  I thought it _might_ be because the submitting
machine is my machine, a Win32, and the receiving machine is a Linux box:
Maybe the differences between the CR/LFs is throwing it off.  Honestly,
though, I don't think that is really what it is.

If anyone has any insight about this, your reply to this message would be
greatly appreciated.

Thank you all and God bless.

Paul B.




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

Date: 27 Oct 2001 15:09:05 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Hello all.
Message-Id: <9reimh$i9u$6@neptunium.btinternet.com>

Zecho <zecho@radicalmatter.com> wrote:
> Just thought I would introduce myself.  I stalked Dave Cross and he led
> me here (don't hold him responsible). 
> 

Oh believe me I will hold him responsible ;-} 

> As a relative newbie to perl, and having way too much time on my hands, I
> don't know _what_ I can do with my new skills.  I have read the llama a
> few times, and have participated in the perlmonks community for a number
> of months.
> 
> Any suggestions as to projects to enhance what I have gathered so far?  I
> really need the practice.
> 

I dont have any specific suggestions to make but I might make the suggestion
that you join a local Perl Mongers group - actually I am surprised that
Dave didnt suggest you join london.pm ;-}  Actually why *dont* you join
london.pm - check http://london.pm.org/join/  even if you are nowhere near
london there's always people on
the mailling list with some crack head scheme going on.

Another suggestion might be to look at sourceforge and see if there are 
any projects that might require a Perl programmer with your level of skill.

/J\
-- 
Jonathan Stowe                      |
<http://www.gellyfish.com>          |      This space for rent
                                    |


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

Date: Sat, 27 Oct 2001 19:28:57 +0300
From: "Stuart Gall" <stuart@otenet.gr>
Subject: Re: How to delete the last link
Message-Id: <9renpi$dsk$1@usenet.otenet.gr>

I guessed the problem might be that if page does not have an html extension
in which case

so $url =~ s|(^http://[^/]*).*|$1|

does it have to deal with the http:// possibly missing too?
--

Stuart Gall
------------------------------------------------
This message is not provable.
"Laocoon" <Laocoon@eudoramail.com> wrote in message
news:Xns91479B06AD1CCLaocooneudoramailcom@62.153.159.134...
> $url =~ s#/.+?html$##i;
>
> Hope this helps you..



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

Date: Sat, 27 Oct 2001 19:39:38 +0300
From: "Stuart Gall" <stuart@otenet.gr>
Subject: Re: How to delete the last link
Message-Id: <9reoae$e9c$1@usenet.otenet.gr>

or  $url =~ s|(^http://[^/]*).*|$1/|
if you want the /


--

Stuart Gall
------------------------------------------------
This message is not provable.
"Stuart Gall" <stuart@otenet.gr> wrote in message
news:9renpi$dsk$1@usenet.otenet.gr...
> I guessed the problem might be that if page does not have an html
extension
> in which case
>
> so $url =~ s|(^http://[^/]*).*|$1|
>
> does it have to deal with the http:// possibly missing too?
> --
>
> Stuart Gall
> ------------------------------------------------
> This message is not provable.
> "Laocoon" <Laocoon@eudoramail.com> wrote in message
> news:Xns91479B06AD1CCLaocooneudoramailcom@62.153.159.134...
> > $url =~ s#/.+?html$##i;
> >
> > Hope this helps you..
>



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

Date: 27 Oct 2001 16:52:36 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: How to delete the last link
Message-Id: <9reook$8t$3@neptunium.btinternet.com>

Pujo C A <adustipujo1@mediaone.net> wrote:
> 
> Does any body know how to do this?
> I want to delete the character from the last / occurence until html
> ex: http://www.yahoo.com/shopping.html
> I want to delete only shopping.html( I mean any number of word after the
> last /)
> I tried this one:
> $url =~s/\w{8}\.html//i;
> but this is too rigid, I want something more flexible.
> 

You might find that the module URI will make doing this easier as it
has methods to decompose the URI into its component parts.  However I
think that the regular expression you are looking for will be something like:

  $url =~ s%[^/]$%%;

note that I have replaced the usual regex separator with %s to avoid a bit
of ugliness although that is not essential.

/J\
-- 
Jonathan Stowe                      |
<http://www.gellyfish.com>          |      This space for rent
                                    |


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

Date: Sat, 27 Oct 2001 10:05:47 -0700
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: How to delete the last link
Message-Id: <3bdae971@news.microsoft.com>

"Pujo C A" <adustipujo1@mediaone.net> wrote in message
news:xKxC7.38340$bK.456205@typhoon.mw.mediaone.net...
> Does any body know how to do this?
> I want to delete the character from the last / occurence until html
> ex: http://www.yahoo.com/shopping.html
> I want to delete only shopping.html( I mean any number of word after the
> last /)

    File::Basename
should do the job quite nicely

jue




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

Date: 27 Oct 2001 17:51:30 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: How to delete the last link
Message-Id: <9res72$fg5$1@uranium.btinternet.com>

Jonathan Stowe <gellyfish@gellyfish.com> wrote:
> 
>   $url =~ s%[^/]$%%;
> 

Of course that should be:

   $url =~ s%[^/]*$%%;

/J\
-- 
Jonathan Stowe                      |
<http://www.gellyfish.com>          |      This space for rent
                                    |


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

Date: 27 Oct 2001 18:37:59 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: How to delete the last link
Message-Id: <9reuu7$jnr$1@plutonium.btinternet.com>

Jonathan Stowe <gellyfish@gellyfish.com> wrote:
> Pujo C A <adustipujo1@mediaone.net> wrote:
>> 
>> Does any body know how to do this?
>> I want to delete the character from the last / occurence until html
>> ex: http://www.yahoo.com/shopping.html
>> I want to delete only shopping.html( I mean any number of word after the
>> last /)
>> I tried this one:
>> $url =~s/\w{8}\.html//i;
>> but this is too rigid, I want something more flexible.
>> 
> 
> You might find that the module URI will make doing this easier as it
> has methods to decompose the URI into its component parts.
> 

The overkill method of doing this with URI might be like :

#!/usr/bin/perl -w


use strict;

use URI;
use File::Basename;

my $uri = URI->new('http://some.server.com/some/path/to/file.html');

my ($file, $path, $suffix ) = fileparse($uri->path());

$uri->path($path);

print $uri->as_string();


/J\
-- 
Jonathan Stowe                      |
<http://www.gellyfish.com>          |      This space for rent
                                    |


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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 2023
***************************************


home help back first fref pref prev next nref lref last post