[25662] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 7903 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Mar 22 03:06:31 2005

Date: Tue, 22 Mar 2005 00:05:11 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 22 Mar 2005     Volume: 10 Number: 7903

Today's topics:
    Re: == operator acts differently in perl 5.005_03 and 5 <nospam-abuse@ilyaz.org>
    Re: == operator acts differently in perl 5.005_03 and 5 <jurgenex@hotmail.com>
    Re: Bug: Hard link in perl 5.8.6 under Solaris 8? <jgibson@mail.arc.nasa.gov>
        LWP: Any Easy Way to Use Relative Links? <hal@thresholddigital.com>
    Re: LWP: Any Easy Way to Use Relative Links? <noreply@gunnar.cc>
    Re: LWP: Any Easy Way to Use Relative Links? <hal@thresholddigital.com>
    Re: LWP: Any Easy Way to Use Relative Links? (Jay Tilton)
    Re: LWP: Any Easy Way to Use Relative Links? <postmaster@castleamber.com>
    Re: LWP: Any Easy Way to Use Relative Links? <hal@thresholddigital.com>
    Re: LWP: Any Easy Way to Use Relative Links? <hal@thresholddigital.com>
        Need help converting unix text to windows text sking623@aol.com
        Need help getting start with a test cgi script. <chariya@verizon.not>
    Re: Need help getting start with a test cgi script. <postmaster@castleamber.com>
    Re: Perl Command line for this problem <someone@example.com>
    Re: Perl Command line for this problem <lv@aol.com>
    Re: Perl Command line for this problem <tadmc@augustmail.com>
    Re: Perl ODBC complex query example needed <see.sig@rochester.rr.com>
        quickist way to repopulate a html form (sking)
    Re: Random String Generator <tadmc@augustmail.com>
        test <chandrakant.m@in.bosch.com>
        XML::LibXSLT element tags stripped out <abrogaticus@gmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 22 Mar 2005 02:05:19 +0000 (UTC)
From:  Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: == operator acts differently in perl 5.005_03 and 5.8.2
Message-Id: <d1nugv$1l5o$1@agate.berkeley.edu>

[A complimentary Cc of this posting was sent to
Anno Siegel
<anno4000@lublin.zrz.tu-berlin.de>], who wrote in article <d1mh4a$2rq$1@mamenchi.zrz.TU-Berlin.DE>:
>     perl -e 'printf "%.24f %.24f\n", 2.2e-7, 0.22e-6'
> 
> prints
> 
> 0.000000219999999999999985 0.000000220000000000000011

Can you explain why this is not considered as a bug in CRTL?  Should
not string-to-double conversion return the closest "double-precision
number" to the real number represented by the input?  So the second
number should be returned in both cases?

Puzzled,
Ilya


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

Date: Tue, 22 Mar 2005 03:09:05 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: == operator acts differently in perl 5.005_03 and 5.8.2
Message-Id: <l%L%d.32112$hA3.24510@trnddc09>

Yahav wrote:
> Second, my current solution is to multiply each of the numbers by one,
> and then i get the same number...
> Maybe there's other (maybe better) ways of overtaking this..

Arrrrg, if you quoting Tad's hint for the FAQ, then why don't you actually 
read _and_follow_ it?
Obviously you must have missed the first class in Introduction to Computer 
Numerics, therefore here a summary:

    Thou shalt not compare floating point numbers for equality!

If you must then use an epsilon distance instead.

jue





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

Date: Mon, 21 Mar 2005 15:37:12 -0800
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: Bug: Hard link in perl 5.8.6 under Solaris 8?
Message-Id: <210320051537126678%jgibson@mail.arc.nasa.gov>

In article <1111440330.819776.83230@f14g2000cwb.googlegroups.com>,
daveo <dave_bloom@yahoo.com> wrote:

