[23273] in Perl-Users-Digest
Perl-Users Digest, Issue: 5493 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Sep 12 11:05:38 2003
Date: Fri, 12 Sep 2003 08:05:06 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 12 Sep 2003 Volume: 10 Number: 5493
Today's topics:
Re: Converting DBM to other DB file type <archi3@archiventure.net>
DBI problem : How can I load quickly one huge table wit <texier@ebi.ac.uk>
Re: DBI problem : How can I load quickly one huge table <thaynes@openlinksw.com>
Re: DBI problem : How can I load quickly one huge table <kurzhalsflasche@yahoo.co.uk>
Re: Direct experience of text manipulation in Perl/TCL? (Helgi Briem)
How to ignore "Callback called exit" <daniel.rawson.take!this!out!@asml.nl>
Re: How to ignore "Callback called exit" <kurzhalsflasche@yahoo.co.uk>
index, find regex <Ben_Dover@pickupsoap.forme.com>
Re: index, find regex <matt@userve.net>
Re: index, find regex <matt@userve.net>
Re: index, find regex <Ben_Dover@pickupsoap.forme.com>
Re: index, find regex <tore@aursand.no>
Re: index, find regex <twhu@lucent.com>
Re: index, find regex <kuujinbo@hotmail.com>
Re: index, find regex <Ben_Dover@pickupsoap.forme.com>
Modify Apache http headers from perl? <REMOVEXtwoheadsX@tiscaliX.co.uk>
Re: Newsgroup post test... <Ben_Dover@pickupsoap.forme.com>
Re: not able to access a URL with LWP::UserAgent. <danglesocket@no_spam>
Re: Redirecting via LWP <someone@somewhere.com>
Re: splitting an array (Anno Siegel)
Re: Splitting and keeping the delimiter <mr@sandman.net>
Re: <bwalton@rochester.rr.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 12 Sep 2003 09:44:08 -0400
From: "Archi3" <archi3@archiventure.net>
Subject: Re: Converting DBM to other DB file type
Message-Id: <3f61f6ec@news.greennet.net>
Jim,
I have the account file (account.dbm) from an older program I use...can I
just manipulate that file?
My background..VB6 programmer with little knowledge of PERL, CGI, Linux..etc
etc
I was hoping I could take the files and DTS them into a SQL db or something
to that effect
Is there a program I can open the file in, that is windows based?
Thanks,
Archi3
> > I have an older program which stores information in a dbm file...is
> > there a way to convert this file into something Windows based or
> > that can data transferred into SQL?
> >
> > I appreciate any help.
>
> As you get each record from the dbm file, you can then insert the
> record into your new database using DBI. Or, you can loop through
> each dbm record and write it to a CSV file - then, using your database
> client, you can insert the records into your database (because _most_
> databases will allow you to update/insert/etc. records from a CSV
> file).
>
> Since you have given little information about what your doing (code,
> database your going to use, what you have tried so far), this is all I
> can offer.
>
> HTH
>
> --
> Jim
>
> Copyright notice: all code written by the author in this post is
> released under the GPL. http://www.gnu.org/licenses/gpl.txt
> for more information.
>
> a fortune quote ...
> For perfect happiness, remember two things: (1) Be content with
> what you've got. (2) Be sure you've got plenty.
------------------------------
Date: Fri, 12 Sep 2003 13:23:35 +0100
From: Vincent Le-Texier <texier@ebi.ac.uk>
Subject: DBI problem : How can I load quickly one huge table with DBI ??.
Message-Id: <bjsds7$8t3$2@niobium.hgmp.mrc.ac.uk>
Hi all,
I'm using DBI from perl to load Oracle databse (dbi:Oracle).
my program works but very slow.
The fact is :
If the query is :
my $str_trans = "INSERT INTO transcript (id,embl_acc) VALUES (?,?)";
my $s_trans = $dbh->prepare($str_trans);
Foreach entries I want to load into the transcript table , I do :
$s_trans->bind_param(1,$id);
$s_trans->bind_param(2,$embl_acc);
and $s_trans->execute;
that means, for each entry I've executed the statement $str_trans.
THIS IS VERY SLOW (if you have for example 1 million entries to load).
I would like to known, if there are objects and methods with perl DBI
to load by block of statements (execute one statement every 3000 entries
for example) instead of each entry.
Others ideas are also welcome.
Thanks for your advices,
Vincent.
------------------------------
Date: Fri, 12 Sep 2003 12:49:39 +0100
From: Tim Haynes <thaynes@openlinksw.com>
Subject: Re: DBI problem : How can I load quickly one huge table with DBI ??.
Message-Id: <87d6e6mdkc.fsf@purple.uknet.private>
Vincent Le-Texier <texier@ebi.ac.uk> writes:
> If the query is :
>
> my $str_trans = "INSERT INTO transcript (id,embl_acc) VALUES (?,?)";
> my $s_trans = $dbh->prepare($str_trans);
>
> Foreach entries I want to load into the transcript table , I do :
> $s_trans->bind_param(1,$id);
> $s_trans->bind_param(2,$embl_acc);
>
> and $s_trans->execute;
OK. At least you're not preparing it as well as executing it every time :)
> I would like to known, if there are objects and methods with perl DBI to
> load by block of statements (execute one statement every 3000 entries for
> example) instead of each entry.
Two thoughts:
a) do you have any indexes or primary keys on the table while you're
inserting all this stuff? You don't want the hold-up of maintaining the
index every time, so only create such things after all the data's in place;
b) sure you can batch things up, with transactions. Turn off auto_commit
behaviour e.g. like:
| $dbh=DBI->connect("dbi:[stuff]", "", "", {AutoCommit => 0})
and then in your main loop, maintain a counter of number of rows and every
few hundred, do a commit. Fill in the blanks in the following:
| $rowcount=0;
| $sth=$dbh->prepare (some_insert_statement);
|
| while (looping_over_input_values) {
| $rc=$sth->bind_param(1, something);
| $rc=$sth->bind_param(2, somethingelse);
| $rc=$sth->execute;
|
| if(!($rowcount%100)) {
| $handle->commit;
| }
| $rowcount++;
| }
| $handle->commit; # don't forget this after they're all in
HTH,
~Tim
--
Product Development Consultant
OpenLink Software
Tel: +44 (0) 20 8681 7701
Web: <http://www.openlinksw.com>
Universal Data Access & Data Integration Technology Providers
------------------------------
Date: Fri, 12 Sep 2003 16:03:44 +0200
From: Dominik Seelow <kurzhalsflasche@yahoo.co.uk>
Subject: Re: DBI problem : How can I load quickly one huge table with DBI ??.
Message-Id: <bjsjld$lot90$1@uni-berlin.de>
Vincent Le-Texier wrote:
Hello Vincent,
> Hi all,
>
> I'm using DBI from perl to load Oracle databse (dbi:Oracle).
>
> my program works but very slow.
>
> The fact is :
>
> If the query is :
>
> my $str_trans = "INSERT INTO transcript (id,embl_acc) VALUES (?,?)";
> my $s_trans = $dbh->prepare($str_trans);
>
> Foreach entries I want to load into the transcript table , I do :
> $s_trans->bind_param(1,$id);
> $s_trans->bind_param(2,$embl_acc);
>
you don't have do to that.
$s_trans->execute ($id,$embl_acc)
works as well.
> and $s_trans->execute;
>
>
> that means, for each entry I've executed the statement $str_trans.
>
> THIS IS VERY SLOW (if you have for example 1 million entries to load).
>
>
> I would like to known, if there are objects and methods with perl DBI
> to load by block of statements (execute one statement every 3000 entries
> for example) instead of each entry.
You should set
$dbi->{AutoCommit} = 0;
so that statements are only committed if you explicitly do this. Of
course, you'll have to add a
$dbi->commit()
then, either at the end of your code (which is probably not a good idea
for 1 million entries) or you commit every 10,000 rows or so.
However, I once wrote the whole NCBI Unigene data (including accession
numbers) into two tables and, surprisingly, it was actually quite fast.
>
> Others ideas are also welcome.
I think, SQL Loader might be faster than Perl. But I never used it. :-)
>
> Thanks for your advices,
>
> Vincent.
>
Cheers,
Dominik
------------------------------
Date: Fri, 12 Sep 2003 11:57:07 GMT
From: f_baggins80@hotmail.com (Helgi Briem)
Subject: Re: Direct experience of text manipulation in Perl/TCL?
Message-Id: <3f61b468.591143930@News.CIS.DFN.DE>
On 11 Sep 2003 15:06:57 GMT, Abigail <abigail@abigail.nl> wrote:
>Processing text in Perl is a pain. It lacks decent parsing tools
>(yeah, there's perl6 vaporware...), all it has is a slightly beefed
>up sed. Man, I could tell you about the times I couldn't do
>something simple in Perl, and had to use a gazillion badly
>documented, buggy modules to get it done.
>
>Abigail
You're an evil, evil person, Abigail.
------------------------------
Date: Fri, 12 Sep 2003 10:34:02 -0400
From: Dan Rawson <daniel.rawson.take!this!out!@asml.nl>
Subject: How to ignore "Callback called exit"
Message-Id: <bjslgs$mr9ic$1@ID-122008.news.uni-berlin.de>
I'd like to be able to ignore the "Callback called exit" warning (since I'm doing it on purpose <g>); how can I do it??
On a more general note, is there a mechanism (other than reading the source code) to determine what warnings categories
are actually available??
TIA . . . .
Dan
------------------------------
Date: Fri, 12 Sep 2003 16:55:55 +0200
From: Dominik Seelow <kurzhalsflasche@yahoo.co.uk>
Subject: Re: How to ignore "Callback called exit"
Message-Id: <bjsmn8$mu9kg$1@uni-berlin.de>
Hello Dan,
> I'd like to be able to ignore the "Callback called exit" warning (since I'm doing it on purpose <g>); how can I do it??
That's presumeably not a warning but a fatal error?! They can be
trapped, but as the reason lies probably somewhere within your code, you
should rather try to fix the error.
>
> On a more general note, is there a mechanism (other than reading the source code) to determine what warnings categories
> are actually available??
You can set warnings and die messages at run-time. So you won't be able
to find out the message's text in advance:
for my $n (0..20){
warn ("I don't like this number $n\n") if rand($n)>10;
}
Or do you mean this:
form 'perldiag':
These messages are classified as follows (listed in increasing order of
desperation):
(W) A warning (optional).
(D) A deprecation (optional).
(S) A severe warning (default).
(F) A fatal error (trappable).
(P) An internal error you should never see (trappable).
(X) A very fatal error (nontrappable).
(A) An alien error message (not generated by Perl).
The majority of messages from the first three classifications above (W,
D & S) can be controlled using the warnings pragma.
HTH,
Dominik
------------------------------
Date: Fri, 12 Sep 2003 08:39:36 -0400
From: Ben Dover <Ben_Dover@pickupsoap.forme.com>
Subject: index, find regex
Message-Id: <3F61BE88.2794624F@pickupsoap.forme.com>
i have some .jpg files created by a digital camera (nikon 5700).
the camera imbeds time and date in the binary.
viewing the binary file, i can see the numeric dates
"2003:09:10 21:55:01"
that number is the date/time.
i was able to do a regex to find it:
/\d\d\d\d:\d\d:\d\d \d\d:\d\d:\d\d/
but then I had trouble finding it's position with index. it returns a
"-1" on every occurance.
here's the code:
#!/usr/bin/perl
# variables
$picFile='DSCN0155.JPG';
open (READ, $picFile);
while ($line=<READ>){
if ($line=~ /\d\d\d\d:\d\d:\d\d \d\d:\d\d:\d\d/) {
$indexA=index ($line, "\d\d\d\d:\d\d:\d\d \d\d:\d\d:\d\d");
$substrA=substr($line,$indexA,400);
print $indexA;
}
}
close (READ);
------------------------------
Date: Fri, 12 Sep 2003 14:13:41 +0100
From: "Matt Churchyard" <matt@userve.net>
Subject: Re: index, find regex
Message-Id: <3f61bd85@news.userve.net>
if you just want to read the date you can put the regex in brackets
and the date will be stored in $1 -
$line =~ /(\d\d\d\d:\d\d:\d\d \d\d:\d\d:\d\d)/;
print $1;
# --- or ----
($date) = $line =~ /(\d\d\d\d:\d\d:\d\d \d\d:\d\d:\d\d)/;
print $date;
if you need the position, add 'g' to the end of regex and use the pos
function
(the pos function returns where the match ended so take off the length of
the date
to get the start position)
($date) = $line =~ /(\d\d\d\d:\d\d:\d\d \d\d:\d\d:\d\d)/g;
print pos($line) - length($date);
--
Matt
"Ben Dover" <Ben_Dover@pickupsoap.forme.com> wrote in message
news:3F61BE88.2794624F@pickupsoap.forme.com...
> i have some .jpg files created by a digital camera (nikon 5700).
> the camera imbeds time and date in the binary.
>
> viewing the binary file, i can see the numeric dates
> "2003:09:10 21:55:01"
> that number is the date/time.
> i was able to do a regex to find it:
> /\d\d\d\d:\d\d:\d\d \d\d:\d\d:\d\d/
>
> but then I had trouble finding it's position with index. it returns a
> "-1" on every occurance.
> here's the code:
>
>
> #!/usr/bin/perl
>
> # variables
> $picFile='DSCN0155.JPG';
>
> open (READ, $picFile);
> while ($line=<READ>){
> if ($line=~ /\d\d\d\d:\d\d:\d\d \d\d:\d\d:\d\d/) {
> $indexA=index ($line, "\d\d\d\d:\d\d:\d\d \d\d:\d\d:\d\d");
> $substrA=substr($line,$indexA,400);
> print $indexA;
> }
> }
> close (READ);
------------------------------
Date: Fri, 12 Sep 2003 14:25:49 +0100
From: "Matt Churchyard" <matt@userve.net>
Subject: Re: index, find regex
Message-Id: <3f61c05c$1@news.userve.net>
"Matt Churchyard" <matt@userve.net> wrote in message
news:3f61bd85@news.userve.net...
> if you just want to read the date you can put the regex in brackets
> and the date will be stored in $1 -
>
>
> $line =~ /(\d\d\d\d:\d\d:\d\d \d\d:\d\d:\d\d)/;
> print $1;
> # --- or ----
> ($date) = $line =~ /(\d\d\d\d:\d\d:\d\d \d\d:\d\d:\d\d)/;
> print $date;
>
> if you need the position, add 'g' to the end of regex and use the pos
> function
> (the pos function returns where the match ended so take off the length of
> the date
> to get the start position)
>
> ($date) = $line =~ /(\d\d\d\d:\d\d:\d\d \d\d:\d\d:\d\d)/g;
> print pos($line) - length($date);
>
after realising i hadn't tested that last piece of code I ran it
and have realised that for some intrieging reason, the /g modifier
does not work when you try to gather the results using the '($date) ='
syntax. (atleast not on my winxp/activestate perl5.8 pc)
Therefore, the code above must be written
$line =~ /(\d\d\d\d:\d\d:\d\d \d\d:\d\d:\d\d)/g;
print pos($line) - length($1);
> --
>
> Matt
>
> "Ben Dover" <Ben_Dover@pickupsoap.forme.com> wrote in message
> news:3F61BE88.2794624F@pickupsoap.forme.com...
> > i have some .jpg files created by a digital camera (nikon 5700).
> > the camera imbeds time and date in the binary.
> >
> > viewing the binary file, i can see the numeric dates
> > "2003:09:10 21:55:01"
> > that number is the date/time.
> > i was able to do a regex to find it:
> > /\d\d\d\d:\d\d:\d\d \d\d:\d\d:\d\d/
> >
> > but then I had trouble finding it's position with index. it returns a
> > "-1" on every occurance.
> > here's the code:
> >
> >
> > #!/usr/bin/perl
> >
> > # variables
> > $picFile='DSCN0155.JPG';
> >
> > open (READ, $picFile);
> > while ($line=<READ>){
> > if ($line=~ /\d\d\d\d:\d\d:\d\d \d\d:\d\d:\d\d/) {
> > $indexA=index ($line, "\d\d\d\d:\d\d:\d\d \d\d:\d\d:\d\d");
> > $substrA=substr($line,$indexA,400);
> > print $indexA;
> > }
> > }
> > close (READ);
>
>
------------------------------
Date: Fri, 12 Sep 2003 09:38:55 -0400
From: Ben Dover <Ben_Dover@pickupsoap.forme.com>
Subject: Re: index, find regex
Message-Id: <3F61CC6F.CC3FBAD6@pickupsoap.forme.com>
i also realized that this binanry jpg file also has occurances of the
date time twice in one line.
like:
Matt Churchyard wrote:
>
> if you just want to read the date you can put the regex in brackets
> and the date will be stored in $1 -
>
> $line =~ /(\d\d\d\d:\d\d:\d\d \d\d:\d\d:\d\d)/;
> print $1;
> # --- or ----
......
------------------------------
Date: Fri, 12 Sep 2003 16:02:05 +0200
From: Tore Aursand <tore@aursand.no>
Subject: Re: index, find regex
Message-Id: <pan.2003.09.12.14.01.55.714550@aursand.no>
On Fri, 12 Sep 2003 08:39:36 -0400, Ben Dover wrote:
> #!/usr/bin/perl
use strict;
use warnings;
> # variables
> $picFile='DSCN0155.JPG';
>
> open (READ, $picFile);
> while ($line=<READ>){
> if ($line=~ /\d\d\d\d:\d\d:\d\d \d\d:\d\d:\d\d/) {
> $indexA=index ($line, "\d\d\d\d:\d\d:\d\d \d\d:\d\d:\d\d");
> $substrA=substr($line,$indexA,400);
> print $indexA;
> }
> }
> close (READ);
Very un-Perl to do it this way. :-) Try this one instead;
while ( <READ> ) {
if ( m,(\d{4}:\d{2}:\d{2}) (\d{2}:\d{2}:\d{2}), ) {
my $date = $1;
my $time = $2;
print "$date $time\n";
}
}
You get the point. Look at those parantheses.
--
Tore Aursand <tore@extend.no>
"Yes, madam, I am drunk. But in the morning I will be sober and you will
still be ugly." -- Winston Churchill, replying to Lady Astor's comment
"Sir, you're drunk!"
------------------------------
Date: Fri, 12 Sep 2003 10:12:59 -0400
From: "Tulan W. Hu" <twhu@lucent.com>
Subject: Re: index, find regex
Message-Id: <bjsk9e$298@netnews.proxy.lucent.com>
"Ben Dover" <Ben_Dover@pickupsoap.forme.com> wrote in...
> #!/usr/bin/perl
>
> # variables
> $picFile='DSCN0155.JPG';
>
> open (READ, $picFile);
> while ($line=<READ>){
> if ($line=~ /\d\d\d\d:\d\d:\d\d \d\d:\d\d:\d\d/) {
> # $indexA=index ($line, "\d\d\d\d:\d\d:\d\d \d\d:\d\d:\d\d");
$dateString = $line;
$dateString =~ s/(.*)(\d{4}:\d{2}:\d{2}\s\d{2}:\d{2}:\d{2})(.*)/$2/;
$indexA = index($line, $dateString);
> $substrA=substr($line,$indexA,400);
> print $indexA;
> }
> }
> close (READ);
------------------------------
Date: Fri, 12 Sep 2003 23:07:18 +0900
From: ko <kuujinbo@hotmail.com>
Subject: Re: index, find regex
Message-Id: <bjsk0u$r74$1@pin3.tky.plala.or.jp>
Ben Dover wrote:
> i have some .jpg files created by a digital camera (nikon 5700).
> the camera imbeds time and date in the binary.
>
> viewing the binary file, i can see the numeric dates
> "2003:09:10 21:55:01"
> that number is the date/time.
> i was able to do a regex to find it:
> /\d\d\d\d:\d\d:\d\d \d\d:\d\d:\d\d/
>
> but then I had trouble finding it's position with index. it returns a
> "-1" on every occurance.
> here's the code:
You have to use index either:
1. index STR,SUBSTR,POSITION
or:
2. index STR,SUBSTR
index() returns -1 when the substring does *not* match. The reason it
didn't match was:
> $indexA=index ($line, "\d\d\d\d:\d\d:\d\d \d\d:\d\d:\d\d");
=> HERE
'SUBSTR' is a literal string, not a regex. So you are literally trying
to match '\d\d\d\d:\d\d:\d\d \d\d:\d\d:\d\d'. If you want to use
index(), save the match from your regex:
$line=~ /(\d\d\d\d:\d\d:\d\d \d\d:\d\d:\d\d)/;
$indexA = index($line, $1);
Please read the posting guidleines:
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
Information on how to use Perl built-in functions is available on your
system:
perldoc -f index
HTH - keith
------------------------------
Date: Fri, 12 Sep 2003 10:57:11 -0400
From: Ben Dover <Ben_Dover@pickupsoap.forme.com>
Subject: Re: index, find regex
Message-Id: <3F61DEC7.88ADEC7A@pickupsoap.forme.com>
ok!
here's version .00000000000001 of my tiny project. its more dynamic now.
it takes input of file names like anyother un*x program from the command
line.
then it reads each file and adds the date / time to the filename like
this:
file pic01.jpg has embedded date of 9/11/2001 time of 08:47:01
file pic02.jpg has embedded date of 9/11/2002 time of 09:05:01
file pic03.jpg has embedded date of 9/11/2003 time of 10:05:01
they become this
pic01_2001-09-11_08_47_01.jpg
pic02_2002-09-11_09_05_01.jpg
pic03_2003-09-11_10_05_01.jpg
simple enough.
#!/usr/bin/perl
# variables
foreach $picFile (@ARGV) {
open (READ, $picFile);
ENDHERE: while ($line=<READ>){
if ($line=~ /\d{4}:\d{2}:\d{2} \d{2}:\d{2}:\d{2}/) {
$line =~ /(\d{4}:\d{2}:\d{2} \d{2}:\d{2}:\d{2})/;
$datetime=$1;
last ENDHERE;
}
}
close (READ);
$datetime=~ s|(\d{4}):(\d{2}):(\d{2})
(\d{2}):(\d{2}):(\d{2})|_$1-$2-$3_$4_$5_$6|;
$dotPos=rindex($picFile, '.');
$filename=substr($picFile, 0,$dotPos);
$fileExt=substr($picFile, $dotPos+1, length($picFile)-$dotPos-1);
$renTo= "$filename$datetime.$fileExt";
#testing!!! later this procedure will rename files
print "$picFile ==> $renTo\n";
}
(yeah,yeah, use strict, warnings, its just a test)
------------------------------
Date: Fri, 12 Sep 2003 15:13:24 +0100
From: Mark <REMOVEXtwoheadsX@tiscaliX.co.uk>
Subject: Modify Apache http headers from perl?
Message-Id: <jlk3mvk4vhvu6l5soa233enl6g4et54hdh@4ax.com>
Hi,
In order to stop certain documents from caching I would like to modify
the http headers generated by the server. I have tried the usual meta
tag solution and a variety of other suggestiongs but find that whilst
they may work in one browser they fail in others, and I have been told
that modifying the server http header is the only reliable method.
Unfortunately I am on a shared hosting plan with no telnet access so
the only way I might be able ot modify the server parameters is
through perl. There are only a few documents that I do not want to be
cached and it would be handy if I could tell the script generating the
document to change the header to 'no cache', deliver the document and
then change it back to a normal header.
Does anyone know if this is possible in perl and which commands,
modules, etc. I should be looking at?
Many thanks for your time and consideration.
Mark
------------------------------
Date: Fri, 12 Sep 2003 11:02:54 -0400
From: Ben Dover <Ben_Dover@pickupsoap.forme.com>
Subject: Re: Newsgroup post test...
Message-Id: <3F61E01E.ED6FFF17@pickupsoap.forme.com>
holy sh*t! it worked, he turned it into a discussion. now rodney, show
some manners and thank the others for making this possible for you.
admit it, you could not have done it yourself. now let me go back to my
mental asylum.
Anno Siegel wrote:
>
> Rodney <NoSpamPlease@bellsouth.net> wrote in comp.lang.perl.misc:
> > Well, at least my "test" has turned into a discussion.
> >
> > So, in fact, it is no longer a test....
> > but instead, it a discussion about "test".
>
> A blatantly off-topic one that serves no other purpose than to teach
> you some basic Usenet manners.
>
> > So now it should be a little more acceptable.
>
> No. Go away until you have a question or something to contribute.
>
> Anno
------------------------------
Date: Fri, 12 Sep 2003 10:39:25 -0400
From: danglesocket <danglesocket@no_spam>
Subject: Re: not able to access a URL with LWP::UserAgent.
Message-Id: <3f61daa0$1@shknews01>
>>> ko<kuujinbo@hotmail.com> 9/11/2003 9:16:58 PM >>>
danglesocket <danglesocket@no_spam> wrote in message
news:<3f60cda7@shknews01>...
> Rather than responding with a half assed answer that proves that you
didn't
> read the question and
> tries to make me look like an idiot, either don't respond or offer
somthing
> more 'insightful'.
Whoa, don't take things so personally...that's harsh, considering two
things:
1. You're asking for free advice.
2. Really don't see where he was trying to make you look like an idiot
or that a 'half assed answer' was offered. Speaking from *personal*
experience (time wasted looking for something complex when something
simple was breaking my script), its best to *first* look at basic
things when debugging.
-you're right. thanks for the response. apologies to Brian, thanks for the
suggestions.
__danglesocket__
------------------------------
Date: Fri, 12 Sep 2003 15:40:54 +0100
From: "Bigus" <someone@somewhere.com>
Subject: Re: Redirecting via LWP
Message-Id: <bjsltn$r8m@newton.cc.rl.ac.uk>
"Michael Budash" <mbudash@sonic.net> wrote in message
news:mbudash-94523B.11201311092003@typhoon.sonic.net...
[..]
> really hope this helps. and please, if you come up with a solution,
> share it with the ng, ok?
Thanks for your reply and the info .. I think I may have come up with the
solution. That is, the code is as follows:
sub gotofilearea()
{
$url = "http://username:password\@$host/files/$listname/";
print "Refresh: 0; URL=$url\n";
print "Content-type:text/html\n\n";
exit;
}
I didn't think it would work because a similar method (ie: using print
"Location: $url\n\n") didn't like the username & password in the URL.
With the above, I was worried it would work in the same way as the HTML meta
tag (HTTP-EQUIV="refresh"), in that if the refresh didn't happen for some
reason, the user could view the source code and see the password in the URL
string. However, I set the refresh value to "10" so I had chance to view the
source and it contains this:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html;
charset=iso-8859-1"></HEAD>
<BODY></BODY></HTML>
I want to try that in a few different browsers, just to make sure you really
can't see the password anywhere, but it's looking good :-)
Regards
Bigus
------------------------------
Date: 12 Sep 2003 11:04:00 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: splitting an array
Message-Id: <bjs970$mm3$1@mamenchi.zrz.TU-Berlin.DE>
LaDainian Tomlinson <go@away.spam> wrote in comp.lang.perl.misc:
> On Sat, 06 Sep 2003 03:18:25 -0400, debraj wrote:
> > I have one array of numbers say (12 17 18 19 120 121 122 123 124 379 480
> > 481).
> > Now I want to get the starting and ending of any cosecutive numbers from
> > this array .
> > For eg. result should be (12--12,17--19,120--124,379--379,480--481) .
> > Note that if a number without any sequence is present it will be
> > printed in the format 12--12 .
>
> This may not help much, but it works for your case and I learned a lot :-)
>
>
> _(qw.12 17 18 19 120 121 122 123 124 379 480 481.);
> sub _{
> print($_ = shift);
> while(@_){ ($_[0] == $_ + 1) ? $_ = shift : last; }
> print("--$_\n"), (@_ && _(@_));
> }
Here is a solution based on matching and substitution:
sub trans {
my $str = '';
vec( $str, $_, 8) = ord '1' for @_; # any char except "\0"
$str =~ s/1+/"$-[ 0]-" . ($+[ 0] - 1)/eg;
split /\0+/, $str;
}
For this the original list doesn't have to be sorted.
Anno
------------------------------
Date: Fri, 12 Sep 2003 14:40:09 +0200
From: Sandman <mr@sandman.net>
Subject: Re: Splitting and keeping the delimiter
Message-Id: <mr-DF8CB6.14400812092003@news.fu-berlin.de>
Thanks for all the suggestions!
--
Sandman[.net]
------------------------------
Date: Sat, 19 Jul 2003 01:59:56 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re:
Message-Id: <3F18A600.3040306@rochester.rr.com>
Ron wrote:
> Tried this code get a server 500 error.
>
> Anyone know what's wrong with it?
>
> if $DayName eq "Select a Day" or $RouteName eq "Select A Route") {
(---^
> dienice("Please use the back button on your browser to fill out the Day
> & Route fields.");
> }
...
> Ron
...
--
Bob Walton
------------------------------
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 5493
***************************************