[29055] in Perl-Users-Digest
Perl-Users Digest, Issue: 299 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Apr 4 00:09:51 2007
Date: Tue, 3 Apr 2007 21:09:05 -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 Tue, 3 Apr 2007 Volume: 11 Number: 299
Today's topics:
Can't change filenames..why? <edMbj@aes-intl.com>
Re: Can't change filenames..why? <purlgurl@purlgurl.net>
Re: Can't change filenames..why? <purlgurl@purlgurl.net>
Re: Can't change filenames..why? <paduille.4060.mumia.w+nospam@earthlink.net>
Re: Can't change filenames..why? <tadmc@augustmail.com>
Re: comp.lang.perl.cgi? (aka ? the Platypus)
Re: comp.lang.perl.cgi? <tadmc@augustmail.com>
Re: Error when using a defining a new module <tadmc@augustmail.com>
Re: extending a module? <nobull67@gmail.com>
How to resolve funky sync issues with fork here. <cdalten@gmail.com>
Re: How to resolve funky sync issues with fork here. <tadmc@augustmail.com>
Re: How to resolve funky sync issues with fork here. <cdalten@gmail.com>
Re: How to resolve funky sync issues with fork here. <cdalten@gmail.com>
Re: Internalisation support and dictionaries (Broke)
Re: Internalisation support and dictionaries <bik.mido@tiscalinet.it>
Re: Internalisation support and dictionaries <paduille.4060.mumia.w+nospam@earthlink.net>
MIME Structure Multipart/Mixed with attachment and Mul <blaine@worldweb.com>
Probelm installing Test::WWW::Mechanize <joliver@john-oliver.net>
Re: Probelm installing Test::WWW::Mechanize <spamtrap@dot-app.org>
Re: Probelm installing Test::WWW::Mechanize <joliver@john-oliver.net>
Re: Probelm installing Test::WWW::Mechanize <glex_no-spam@qwest-spam-no.invalid>
Re: Trailing whitespace question <rvtol+news@isolution.nl>
Re: Trailing whitespace question <noreply@invalid.net>
Re: Trailing whitespace question <rvtol+news@isolution.nl>
Re: Trailing whitespace question <bik.mido@tiscalinet.it>
Re: Trailing whitespace question <bik.mido@tiscalinet.it>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 03 Apr 2007 17:39:24 -0700
From: Ed Jay <edMbj@aes-intl.com>
Subject: Can't change filenames..why?
Message-Id: <0lr5139qv9jkvskb675gl2hi2qnq7nhm65@4ax.com>
My user selects up to five files to upload. I need to change the filenames
to coded names. I can't effect a name change.
The script:
use CGI qw(:standard);
$query = new CGI;
$filepath = 'http://yadayada.com/uploads;
$imgCode = 'maryjones040307';
#First, filter the filenames out of all form elements and store in an array:
my @VAL = $query->param; #get all form field names
foreach(@VAL){
$FORM{$_} = $query->param($_); # put all fields and values in hash
}
my @files;
foreach(keys %FORM){
if($_ =~ /^myFile/){
push(@files, $_); # place the form field NAME in array
}
}
#Access the array and upload the files
$i=0; my @fn;
for($i = 0; $i < $imgCnt; $i++) {
$fn[$i] = param($files[$i]);
$filename=$fn[$i]; #e.g., original filenames
$filename =~ s/.*[\/\\](.*)/$1/;
$upload_filehandle = $query->upload($files[$i]);
open (UPLOADFILE, ">$filePath/$filename") or die "!Open $filename. $!";
binmode UPLOADFILE;
while (<$upload_filehandle>) {
print UPLOADFILE;
}
close UPLOADFILE or die "Can't Close $filename. $!";
chdir $filepath;
rename($filename,$imgCode$i.jpg) or die "Could not rename file: $!";
}
What I'm hoping will result for (e.g.) three files of inconsequential
original filenames is:
maryjones0403070.jpg
maryjones0403071.jpg
maryjones0403072.jpg
The original files upload fine. Everything seems to work...until I try to
change the filenames. The script dies trying to change the first filename.
--
Ed Jay (remove 'M' to respond by email)
------------------------------
Date: Tue, 03 Apr 2007 18:12:54 -0700
From: Purl Gurl <purlgurl@purlgurl.net>
Subject: Re: Can't change filenames..why?
Message-Id: <45OdnTFe3tcFZo_bnZ2dnUVZ_tGvnZ2d@giganews.com>
Ed Jay wrote:
(snipped)
> rename($filename,$imgCode$i.jpg) or die "Could not rename file: $!";
> The original files upload fine. Everything seems to work...until I try to
> change the filenames. The script dies trying to change the first filename.
Have you considered reading your returned error message?
Purl Gurl
------------------------------
Date: Tue, 03 Apr 2007 18:27:06 -0700
From: Purl Gurl <purlgurl@purlgurl.net>
Subject: Re: Can't change filenames..why?
Message-Id: <UIudnVj9kt1xY4_bnZ2dnUVZ_o-knZ2d@giganews.com>
Purl Gurl wrote:
> Ed Jay wrote:
(snipped)
>> rename($filename,$imgCode$i.jpg) or die "Could not rename file: $!";
>> The original files upload fine. Everything seems to work...until I try to
>> change the filenames. The script dies trying to change the first
>> filename.
> Have you considered reading your returned error message?
c:\apache\users\test>perl -c test.pl
Bad name after maryjones040307' at test.pl line 6.
c:\apache\users\test>perl -c test.pl
Scalar found where operator expected at test.pl line 36, near "$imgCode$i"
(Missing operator before $i?)
syntax error at test.pl line 36, near "$imgCode$i"
test.pl had compilation errors.
---
Interesting you are able to run a script which will not compile.
Purl Gurl
------------------------------
Date: Wed, 04 Apr 2007 01:58:04 GMT
From: "Mumia W." <paduille.4060.mumia.w+nospam@earthlink.net>
Subject: Re: Can't change filenames..why?
Message-Id: <MCDQh.134108$_73.50534@newsread2.news.pas.earthlink.net>
On 04/03/2007 07:39 PM, Ed Jay wrote:
> My user selects up to five files to upload. I need to change the filenames
> to coded names. I can't effect a name change.
>
> The script:
>
> use CGI qw(:standard);
Missing:
use strict;
use warnings;
Please modify your program to work with them. "Strict" and "warnings"
will capture most errors early.
> $query = new CGI;
> $filepath = 'http://yadayada.com/uploads;
That is not a filepath. That's a URL.
> $imgCode = 'maryjones040307';
>
> #First, filter the filenames out of all form elements and store in an array:
>
> my @VAL = $query->param; #get all form field names
> foreach(@VAL){
> $FORM{$_} = $query->param($_); # put all fields and values in hash
> }
> my @files;
> foreach(keys %FORM){
> if($_ =~ /^myFile/){
> push(@files, $_); # place the form field NAME in array
> }
> }
> #Access the array and upload the files
> $i=0; my @fn;
> for($i = 0; $i < $imgCnt; $i++) {
> $fn[$i] = param($files[$i]);
> $filename=$fn[$i]; #e.g., original filenames
> $filename =~ s/.*[\/\\](.*)/$1/;
>
> $upload_filehandle = $query->upload($files[$i]);
> open (UPLOADFILE, ">$filePath/$filename") or die "!Open $filename. $!";
You have two problems here. The first is that "open" cannot accept a URL
as an argument, so "open (UPLOADFILE,
'>http://yadayada.com/uploads/mjones04221.pdf')" is an error.
The second problem is that $filePath is undefined. You meant to write
$filepath (notice the difference in capitalization for 'P').
Effectively, you tried to do this:
open (UPLOADFILE, '>/mjones04221.pdf') or die ...
Your program doesn't have permission to write into the root directory,
so this fails.
> binmode UPLOADFILE;
> while (<$upload_filehandle>) {
> print UPLOADFILE;
You probably want to do this:
print UPLOADFILE $_;
> }
> close UPLOADFILE or die "Can't Close $filename. $!";
>
> chdir $filepath;
> rename($filename,$imgCode$i.jpg) or die "Could not rename file: $!";
Just to be sure, I would write this;
rename ($filename, "$imgCode$i.jpg") or die ...
You really need strictures (use strict) and warnings (use warnings)
turned on, because all of the problems with your program were related to
them being off.
> }
>
> What I'm hoping will result for (e.g.) three files of inconsequential
> original filenames is:
>
> maryjones0403070.jpg
> maryjones0403071.jpg
> maryjones0403072.jpg
>
> The original files upload fine. Everything seems to work...until I try to
> change the filenames. The script dies trying to change the first filename.
Just in case you haven't already read them, here are the posting
guidelines for comp.lang.perl.misc:
http://www.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
HTH
------------------------------
Date: Tue, 3 Apr 2007 22:02:48 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Can't change filenames..why?
Message-Id: <slrnf165ao.b57.tadmc@tadmc30.august.net>
Ed Jay <edMbj@aes-intl.com> wrote:
> $filepath = 'http://yadayada.com/uploads;
You need quotes on *both* ends of strings.
> open (UPLOADFILE, ">$filePath/$filename") or die "!Open $filename. $!";
$filePath does not contain a file path. It contains a URL.
Errr, well, it would contain that if you had Real Perl Code.
> rename($filename,$imgCode$i.jpg) or die "Could not rename file: $!";
^^^^^^^^^^
Syntax error.
> The original files upload fine. Everything seems to work.
We cannot help you if you lie to us.
Have you seen the Posting Guidelines that are posted here frequently/
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 03 Apr 2007 20:19:41 GMT
From: "David Formosa (aka ? the Platypus)" <dformosa@dformosa.zeta.org.au>
Subject: Re: comp.lang.perl.cgi?
Message-Id: <slrnf15eab.bim.dformosa@localhost.localdomain>
On Mon, 02 Apr 2007 18:18:21 +0200, Gunnar Hjalmarsson
<noreply@gunnar.cc> wrote:
> The group comp.infosystems.www.authoring.cgi has been down for several
> months. As far as I can understand, it means that there is no longer an
> appropriate Usenet group for those who use Perl for web applications to
> discuss CGI and HTTP matters.
Wouldn't it be better to get a new moderator?
------------------------------
Date: Tue, 3 Apr 2007 20:11:43 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: comp.lang.perl.cgi?
Message-Id: <slrnf15uqf.at0.tadmc@tadmc30.august.net>
Sherm Pendley <spamtrap@dot-app.org> wrote:
> Michele Dondi <bik.mido@tiscalinet.it> writes:
>
>> On Tue, 03 Apr 2007 12:52:24 +0200, Gunnar Hjalmarsson
>> <noreply@gunnar.cc> wrote:
>>
>>>Would you mind to share your thinking on the subject, Tad? Do you
>>>welcome those who use Perl for webb stuff to use clpmisc for other
>>>matters than pure Perl programming ditto, or do you find it satisfying
>>>that there is no appropriate Usenet group for them?
>>
>> Don't know 'bout Tad, but personally I welcome to clpmisc anyone for
>> any ("misc") use of Perl, web stuff included.
>
> I think a lot of us feel the same way; I have no objections to questions
> that are actually about Perl, regardless of what the code in question is
> being used for.
>
>> in that area, it gives me chances of learning something. I don't
>> welcome any question that has really *nothing* to do with Perl.
>
> Exactly so. The problem is quite a few questions get posted here that are
> really HTML or HTTP questions, where the fact that a Perl script happens
> to be involved simply isn't relevant to the question.
>
>> Simple, isn't it?
>
> To an experienced developer it is.
>
> On the other hand, the volume of off-topic posts here suggests that parti-
> tioning the problem space is a difficult concept for novices to master. I
> can't imagine how creating a new group would change that.
This post, along with Sherm's other one, pretty much mirrors my
position on this subject.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 3 Apr 2007 20:26:58 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Error when using a defining a new module
Message-Id: <slrnf15vn2.at0.tadmc@tadmc30.august.net>
ashwani <ashwanijain@gmail.com> wrote:
> #use strict;
You lose all of the benefits of strict when you comment it out!
> my %this = (SERVICE_INI_FILE_NAME => "sgutat.ini");
^^^^^
> $this{'TRACE_FILE_NAME'} = "D:/Strech Goals/Unit test Automation/
> Development/input files/OC_CC_C2_002.tra";
>
> $this->{'SERVICE_INI_FD'} = service_ini::openServiceIni();
^^^^^
This $this is not that $this that appears above this.
strict would have told you that... and this.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 3 Apr 2007 14:19:28 -0700
From: "Brian McCauley" <nobull67@gmail.com>
Subject: Re: extending a module?
Message-Id: <1175635168.535280.244790@p77g2000hsh.googlegroups.com>
On Apr 3, 4:18 pm, bugbear <bugbear@trim_papermule.co.uk_trim> wrote:
> For local convenience I would like to "wrap"
> an existing module, making a new and slightly
> larger/customised module.
>
> Is there a convention on doing this?
> Export and @ISA would seem quite key :-)
>
> Specifically, can I (somehow)
> manufacture the new Modules @EXPORT and
> @EXPORT_OK from the underlying module?
@EXPORT and @EXPORT_OK are ordinary package variables you can
manipulate them just like any other.
eg.
use Some::Module;
our @EXPORT = (@Some::Module::EXPORT, 'plus', 'some', 'more');
------------------------------
Date: 3 Apr 2007 18:27:49 -0700
From: "grocery_stocker" <cdalten@gmail.com>
Subject: How to resolve funky sync issues with fork here.
Message-Id: <1175650069.478051.260260@w1g2000hsg.googlegroups.com>
Here is a copy a persons code I saw on a blog. The only difference
here is that I enable warnings use my().
#!/usr/bin/perl -w
my @array = qw(ugh geeze blah test smith bob homes point);
my $num = "10";
for(1..$num) {
my $pid = fork();
if ($pid) {
# parent
push(@childs, $pid);
} elsif ($pid == 0) {
# child
print "@array\n\n";
sleep 5;
exit(0);
} else {
die "couldn't fork: $!\n";
}
print "BEFORE FOR BRACKET\n";
}
print "AFTER FOR BRACKET\n";
foreach (@childs) {
waitpid($_, 0);
}
And here is what I get when I run it a few times...
[cdalten@localhost perl]$ ./par.pl
ugh geeze blah test smith bob homes point
BEFORE FOR BRACKET
ugh geeze blah test smith bob homes point
BEFORE FOR BRACKET
ugh geeze blah test smith bob homes point
BEFORE FOR BRACKET
ugh geeze blah test smith bob homes point
BEFORE FOR BRACKET
ugh geeze blah test smith bob homes point
BEFORE FOR BRACKET
ugh geeze blah test smith bob homes point
BEFORE FOR BRACKET
ugh geeze blah test smith bob homes point
BEFORE FOR BRACKET
ugh geeze blah test smith bob homes point
BEFORE FOR BRACKET
ugh geeze blah test smith bob homes point
BEFORE FOR BRACKET
ugh geeze blah test smith bob homes point
BEFORE FOR BRACKET
AFTER FOR BRACKET
[cdalten@localhost perl]$ ./par.pl
ugh geeze blah test smith bob homes point
BEFORE FOR BRACKET
ugh geeze blah test smith bob homes point
BEFORE FOR BRACKET
ugh geeze blah test smith bob homes point
BEFORE FOR BRACKET
ugh geeze blah test smith bob homes point
BEFORE FOR BRACKET
ugh geeze blah test smith bob homes point
BEFORE FOR BRACKET
BEFORE FOR BRACKET
ugh geeze blah test smith bob homes point
ugh geeze blah test smith bob homes point
BEFORE FOR BRACKET
ugh geeze blah test smith bob homes point
BEFORE FOR BRACKET
ugh geeze blah test smith bob homes point
BEFORE FOR BRACKET
ugh geeze blah test smith bob homes point
BEFORE FOR BRACKET
AFTER FOR BRACKET
[cdalten@localhost perl]$
The lines:
BEFORE FOR BRACKET
ugh geeze blah test smith bob homes point
Sometmes don't appear in sync. How would I get them in sync? Would I
have to insert another wait() into the child? Just need some ideas
here.
Chad
------------------------------
Date: Tue, 3 Apr 2007 22:08:21 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: How to resolve funky sync issues with fork here.
Message-Id: <slrnf165l5.b57.tadmc@tadmc30.august.net>
["Followup-To:" header set to comp.lang.perl.misc.]
grocery_stocker <cdalten@gmail.com> wrote:
> Sometmes don't appear in sync. How would I get them in sync?
$| = 1;
> Just need some ideas
> here.
Suffering from Buffering?
http://perl.plover.com/FAQs/Buffering.html
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 3 Apr 2007 19:16:18 -0700
From: "grocery_stocker" <cdalten@gmail.com>
Subject: Re: How to resolve funky sync issues with fork here.
Message-Id: <1175652978.295279.102710@y80g2000hsf.googlegroups.com>
On Apr 3, 8:08 pm, Tad McClellan <t...@augustmail.com> wrote:
> ["Followup-To:" header set to comp.lang.perl.misc.]
>
> grocery_stocker <cdal...@gmail.com> wrote:
> > Sometmes don't appear in sync. How would I get them in sync?
>
> $| = 1;
>
> > Just need some ideas
> > here.
>
> Suffering from Buffering?
>
> http://perl.plover.com/FAQs/Buffering.html
>
After re-reading my initial post, it also appears I'm suffering from
some poor grammar.
------------------------------
Date: 3 Apr 2007 21:06:54 -0700
From: "grocery_stocker" <cdalten@gmail.com>
Subject: Re: How to resolve funky sync issues with fork here.
Message-Id: <1175659614.689350.15030@e65g2000hsc.googlegroups.com>
On Apr 3, 8:08 pm, Tad McClellan <t...@augustmail.com> wrote:
> ["Followup-To:" header set to comp.lang.perl.misc.]
>
> grocery_stocker <cdal...@gmail.com> wrote:
> > Sometmes don't appear in sync. How would I get them in sync?
>
> $| = 1;
>
> > Just need some ideas
> > here.
>
> Suffering from Buffering?
>
> http://perl.plover.com/FAQs/Buffering.html
>
I tried several variations on $|=1, however, it's still not in sync.
#!/usr/bin/perl -w
my @array = qw(ugh geeze blah test smith bob homes point);
my $num = "10";
for(1..$num) {
my $pid = fork();
if ($pid) {
# parent
push(@childs, $pid);
my $oldfh = select(STDOUT); $| = 1; select ($oldfh);
} elsif ($pid == 0) {
# child
#my $oldfh = select(STDOUT); $| = 1;
print "@array\n";
#$oldfh = select(STDOUT); $| = 1; select($oldfh);
sleep 5;
exit(0);
} else {
die "couldn't fork: $!\n";
}
#my $olderfh = select(STDOUT); $| = 1;
print "BEFORE FOR BRACKET\n";
#$olderfh = select(STDOUT); $| = 1; select($olderfh);
}
#$oldestfh = select(STDOUT); $| = 1; select($oldestfh);
print "AFTER FOR BRACKET\n";
#$oldestfh = select(STDOUT); $| = 1; select($oldestfh);
foreach (@childs) {
waitpid($_, 0);
}
However, I still get the following:
[cdalten@localhost perl]$ ./par.pl
ugh geeze blah test smith bob homes point
BEFORE FOR BRACKET
ugh geeze blah test smith bob homes point
BEFORE FOR BRACKET
ugh geeze blah test smith bob homes point
BEFORE FOR BRACKET
ugh geeze blah test smith bob homes point
BEFORE FOR BRACKET
ugh geeze blah test smith bob homes point
BEFORE FOR BRACKET
ugh geeze blah test smith bob homes point
BEFORE FOR BRACKET
ugh geeze blah test smith bob homes point
BEFORE FOR BRACKET
BEFORE FOR BRACKET
ugh geeze blah test smith bob homes point
BEFORE FOR BRACKET
ugh geeze blah test smith bob homes point
BEFORE FOR BRACKET
AFTER FOR BRACKET
ugh geeze blah test smith bob homes point
[cdalten@localhost perl]$ ./par.pl
------------------------------
Date: Wed, 4 Apr 2007 00:48:02 +0200
From: nospam@tele2.fr (Broke)
Subject: Re: Internalisation support and dictionaries
Message-Id: <1hw0st5.1lh8vdi31z3nN%nospam@tele2.fr>
Mumia W. <paduille.4060.mumia.w+nospam@earthlink.net> wrote:
Hello Mumia,
That's a wonderful idea.
I will do it.
Thanks to you !
B.
> You can set an encoding for the 'open' command:
>
> open (IN, '<:utf8', $file) or die (...
>
> Read about the 'open' command and Perl:
>
> Start->Run->"perldoc -f open"
> Start->Run->"perldoc perl"
------------------------------
Date: Wed, 04 Apr 2007 02:02:18 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Internalisation support and dictionaries
Message-Id: <anq51359lhj7150bf592t3m2bvjm557mr3@4ax.com>
On Tue, 03 Apr 2007 18:10:05 GMT, "Mumia W."
<paduille.4060.mumia.w+nospam@earthlink.net> wrote:
>You can set an encoding for the 'open' command:
>
>open (IN, '<:utf8', $file) or die (...
And there's even an C<open> pragma.
perldoc open
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: Wed, 04 Apr 2007 01:29:03 GMT
From: "Mumia W." <paduille.4060.mumia.w+nospam@earthlink.net>
Subject: Re: Internalisation support and dictionaries
Message-Id: <zbDQh.134102$_73.105334@newsread2.news.pas.earthlink.net>
On 04/03/2007 05:48 PM, Broke wrote:
> Mumia W. <paduille.4060.mumia.w+nospam@earthlink.net> wrote:
>> You can set an encoding for the 'open' command:
>>
>> open (IN, '<:utf8', $file) or die (...
>>
>
> That's a wonderful idea.
> I will do it.
>
> Thanks to you !
> B.
Sure, you're very welcome.
------------------------------
Date: 3 Apr 2007 15:21:58 -0700
From: "blaine@worldweb.com" <blaine@worldweb.com>
Subject: MIME Structure Multipart/Mixed with attachment and Multipart/Alternative
Message-Id: <1175638918.325546.277020@l77g2000hsb.googlegroups.com>
Hello,
I'm trying to send a message that has an attachment as well as either
text or html message depending on the email client. Below is the code
I use to create the structure. However when the email arrives it looks
good except that boundary information is displayed prior to the email
client showing the correct alternative selection.
How can I manipulate this structure so that boundary information is
not displayed when the email client chooses either the text or html
entity for display?
++++CODE++++
my $top = MIME::Entity->build('Type' => "multipart/mixed",
'From' => 'test@nowwherel.com',
'To' => 'myaddress@email.com',
'Subject' => 'test Message' );
### Attach stuff to it:
$top->attach(Path => "t.txt",
Type => "text/plain",
Disposition => "attachment",
Encoding => "7bit");
##Build Alternative Entity for email client to select the correct
message
my $ent = MIME::Entity->build('Type' => "multipart/alternative");
$ent->attach(Data => 'test text/plain Message',
Type => 'text/plain',
Encoding => "7bit");
$ent->attach(Data => '<html><body>test <h3>text/html</h3> Message</
body></html>',
Type => 'text/html',
Encoding => "7bit");
## add the alternitive entity to the root entity (multipart/mixed)
$top->add_part( $ent );
## Show the skeleton.. After send the message
$top->dump_skeleton(\*STDERR);
#open MAIL, "| /usr/sbin/sendmail -t -f \"test@nowhere.com\"" or die
"open: $ !";
#$top->print(\*MAIL);
#close MAIL;
------------------------------
Date: 03 Apr 2007 21:07:09 GMT
From: John Oliver <joliver@john-oliver.net>
Subject: Probelm installing Test::WWW::Mechanize
Message-Id: <slrnf15gft.6sj.joliver@ns.sdsitehosting.net>
cpan[2]> install Test::WWW::Mechanize
Running install for module Test::WWW::Mechanize
Running make for P/PE/PETDANCE/Test-WWW-Mechanize-1.12.tar.gz
Is already unwrapped into directory
/root/.cpan/build/Test-WWW-Mechanize-1.12
Has already been processed within this session
Running make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e"
"test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/00load................ok 1/1# Testing Test::WWW::Mechanize 1.12, Perl
5.008005, /usr/bin/perl
t/00load................ok
t/content_contains......ok
t/content_lacks.........ok
t/follow_link_ok........NOK 4/6
# Failed test 'Go after first link'
# at t/follow_link_ok.t line 29.
# 500 Can't connect to localhost:13432 (connect: Connection refused)
Why is it assuming that something it isn't starting is going to be
running on port 13432???
--
* John Oliver http://www.john-oliver.net/ *
------------------------------
Date: Tue, 03 Apr 2007 17:17:19 -0400
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: Probelm installing Test::WWW::Mechanize
Message-Id: <m2ircdnoo0.fsf@local.wv-www.com>
John Oliver <joliver@john-oliver.net> writes:
> cpan[2]> install Test::WWW::Mechanize
> Running install for module Test::WWW::Mechanize
> Running make for P/PE/PETDANCE/Test-WWW-Mechanize-1.12.tar.gz
> Is already unwrapped into directory
> /root/.cpan/build/Test-WWW-Mechanize-1.12
> Has already been processed within this session
> Running make test
> PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e"
> "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
> t/00load................ok 1/1# Testing Test::WWW::Mechanize 1.12, Perl
> 5.008005, /usr/bin/perl
> t/00load................ok
> t/content_contains......ok
> t/content_lacks.........ok
> t/follow_link_ok........NOK 4/6
> # Failed test 'Go after first link'
> # at t/follow_link_ok.t line 29.
> # 500 Can't connect to localhost:13432 (connect: Connection refused)
>
>
>
> Why is it assuming that something it isn't starting is going to be
> running on port 13432???
It's not assuming that - it *did* its own server on port 13432, and would
have failed subtest 1 if it couldn't do that.
Are you running a firewall that would prevent it from connecting?
sherm--
--
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net
------------------------------
Date: 03 Apr 2007 22:22:24 GMT
From: John Oliver <joliver@john-oliver.net>
Subject: Re: Probelm installing Test::WWW::Mechanize
Message-Id: <slrnf15kt0.8co.joliver@ns.sdsitehosting.net>
On Tue, 03 Apr 2007 17:17:19 -0400, Sherm Pendley wrote:
> John Oliver <joliver@john-oliver.net> writes:
>
>> cpan[2]> install Test::WWW::Mechanize
>> Running install for module Test::WWW::Mechanize
>> Running make for P/PE/PETDANCE/Test-WWW-Mechanize-1.12.tar.gz
>> Is already unwrapped into directory
>> /root/.cpan/build/Test-WWW-Mechanize-1.12
>> Has already been processed within this session
>> Running make test
>> PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e"
>> "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
>> t/00load................ok 1/1# Testing Test::WWW::Mechanize 1.12, Perl
>> 5.008005, /usr/bin/perl
>> t/00load................ok
>> t/content_contains......ok
>> t/content_lacks.........ok
>> t/follow_link_ok........NOK 4/6
>> # Failed test 'Go after first link'
>> # at t/follow_link_ok.t line 29.
>> # 500 Can't connect to localhost:13432 (connect: Connection refused)
>>
>>
>>
>> Why is it assuming that something it isn't starting is going to be
>> running on port 13432???
>
> It's not assuming that - it *did* its own server on port 13432, and would
> have failed subtest 1 if it couldn't do that.
>
> Are you running a firewall that would prevent it from connecting?
No.
What is it trying to start? Where are the logs? How do I find out why
it isn't starting, or why it's starting and failing, or why the "first
link" is missing, or whatever else it's unhappy about?
--
* John Oliver http://www.john-oliver.net/ *
------------------------------
Date: Tue, 03 Apr 2007 17:41:25 -0500
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: Probelm installing Test::WWW::Mechanize
Message-Id: <4612e638$0$497$815e3792@news.qwest.net>
John Oliver wrote:
> On Tue, 03 Apr 2007 17:17:19 -0400, Sherm Pendley wrote:
>> John Oliver <joliver@john-oliver.net> writes:
>>
>>> cpan[2]> install Test::WWW::Mechanize
>>> Running install for module Test::WWW::Mechanize
>>> Running make for P/PE/PETDANCE/Test-WWW-Mechanize-1.12.tar.gz
>>> Is already unwrapped into directory
>>> /root/.cpan/build/Test-WWW-Mechanize-1.12
>>> Has already been processed within this session
>>> Running make test
>>> PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e"
>>> "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
>>> t/00load................ok 1/1# Testing Test::WWW::Mechanize 1.12, Perl
>>> 5.008005, /usr/bin/perl
>>> t/00load................ok
>>> t/content_contains......ok
>>> t/content_lacks.........ok
>>> t/follow_link_ok........NOK 4/6
>>> # Failed test 'Go after first link'
>>> # at t/follow_link_ok.t line 29.
>>> # 500 Can't connect to localhost:13432 (connect: Connection refused)
>>>
>>>
>>>
>>> Why is it assuming that something it isn't starting is going to be
>>> running on port 13432???
>> It's not assuming that - it *did* its own server on port 13432, and would
>> have failed subtest 1 if it couldn't do that.
>>
>> Are you running a firewall that would prevent it from connecting?
>
> No.
>
> What is it trying to start? Where are the logs? How do I find out why
> it isn't starting, or why it's starting and failing, or why the "first
> link" is missing, or whatever else it's unhappy about?
You have all of the information. Look at the test script
(t/follow_link_ok) to see what it's doing. It's using
HTTP::Server::Simple::CGI to start a server, then it's
trying to access html/goodlinks.html.
You could also skip the tests by doing a force install.
------------------------------
Date: Tue, 3 Apr 2007 20:54:24 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: Trailing whitespace question
Message-Id: <euune4.1a0.1@news.isolution.nl>
Michele Dondi schreef:
> Michele Dondi:
>> Or
>> unpack 'A4A20A30A8@70A8@103A20A1' => $_;
>
> Or
> unpack 'A4A20A30A8x8A8x25A20A1' => $_;
> (And one would probably include some whitespace to improve
> readability.)
Are you sure "A" is powerful enough? In de documentation I see that only
ASCII is captured.
(perl 5.8.1, perldoc -f pack)
--
Affijn, Ruud
"Gewoon is een tijger."
------------------------------
Date: Tue, 03 Apr 2007 22:18:35 GMT
From: Ala Qumsieh <noreply@invalid.net>
Subject: Re: Trailing whitespace question
Message-Id: <%oAQh.4664$YL5.4208@newssvr29.news.prodigy.net>
Michele Dondi wrote:
> On Mon, 02 Apr 2007 11:27:11 -0400, nun <junk@yahoo.com> wrote:
>
>>I'm reading data from a text file into an array like this:
>>
>> push @AoA, [(
>
> Why @AoA? It's just a plain array of strings...
No. It's an array of array references. @AoA is appropriate.
>> substr($_, 0, 4),
>> substr($_, 4, 20),
>> substr($_, 24, 30),
>> substr($_, 54, 8),
>> substr($_, 70, 8),
>> substr($_, 103, 20),
>> substr($_, 123, 1),
>>)];
>>
>>
>>I'd like to trim any trailing spaces from the substr($_, 24, 30) entry.
>
> You want to know about =~.
>
>>I see from Google that:
>>
>> s/ *$//;
>
> If you want to be picky, s/ *\z// would be more precise. But what you
> wrote may be what you want. If there are no newlines involved, they
> will be the same.
That is not correct. The OP wants to make sure that whatever is returned by
substr($_, 24, 30)
does not contain trailing spaces.
--Ala
------------------------------
Date: Wed, 4 Apr 2007 00:49:25 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: Trailing whitespace question
Message-Id: <euusn9.1ds.1@news.isolution.nl>
Dr.Ruud schreef:
> Michele Dondi:
>> Michele Dondi:
>>> Or
>>> unpack 'A4A20A30A8@70A8@103A20A1' => $_;
>>
>> Or
>> unpack 'A4A20A30A8x8A8x25A20A1' => $_;
>> (And one would probably include some whitespace to improve
>> readability.)
>
> Are you sure "A" is powerful enough? In de documentation I see
> that only ASCII is captured.
> (perl 5.8.1, perldoc -f pack)
Test on perl 5.8.6:
perl -wle'
$_ = "\x{20ac}"; # euro sign
print length unpack "A*", $_
'
3
--
Affijn, Ruud
"Gewoon is een tijger."
------------------------------
Date: Wed, 04 Apr 2007 01:56:16 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Trailing whitespace question
Message-Id: <s7q513p3l030nd3uvgqq5e30pdmve4bmub@4ax.com>
On Tue, 03 Apr 2007 22:18:35 GMT, Ala Qumsieh <noreply@invalid.net>
wrote:
>>> push @AoA, [(
>>
>> Why @AoA? It's just a plain array of strings...
>
>No. It's an array of array references. @AoA is appropriate.
You're right. I stand corrected. I hadn't noticed... well a bunch of
things.
>> If you want to be picky, s/ *\z// would be more precise. But what you
>> wrote may be what you want. If there are no newlines involved, they
>> will be the same.
>
>That is not correct. The OP wants to make sure that whatever is returned by
>
> substr($_, 24, 30)
>
>does not contain trailing spaces.
So what? I was just pointing out that the possible presence of some
newlines may, well, screw up things. It was also a reminder of being
careful in such situations.
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: Wed, 04 Apr 2007 02:00:27 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Trailing whitespace question
Message-Id: <6iq513p8ged6q8u1ih7b7hv2fftl771diu@4ax.com>
On Tue, 3 Apr 2007 20:54:24 +0200, "Dr.Ruud" <rvtol+news@isolution.nl>
wrote:
>Are you sure "A" is powerful enough? In de documentation I see that only
>ASCII is captured.
>(perl 5.8.1, perldoc -f pack)
Not, by any means! But then I have to check the docs each time I use
pack and unpack. Perhaps "a" would be better, and a leading "U0" could
be useful. Really depends on the actual situation.
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
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 V11 Issue 299
**************************************