> I have an interesting problem.  I have a file and directory which exist
> on the same device but are pointed to by symlinks from another device.
> First the directory:
> 
> $ ls -l /var/opt/zip/Zantaz/spool
> lrwxrwxrwx   1 root     other         20 Mar 21 15:58
> /var/opt/zip/Zantaz/spool -> /spool0/Zantaz-spool
> 
> I'll do a df to show the device it's pointing to:
> 
> $ df /var/opt/zip/Zantaz/spool
> /spool0            (/dev/vx/dsk/dbdg/vol01):67653708 blocks  8456713
> files
> 
> Now for the file:
> 
> $ ls -l /var/opt/zip/Zmaster/spool/00/0000033070.0003883500
> -rw-------   1 zip      zip          412 Mar 18 20:27
> /var/opt/zip/Zmaster/spool/00/0000033070.0003883500
> 
> $ df /var/opt/zip/Zmaster/spool/00/0000033070.0003883500
> /spool0            (/dev/vx/dsk/dbdg/vol01):67653708 blocks  8456713
> files
> 
> OK. The Solaris link command works fine:
> 
> $ ln /var/opt/zip/Zmaster/spool/00/0000033070.0003883500 \
> /var/opt/zip/Zantaz/spool
> $
> $ ls -lL /var/opt/zip/Zantaz/spool
> total 2
> -rw-------   2 zip      zip          412 Mar 18 20:27
> 0000033070.0003883500
> 
> OK.  I've removed the file.  Now I'll try it with the following perl
> program:
> 
> $ cat /tmp/test
> link("/var/opt/zip/Zmaster/spool/00/0000033070.0003883500",
> "/var/opt/zip/Zantaz/spool"
> ) || die "$0: link failed: $!\n";
> 
> $ perl /tmp/test
> /tmp/test: link failed: Cross-device link
> 
> Any ideas what's going on here?  Is this a well known bug?

According to 'perldoc -f link', the link function wants two filenames.
The Unix ln command will accept a directory name as the second
argument, creating a file of the same base name as the first argument
in that directory. Try using a complete path name as the second
argument of the link function.

