[22467] in Perl-Users-Digest
Perl-Users Digest, Issue: 4688 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Mar 10 06:07:02 2003
Date: Mon, 10 Mar 2003 03:05:08 -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 Mon, 10 Mar 2003 Volume: 10 Number: 4688
Today's topics:
Re: a minor point about the distinction between arrays <goldbb2@earthlink.net>
Re: a minor point about the distinction between arrays <bik.mido@tiscalinet.it>
getting the FQDN (for anon ftp password) <s.patterson@freeuk.com>
Re: getting the FQDN (for anon ftp password) <abigail@abigail.nl>
Re: How to access proxy server for Perl Soap client (Sade Bhat Kalasabail)
Re: Lightweight CGI module? <pkent77tea@yahoo.com.tea>
Re: new Perl feature request: call into shared libs <nospam-abuse@ilyaz.org>
Re: new Perl feature request: call into shared libs (Bryan Castillo)
Perl - Printing - Excel Files <test@test.com>
Re: Perl Mysql uploading a image in a database. <simon.andrews@bbsrc.ac.uk>
Re: Perl Mysql uploading a image in a database. <simon.andrews@bbsrc.ac.uk>
Re: Problem with Term::ReadKey on RedHat <bigj@kamelfreund.de>
Re: Problem with Term::ReadKey on RedHat <bigj@kamelfreund.de>
Re: Problem with Term::ReadKey on RedHat <bigj@kamelfreund.de>
Re: question about "new" in a module <bigj@kamelfreund.de>
remove anything from string except two words (Pynex)
Re: remove anything from string except two words <krahnj@acm.org>
Re: system adds "?" to a file redirection <krahnj@acm.org>
Re: Using browser instead of Tk? <goldbb2@earthlink.net>
Re: using Perl to make an 'xml-like' XML <thens@nospam.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 09 Mar 2003 22:43:42 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: a minor point about the distinction between arrays and lists.
Message-Id: <3E6C09EE.FDC6F6CE@earthlink.net>
Michele Dondi wrote:
>
> Having read the relevant docs (including the faq), I think I have
> mostly understood the difference between arrays and lists. However I
> still have the feeling that there are some details that are plainly
> counter-intuitive.
>
> In particular I have an issue with subscribing the return value(s) of
> a function. Thus I can use e.g. '(split /$re/)[0]' to get the first
> element or '(reverse split /$re/)[0]' to get the last one without
> assigning to an intermediate array var.
>
> But how can I get, say, both the *1st* and the *last* entry?
Index from the end:
my ($first, $last) = (split /$re/)[0, -1];
> One obvious answer would be to just do it another way... granted! But
> IMHO there are situations in which using a slice would be elegant and
> conceptually clear.
List slices are indeed possible, as I've shown above.
> OTOH for *named* arrays I can use the $#array construct to access the
> last entry of (e.g.) @array. Now I seem to recollect that this syntax
> is taken from a shell lingo, but I can hardly imagine a situation in
> which one has to use (e.g.) $#a with @b or vice versa...
>
> Wouldn't it be nice if there were an automatic variable to be used
> exclusively as a subscript with the meaning of "subscript of last
> entry of *this* (possibly anonymous) array"?
You mean like -1? And, -2 for the subscript of the next-to-last entry,
etc?
> I read that Perl6 is expected to offer a much improved treatment of
> lists, but what I'd like to know is wether there's any serious reason
> why a feature like the one I'm hinting at could be incompatible with
> the current language semantic.
It's not incompatible -- it already exists!
Anyway, for more on slices and such, read perldoc perldata.
--
@1=a..c;$;=4;{push@2,map[$;--,@1[0,2,1]=@1
],2..$;x--$|;print"$1[0]=>$1[2]\n";--$;?@1
=@1[1,0,2]:(($;,@1)=@{pop@2||last});redo}
------------------------------
Date: Mon, 10 Mar 2003 09:17:48 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: a minor point about the distinction between arrays and lists.
Message-Id: <kfio6v4fv6umfos5fon9egk8jb30eliqug@4ax.com>
On Sun, 9 Mar 2003 07:56:35 -0600, tadmc@augustmail.com (Tad
McClellan) wrote:
>> Wouldn't it be nice if there were an automatic variable to be used
>> exclusively as a subscript with the meaning of "subscript of last
>> entry of *this* (possibly anonymous) array"?
>
>We already have it.
D'Oh!
Michele
--
>It's because the universe was programmed in C++.
No, no, it was programmed in Forth. See Genesis 1:12:
"And the earth brought Forth ..."
- Robert Israel on sci.math, thread "Why numbers?"
------------------------------
Date: 10 Mar 2003 01:42:57 GMT
From: Stephen Patterson <s.patterson@freeuk.com>
Subject: getting the FQDN (for anon ftp password)
Message-Id: <slrnb6nrc3.j9d.s.patterson@eccles.localdomain>
I'm trying to get my system's FQDN (hostname and domain name) on linux
to generate an email address to use as an anonymous FTP password. Now,
as this is in a module I'll be distributing, I don't want to depend on
resolv.conf or anything which some systems may be missing. So, any
suggestions?
--
Stephen Patterson http://www.lexx.uklinux.net http://patter.mine.nu
steve@SPAM.lexx.uklinux.net remove SPAM to reply
Linux Counter No: 142831 GPG Public key: 252B8B37
Last one down the pub's an MCSE
------------------------------
Date: 10 Mar 2003 06:57:32 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: getting the FQDN (for anon ftp password)
Message-Id: <slrnb6odqs.6oo.abigail@alexandra.abigail.nl>
Stephen Patterson (s.patterson@freeuk.com) wrote on MMMCDLXXVIII
September MCMXCIII in <URL:news:slrnb6nrc3.j9d.s.patterson@eccles.localdomain>:
}} I'm trying to get my system's FQDN (hostname and domain name) on linux
}} to generate an email address to use as an anonymous FTP password. Now,
}} as this is in a module I'll be distributing, I don't want to depend on
}} resolv.conf or anything which some systems may be missing. So, any
}} suggestions?
1) Net::FTP is distributed in the core.
2) Why don't you use 'anonymous@' as the password?
3) Domain names are human readable forms of IP addresses.
IP addresses are associated with interface cards, not hosts.
A card can have more than one IP address, and a system can
get more than one card. You cannot assume a system has one
FQDN - it often has more than one.
4) Email addresses are typically *NOT* of the form 'user@FQDN'.
Abigail
--
#!/opt/perl/bin/perl -w
$\ = $"; $; = $$; END {$: and print $:} $SIG {TERM} = sub {$ := $_}; kill 15 =>
fork and ($; == getppid and exit or wait) foreach qw /Just another Perl Hacker/
------------------------------
Date: 9 Mar 2003 18:52:54 -0800
From: sade_bhat@yahoo.com (Sade Bhat Kalasabail)
Subject: Re: How to access proxy server for Perl Soap client
Message-Id: <3a621d3c.0303091852.34b813f0@posting.google.com>
Thanks Chris,
It is working now.
Yes I put the \ in the user it didn't work.Then
I included the 8080 after the proxy server ip address and it started working.
Found that the 2 types which work.
in the Env{HTTP_proxy}="htttp://proxyuser:proxypass@myproxy.ip:8080";
works
and setting the HTTP_proxy_user & HTTP_proxy_pass as u suggested works.
I am very grateful for your help and appreciate it very much.
Regards
Sade
------------------------------
Date: Mon, 10 Mar 2003 02:20:05 GMT
From: pkent <pkent77tea@yahoo.com.tea>
Subject: Re: Lightweight CGI module?
Message-Id: <pkent77tea-CEDC0A.02141410032003@[10.1.1.10]>
In article <pan.2003.03.06.09.05.11.375765@aursand.no>,
"Tore Aursand" <tore@aursand.no> wrote:
> What's the status on lightweight CGI modules?
>
> The reason I'm asking, is that I'm working on a project where we've come
> to the part of tuning the application for best possible performance.
If you want the best performance then use a persistent perl environment.
The Apache mod_perl works great on Windows and *nix platforms, and there
are other similar systems such as FastCGI.
For IIS there's at least one persistent environemnt -
http://www.activestate.com/Products/PerlEx/ - and there's probably
others.
If you're using an out-of-process fork-and-exec-a-CGI-program model then
you're immediately imposing a massive overhead on yourself for every
single request, that of loading the perl interpreter binary. You're also
missing out on in-memory caching of commonly used binary objects,
database handles, etc etc.
P
--
pkent 77 at yahoo dot, er... what's the last bit, oh yes, com
Remove the tea to reply
------------------------------
Date: Sun, 9 Mar 2003 21:48:04 +0000 (UTC)
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: new Perl feature request: call into shared libs
Message-Id: <b4gcqk$1vgq$1@agate.berkeley.edu>
[A complimentary Cc of this posting was sent to
Bryan Castillo
<rook_5150@yahoo.com>], who wrote in article <1bff1830.0303081309.752facce@posting.google.com>:
> > non-portability of such a call. E.g., I do not know how to write i386
> > assembler which would call a C function with n long arguments; here n
> > is a variable number given as a parameter:
> >
> > void
> > call_many_longs(void (*f)(), long n, long *array_of_arguments)
> > {
> > __asm__("???");
> > }
>
> (This should work on Linux/i386 using gcc/gas? I only tried 0 to 6 32 bit args)
>
> _call_fptr:
> pushl %ebp /* save register */
> movl %esp, %ebp /* setup ebp for reference */
...
> movl 8(%ebp), %eax /* get the function pointer */
> call *%eax /* call the function */
>
> movl -4(%ebp), %ecx /* restore register */
Of course, if you know that a particular register is preserved during
the call, then there is the place to store the number of arguments so
it survives during the call, and one can adjust ESP accordingly. And
I see that even with -fomit-frame-pointer gcc is doing
popl %ebx
popl %esi
popl %edi
popl %ebp
ret
so it preserves 4 registers (including EBP you used). Is it a
universally accepted ABI on all x86-hosted OSes and all compilers? If
yes, then indeed this particular problem is not a problem.
Thanks,
Ilya
------------------------------
Date: 9 Mar 2003 16:29:01 -0800
From: rook_5150@yahoo.com (Bryan Castillo)
Subject: Re: new Perl feature request: call into shared libs
Message-Id: <1bff1830.0303091629.212a02b9@posting.google.com>
Guenter <no.spam@gknw.de> wrote in message news:<3E6B5A9A.6050506@gknw.de>...
> Hi Bryan,
> seems you're the right man for a new Unix::API module then; please take
> a look at the Win32::API module, I think that this could serve as base
> for it; if you replace the inline asm with yours, and find a way to load
> a .so, then it's learly done...!
> Guenter.
Loading a .so is easy, as is finding a symbol within it. You can see
the man pages for dlopen and dlsym. In fact the Dynaloader module has
this basic functionality. The asm I provided only works on Intel, you
would have to port that to SPARC, Alpha, Motorolla whatever other
architecture you have out there. It is also ~ AT&T syntax. Try
assembling it with some other assembler. I was going to write the XS
to interface to it (for fun), but I wouldn't call it a new Unix::API,
it would be much more specific than any Unix-like OS (Unix != Linux,
some even say Linux is not Unix). Perhaps Linux::I386::SOCall or
something....
Of course you would also have to pack the Perl data somehow. Are you
passing pointers, chars, whatever. (chars and shorts also seemed to
be pushed onto the stack in 32 bit chunks for gcc).
I was thinking you would have a function that takes a string like that
used by pack/unpack, a c-function name, a so-name or previously opened
handle, and a perl function name to be created. The function would
create the perl code to pack the perl values into the appropriate
binary formats, and call the c_function, (it should probably check
argument counts also).
Any ideas?
>
> Bryan Castillo schrieb:
> >>During the time of v5.000alpha, there was a discussion on p5p about
> >>adding a functionality of a call to a function with the simplest,
> >>cdecl, calling convention. Again, this was not implemented due to
> >>non-portability of such a call. E.g., I do not know how to write i386
> >>assembler which would call a C function with n long arguments; here n
> >>is a variable number given as a parameter:
> >>
> >> void
> >> call_many_longs(void (*f)(), long n, long *array_of_arguments)
> >> {
> >> __asm__("???");
> >> }
> >
> >
> > (This should work on Linux/i386 using gcc/gas? I only tried 0 to 6 32 bit args)
> >
> > _call_fptr:
> > pushl %ebp /* save register */
> > movl %esp, %ebp /* setup ebp for reference */
> >
> > pushl %ecx /* save register */
> > pushl %ebx /* save register */
> >
> > movl 16(%ebp), %ecx /* store count */
> > sall $2, %ecx /* multiply by 4 */
> > movl 12(%ebp), %ebx /* load array */
> > addl %ecx, %ebx /* set position to end of array */
> >
> > .lp1bg:
> > cmpl %ebx, 12(%ebp) /* at beginning of array ? */
> > je .lp1end /* end loop */
> > subl $4, %ebx /* decrement pointer */
> > pushl (%ebx) /* push argument onto stack */
> > jmp .lp1bg /* loop */
> > .lp1end:
> >
> > movl 8(%ebp), %eax /* get the function pointer */
> > call *%eax /* call the function */
> >
> > movl -4(%ebp), %ecx /* restore register */
> > movl -8(%ebp), %ebx /* restore register */
> > movl %ebp, %esp /* set SP to known position */
> > popl %ebp /* restore SP and ebp */
> >
> > ret /* done */
> >
> >
> >
> >
> >>But it is easy to write a wrapper which would work with e.g., n<20;
> >>both for cdecl, and for regparam(3) calling conventions. Actually,
> >>doing this for the OS2 port is in my TODO list. [Important since OS/2
> >>API more or less always takes a series of longs (or compatibles) as
> >>arguments.]
> >>
> >>Hope this helps,
> >>Ilya
> >
> >
------------------------------
Date: Mon, 10 Mar 2003 05:51:19 GMT
From: test <test@test.com>
Subject: Perl - Printing - Excel Files
Message-Id: <rJVaa.29329$6b3.120618@rwcrnsc51.ops.asp.att.net>
i have used Spreadsheet::WriteExcel to created excel spread sheets from
text files. one of the requirement is to print the created spreadsheet
on a post script printer.
question is instead on opening a file handle to write into can this file
handle be a PS printer?
just wondering if this can be done.
thanks
------------------------------
Date: Mon, 10 Mar 2003 10:49:09 +0000
From: Simon Andrews <simon.andrews@bbsrc.ac.uk>
Subject: Re: Perl Mysql uploading a image in a database.
Message-Id: <3E6C6DA5.9441262D@bbsrc.ac.uk>
niels wrote:
> my($reclame_image)=$query->param("reclame_image");
In newer versions of CGI.pm this should be..
my $reclame_image) = $query->upload("reclame_image");
..otherwise you can't run under "use strict" (which you are - aren't
you?!)
Have you set a POST_MAX limit within your CGI? Could some of your
images be larger than this?
You should apply binmode to your filehandle at this point.
binmode $reclame_image;
> my($afbeelding);
> {
> local $/=undef;
> $afbeelding=<$reclame_image>;
> }
> close $reclame_image;
>
> if($afbeelding)
> {
> $afbeelding=Quote_Chars($afbeelding);
> $afbeelding=Escape_Chars($afbeelding);
Go back to my earlier post in this thread an re-read the section from
perldoc DBI about quoting. You can't use quote methods on binary data
reliably. You MUST use placeholders to ensure your data isn't
corrupted. Sometimes your current approach will work, but not always!
> binmode($afbeelding);
As Martien pointed out, this is wrong. Binmode applies to filehandles
not ordinary scalars. If you binmoded $reclame_image earlier on, that's
all you need.
Simon.
------------------------------
Date: Mon, 10 Mar 2003 10:53:15 +0000
From: Simon Andrews <simon.andrews@bbsrc.ac.uk>
Subject: Re: Perl Mysql uploading a image in a database.
Message-Id: <3E6C6E9B.5F8A91D0@bbsrc.ac.uk>
Martien Verbruggen wrote:
>
> On 7 Mar 2003 niels <niels_bond@hotmail.com> wrote:
> > my($afbeelding);
> > {
> > local $/=undef;
>
> You need to open the image, and use binmode.
>
> > $afbeelding=<$reclame_image>;
>
> This, confusingly, does not read from the file, but will treat
> $reclame_image as a glob pattern (see the glob entry in perlfunc).
I don't think this is the case (I could be wrong!), $reclame_image comes
from a CGI upload field, so the param call returns a filehandle, which
can be read as set out above. He should of course be using the CGI.pm
upload method really, but param will still work (albeit not under
strictures).
Your code would be correct if the reclame_image field contained the path
to a locally stored image file, but I didn't think it did.
Simon.
------------------------------
Date: Mon, 10 Mar 2003 10:22:59 +0100
From: "Janek Schleicher" <bigj@kamelfreund.de>
Subject: Re: Problem with Term::ReadKey on RedHat
Message-Id: <pan.2003.03.10.09.06.22.238534@kamelfreund.de>
mrtn wrote at Sun, 09 Mar 2003 17:07:02 +0100:
> Thanks for response ;) , but it still doesn't work for me, here is what I
> actually want to achive:
>
> #!/usr/bin/perl -w
> use Term::ReadKey;
> sub test
> {
> ReadMode('cbreak');
> my $key="e";
> while($key ne "q")
> {
> if (defined($char = ReadKey(-1)))
> {
> $key=$char;
> print $key,"\n";
> }
> }
> ReadMode('normal');
> }
> test();
> [...]
This runs on my RedHat 8.0 box as you wanted.
Strange :-o
Cheerio,
Janek
------------------------------
Date: Mon, 10 Mar 2003 10:23:00 +0100
From: "Janek Schleicher" <bigj@kamelfreund.de>
Subject: Re: Problem with Term::ReadKey on RedHat
Message-Id: <pan.2003.03.10.09.06.42.169788@kamelfreund.de>
mrtn wrote at Sun, 09 Mar 2003 17:07:02 +0100:
> Thanks for response ;) , but it still doesn't work for me, here is what I
> actually want to achive:
>
> #!/usr/bin/perl -w
> use Term::ReadKey;
> sub test
> {
> ReadMode('cbreak');
> my $key="e";
> while($key ne "q")
> {
> if (defined($char = ReadKey(-1)))
> {
> $key=$char;
> print $key,"\n";
> }
> }
> ReadMode('normal');
> }
> test();
> [...]
This runs on my RedHat 8.0 box as you wanted.
Strange :-o
Cheerio,
Janek
------------------------------
Date: Mon, 10 Mar 2003 10:23:02 +0100
From: "Janek Schleicher" <bigj@kamelfreund.de>
Subject: Re: Problem with Term::ReadKey on RedHat
Message-Id: <pan.2003.03.10.09.05.56.697405@kamelfreund.de>
mrtn wrote at Sun, 09 Mar 2003 17:07:02 +0100:
> Thanks for response ;) , but it still doesn't work for me, here is what I
> actually want to achive:
>
> #!/usr/bin/perl -w
> use Term::ReadKey;
> sub test
> {
> ReadMode('cbreak');
> my $key="e";
> while($key ne "q")
> {
> if (defined($char = ReadKey(-1)))
> {
> $key=$char;
> print $key,"\n";
> }
> }
> ReadMode('normal');
> }
> test();
> [...]
This runs on my RedHat 8.0 box perfectly :-)
Cheerio,
Janek
------------------------------
Date: Mon, 10 Mar 2003 10:23:01 +0100
From: "Janek Schleicher" <bigj@kamelfreund.de>
Subject: Re: question about "new" in a module
Message-Id: <pan.2003.03.07.05.37.41.297571@kamelfreund.de>
Andrew Lee wrote at Fri, 07 Mar 2003 03:27:24 +0000:
> I am getting an error in the following code, I wonder if anyone can
> explain the error and tell me how to avoid it :
>
>
> package DT::AssetManager;
> use 5.006;
> use strict;
> use warnings;
> use DBConf;
> my $conf = DBConf::new("/PATH-TO-CONFIG/myconfig");
>
> # this works in a .pl file
> # more stuff snipped
>
> sub new {
> my $classname = shift;
>
>>>error : Subroutine new redefined at blib/lib/DT/AssetManager.pm line 22.
>
> It seems like I am fully qualifying 'new' for the module DBConf. Why is
> there a name clash?
>
> DBConf starts with :
>
> package DBConf;
> require Exporter;
>
> our @EXPORT = qw/new get_dbh getVars DB_Connect getMaxId getMaxRow/;
^^^
That's why.
The new function is exported from the DBConf module into the namespace of
every module that uses DBConf.
Just remove new from the export list and everything will work fine.
> ... other stuff
>
> sub new { .. etc, like above
>
>
> Thank you for any insight.
Best Wishes,
Janek
------------------------------
Date: 10 Mar 2003 01:55:26 -0800
From: pynex@gmx.de (Pynex)
Subject: remove anything from string except two words
Message-Id: <d57585e5.0303100155.6ee785bc@posting.google.com>
Hello everybody !
I've some strings,
$oldstring="this is an example, but i don't know how to do it"
&oldstring2="That is what i know"
Now i want to remove everything except "is" and "know" , so that i've
got a string :
$newstring="is know"
$newstring2="is know"
But all strings doesn't have the same length.
does anybody know how to do it ?
------------------------------
Date: Mon, 10 Mar 2003 10:29:13 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: remove anything from string except two words
Message-Id: <3E6C68E0.6DA0D9EE@acm.org>
Pynex wrote:
>
> I've some strings,
>
> $oldstring="this is an example, but i don't know how to do it"
> &oldstring2="That is what i know"
>
> Now i want to remove everything except "is" and "know" , so that i've
> got a string :
>
> $newstring="is know"
> $newstring2="is know"
>
> But all strings doesn't have the same length.
>
> does anybody know how to do it ?
$newstring = "is know" if $oldstring =~ /(?=is).*?(?=know)/;
Or:
( $newstring = $oldstring ) =~ s/.*?(is).*?(know).*/$1 $2/;
John
--
use Perl;
program
fulfillment
------------------------------
Date: Mon, 10 Mar 2003 09:41:52 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: system adds "?" to a file redirection
Message-Id: <3E6C5DC7.E8750ECD@acm.org>
"ruth.crossley" wrote:
>
> I am writing a scheduler using perl to work in a distributed environment.
> Each host will be required to run a server that will execute tasks return
> their sucess or failure. I have written pretty much most of the code to
> execute the tasks, but it seems the system() function is adding a "?" to the
> end of any file redirections. For example, if I ask it to run the command ls
> > /tmp/ls.txt the file /tmp/ls.txt? is created. Similarly if I ask it to run
> date > date.txt I get date.txt?
A question mark is how ls displays a nongraphic character. Use the -b
switch to ls to display the octal value of the character.
> I have attached the code for the server, and the test I run to recreate the
> problem. The tests can be run just using telnet.
>
> Name: listener.pl
> listener.pl Type: Perl Program (application/x-perl)
> Encoding: x-uuencode
Please copy and paste any code directly into your posting.
John
--
use Perl;
program
fulfillment
------------------------------
Date: Sun, 09 Mar 2003 22:37:22 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Using browser instead of Tk?
Message-Id: <3E6C0872.9B5C43F3@earthlink.net>
"d.borland" wrote:
>
> Hi all,
>
> I was wondering if there is a way to use perl to communicate with a
> web browser without having to run a web server?
Well, if you merely want to communicate *to* the web browser, you can
merely rely on writing html to a local file, and telling the web browser
(using the system() command) to read it.
Getting data *back* might be a bit of a problem, though. :)
To have data from an html form go to your perl program, there are two
ways (that I know of) to do it.
1/ Run a web server of some sort. It need not be a fully featured
web server; something as simple as HTTP::Daemon might do.
2/ Require that the web browser have PerlScript installed, and have
the submit button run some perl code. This perl code could be your
program itself, or could it use IO::Socket to connect to your actual
perl program.
> Basically i am looking to create a GUI front end to for a database
> like program and would rather not have to learn pTk for this. Thus
> the reason for wondering about using a web browser as an average
> browsers capabilities will be more than sufficent. As i am wanting to
> make this program as portable as possible this would also help, unless
> of course the user would need to have a web server running on their
> machine, as the script/program and browser would need to be able to
> pass data to and from each other while running (which would obviously
> not be so good).
You're thinking of a traditional web server, and the CGI interface --
obviously each access from the web page to the web server starts a new
program isntance -- however, you *could* make it so that any of those
CGI program instances use sockets or named pipes to communicate with
your original perl program.
> I am using a Win32 macinhe though would prefer any ideas to be
> no-platform independent. Though any help you can give is much
> appreciated.
In the English language, a double-negative becomes a positive; so,
you've just asked for platform-dependent (Win32 only) solution.
Somehow, I don't think that this is what you really want :)
Anyway... I think that HTTP::Daemon is likely the best avenue of attack.
--
@1=a..c;$;=4;{push@2,map[$;--,@1[0,2,1]=@1
],2..$;x--$|;print"$1[0]=>$1[2]\n";--$;?@1
=@1[1,0,2]:(($;,@1)=@{pop@2||last});redo}
------------------------------
Date: Mon, 10 Mar 2003 15:12:08 +0530
From: Thens <thens@nospam.com>
Subject: Re: using Perl to make an 'xml-like' XML
Message-Id: <20030310151208.52865a53.thens@nospam.com>
On Sat, 01 Mar 2003 02:22:31 -0500
Josh McCormack <joshmccormack@travelersdiary.com> wrote:
> I have a ton of files that are 'xml-like' that I need to parse through
> and insert into a database. Wanted to know if there's an easy way to
> heal these wounded files.
>
> Lots of lines of items that have start tags, ie -> <TYPE>SC 12G
> but no end tag.
>
> Some items have sets of tags are within a set of tags, ie->
> <BUSINESS-ADDRESS>
> <STREET1>250 Foo BLVD
> <STREET2>P O BOX 20
> <CITY>Bar
> <STATE>JI
> <ZIP>84356
> <PHONE>1043966200
> </BUSINESS-ADDRESS>
>
> And there are hunks of text that are on multiple lines.
>
> So I guess what I'd like to do is if there's no </ .... > before a
> < ... > make one that corresponds to the last < ... >, unless there's
> another < .... > with no text between (since those would encapsulate tag
> sets, like the one above.
>
> This just seems like something that lots of people have had to do, so I
> thought I'd ask if I'd be reinventing the wheel.
You are right. Config::General does this. Given a data file with xml
like tags it will return a hash with the tags as keys and the contents
in a nested hash.
use Config::General
Thanks,
Thens.
> Thanks!
>
> Josh
>
------------------------------
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 4688
***************************************