From roberthpike at yahoo.com Wed Jan 9 06:46:24 2008 From: roberthpike at yahoo.com (Robert Pike) Date: Wed, 9 Jan 2008 06:46:24 -0800 (PST) Subject: [kw-pm] Question regarding uploading file(s) Message-ID: <30652.51658.qm@web58703.mail.re1.yahoo.com> Hi all, Hopefully a quick question: has anyone written or familar with writing CGI script(s) (in Perl) to accept uploaded files? I've been trying to use the CGI module but it looks as though on the ->import("filename") line is seems to stop at that point and not process any further. Any ehlp would be much appreciated. Here's a tim... I mean tidbit with a rough outline of what I'm trying. Rob our $query = new CGI; ... ... $imgKey = "uplImg1"; $uploadFile = $query->upload($imgKey); #*** prints here do not get reached *** open UPLOADFILE, ">$defaultdir/uploads/$imgKey" or die "Can't open the destination file"; binmode UPLOADFILE; while ( <$uploadFile> ) { print UPLOADFILE; } close UPLOADFILE; ____________________________________________________________________________________ Looking for last minute shopping deals? Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping From abez at abez.ca Wed Jan 9 08:07:35 2008 From: abez at abez.ca (abez) Date: Wed, 09 Jan 2008 11:07:35 -0500 Subject: [kw-pm] Question regarding uploading file(s) In-Reply-To: <30652.51658.qm@web58703.mail.re1.yahoo.com> References: <30652.51658.qm@web58703.mail.re1.yahoo.com> Message-ID: <4784F147.1090601@abez.ca> From perldoc CGI: To be safe, use the upload() function (new in version 2.47). When called with the name of an upload field, upload() returns a filehandle, or undef if the parameter is not a valid filehandle. $fh = upload(?uploaded_file?); while (<$fh>) { print; } In an list context, upload() will return an array of filehandles. This makes it possible to create forms that use the same name for multiple upload fields. It is returning a file handle, not a file name. perldoc CGI http://perldoc.perl.org/CGI.html abram Robert Pike wrote: > Hi all, > Hopefully a quick question: has anyone written or > familar with writing CGI script(s) (in Perl) to accept > uploaded files? I've been trying to use the CGI module > but it looks as though on the Handle>->import("filename") line is seems to stop at > that point and not process any further. Any ehlp would > be much appreciated. Here's a tim... I mean tidbit > with a rough outline of what I'm trying. > > Rob > > our $query = new CGI; > ... > ... > $imgKey = "uplImg1"; > $uploadFile = $query->upload($imgKey); > #*** prints here do not get reached *** > open UPLOADFILE, ">$defaultdir/uploads/$imgKey" or die > "Can't open the destination file"; > binmode UPLOADFILE; > while ( <$uploadFile> ) { > print UPLOADFILE; > } > close UPLOADFILE; > > > ____________________________________________________________________________________ > Looking for last minute shopping deals? > Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping > _______________________________________________ > kw-pm mailing list > kw-pm at pm.org > http://mail.pm.org/mailman/listinfo/kw-pm > > > ** ACCEPT: CRM114 PASS osb unique microgroom Matcher ** > CLASSIFY succeeds; success probability: 1.0000 pR: 24.1521 > Best match to file #0 (/home/abez/crm/nonspam.css) prob: 1.0000 pR: 24.1521 > Total features in input file: 3236 > #0 (/home/abez/crm/nonspam.css): features: 663445, hits: 18615534, prob: 1.00e+00, pR: 24.15 > #1 (/home/abez/crm/spam.css): features: 8585329, hits: 11210305, prob: 7.05e-25, pR: -24.15 > -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 252 bytes Desc: not available Url : http://mail.pm.org/pipermail/kw-pm/attachments/20080109/e3ac6d1a/attachment.bin -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 252 bytes Desc: OpenPGP digital signature Url : http://mail.pm.org/pipermail/kw-pm/attachments/20080109/e3ac6d1a/attachment-0001.bin From abez at abez.ca Wed Jan 9 13:25:16 2008 From: abez at abez.ca (abez) Date: Wed, 09 Jan 2008 16:25:16 -0500 Subject: [kw-pm] Question regarding uploading file(s) In-Reply-To: <449737.96498.qm@web58711.mail.re1.yahoo.com> References: <449737.96498.qm@web58711.mail.re1.yahoo.com> Message-ID: <47853BBC.5000100@abez.ca> Read the CGI perldoc and look for multipart form, your submitting form must be multipart (see the CGI perldoc) and have to send it correctly. If the file was sent properly and you are capable of writing files with that account it will work. abram Robert Pike wrote: > Abez, > Hopefully a quick one. I tried doing what was > suggested in the posts I got off the web and one thing > fails to work. When I try uploading jpgs I can't open > the copy that was uploaded (gives an error about > improper format or something similar to that). In the > examples off the web it says to upload(filename) and > then read that file in and write it in binmode. Any > ideas? Thanks again. > > Rob > --- abez wrote: > >> From perldoc CGI: >> >> To be safe, use the upload() function (new in >> version 2.47). When called >> with the name of an upload field, upload() returns a >> filehandle, or >> undef if the parameter is not a valid filehandle. >> >> $fh = upload(???uploaded_file???); >> while (<$fh>) { >> print; >> } >> >> In an list context, upload() will return an >> array of filehandles. >> This makes it possible to create forms that use the >> same name for >> multiple upload fields. >> >> It is returning a file handle, not a file name. >> >> perldoc CGI http://perldoc.perl.org/CGI.html >> >> abram >> >> Robert Pike wrote: >>> Hi all, >>> Hopefully a quick question: has anyone written >> or >>> familar with writing CGI script(s) (in Perl) to >> accept >>> uploaded files? I've been trying to use the CGI >> module >>> but it looks as though on the >> Handle>->import("filename") line is seems to stop >> at >>> that point and not process any further. Any ehlp >> would >>> be much appreciated. Here's a tim... I mean tidbit >>> with a rough outline of what I'm trying. >>> >>> Rob >>> >>> our $query = new CGI; >>> ... >>> ... >>> $imgKey = "uplImg1"; >>> $uploadFile = $query->upload($imgKey); >>> #*** prints here do not get reached *** >>> open UPLOADFILE, ">$defaultdir/uploads/$imgKey" or >> die >>> "Can't open the destination file"; >>> binmode UPLOADFILE; >>> while ( <$uploadFile> ) { >>> print UPLOADFILE; >>> } >>> close UPLOADFILE; >>> >>> >>> > ____________________________________________________________________________________ >>> Looking for last minute shopping deals? >>> Find them fast with Yahoo! Search. > http://tools.search.yahoo.com/newsearch/category.php?category=shopping >>> _______________________________________________ >>> kw-pm mailing list >>> kw-pm at pm.org >>> http://mail.pm.org/mailman/listinfo/kw-pm >>> >>> >>> ** ACCEPT: CRM114 PASS osb unique microgroom >> Matcher ** >>> CLASSIFY succeeds; success probability: 1.0000 >> pR: 24.1521 >>> Best match to file #0 (/home/abez/crm/nonspam.css) >> prob: 1.0000 pR: 24.1521 >>> Total features in input file: 3236 >>> #0 (/home/abez/crm/nonspam.css): features: 663445, >> hits: 18615534, prob: 1.00e+00, pR: 24.15 >>> #1 (/home/abez/crm/spam.css): features: 8585329, >> hits: 11210305, prob: 7.05e-25, pR: -24.15 >>> >> >> >>> _______________________________________________ >> kw-pm mailing list >> kw-pm at pm.org >> http://mail.pm.org/mailman/listinfo/kw-pm > > > > ____________________________________________________________________________________ > Be a better friend, newshound, and > know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ > > > ** ACCEPT: CRM114 PASS osb unique microgroom Matcher ** > CLASSIFY succeeds; success probability: 1.0000 pR: 23.2914 > Best match to file #0 (/home/abez/crm/nonspam.css) prob: 1.0000 pR: 23.2914 > Total features in input file: 5316 > #0 (/home/abez/crm/nonspam.css): features: 663445, hits: 31300778, prob: 1.00e+00, pR: 23.29 > #1 (/home/abez/crm/spam.css): features: 8585329, hits: 16636278, prob: 5.11e-24, pR: -23.29 > -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 252 bytes Desc: OpenPGP digital signature Url : http://mail.pm.org/pipermail/kw-pm/attachments/20080109/0338192b/attachment.bin From daniel at coder.com Tue Jan 15 10:33:11 2008 From: daniel at coder.com (Daniel R. Allen) Date: Tue, 15 Jan 2008 13:33:11 -0500 (EST) Subject: [kw-pm] January's Meeting Postponed Message-ID: I apparently sent this to myself instead of the list. The appropriate people have been sacked. -D ---------- Forwarded message ---------- Date: Fri, 11 Jan 2008 16:16:39 -0500 (EST) From: Daniel R. Allen Subject: January's Meeting Postponed We lack a topic for the January 'mongers Meeting next Thursday, so consensus is we're gonna defer until February. You can partly blame http://www.addictinggames.com/gimmefrictionbaby.html for our attentions elsewhere. ;) We're talking in the IRC channel about having "Return of perlski" an evening later in the month, possibly the first Tuesday after we get serious snow again. Chicopee has a cheap Tuesdays deal; the lift ticket costs $10.25 for all-day 'till 9:30pm. Watch this space for details. In the meantime, have you learned something cool and perlish and feel like presenting in February or March? Or do any of the topics on http://kw.pm.org/wiki/index.cgi?MeetingTopics sound exciting to you? Give a shout if there's something you want to see presented and we'll do our best. -Daniel From daniel at coder.com Fri Jan 18 12:14:28 2008 From: daniel at coder.com (Daniel R. Allen) Date: Fri, 18 Jan 2008 15:14:28 -0500 (EST) Subject: [kw-pm] PerlSki: Tuesday the 22nd? Message-ID: Who's up for an evening PerlSki at Chicopee next Tuesday? Lift tickets are cheap on Tuesdays, $10.75 [1] for all-day. Rentals are $22 for 2h, $27 for 4h [2] I'm planning to drive down at around 5pm and stay till closing or so (9:30pm). -Daniel [1] http://www.davefm.com/station/cares.cfm?REM=95153 [2] http://www.skichicopee.com/rates.html From matt at sergeant.org Fri Jan 18 12:23:19 2008 From: matt at sergeant.org (Matt Sergeant) Date: Fri, 18 Jan 2008 15:23:19 -0500 Subject: [kw-pm] PerlSki: Tuesday the 22nd? In-Reply-To: References: Message-ID: <91B957B4-7442-40EF-BFB4-F672F4514059@sergeant.org> And beers after! The bar there generally stays open until 10:30 or 11. On 18-Jan-08, at 3:14 PM, Daniel R. Allen wrote: > Who's up for an evening PerlSki at Chicopee next Tuesday? > > Lift tickets are cheap on Tuesdays, $10.75 [1] for all-day. > Rentals are $22 for 2h, $27 for 4h [2] > > I'm planning to drive down at around 5pm and stay till closing or so > (9:30pm). > > -Daniel > > [1] http://www.davefm.com/station/cares.cfm?REM=95153 > [2] http://www.skichicopee.com/rates.html > > > > _______________________________________________ > kw-pm mailing list > kw-pm at pm.org > http://mail.pm.org/mailman/listinfo/kw-pm > From da at coder.com Fri Jan 18 12:33:19 2008 From: da at coder.com (Daniel R. Allen) Date: Fri, 18 Jan 2008 15:33:19 -0500 (EST) Subject: [kw-pm] PerlSki: Tuesday the 22nd? In-Reply-To: <91B957B4-7442-40EF-BFB4-F672F4514059@sergeant.org> Message-ID: Sounds like a plan! On Fri, 18 Jan 2008, Matt Sergeant wrote: > And beers after! The bar there generally stays open until 10:30 or 11. From roberthpike at yahoo.com Thu Jan 31 08:44:59 2008 From: roberthpike at yahoo.com (Robert Pike) Date: Thu, 31 Jan 2008 08:44:59 -0800 (PST) Subject: [kw-pm] Date Difference Question Message-ID: <542099.21176.qm@web58702.mail.re1.yahoo.com> Hi All, What's the easiest/best way to find the difference (in days) between 2 dates? I'm basically looking for the difference between a varying date and Jan 1, 1968. Appreciate any helpful info. Rob ____________________________________________________________________________________ Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ From matt at sergeant.org Thu Jan 31 08:58:56 2008 From: matt at sergeant.org (Matt Sergeant) Date: Thu, 31 Jan 2008 11:58:56 -0500 Subject: [kw-pm] Date Difference Question In-Reply-To: <542099.21176.qm@web58702.mail.re1.yahoo.com> References: <542099.21176.qm@web58702.mail.re1.yahoo.com> Message-ID: On 31-Jan-08, at 11:44 AM, Robert Pike wrote: > Hi All, > What's the easiest/best way to find the difference > (in days) between 2 dates? I'm basically looking for > the difference between a varying date and Jan 1, 1968. > Appreciate any helpful info. Either Time::Piece (part of perl 5.10) or DateTime. Both can do date differences.