If the link is not within the same file system as the original file,
you may need to use the symlink function. Perhaps the Solaris ln
command is creating a symbolic link, even though you have not specified
the '-s' option (don't have access to Solaris system).


----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---


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

Date: Mon, 21 Mar 2005 23:14:44 -0500
From: Hal Vaughan <hal@thresholddigital.com>
Subject: LWP: Any Easy Way to Use Relative Links?
Message-Id: <X-udnf2X8ebgBqLfRVn-qA@comcast.com>

I'm exploring LWP and trying to write a program that will pull down some web
pages.  When I read one page, I use regular expressions to find the links
for other pages I want to download.  Sometimes the links are relative
(like /cgi/link.pl or subdir/newfile.html) instead of including a domain
name.  I don't see anything in the doc files about any consistency from one
connection to another.

Is there any module out there for keeping track of domains and handling
relative URLs?

I thought about writing a program to look for them, but it seems rather hard
to distinguish if a string is a domain name (I'd look for periods, but
can't be sure it'll include a .com, .gov, or anything else unless I check
all TLDs), and some URLs might not have a slash (if it's a domain name
only, or just a file in the same directory), so I can't think of a way to
be sure a string includes a domain and full path or is a relative URL
(other than trying to load it, and checking the error messag).

I would think there's a module or something to help handle this either by
tracking links used OR by easily determining if a link is absolute or
relative.

Thanks!

Hal


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

Date: Tue, 22 Mar 2005 05:24:30 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: LWP: Any Easy Way to Use Relative Links?
Message-Id: <3a9ldiF682lcnU1@individual.net>

Hal Vaughan wrote:
> I'm exploring LWP and trying to write a program that will pull down some web
> pages.  When I read one page, I use regular expressions to find the links
> for other pages I want to download.  Sometimes the links are relative
> (like /cgi/link.pl or subdir/newfile.html) instead of including a domain
> name.  I don't see anything in the doc files about any consistency from one
> connection to another.
> 
> Is there any module out there for keeping track of domains and handling
> relative URLs?

Maybe you are looking for URI::WithBase.

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


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

Date: Tue, 22 Mar 2005 00:30:18 -0500
From: Hal Vaughan <hal@thresholddigital.com>
Subject: Re: LWP: Any Easy Way to Use Relative Links?
Message-Id: <lpWdnQD3SI6uMKLfRVn-tA@comcast.com>

Gunnar Hjalmarsson wrote:

> Hal Vaughan wrote:
>> I'm exploring LWP and trying to write a program that will pull down some
>> web
>> pages.  When I read one page, I use regular expressions to find the links
>> for other pages I want to download.  Sometimes the links are relative
>> (like /cgi/link.pl or subdir/newfile.html) instead of including a domain
>> name.  I don't see anything in the doc files about any consistency from
>> one connection to another.
>> 
>> Is there any module out there for keeping track of domains and handling
>> relative URLs?
> 
> Maybe you are looking for URI::WithBase.
> 

Pretty close.  I didn't know about that, and your comment led me to it, and
from the docs on CPAN, that lead me to URI.  After experimenting with
URI::WithBase, I realized I can't always tell if a link is relative or not,
and URI::WithBase seems to expect you to know.  URI includes uri->scheme,
which will return http for an http connection, and nothing if it's
relative, which is a major help, and lets me detect if a URL is relative or
not.

Hal


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

Date: Tue, 22 Mar 2005 05:40:23 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: LWP: Any Easy Way to Use Relative Links?
Message-Id: <423fabc9.88793728@news.erols.com>

Hal Vaughan <hal@thresholddigital.com> wrote:

: I'm exploring LWP and trying to write a program that will pull down some web
: pages.  When I read one page, I use regular expressions to find the links
: for other pages I want to download.

Regex-parsing HTML?  Yuck.

: Sometimes the links are relative
: (like /cgi/link.pl or subdir/newfile.html) instead of including a domain
: name.  I don't see anything in the doc files about any consistency from one
: connection to another.
: 
: Is there any module out there for keeping track of domains and handling
: relative URLs?

HTML::LinkExtor is your one-stop answer.  It can snatch links from HTML
better than your regex can, and it can return all links in a
fully-qualified form if given a base URL.



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

Date: 22 Mar 2005 06:11:42 GMT
From: John Bokma <postmaster@castleamber.com>
Subject: Re: LWP: Any Easy Way to Use Relative Links?
Message-Id: <Xns96211FBB3894castleamber@130.133.1.4>

Hal Vaughan wrote:

> Pretty close.  I didn't know about that, and your comment led me to
> it, and from the docs on CPAN, that lead me to URI.  After
> experimenting with URI::WithBase, I realized I can't always tell if a
> link is relative or not, and URI::WithBase seems to expect you to
> know.  URI includes uri->scheme, which will return http for an http
> connection, and nothing if it's relative, which is a major help, and
> lets me detect if a URL is relative or not.

$uri = URI->new_abs( $str, $base_uri )
    
This constructs a new absolute URI object. The $str argument can denote a 
relative or absolute URI. If relative, then it will be absolutized using 
$base_uri as base. The $base_uri must be an absolute URI.

No need for fancy scheme detection.

And the base_uri you know, since you just fetched it :-D.

>perl -e "use URI; print URI->new_abs('../baz', 
'http://castleamber.com/foo/bar/')"
http://castleamber.com/foo/baz

>perl -e "use URI; print URI->new_abs('http://johnbokma.com/perl/', 
'http://castleamber.com/foo/bar/')"
http://johnbokma.com/perl/

-- 
John                   Small Perl scripts: http://johnbokma.com/perl/
               Perl programmer available:     http://castleamber.com/
            Happy Customers: http://castleamber.com/testimonials.html
                        


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

Date: Tue, 22 Mar 2005 02:37:56 -0500
From: Hal Vaughan <hal@thresholddigital.com>
Subject: Re: LWP: Any Easy Way to Use Relative Links?
Message-Id: <sY2dnSOYTOSGVqLfRVn-3A@comcast.com>

John Bokma wrote:

> Hal Vaughan wrote:
> 
>> Pretty close.  I didn't know about that, and your comment led me to
>> it, and from the docs on CPAN, that lead me to URI.  After
>> experimenting with URI::WithBase, I realized I can't always tell if a
>> link is relative or not, and URI::WithBase seems to expect you to
>> know.  URI includes uri->scheme, which will return http for an http
>> connection, and nothing if it's relative, which is a major help, and
>> lets me detect if a URL is relative or not.
> 
> $uri = URI->new_abs( $str, $base_uri )
>     
> This constructs a new absolute URI object. The $str argument can denote a
> relative or absolute URI. If relative, then it will be absolutized using
> $base_uri as base. The $base_uri must be an absolute URI.
> 
> No need for fancy scheme detection.

