[25260] in Perl-Users-Digest
Perl-Users Digest, Issue: 7505 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Dec 10 14:10:42 2004
Date: Fri, 10 Dec 2004 11:10:12 -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 Fri, 10 Dec 2004 Volume: 10 Number: 7505
Today's topics:
Re: Need help with froogle and cart id prob <shagyez@gmx.net>
Re: Need help with froogle and cart id prob <shagyez@gmx.net>
Open All files one by one <bustanut2020@yahoo.com>
Re: Open All files one by one <spamtrap@dot-app.org>
Re: Open All files one by one <jurgenex@hotmail.com>
Re: Open All files one by one <kkeller-usenet@wombat.san-francisco.ca.us>
Re: Open All files one by one <bik.mido@tiscalinet.it>
Re: Open All files one by one <tintin@invalid.invalid>
Re: passing string to ksh with system command <tadmc@augustmail.com>
Perldoc: No documentation on perl found [newbie] <shashank@mia.ece.uic.edu>
Re: Perldoc: No documentation on perl found [newbie] <do-not-use@invalid.net>
Re: Recognize directories and files. (Anno Siegel)
Re: Recognize directories and files. <mritty@gmail.com>
Re: Retrieving web pages <tintin@invalid.invalid>
Re: Retrieving web pages (Anno Siegel)
Re: Retrieving web pages <simon.dukes@gmail.com>
Re: Retrieving web pages <not@home.net>
Re: Using MIME::Lite for multipart message - trouble wi <alamukutty@gmail.com>
Re: Web Form search and open pdf <mbudash@sonic.net>
Re: Web Form search and open pdf dbmeyers23@yahoo.com
Re: why the following HereDoc print don't work? (Anno Siegel)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 10 Dec 2004 08:11:57 +0100
From: "dave" <shagyez@gmx.net>
Subject: Re: Need help with froogle and cart id prob
Message-Id: <cpbi86$c8i$01$1@news.t-online.com>
Thanks ever so much for the response(s).
I'll post more tonite after work.
It's not that I want to get customers to go back to my main page - Froogle
returns my site in the search answers listing (leastways I hope so) - the
customer can click on a desired item and proceed to the check-out. But
there's no unique ID because that happens on a previous page.
But I gotta run.
David
"AD" <aditya.singh@gmail.com> wrote in message
news:1102632739.795412.294240@f14g2000cwb.googlegroups.com...
> Dave said:
> "My problem is that a cart id doesn't get created unless the shopper
> starts
> at the storefront page, or at least at the category page."
>
> I think this is not a good design. If a customer is directed to your
> product from another website, he should be able to add that item to
> cart from that page itself and checkout. If you expect customers to go
> back to your main page, then it won't work. You'll lose customers.
>
> BTW, there is no Perl question in your post. The least you could do is
> put some sample code through which clpm users could have tried out the
> problem you were facing.
>
> HTH,
> AD
>
------------------------------
Date: Fri, 10 Dec 2004 08:15:21 +0100
From: "dave" <shagyez@gmx.net>
Subject: Re: Need help with froogle and cart id prob
Message-Id: <cpbied$3na$05$1@news.t-online.com>
Sorry Abigail, I plead ignorance and hey, what can I say, I need help.
And this being the season of good will and all...
David
"Abigail" <abigail@abigail.nl> wrote in message
news:slrncrhrqn.k4s.abigail@alexandra.abigail.nl...
> dave (shagyez@gmx.net) wrote on MMMMCXVIII September MCMXCIII in
> <URL:news:cpajbe$9ge$04$1@news.t-online.com>:
> `' Hi folks,
> `'
> `' I'm using a variation of Selena Sol's web_store.cgi as my online shop
> (or
> `' trying to, that is).
> `' I'm currently trying to put a product page on Froogle.
> `' Froogle requires that the url from the Froogle results list, to the
> vendor
> `' site, be directly to the product page and not to any category page or
> other
> `' page before the product page.
> `' My problem is that a cart id doesn't get created unless the shopper
> starts
> `' at the storefront page, or at least at the category page.
> `' So how would I modify the product page so that when the "buy this
> item"
> `' button is clicked, a cart id is created and passed to the checkout
> page?
> `' Any and all help will be really appreciated.
>
>
> If you have problems with a particular software product, or with a
> particular service, you should direct your questions to the supplier
> of such product or service.
>
> This language is about the language Perl. It isn't about random pieces
> of software that happen to be written in Perl.
>
> (Otherwise, there wouldn't have been a comp.lang.perl.* hierarchie in the
> first place - since perl is written in C, we'd be discussing Perl issues
> in comp.lang.c).
>
>
>
> Abigail
> --
> perl5.004 -wMMath::BigInt -e'$^V=Math::BigInt->new(qq]$^F$^W783$[$%9889$^F47]
> .qq]$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W]
> .qq]98$^F76777$=56]);$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V
> %$^U;$^V/=$^U}while$^V!=$^W'
------------------------------
Date: Fri, 10 Dec 2004 05:39:04 GMT
From: "Billy" <bustanut2020@yahoo.com>
Subject: Open All files one by one
Message-Id: <YDaud.738441$8_6.539088@attbi_s04>
All,
I am looking for a way to open ALL files in a directory one by one in perl.
I am able to open one file... read in the data and write it out to another
file without any problems. But I have to tell the script the file I am
opening. I would like the script to open all .txt files read out some data
and append it to another file. The only part I am stuck on is the opening of
the files without providing the filenames.
I searched around and got tired of going in circles.
Say I have a directory that has...
bob.txt
ted.txt
sam.txt
sue.txt
index.html
Is there a simple way to open all the .txt files?
If this needs more info please let me know.
Billy
------------------------------
Date: Fri, 10 Dec 2004 00:51:54 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: Open All files one by one
Message-Id: <RfedneXptoznpCTcRVn-tg@adelphia.com>
Billy wrote:
> I am looking for a way to open ALL files in a directory one by one in perl.
Have a look at the opendir() and readdir() functions:
perldoc -f opendir
perldoc -f readdir
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
------------------------------
Date: Fri, 10 Dec 2004 05:57:11 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Open All files one by one
Message-Id: <XUaud.2220$DV3.2026@trnddc06>
Billy wrote:
[...]
> I am able to open one file... read in the data and write it out to
> another file without any problems. [...]
> Is there a simple way to open all the .txt files?
See 'perldoc -f glob' and then simply loop through the list.
jue
------------------------------
Date: Thu, 9 Dec 2004 21:55:19 -0800
From: Keith Keller <kkeller-usenet@wombat.san-francisco.ca.us>
Subject: Re: Open All files one by one
Message-Id: <sbqn82xil6.ln2@goaway.wombat.san-francisco.ca.us>
On 2004-12-10, Billy <bustanut2020@yahoo.com> wrote:
> I am looking for a way to open ALL files in a directory one by one in perl.
Are you sure?
> I am able to open one file... read in the data and write it out to another
> file without any problems. But I have to tell the script the file I am
> opening. I would like the script to open all .txt files read out some data
> and append it to another file. The only part I am stuck on is the opening of
> the files without providing the filenames.
I'd suggest getting a list of filenames, then opening a filehandle on
each one at a time, doing what you need, and closing the filehandle.
Presuming you already know the opening and closing part, you probably
want glob to make a list of filenames; perldoc -f glob for help.
If that's not useful advice, you might consider posting a short
script which demonstrates what you're trying to do, and where you
need help.
--keith
--
kkeller-usenet@wombat.san-francisco.ca.us
(try just my userid to email me)
AOLSFAQ=http://wombat.san-francisco.ca.us/cgi-bin/fom
------------------------------
Date: Fri, 10 Dec 2004 09:26:46 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Open All files one by one
Message-Id: <r6nir0p575c9hrkligrlpt3gjape6v0t5e@4ax.com>
On Fri, 10 Dec 2004 05:39:04 GMT, "Billy" <bustanut2020@yahoo.com>
wrote:
>Say I have a directory that has...
>
>bob.txt
>ted.txt
>sam.txt
>sue.txt
>index.html
>
>Is there a simple way to open all the .txt files?
In addition to the answers you already got, that you certainly
*should* take into account, depending on what you *really* need to do
with those files, you can also "trick" @ARGV to do the job for you (of
course some care must be taken if you're already using it for
something else):
@ARGV=<*.txt>;
while (<>) {
# ...
}
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: Fri, 10 Dec 2004 22:24:49 +1300
From: "Tintin" <tintin@invalid.invalid>
Subject: Re: Open All files one by one
Message-Id: <31t883F3eererU1@individual.net>
"Billy" <bustanut2020@yahoo.com> wrote in message
news:YDaud.738441$8_6.539088@attbi_s04...
>
> All,
>
> I am looking for a way to open ALL files in a directory one by one in
> perl.
>
> I am able to open one file... read in the data and write it out to another
> file without any problems. But I have to tell the script the file I am
> opening. I would like the script to open all .txt files read out some data
> and append it to another file. The only part I am stuck on is the opening
> of
> the files without providing the filenames.
>
> I searched around and got tired of going in circles.
>
> Say I have a directory that has...
>
> bob.txt
> ted.txt
> sam.txt
> sue.txt
> index.html
>
> Is there a simple way to open all the .txt files?
Do you mean one at a time? If so, then
#!/usr/bin/perl
use strict;
foreach my $file (</path/to/dir/*>) {
open FILE, $file or die "Can not open $file $!\n";
while (<FILE>) {
print; # or whatever
}
close FILE;
}
------------------------------
Date: Fri, 10 Dec 2004 00:14:05 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: passing string to ksh with system command
Message-Id: <slrncrifld.ah2.tadmc@magna.augustmail.com>
joez3@yahoo.com <joez3@yahoo.com> wrote:
> This
> is how I have this coded right now:
> $type = "com+ app";
> system "runshell.ksh ".$item." "$type;
^^^^
^^^^
Please have the courtesy to post Real Perl Code.
> Is there a way to encase my type string in
> "".
Yes. See the "Quote and Quote-like Operators" section in
perldoc perlop
for many different ways of quoting your strings, for example:
$type = "\"com+ app\"";
or
$type = qq("com+ app");
or use single quotes for ksh
$type = "'com+ app'";
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 10 Dec 2004 12:22:43 -0600
From: Shashank Khanvilkar <shashank@mia.ece.uic.edu>
Subject: Perldoc: No documentation on perl found [newbie]
Message-Id: <cpcp7f$836$1@newsx.cc.uic.edu>
Hi,
Whenever i do
%>perldoc -f foreach
I get the following message
No documentation for perl function `foreach' found
Are there any environment variables that I need to set for perldoc to
finc the documentation? or am i doing something wrong?
ANy help appreciated.
Shashank
------------------------------
Date: 10 Dec 2004 19:31:17 +0100
From: Arndt Jonasson <do-not-use@invalid.net>
Subject: Re: Perldoc: No documentation on perl found [newbie]
Message-Id: <yzd1xdym2dm.fsf@invalid.net>
Shashank Khanvilkar <shashank@mia.ece.uic.edu> writes:
> Whenever i do
> %>perldoc -f foreach
> I get the following message
> No documentation for perl function `foreach' found
>
> Are there any environment variables that I need to set for perldoc to
> finc the documentation? or am i doing something wrong?
'foreach' is not a built-in function, so "perldoc -f" doesn't find it.
You can read about it in the syntax chapter: "perldoc perlsyn".
I don't know if there is an easy way to get there just knowing the
word "foreach".
------------------------------
Date: 10 Dec 2004 11:55:43 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Recognize directories and files.
Message-Id: <cpc2rv$ip6$1@mamenchi.zrz.TU-Berlin.DE>
Paul Lalli <mritty@gmail.com> wrote in comp.lang.perl.misc:
> "Mitchell Hulscher" <unacceptable@gmail.com> wrote in message
> news:41b8a84e$0$1257$ba620dc5@nova.planet.nl...
> > if (-d $path) {
> > push(@dirs, $path);
> > } elsif (-f $path) {
> > push(@files, $path);
> > }
>
> All well and good, but I'd probably rewrite it like so:
>
> push (-d $path ? @dirs : @files), $path));
That would be nice if it worked, but it doesn't (even with the missing
"(" added). This does:
push @{ -d $path ? \ @dirs : \ @files}, $path;
I'm not sure if this is documented, and where.
Anno
------------------------------
Date: Fri, 10 Dec 2004 13:26:10 GMT
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: Recognize directories and files.
Message-Id: <Sthud.1759$eO5.1729@trndny08>
"Anno Siegel" <anno4000@lublin.zrz.tu-berlin.de> wrote in message
news:cpc2rv$ip6$1@mamenchi.zrz.TU-Berlin.DE...
> Paul Lalli <mritty@gmail.com> wrote in comp.lang.perl.misc:
> >
> > push (-d $path ? @dirs : @files), $path));
>
> That would be nice if it worked, but it doesn't (even with the missing
> "(" added). This does:
>
> push @{ -d $path ? \ @dirs : \ @files}, $path;
>
> I'm not sure if this is documented, and where.
Ack. My mistake. I had run a quick test to verify that this worked
before posting, but my test was in error. To quickly test, I did:
push ( 1 ? @foo : @bar, 'abc');
push ( 0 ? @foo : @bar, 'xyz');
print "Foo: @foo\nBar: @bar\n";
Running that code places 'abc' in @foo and 'xyz' in @bar, as desired.
However, when I run the actual code I posted (as I should have done in
the first place), I see that it results in compilation errors. After
running my test through B::Deparse, I understand why: perl optimized
away the ? : operator due to the use of the constant values.
I apologize to the OP for being misleading in my assertions.
Paul Lalli
------------------------------
Date: Fri, 10 Dec 2004 19:46:02 +1300
From: "Tintin" <tintin@invalid.invalid>
Subject: Re: Retrieving web pages
Message-Id: <31suucF3egnvdU1@individual.net>
"Dackle" <simon.dukes@gmail.com> wrote in message
news:51f6bb21.0412091030.150bd75e@posting.google.com...
> Newbie question: I'm trying to retrieve general HTML web pages but
> running into a few problems, which in part are probably due to the
> fact that I've never used Perl modules before. I downloaded
> libwww-perl and copied LWP::Simple into the Perl lib directory.
You can't just randomly copy parts of Perl modules and hope they will work.
ActiveState Perl uses PPM to manage Perl modules. Either type 'ppm' at the
command line, or follow:
Start->Programs->ActiveState Perl->Perl Package Manager
Anyway, you don't need to install libwww as it comes standard with
ActiveState Perl.
------------------------------
Date: 10 Dec 2004 12:08:20 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Retrieving web pages
Message-Id: <cpc3jk$ip6$2@mamenchi.zrz.TU-Berlin.DE>
Tintin <tintin@invalid.invalid> wrote in comp.lang.perl.misc:
>
> "Dackle" <simon.dukes@gmail.com> wrote in message
> news:51f6bb21.0412091030.150bd75e@posting.google.com...
> > Newbie question: I'm trying to retrieve general HTML web pages but
> > running into a few problems, which in part are probably due to the
> > fact that I've never used Perl modules before. I downloaded
> > libwww-perl and copied LWP::Simple into the Perl lib directory.
>
> You can't just randomly copy parts of Perl modules and hope they will work.
You can always hope!
Anno
------------------------------
Date: 10 Dec 2004 08:16:10 -0800
From: "Dackle" <simon.dukes@gmail.com>
Subject: Re: Retrieving web pages
Message-Id: <1102695370.562393.87950@f14g2000cwb.googlegroups.com>
Thanks, I've got it running now. The error was in fact caused by
the filename in the text editor and not Perl itself. Sorry for the
confusion and the sloppiness.
------------------------------
Date: Fri, 10 Dec 2004 17:29:46 GMT
From: "VBSome" <not@home.net>
Subject: Re: Retrieving web pages
Message-Id: <e2lud.42510$Al3.29581@newssvr30.news.prodigy.com>
If all you are trying to do is navigate some web pages and look at the
results then I would suggest you use WWW::Mechanize or if on a Win32
platform Win32::IE::Mechanize (which is the same module as the first one but
uses IE as a browser). These 2 modules are much easier to use then LWP.
"Dackle" <simon.dukes@gmail.com> wrote in message
news:51f6bb21.0412091030.150bd75e@posting.google.com...
> Newbie question: I'm trying to retrieve general HTML web pages but
> running into a few problems, which in part are probably due to the
> fact that I've never used Perl modules before. I downloaded
> libwww-perl and copied LWP::Simple into the Perl lib directory, but
> I'm still having trouble grabbing web pages. I tried something like
> this:
>
>
> use LWP::Simple;
> $url="www.torontostar.com";
> $content= get($url);
>
> But I keep getting back a type 2 error saying File "internet" does
> not exist. I'm using the ActiveState port of Perl on Windows XP
> through the Crimson Editor. Any advice? Is there any other way to
> retrieve web pages using existing Perl modules?
------------------------------
Date: 10 Dec 2004 07:47:00 -0800
From: "AlamuKutty" <alamukutty@gmail.com>
Subject: Re: Using MIME::Lite for multipart message - trouble with string manipulation
Message-Id: <1102693620.686962.194180@z14g2000cwz.googlegroups.com>
I got it to work with MIME::Lite and CGI.pm . Thanks to everyone for
their patience and help!
Tintin wrote:
> <alamukutty@gmail.com> wrote in message
> news:1102606298.518074.181700@f14g2000cwb.googlegroups.com...
> > Hi,
> >
> > I am pretty new to cgi-perl and I'm trying to process a form and
> > send the email using sendmail. I figured how to send attachments
using
> > MIME::Lite and also figured how to process a form and send a plain
> > text mail like
> >
> > for each param()
> > ParamName = Param vAlue
> >
> > When I try to put the two together, I am stuck. I don't know how to
> > process strings with perl and any help will be appreciated.
> > For now, this is what I am trying and I get a server error.
> >
> > ----------------------
> >
> > #! / usr/bin/perl -w
>
> That's a might strange path to perl on your system.
>
> > use lib '/usr/lib/perl5/site_perl/5.8.0/MIME';
>
> Why? Do you have different versions of perl installed?
------------------------------
Date: Fri, 10 Dec 2004 18:09:55 GMT
From: Michael Budash <mbudash@sonic.net>
Subject: Re: Web Form search and open pdf
Message-Id: <mbudash-CA3362.10100210122004@typhoon.sonic.net>
In article <1102692163.140732.227850@f14g2000cwb.googlegroups.com>,
dbmeyers23@yahoo.com wrote:
> Thanks everyone, I have an acceptable version of this working.
> Michael Budash's suggestion of the redirection solved the problem of
> the file showing up with the name as "script.cgi" instead of "xxx.pdf".
> This also allows Macs (OS9-OSX browsers) to open the pdf's.....
>
glad to help. like i said, that method has never failed me.
--
Michael Budash
------------------------------
Date: 10 Dec 2004 07:22:43 -0800
From: dbmeyers23@yahoo.com
Subject: Re: Web Form search and open pdf
Message-Id: <1102692163.140732.227850@f14g2000cwb.googlegroups.com>
Thanks everyone, I have an acceptable version of this working.
Michael Budash's suggestion of the redirection solved the problem of
the file showing up with the name as "script.cgi" instead of "xxx.pdf".
This also allows Macs (OS9-OSX browsers) to open the pdf's.....
------------------------------
Date: 10 Dec 2004 08:29:57 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: why the following HereDoc print don't work?
Message-Id: <cpbmq5$ahf$1@mamenchi.zrz.TU-Berlin.DE>
Sherm Pendley <spamtrap@dot-app.org> wrote in comp.lang.perl.misc:
> Anno Siegel wrote:
>
> > I cannot reproduce this with v5.8.1
>
> My Perl:
>
> Sherm-Pendleys-Computer:~ sherm$ perl -v
>
> This is perl, v5.8.1-RC3 built for darwin-thread-multi-2level
> (with 1 registered patch, see perl -V for more detail)
>
> Standard factory-supplied Perl for Mac OS X "Panther".
>
> Your editor might be adding a trailing newline to text files
> automatically - quite a few can be configured to do that.
Yes, that's what was happening. Sorry -- should have checked.
With the newline actually missing I see the same effect.
> > but if it is the reason then
> > it *is* arguably a bug in (some version of) Perl. The final line
> > feed shouldn't matter.
>
> Agreed. Anyone using 5.8.6 care to comment here?
RSN...
Anno
------------------------------
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 7505
***************************************