RE: Formatting integer input: use the sprintf() in perlfunc - Perl builtin functions
whenever you need to do any special formatting like this, especially numbers, use the sprintf() in perlfunc - Perl builtin functions for your case, try this: print sprintf(%05.02f\n, 4.5 ); 04.50 Why not just use 'printf()' for this? Makes it somewhat less confusing while doing essentially the same thing in the background: printf %05.02f\n, 4.5; The difference lies in if the '$\' ($OUTPUT_RECORD_SEPERATOR) is set when you use the first example it will add an extra newline that you probably would not intend (given the \n in the format). printf() will ignore the value of $\ and format only according to your format argument. Just a suggestion. Matt -Original Message- From: Sara [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 20, 2003 1:21 PM To: beginperl Subject: Formatting integer input $one = 2.5; $two = 2; $three = $one + $two; print $three; # prints 4.5 I want 4.5 in proper format as 04.05 Any ideas? Thanks, Sara. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Counter triggered on download
On Sun, 24 Aug 2003 at 03:04, zsdc opined: z:fliptop wrote: z: z: merrill - i'm a little late on this thread, and the other suggestions are z: valid, but here's one way to serve up files w/o using a direct link by z: taking advantage of CGI.pm's header() function: z: z: my $cgi = new CGI; z: print $cgi-header('application/pdf'); z: z:Actually, it's the same as just: z: z: print Content-Type: application/pdf\n\n; z: z:CGI.pm is great but it's an overkill for just printing HTTP Content-Type z:header. that is true, however i cut the code out of a script i had handy. the params are passed in as such: /cgi-bin/mime.cgi?filename=whatevermime_type=application%02Fpdf so the full file looked something like this: use CGI; my $cgi = new CGI; my $filename = $cgi-param('filename'); my $mime_type = $cgi-param('mime_type'); print $cgi-header($mime_type); open OUT, $filename; my $buffer; while (my $read = read(OUT, $buffer, 4096)) { print $buffer; } close OUT; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Counter triggered on download
On Tue, 26 Aug 2003 at 00:31, Octavian Rasnita opined: OR:This is a pretty good method, but it is not so good because the OR:visitors won't be able to use a Download manager to download the file. OR:Or better said, they won't be able to resume the download. true, however the original poster asked how to increment a counter when a file is downloaded. they did not pose the question of how to do it *and* allow the user to use download manager or resume the download if it became interrupted. OR:I am not sure, I will be testing this soon, but maybe a solution for OR:this problem could be specifying the Content-length of this file as a OR:HTTP header. OR: OR:This way the browsers and the download managers will be able to send OR:the Range HTTP header and the web server will accept it. be sure to share your results. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Net::FTP or similar
Hello, Has anyone used Net::FTP to create a browser based FTP client? (I assume that's one use for it) I have a client that needs to let their clients transfer files to and from their server. Some of the files may be big (30-40MB) and using a regular FTP client isn't an option, unfortunately. I'm interested to hear peoples experience or suggestions. Andrew -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Installing/Uninstalling CPAN modules
This may be the wrong forum to ask this... How do I uninstall a module downloaded from CPAN? Specifically, I cannot get the DBD::MySQL driver to install under OS X. It refuses to find the mysql_config file, and when I run Makefile again with the -L and -I switches it won't work after install. I am running the Complete MySQL distribution which has worked before, but since this installs into /usr/Library and not /usr/local, I am wondering if the module ignores symlinks to /usr/local. Hence I want to pull everything out and reload the MySQL AB distribution and try again. A quick search shows DBD in dozens of places, in perl/ in DBI/ in mySQL/ etc etc, which ones do I trash? Dave -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Net::FTP or similar
On Tue, 26 Aug 2003 15:06:08 -0400, Andrew Brosnan [EMAIL PROTECTED] wrote: Hello, Has anyone used Net::FTP to create a browser based FTP client? (I assume that's one use for it) I have a client that needs to let their clients transfer files to and from their server. Some of the files may be big (30-40MB) and using a regular FTP client isn't an option, unfortunately. I'm interested to hear peoples experience or suggestions. I am not sure I take your meaning?? I have used CGI to allow someone to upload files, and I have used Net::FTP to transfer files between servers, but I am not sure I know what you mean by a browser based FTP client. Presumably you have a web server at your disposal which can take uploads, but then I am at a loss as to why you need FTP? If you mean to act as a proxy, so the file gets transferred to the web server, and then routed from there somewhere else, then basically you have a proxy and the underlying technology could be anything that allows file transfers, aka SSH, NFS, FTP, etc. But at that point the technologies are in effect not linked, so you would be better off dividing the tasks. In other words, have a CGI that just stores a file locally, then have another process watch/poll/scheduled to check for new uploads, in the event one exists, then do whatever it is you do when a new file is present, if that is FTP so be it. The one problem I can definitely see you running into, especially based on the file size you mentioned, is timeouts both on the server and client side. There is also another HTTP protocol request type specifically for this, but I can't remember what it is right now (because it is almost never used for anything...) that essentially just allows a file to be stored to the server, but yikes Unless you mean something along the lines of Mozilla and XPI? But then you are talking about Net::FTP installed on the client side... http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Installing/Uninstalling CPAN modules
You may have better luck in the [EMAIL PROTECTED] list since OS X likes to do all kinds of weird things with its Perl, and with regards to DBI/DBD in [EMAIL PROTECTED] Typically removing a Perl module is not as easy as installing them, removing the associated files is only one step... Sorry I can't provide specifics I haven't tried this and don't have my PB with me http://danconia.org Thanks for that macosx link, that list passed me by somehow. I will ask there. Dave -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Installing/Uninstalling CPAN modules
On Tue, 26 Aug 2003 19:20:03 +, Greenhalgh David [EMAIL PROTECTED] wrote: This may be the wrong forum to ask this... How do I uninstall a module downloaded from CPAN? Specifically, I cannot get the DBD::MySQL driver to install under OS X. It refuses to find the mysql_config file, and when I run Makefile again with the -L and -I switches it won't work after install. I am running the Complete MySQL distribution which has worked before, but since this installs into /usr/Library and not /usr/local, I am wondering if the module ignores symlinks to /usr/local. Hence I want to pull everything out and reload the MySQL AB distribution and try again. A quick search shows DBD in dozens of places, in perl/ in DBI/ in mySQL/ etc etc, which ones do I trash? You may have better luck in the [EMAIL PROTECTED] list since OS X likes to do all kinds of weird things with its Perl, and with regards to DBI/DBD in [EMAIL PROTECTED] Typically removing a Perl module is not as easy as installing them, removing the associated files is only one step... Sorry I can't provide specifics I haven't tried this and don't have my PB with me http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]