Great!  It works even better.  I must not have tested it properly, since I
missed it first time around.

Thanks!

Hal
 
> And the base_uri you know, since you just fetched it :-D.
> 
>>perl -e "use URI; print URI->new_abs('../baz',
> 'http://castleamber.com/foo/bar/')"
> http://castleamber.com/foo/baz
> 
>>perl -e "use URI; print URI->new_abs('http://johnbokma.com/perl/',
> 'http://castleamber.com/foo/bar/')"
> http://johnbokma.com/perl/
> 



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

Date: Tue, 22 Mar 2005 02:42:58 -0500
From: Hal Vaughan <hal@thresholddigital.com>
Subject: Re: LWP: Any Easy Way to Use Relative Links?
Message-Id: <sY2dnSKYTOTVUaLfRVn-3A@comcast.com>

Jay Tilton wrote:

> Hal Vaughan <hal@thresholddigital.com> wrote:
> 
> : I'm exploring LWP and trying to write a program that will pull down some
> : web
> : pages.  When I read one page, I use regular expressions to find the
> : links for other pages I want to download.
> 
> Regex-parsing HTML?  Yuck.
> 
> : Sometimes the links are relative
> : (like /cgi/link.pl or subdir/newfile.html) instead of including a domain
> : name.  I don't see anything in the doc files about any consistency from
> : one connection to another.
> : 
> : Is there any module out there for keeping track of domains and handling
> : relative URLs?
> 
> HTML::LinkExtor is your one-stop answer.  It can snatch links from HTML
> better than your regex can, and it can return all links in a
> fully-qualified form if given a base URL.

I had never seen that before.  I'll look into it.  For this project, though,
I scan each page for specific links with a specific phrase as the displayed
text part of the link.  Once I get that link, I pull out the url.  From
what I see in HTML::LinkExtor, I'd still have to do it close to what I do.

As of now, I do this:

$page =~ s/\n//g; #kill all cr's
(@links) = $page =~ /(<a href.*?<\/a>)/gi; #get all links

Then I page through each link and see if it includes the text part I want. 
With HTML::LinkExtor, I'd still have to loop through all the links.

It will be useful on the next project I'm doing, so thanks!

Hal


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

Date: 21 Mar 2005 23:35:54 -0800
From: sking623@aol.com
Subject: Need help converting unix text to windows text
Message-Id: <1111476954.093909.88340@z14g2000cwz.googlegroups.com>

I have been working on this for weeks.  Whatever my FTP client does to
translate the unix text file with each line ending in a LF character
back into a LF CR I need some code in Perl to this.

The task is, save data from an html form into a flatfile database.  I
have a Linux server. The program I have allows the user to search for a
text file (unix text) and download the file through their browser.  It
has to convert the little LF's to CRLF.  I have tried using some
people's suggestion on how to do this.  But it doesn't work yet.  Right
now it serves up the file because I have everything commented out! A
little messy, but the solution might be hiding in there! I just need to
know the right way to tweak it...

Any assistance is greatly appreciated.

Here's my code:

#!/usr/bin/perl
# This file is the one working
# This is called form the search page from option 1 in menu. You have
to login and search for a record.
# use a 1 to search for 1001.txt
use CGI ':standard';
use CGI::Carp qw(fatalsToBrowser);

my $file_location;
my $ID;
my @fileholder;

$subdirectory=param('subdirectory');
$ID = param('id');
$file_location = "../" . $subdirectory. "/" . $ID . "du.txt";
if ($ID eq '') {
print "Content-type: text/html\n\n";
print "You must specify a file to download.";
} else {
#open(FILE, "$file_location") || Error('open', 'file');
#binmode (FILE);   # will read file as is (binary) it need to send
images
#@data=<FILE>;
#close FILE;
#print "Content-type: text/html\n\n";
#print $file_location;
#print @data;
#exit;
open(DLFILE, "<$file_location") || Error('open', 'file');
binmode -f(DLFILE);
@fileholder = <DLFILE>;
close (DLFILE) || Error ('close', 'file');

#foreach $fileholder (@fileholder) {
#$fileholder =~ s|\012|\m\n|g;
#$fileholder =~ s|\012|$/|g;
#$fileholder = split(/\012/,$fileholder);
#}
#print "Content-type: text/html\n\n";
#foreach $fileholder (@fileholder) {
#print $fileholder;
#}
#exit;
open (LOG, ">>/home/mortga20/public_html/$subdirectory/log.txt") ||
Error('open', 'file');
print LOG "$ID\n";
close (LOG);

#print "Content-type:application/x-download\n"; #paste your type
#binmode STDOUT; # i not shure than need it
#print join(//, @data); # send client

print "Content-Type:application/x-download\n";
print "Content-Disposition:attachment;filename=$ID\n\n";
print @fileholder
}

sub Error {
      print "Content-type: text/html\n\n";
	print "The server can't $_[0] the $_[1]: $! \n";
	exit;
}



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

Date: Tue, 22 Mar 2005 05:26:26 GMT
From: "packat" <chariya@verizon.not>
Subject: Need help getting start with a test cgi script.
Message-Id: <60O%d.32161$hA3.763@trnddc09>

I installed Perl 6 and am running Apache 2.0.39 on Windows 
xp (home edition),

I am trying to get my first cgi script running.  First I put 
a simple try.cgi in the directory
C:\Program Files\Apache Group\Apache2\cgi-bin\try.cgi
Then activate a browser pointing to the address

http://localhost/cgi-bin/try.cgi

But I got path cannot be displayed.

The config file has the line ScriptAlias /cgi-bin/ 
"C:/perl/eg/cgi-bin/"


Can anyone help me find what was wrong?

Thanks very much,
packat




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

Date: 22 Mar 2005 06:12:21 GMT
From: John Bokma <postmaster@castleamber.com>
Subject: Re: Need help getting start with a test cgi script.
Message-Id: <Xns9621217D1B8Acastleamber@130.133.1.4>

packat wrote:

> I installed Perl 6

Are you sure about that one?

-- 
John                   Small Perl scripts: http://johnbokma.com/perl/
               Perl programmer available:     http://castleamber.com/
            Happy Customers: http://castleamber.com/testimonials.html
                        


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

Date: Tue, 22 Mar 2005 00:41:24 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: Perl Command line for this problem
Message-Id: <UQJ%d.63763$KI2.30293@clgrps12>

tweetiebirds@gmail.com wrote:
> 
> I am trying to use Perl command line for a bunch of sys admin tasks.
> 
> I would like to do this:
> ------------------------
> 
> Read output from a perl -V command and grep for lines containing words
> starting with /usr or many spaces followed by /usr
> 
> then search these lines (each line will be a directory starting with
> /usr or spaces and then /usr) for a filename (dogs.dat)
> 
> How can I do this efficiently with perl command line (perl -i -pi etc
> ).

This should get you started:

perl -MConfig -le'print "$_ = $Config{$_}" for grep $Config{$_} =~ 
/^\s*\/usr/, keys %Config'


John
-- 
use Perl;
program
fulfillment


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

Date: Mon, 21 Mar 2005 18:54:41 -0600
From: l v <lv@aol.com>
Subject: Re: Perl Command line for this problem
Message-Id: <423f6d84$1_1@127.0.0.1>

tweetiebirds@gmail.com wrote:
> Hi,
> 
> I am trying to use Perl command line for a bunch of sys admin tasks.
> 
> I would like to do this:
> ------------------------
> 
> Read output from a perl -V command and grep for lines containing words
> starting with /usr or many spaces followed by /usr
> 
> then search these lines (each line will be a directory starting with
> /usr or spaces and then /usr) for a filename (dogs.dat)
> 
> How can I do this efficiently with perl command line (perl -i -pi etc
> ).
> 
> Thanks,
> T
> 

for this specific problem I would do the following:
perl -le ' map {print if (-e "$_/dogs.dat") } @INC

The directories which Perl uses to find it's modules are stored within 
Perl's @INC array.

or you could do:
perl -V | perl -nle 'if (m#^\s+(/usr/.+)#) { print $1 if (-e 
"$1/dogs.dat") }'

Len

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----


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

Date: Mon, 21 Mar 2005 19:01:25 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Perl Command line for this problem
Message-Id: <slrnd3urj5.lf0.tadmc@magna.augustmail.com>

tweetiebirds@gmail.com <tweetiebirds@gmail.com> wrote:

> I am trying to use Perl command line for a bunch of sys admin tasks.
> 
> I would like to do this:
> ------------------------
> 
> Read output from a perl -V command and grep for lines containing words
> starting with /usr or many spaces followed by /usr
> then search these lines (each line will be a directory starting with
> /usr or spaces and then /usr) 


Not if we follow your specification above they won't be.

       libpth=/usr/local/lib /lib /usr/lib

has "words starting with /usr", so that line should match.


> for a filename (dogs.dat)
> 
> How can I do this efficiently 


I thought you wanted a one-liner?

Why is efficiency a criterion?


> with perl command line (perl -i -pi etc
> ).


   perl -V | perl -ne 'next unless m#^\s*/usr#; s#.*/##; print'


But I smell an XY-problem.

I doubt you need perl -V at all:

   perl -le 's#.*/##, print for grep m#^\s*/usr#, @INC'


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Tue, 22 Mar 2005 02:12:59 GMT
From: Bob Walton <see.sig@rochester.rr.com>
Subject: Re: Perl ODBC complex query example needed
Message-Id: <LaL%d.108154$H05.12032@twister.nyroc.rr.com>

samregen wrote:

> Hi,
> 
> I cannot find any examples of how to issue a multi-tabe query using
> perl ODBC methods.

Did you

    use DBI;

with DBD::ODBC?  If so:

    perldoc DBI

at a command prompt will give you wonderful documentation 
including lots of examples.  The "complex queries" you mention 
are all in SQL, which is outside the scope of this newsgroup -- a 
newsgroup about SQL would be better for that.

Hint:  It would be helpful if you would state what module you 
used to interface with your database so we don't have to guess, 
or just not know, like in my case.

I am guessing that you probably want to access an ODBC database 
on Windoze.  If so, you will need to create a user or system DSN 
as follows (maybe you already know that):

(for Windoze XP, others may differ):  Start..Control 
Panel..Administrative Tools..Data Sources (ODBC), then pick 
either the user or system DSN tab and add a DSN name for the 
database you want to connect to.  That name goes in the DBI 
connect method.

I don't know what method of accessing a database you were using 
below -- I don't recognize the code.  Using the DBI module is 
definitely *the* way to go.  The DBI code is independent of the 
database and the platform, so it will work the same if you decide 
you want to switch databases or OSes later, for example (some of 
the SQL might be slightly different, as SQL is not really very 
standard, at least if you use the more esoteric stuff, and, of 
course, the connection string will be different).

> 
> I am currently writing a perl script to issue queries generically, but
> I have no reference examples for queries against multiple tables.
> 
> Specifically, I am used to using the form shown below, where a spcific
> sql connection is in scope for the query.  My quer spans connections,
> so I am not sure how to approach this problem.

With DBI, it is no problem at all to have connections to multiple 
databases -- just establish as many connections to as many 
databases as you need.  However, to the best of my knowledge, a 
given SQL query is limited to a specific connection.  That is a 
function of SQL -- the establishment of a connection is outside 
the scope of SQL -- the connection is established before SQL 
starts up.  So I'm not sure what you mean when you say your 
"query spans connections".  Could you clarify, please?

> 
>  #Next we can issue the SQL statement and trap on warnings if it fails
>  if ($db{1}{connection}->Sql($passed_sql_statement)) {
>   my ($err) = $db{1}{connection}->Error;
>   warn "SQL() Error\n";
>   warn "\t\$passed_sql_statement: $passed_sql_statement\n";
>   warn "\t\$err: $err\n";
>   $db{1}{connection}->DumpData();
>   warn "\nThe problem SQL statment was: \n$passed_sql_statement\n";
>   warn "\n\n";
>  } else {
>   print STDERR "The statement \"$passed_sql_statement\" \nran
> successfully\n\n";
>  }
> 
> I have been digging in the bit mines for 5 hours looking for examples
> for this sort of query, but nothing out there shows the use of ODBC
> methods.
> 
> Thanks to anyone who can help.
> 
HTH.
-- 
Bob Walton
Email: http://bwalton.com/cgi-bin/emailbob.pl


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

Date: Tue, 22 Mar 2005 06:44:15 GMT
From: sking623_at_aol_dot_com@foo.com (sking)
Subject: quickist way to repopulate a html form
Message-Id: <39P%d.2118370$Zm5.338937@news.easynews.com>



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

I have a flatfile database.  | symbol is the delimiter. How does one read
this file and repopulate the fields in a html form with 325 fields?  

I can get it into a hash. But what after that?

Thanks.

Scot


##-----------------------------------------------##
Article posted with Web Developer's USENET Archive
http://www.1-script.com/forums
no-spam read and post WWW interface to your favorite newsgroup - 
comp.lang.perl.misc - 24119 messages and counting!
##-----------------------------------------------##


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

Date: Mon, 21 Mar 2005 18:45:03 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Random String Generator
Message-Id: <slrnd3uqkf.lf0.tadmc@magna.augustmail.com>

DMB <dummymb@hotmail.com> wrote:

> Good.  


What is good?


> We 


Do you have a mouse in your pocket?


> agree on something.


What thing is that?


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Tue, 22 Mar 2005 09:46:05 +0530
From: "Chandrakant" <chandrakant.m@in.bosch.com>
Subject: test
Message-Id: <d1o668$j7j$1@ns2.fe.internet.bosch.com>

test post
please ignore




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

Date: 21 Mar 2005 17:25:13 -0800
From: "Abro Gaticus" <abrogaticus@gmail.com>
Subject: XML::LibXSLT element tags stripped out
Message-Id: <1111454713.716983.189190@o13g2000cwo.googlegroups.com>

Being extremely new to XML::LibXSLT and XML/XSL in general I have what
I am assuming is a very newb question.

I found an old post (dated 2001) that showed where to find ppm packages
for libXSLT since I am trying this out using activestate on XP.

C:\> ppm
ppm> set repository RK http://theoryx5.uwinnipeg.ca/p=ADpmpackages/
ppm> set save
ppm> install XML::LibXML
ppm> install XML::LibXSLT

following these explicit instructions (much appreciated) I was able to
install the packages and begin scripting.  The ppm packages are great
as they even download the dll's that XML::LibXSLT depends on.

I created a simple XML file, a simple XSL file, and a simple perl
script that uses XML::LibXSLT to perform the transformation.
Everything seems to work correctly except that in the result document
none of the element tags are output, only their values.  <xls:output
method=3D"xml"/> is ignored.  I find this strange as I have read
documentation that 'xml' should be the default output method anyway.

Perhaps someone can suggest what I am doing incorrectly.  Code below:
Thanks in advance.

--------------------------------
test.xml:
<?xml version=3D"1.0" ?>

<entry>
	<major>
		pain in the grass
	</major>
	<stats>
		<a> 11 </a>
		<b> 21 </b>
		<c> 31 </c>
		<d> 41 </d>
		<e> 51 </e>
	</stats>
</entry>

-------------------------------
template.xsl
<xsl:stylesheet xmlns:xsl=3D"http://www.w3.org/1999/XSL/Transform"
version=3D"1.0">
<xsl:output method=3D"xml"/>

	<!-- first attempt -->
	<xsl:template match=3D"stats">
		<xsl:text> Stats: </xsl:text>
		<xsl:apply-templates/>
	</xsl:template>

</xsl:stylesheet>

---------------------------------
result.xml
<?xml version=3D"1.0"?>


		pain in the grass

	 Stats:
		 11
		 21
		 31
		 41
		 51

---------------------------
xslTest.pl
use strict;
use XML::LibXSLT;
use XML::LibXML;

my $parser =3D XML::LibXML->new();
my $xslt =3D XML::LibXSLT->new();

my $source =3D $parser->parse_file('test.xml');
my $style_doc =3D $parser->parse_file('template.xsl');

my $stylesheet =3D $xslt->parse_stylesheet($style_doc);

my $results =3D $stylesheet->transform($source);

$stylesheet->output_file($results,'result.xml');



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

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.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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 7903
***************************************


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