Re: Send authenticated mail with MIME::Lite

2005-11-10 Thread Mark Wheeler

Hi Brian,

Yes, I did that, but mail is still not going through.

Does anyone know what happens to the mail when it is doesn't go 
through?


Thanks,

Mark

On Nov 10, 2005, at 6:39 AM, brian pink wrote:

the easiest fix for this issue is to go to the SBC DSL site and file the
request to have the ports unblocked for your account. =) it takes about
a day for them to open them up, and it's just a simple web form to fill
out.

- brian



Re: Send authenticated mail with MIME::Lite

2005-11-10 Thread Mark Wheeler
OK Well... I checked out another part of my setup, namely PostFix 
Enabler, which I used to set things up to send out mail. I added the 
SBC smtp server, login, and password and bingo! Mail is going through 
again. So apparently, I don't have to do the authentication through my 
script, but just set it up though postfix. Thanks again for all you 
help. I will check out Mail::Sender, though. Looks interesting. Thanks 
again.


Mark


On Nov 10, 2005, at 8:58 AM, Daniel T. Staal wrote:

On Thu, November 10, 2005 11:43 am, Mark Wheeler said:

Hi Brian,

Yes, I did that, but mail is still not going through.

Does anyone know what happens to the mail when it is doesn't go
through?


In theory it should keep trying until the timeout period expires, which 
is

normally set for around 3 days on SMTP servers.  After that, an error
should be bounced back saying it didn't go through.  Some servers will
send a message earlier (commonly at the end of 12/24 hours), confirming
that they are still trying.

That assumes everyone is playing nice.  If someone is blocking selected
SMTP connections, they are already not playing nice.  They could fake an
acceptance and just drop the message, or do something else...

And, this assumes you've actually got it to the SMTP transport on your
end.  ;)

Daniel T. Staal

---
This email copyright the author.  Unless otherwise noted, you
are expressly allowed to retransmit, quote, or otherwise use
the contents for non-commercial purposes.  This copyright will
expire 5 years after the author's death, or in 30 years,
whichever is longer, unless such a period is in excess of
local copyright law.
---



Send authenticated mail with MIME::Lite

2005-11-09 Thread Mark Wheeler

Hi all,

Just a quick question. I've been using MIME::Lite to send emails from 
my home computer as I am running a server there. But I recently 
switched to DSL with SBC/Yahoo and they are blocking port 25. My mail 
suddenly stopped going through. I've opted out of that, thinking that 
was the problem, as they give you the option, but that didn't seem to 
help. No mail is being sent from my cgi script. So I am wondering if 
there is a way to send authenticated mail with MIME::Lite. I've read 
the examples and docs regarding MIME::Lite and sending authenticated 
mail, but can't seem to make heads or tails about it. Does any one have 
an idea of how to do that? Any help would be appreciated.


Thanks,

Mark



Re: Send authenticated mail with MIME::Lite

2005-11-09 Thread Mark Wheeler

Hi Sherm,

Yes, I saw that (although I didn't try it), but mail can't be sent 
unless I authenticate it with my userid and password. I read something 
about being able to do that with NET::SMTP. Perhaps having MIME::Lite 
prepare the message, and haveing NET::SMTP sending it. But again, I'm 
at a loss of how to do that. Any ideas?


Thanks,

Mark

On Nov 9, 2005, at 8:42 PM, Sherm Pendley wrote:

On Nov 9, 2005, at 11:30 PM, Mark Wheeler wrote:

Just a quick question. I've been using MIME::Lite to send emails from 
my home computer as I am running a server there. But I recently 
switched to DSL with SBC/Yahoo and they are blocking port 25. My mail 
suddenly stopped going through. I've opted out of that, thinking that 
was the problem, as they give you the option, but that didn't seem to 
help. No mail is being sent from my cgi script. So I am wondering if 
there is a way to send authenticated mail with MIME::Lite. I've read 
the examples and docs regarding MIME::Lite and sending authenticated 
mail, but can't seem to make heads or tails about it. Does any one 
have an idea of how to do that? Any help would be appreciated.


Here's an example, taken from the MIME::Lite docs:

### Do something like this in your 'main':
if ($I_DONT_HAVE_SENDMAIL) {
MIME::Lite-send('smtp', smtp.myisp.net, Timeout=60);
}

### Now this will do the right thing:
$msg-send; ### will now use Net::SMTP as shown above

If that doesn't work for you, one possible cause is that your ISP may 
be restricting outgoing email based on the From: header, to help cut 
down on spoofing. The ISPs that do this tend to allow you to opt out, 
because there are lots of valid reasons why you might want to use a 
different return address.


sherm--

Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org



Flat file being Scrambled

2005-06-15 Thread Mark Wheeler

Hi,

Here's a quick question. This doesn't have anything to do with perl on 
my mac, but just a perl question. I have a a small script that simply 
increases a number by 1, when it is run, then writes the changes back 
to the file. I am using it to check how many people come to the site by 
way of an email. Everything seemed to work fine until I got here this 
morning and the file was only left with 1 row of 1 number verses 2 rows 
of 10 numbers each.


Here is what the file should look like

(The zeros would not necessarily be zeros, but could be any number.
0:0:0:0:0:0:0:0:0:0
0:0:0:0:0:0:0:0:0:0

What I have found is that when I click at a normal pace, everything 
works fine, BUT... when I click the reload button unmercifully, the 
data file gets rewritten to look like the following:


0 (or some other number - less then what it was previously)

That's it! everything else is gone. Is is possible that if there are so 
many hits that it can't keep up with the opening and writing of the 
file? This simple database is potentially being alter by 2 million 
people, as the email went out to that many people.


Any help would be greatly appreciated. Below is the script.

Thanks,

Mark Wheler


Here is the script:
--

#!/usr/local/bin/perl -w

#===
# format for ab variable in html email:
#
# control(0)/test(1):week(1-10)
#
# So 0:5 would be control group, week 5 and 1:9 would be
# test group, week 9
#===

use strict;
use CGI ':standard';

if (!-e blastinfo-test.txt) { # Create blastinfo-test.txt file in not 
in place

 open (FILE,  blastinfo-test.txt) || die (Cannot open file);
 flock (FILE, 2);
 print FILE 0:0:0:0:0:0:0:0:0:0\n0:0:0:0:0:0:0:0:0:0;
 close (FILE);
}

#===
# Set and get variables
#===

my $pathtolandingpage='../email_blasts/carnival/carnival1.html';
my $pathtodatafile='blastinfo-test.txt';

my @blasts_split;
my $ab = param('ab');
my @ab_split = split(/:/, $ab);

$ab_split[1]--;

#my $anchor = param('anchor');

open (FILE,  $pathtodatafile) || die $!;
flock (FILE, 2);
my @blasts = FILE;
close (FILE);

if ($ab_split[0] eq 0) {
 chomp($blasts[0]);
 @blasts_split = split(/:/, $blasts[0]);
 $blasts_split[$ab_split[1]]++;
 $blasts[0] = join(:, @blasts_split).\n;
} else {
 @blasts_split = split(/:/, $blasts[1]);
 $blasts_split[$ab_split[1]]++;
 $blasts[1] = join(:, @blasts_split);
}

#
# Write changes back to file
#

open (FILE,  $pathtodatafile) || die (Cannot open file);
flock (FILE, 2);
print FILE @blasts;
close (FILE);

#
# Send to landing page at correct anchor
#

print Location: $pathtolandingpage\n\n;
exit;

--



Re: Flat file being Scrambled

2005-06-15 Thread Mark Wheeler

Hi,

Sorry, I don't understand. What's my breakage? Should I not use flock?

Thanks,

Mark


Mark open (FILE,  $pathtodatafile) || die (Cannot open file);
Mark flock (FILE, 2);

0wn3d!

That's your breakage.

Once in a blue mooon, you'll kill your entire data this way



OT-good DEDICATED hosting service

2005-06-10 Thread Mark Wheeler

Hi,

Sorry if this is off topic, but I need to move a shared account to a 
dedicated account, but picking a new host provider is a need in a 
haystack. So I ask, where is a good place to go for a DEDICATED server 
hosting package? What are your good experiences?


Thanks,

Mark



Re: OT-good DEDICATED hosting service

2005-06-10 Thread Mark Wheeler
Thank you all very much. I'll check into all of them. I'm sure I'll 
find one that is exactly what I am looking for.


Mark

On Jun 10, 2005, at 4:08 PM, Ian Ragsdale wrote:

I've had very good experience with Rackspace.  They have incredible 
customer service, but they have a pretty high price to match.  I've 
also had good luck with Pair.com.


Ian

On Jun 10, 2005, at 5:58 PM, Mark Wheeler wrote:


Hi,

Sorry if this is off topic, but I need to move a shared account to a 
dedicated account, but picking a new host provider is a need in a 
haystack. So I ask, where is a good place to go for a DEDICATED server 
hosting package? What are your good experiences?


Thanks,

Mark





Re: Location redirect question [SOLVED]

2005-06-02 Thread Mark Wheeler

Hi all,

Thanks for all your input. What I decided to do was put up a page that 
had links to download each of the two files. That is working great. I 
remember doing the onLoad thing before, too. That also works great.


Thanks again,

Mark



Re: Mac::Glue script

2005-04-28 Thread Mark Wheeler
Hi all,
OK, I installed Xcode - 1.1 then upgraded to 1.5, and ran the cpan  
Mac::Glue again and still had problems. Here are snipits of the the  
output:


Removing previously used /Users/markwhee/.cpan/build/Mac-Glue-1.23
  CPAN.pm: Going to build C/CN/CNANDOR/Mac-Glue-1.23.tar.gz
Checking if your kit is complete...
Looks good
Warning: prerequisite MLDBM 0 not found.
Warning: prerequisite Mac::AppleEvents 1.3 not found.
Warning: prerequisite Mac::AppleEvents::Simple 1.14 not found.
Warning: prerequisite Mac::Apps::Launch 1.9 not found.
Warning: prerequisite Mac::Errors 0.91 not found.
Warning: prerequisite Mac::Files 1.09 not found.
Warning: prerequisite Mac::Processes 1.04 not found.
Warning: prerequisite Time::Epoch 0.02 not found.
Writing Makefile for Mac::Glue
 Unsatisfied dependencies detected during  
[C/CN/CNANDOR/Mac-Glue-1.23.tar.gz] -
Mac::AppleEvents
Time::Epoch
Mac::Processes
Mac::Errors
Mac::Apps::Launch
Mac::Files
MLDBM
Mac::AppleEvents::Simple
Shall I follow them and prepend them to the queue
of modules we are processing right now? [yes] yes
Running make test
  Delayed until after prerequisites
Running make install
  Delayed until after prerequisites
Running install for module Mac::AppleEvents
Running make for C/CN/CNANDOR/Mac-Carbon-0.72.tar.gz
Checksum for  
/Users/markwhee/.cpan/sources/authors/id/C/CN/CNANDOR/Mac-Carbon 
-0.72.tar.gz ok
.
.
(lists contents of Mac-Carbon)
.
.

---
It continues on for a while installing modules (presumably) and then  
gives this final output:

---
Running make for C/CN/CNANDOR/Mac-Glue-1.23.tar.gz
  Is already unwrapped into directory  
/Users/markwhee/.cpan/build/Mac-Glue-1.23

  CPAN.pm: Going to build C/CN/CNANDOR/Mac-Glue-1.23.tar.gz
-- NOT OK
Running make test
  Can't test without successful make
Running make install
  make had returned bad status, install seems impossible
---
There seems to be a lot of:
Running make test
  Can't test without successful make
Running make install
  make had returned bad status, install seems impossible
throughout the whole process. I must be missing something. Does anyone  
have any ideas?

Thanks,
Mark


Re: Mac::Glue script

2005-04-28 Thread Mark Wheeler
Beautiful. I'll give it a try.
Thanks,
Mark
At 4:19 PM -0700 4/28/05, Mark Wheeler wrote:
And if so, how do I reconfigure CPAN?
cpan o conf init
-Jeff Lowrey


Re: Mac::Glue script

2005-04-28 Thread Mark Wheeler
On Apr 28, 2005, at 4:46 PM, Mark Wheeler wrote:
At 4:19 PM -0700 4/28/05, Mark Wheeler wrote:
And if so, how do I reconfigure CPAN?
cpan o conf init
---
Ok... I tried that, and got the following:
Mark-Wheelers-Computer:~ markwhee$ cpan o conf init
CPAN: Storable loaded ok
Going to read /Users/markwhee/.cpan/Metadata
  Database was generated on Tue, 26 Apr 2005 23:56:03 GMT
LWP not available
CPAN: Net::FTP loaded ok
Fetching with Net::FTP:
  ftp://ftp.perl.org/pub/CPAN/authors/01mailrc.txt.gz
Going to read /Users/markwhee/.cpan/sources/authors/01mailrc.txt.gz
LWP not available
Fetching with Net::FTP:
  ftp://ftp.perl.org/pub/CPAN/modules/02packages.details.txt.gz
Going to read 
/Users/markwhee/.cpan/sources/modules/02packages.details.txt.gz
  Database was generated on Thu, 28 Apr 2005 21:56:07 GMT
  HTTP::Date not available
LWP not available
Fetching with Net::FTP:
  ftp://ftp.perl.org/pub/CPAN/modules/03modlist.data.gz
Going to read /Users/markwhee/.cpan/sources/modules/03modlist.data.gz
Going to write /Users/markwhee/.cpan/Metadata
Warning: Cannot install o, don't know what it is.
Try the command

i /o/
to find objects with matching identifiers.
Warning: Cannot install conf, don't know what it is.
Try the command
i /conf/
to find objects with matching identifiers.
Warning: Cannot install init, don't know what it is.
Try the command
i /init/
to find objects with matching identifiers.
Mark-Wheelers-Computer:~ markwhee$
---
This is getting frustrating. I'll look at your other suggestions, too.
Mark


Re: Mac::Glue script

2005-04-28 Thread Mark Wheeler
Ok.. I think I got it. I needed to be in the CPAN shell first then do  
o conf init:

cpan o conf init
I let it do the auto config then got out of the shell. and sudo cpan to  
get back in. Then in the cpan shell, did:

cpan install Mac::Glue
That seemed to do the trick. It took much longer, as it was installing  
all the prerequs then finally I go this output at the end of it all:


Running make for C/CN/CNANDOR/Mac-Glue-1.23.tar.gz
  Is already unwrapped into directory  
/Users/markwhee/.cpan/build/Mac-Glue-1.23

  CPAN.pm: Going to build C/CN/CNANDOR/Mac-Glue-1.23.tar.gz
cp lib/Mac/AETE/Parser.pm blib/lib/Mac/AETE/Parser.pm
cp lib/Mac/AETE/Format/Converter.pm  
blib/lib/Mac/AETE/Format/Converter.pm
cp lib/Mac/AETE/Format/Glue.pm blib/lib/Mac/AETE/Format/Glue.pm
cp lib/Mac/Glue/Common.pm blib/lib/Mac/Glue/Common.pm
cp Glue.pm blib/lib/Mac/Glue.pm
cp lib/Mac/AETE/Format/Dictionary.pm  
blib/lib/Mac/AETE/Format/Dictionary.pm
cp lib/Mac/AETE/Dialect.pm blib/lib/Mac/AETE/Dialect.pm
cp lib/Mac/AETE/App.pm blib/lib/Mac/AETE/App.pm
/usr/bin/perl -Iblib/arch -Iblib/lib scripts/gluemac.PL  
scripts/gluemac
Extracting gluemac (with variable substitutions)
cp scripts/gluemac blib/script/gluemac
/usr/bin/perl -MExtUtils::MY -e MY-fixin(shift) blib/script/gluemac
/usr/bin/perl -Iblib/arch -Iblib/lib scripts/gluedialect.PL  
scripts/gluedialect
Extracting gluedialect (with variable substitutions)
cp scripts/gluedialect blib/script/gluedialect
/usr/bin/perl -MExtUtils::MY -e MY-fixin(shift)  
blib/script/gluedialect
/usr/bin/perl -Iblib/arch -Iblib/lib scripts/glueedit.PL  
scripts/glueedit
Extracting glueedit (with variable substitutions)
cp scripts/glueedit blib/script/glueedit
/usr/bin/perl -MExtUtils::MY -e MY-fixin(shift)  
blib/script/glueedit
/usr/bin/perl -Iblib/arch -Iblib/lib scripts/gluedoc.PL  
scripts/gluedoc
Extracting gluedoc (with variable substitutions)
cp scripts/gluedoc blib/script/gluedoc
/usr/bin/perl -MExtUtils::MY -e MY-fixin(shift) blib/script/gluedoc
/usr/bin/perl -Iblib/arch -Iblib/lib scripts/gluescriptadds.PL  
scripts/gluescriptadds
Extracting gluescriptadds (with variable substitutions)
cp scripts/gluescriptadds blib/script/gluescriptadds
/usr/bin/perl -MExtUtils::MY -e MY-fixin(shift)  
blib/script/gluescriptadds
Manifying blib/man3/Mac::AETE::App.3pm
Manifying blib/man3/Mac::Glue.3pm
Manifying blib/man3/Mac::AETE::Dialect.3pm
Manifying blib/man3/Mac::AETE::Format::Glue.3pm
Manifying blib/man3/Mac::AETE::Parser.3pm
Created and installed Dialect glue for AppleScript.rsrc (AppleScript)
Created and installed Addition glue for StandardAdditions.osax  
(StandardAdditions)
Created and installed Addition glue for Digital Hub Scripting.osax  
(Digital_Hub_Scripting)
Created and installed App glue for Finder.app, v10.3.2 (Finder)
Created and installed App glue for System Events.app, v1.2.1  
(System_Events)
Created and installed App glue for Keychain Scripting.app  
(Keychain_Scripting)
Created and installed App glue for FontSyncScripting.app, v2.0d1  
(FontSyncScripting)
Created and installed App glue for Image Events.app, v1.0 (Image_Events)
Created and installed App glue for ColorSyncScripting.app  
(ColorSyncScripting)
Created and installed App glue for URL Access Scripting.app  
(URL_Access_Scripting)
Created and installed App glue for Image Capture Scripting.app  
(Image_Capture_Scripting)
  /usr/bin/make  -- OK
Running make test
PERL_DL_NONLAZY=1 /usr/bin/perl -MExtUtils::Command::MM -e  
test_harness(0, 'blib/lib', 'blib/arch') t/*.t
t/glueok
t/pod.skipped
all skipped: Test::Pod v0.95 required for testing POD
All tests successful, 1 test skipped.
Files=2, Tests=3,  3 wallclock secs ( 2.22 cusr +  0.42 csys =  2.64  
CPU)
  /usr/bin/make test -- OK
Running make install
Installing /Library/Perl/5.8.1/Mac/Glue.pm
Installing /Library/Perl/5.8.1/Mac/AETE/App.pm
Installing /Library/Perl/5.8.1/Mac/AETE/Dialect.pm
Installing /Library/Perl/5.8.1/Mac/AETE/Parser.pm
Installing /Library/Perl/5.8.1/Mac/AETE/Format/Converter.pm
Installing /Library/Perl/5.8.1/Mac/AETE/Format/Dictionary.pm
Installing /Library/Perl/5.8.1/Mac/AETE/Format/Glue.pm
Installing /Library/Perl/5.8.1/Mac/Glue/Common.pm
Installing /Library/Perl/5.8.1/Mac/Glue/glues/ColorSyncScripting
Installing /Library/Perl/5.8.1/Mac/Glue/glues/ColorSyncScripting.pod
Installing /Library/Perl/5.8.1/Mac/Glue/glues/Finder
Installing /Library/Perl/5.8.1/Mac/Glue/glues/Finder.pod
Installing /Library/Perl/5.8.1/Mac/Glue/glues/FontSyncScripting
Installing /Library/Perl/5.8.1/Mac/Glue/glues/FontSyncScripting.pod
Installing /Library/Perl/5.8.1/Mac/Glue/glues/Image_Capture_Scripting
Installing  
/Library/Perl/5.8.1/Mac/Glue/glues/Image_Capture_Scripting.pod
Installing /Library/Perl/5.8.1/Mac/Glue/glues/Image_Events
Installing /Library/Perl/5.8.1/Mac/Glue/glues/Image_Events.pod
Installing /Library/Perl/5.8.1/Mac/Glue/glues/Keychain_Scripting
Installing 

Re: Mac::Glue script

2005-04-27 Thread Mark Wheeler
Hi Chris,
I tried to install Mac::Glue and received an error. Here is the command  
I used:
cpan Mac::Glue

It looks like the cpan module initialiezed:
/Users/markwhee/.cpan/CPAN/MyConfig.pm initialized.
and then gave me the option for manual or auto configuration. I chose  
auto, as I am not familiar with this process. I've never installed a  
module using cpan before and thought I'd give it a try.

After automatically entering in info, it tried to download and install  
Mac::Glue. Here is the terminal output of that.
 
---
Running install for module Mac::Glue
Running make for C/CN/CNANDOR/Mac-Glue-1.23.tar.gz
LWP not available
Fetching with Net::FTP:
   
ftp://ftp.perl.org/pub/CPAN/authors/id/C/CN/CNANDOR/Mac-Glue 
-1.23.tar.gz
CPAN: Digest::MD5 loaded ok
LWP not available
Fetching with Net::FTP:
  ftp://ftp.perl.org/pub/CPAN/authors/id/C/CN/CNANDOR/CHECKSUMS
Checksum for  
/Users/markwhee/.cpan/sources/authors/id/C/CN/CNANDOR/Mac-Glue 
-1.23.tar.gz ok
Scanning cache /Users/markwhee/.cpan/build for sizes
Mac-Glue-1.23/
Mac-Glue-1.23/Changes
Mac-Glue-1.23/ex/
Mac-Glue-1.23/ex/00_README
Mac-Glue-1.23/ex/address_book
Mac-Glue-1.23/ex/appleworks_stuff
Mac-Glue-1.23/ex/bettertelnet_login
Mac-Glue-1.23/ex/dialog_director_more_lists
Mac-Glue-1.23/ex/dialog_director_stuff
Mac-Glue-1.23/ex/eudora_make_hidden
Mac-Glue-1.23/ex/eudora_send_email
Mac-Glue-1.23/ex/filemaker_extract_data
Mac-Glue-1.23/ex/finder_clean_up
Mac-Glue-1.23/ex/finder_get_system_folder_files
Mac-Glue-1.23/ex/finder_label
Mac-Glue-1.23/ex/finder_label_and_beep
Mac-Glue-1.23/ex/finder_label_and_beep_cool_version
Mac-Glue-1.23/ex/finder_volume_names
Mac-Glue-1.23/ex/handle_errors
Mac-Glue-1.23/ex/interarchy_stuff
Mac-Glue-1.23/ex/itunes
Mac-Glue-1.23/ex/netscape_open_window
Mac-Glue-1.23/ex/progress_bar_stuff
Mac-Glue-1.23/ex/sherlock_search_drive
Mac-Glue-1.23/ex/sherlock_search_internet
Mac-Glue-1.23/ex/simple_text_and_prefab_player
Mac-Glue-1.23/ex/url_access
Mac-Glue-1.23/Glue.pm
Mac-Glue-1.23/lib/
Mac-Glue-1.23/lib/Mac/
Mac-Glue-1.23/lib/Mac/AETE/
Mac-Glue-1.23/lib/Mac/AETE/App.pm
Mac-Glue-1.23/lib/Mac/AETE/Dialect.pm
Mac-Glue-1.23/lib/Mac/AETE/Format/
Mac-Glue-1.23/lib/Mac/AETE/Format/Converter.pm
Mac-Glue-1.23/lib/Mac/AETE/Format/Dictionary.pm
Mac-Glue-1.23/lib/Mac/AETE/Format/Glue.pm
Mac-Glue-1.23/lib/Mac/AETE/Parser.pm
Mac-Glue-1.23/lib/Mac/Glue/
Mac-Glue-1.23/lib/Mac/Glue/Common.pm
Mac-Glue-1.23/make_glues
Mac-Glue-1.23/Makefile.PL
Mac-Glue-1.23/MANIFEST
Mac-Glue-1.23/MANIFEST.SKIP
Mac-Glue-1.23/README
Mac-Glue-1.23/scripts/
Mac-Glue-1.23/scripts/gluedialect.PL
Mac-Glue-1.23/scripts/gluedoc.PL
Mac-Glue-1.23/scripts/glueedit.PL
Mac-Glue-1.23/scripts/gluemac.PL
Mac-Glue-1.23/scripts/gluescriptadds.PL
Mac-Glue-1.23/scripts/show_glue_pods
Mac-Glue-1.23/t/
Mac-Glue-1.23/t/glue.t
Mac-Glue-1.23/t/pod.t

  CPAN.pm: Going to build C/CN/CNANDOR/Mac-Glue-1.23.tar.gz
Checking if your kit is complete...
Looks good
Warning: prerequisite MLDBM 0 not found.
Warning: prerequisite Mac::AppleEvents 1.3 not found.
Warning: prerequisite Mac::AppleEvents::Simple 1.14 not found.
Warning: prerequisite Mac::Apps::Launch 1.9 not found.
Warning: prerequisite Mac::Errors 0.91 not found.
Warning: prerequisite Mac::Files 1.09 not found.
Warning: prerequisite Mac::Processes 1.04 not found.
Warning: prerequisite Time::Epoch 0.02 not found.
Error: Unable to locate installed Perl libraries or Perl source code.
It is recommended that you install perl in a standard location before
building extensions. Some precompiled versions of perl do not contain
these header files, so you cannot build extensions. In such a case,
please build and install your perl from a fresh perl distribution. It
usually solves this kind of problem.
(You get this message, because MakeMaker could not find  
/System/Library/Perl/5.8.1/darwin-thread-multi-2level/CORE/perl.h)
# Looks like your test died before it could output anything.
Running make test
  Make had some problems, maybe interrupted? Won't test
Running make install
  Make had some problems, maybe interrupted? Won't install
 
-
What am I missing? Do I need to install the Developer Tools? Any help  
would be appreciated.

Thanks very much,
Mark
On Apr 26, 2005, at 8:24 AM, Chris Nandor wrote:
In article [EMAIL PROTECTED],
 [EMAIL PROTECTED] (Mark Wheeler) wrote:
The script will open Internet Connect, dial a number (given by the
script).
I don't know if you can do that with Internet Connect.  This sorta  
works:

   my $ic = new Mac::Glue 'Internet Connect';
   my $conn   = $ic-prop('BlueTooth configuration')-get;
   my $status = $conn-prop('status');
   my $state  = $status-prop('state');
   my $number = '*99#';
   $conn-connect(to_telephone_number = $number) if $state-get == 0;
   while (1) {
  last if $state-get == 8;
  sleep 1;
   }
(That works for my Bluetooth

Re: Mac::Glue script

2005-04-27 Thread Mark Wheeler
On Apr 27, 2005, at 9:35 AM, Sherm Pendley wrote:
You appear to be running Panther, so what you want to install is Xcode. 
That's what used to be called Developer Tools on Jaguar and older - 
Apple renamed it. And to make matters even more confusing, Xcode is 
also the name of the IDE app that's included with the Xcode package...

sherm--
--
So I need to install Xcode and then: cpan Mac::Glue again in the 
terminal. Is that right? I'm assuming the Xcode installation will 
include those missing modules, and the then Mac::Glue will 
install/build correctly.

Thanks,
Mark


Re: Mac::Glue script

2005-04-27 Thread Mark Wheeler
Got it. Thanks. I'll give it a go.
Mark
On Apr 27, 2005, at 12:50 PM, Mark Wheeler wrote:
So I need to install Xcode and then: cpan Mac::Glue again in the 
terminal. Is that right?
Basically. However you install this or other modules, you'll need to 
install Xcode first.

I'm assuming the Xcode installation will include those missing modules
No, Xcode doesn't install any Perl modules at all. All it does is 
install the tools and header files that will allow the CPAN shell to 
compile modules. The CPAN shell should also resolve any dependencies, 
and install the prerequisite modules too.

sherm--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


Mac::Glue script

2005-04-25 Thread Mark Wheeler
Hi,
I've been thinking about installing Mac::Glue to do the following:
The script will open Internet Connect, dial a number (given by the 
script). When a connection is established, a sound file will be played 
5 X (or what ever number of repetitions). After the connection is lost 
(phone is hung up after listening to the sound file), the connection is 
closed, Internet Connect quits and the script ends.

Is Mac::Glue the right tool for this job? Is there a script already in 
existence that does the above? Is what I am wanting to do even 
possible?

Thanks for your input,
Mark


Re: problem with installing DBD::mysql

2005-03-16 Thread Mark Wheeler
On Mar 15, 2005, at 9:56 PM, Ted Zeng wrote:
I set the username to root. That should be enough, I assume.
I didn't do the grant stuff.
Only that I have used PHP to test mysql installation, the PHP page also 
create a test database and
test it. Not sure if that would create a problem.

ted
On Mar 15, 2005, at 9:22 PM, Sherm Pendley wrote:
On Mar 15, 2005, at 11:57 PM, Ted Zeng wrote:
The web page Mark pointed out has this
	4.  	perl Makefile.PL --testdb=test --testuser=username 
--testpassword=user_password --testhost=localhost
And you can watch the output when make is run.It tells you what these 
parameters are for testing.
That looks right. Did you log into MySQL first, and grant write access 
to test for username? Along the lines of:

grant all privileges on test.* to root identified by 'password';
sherm--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
So I guess my question, after following this, is to NOT follow the 
directions in the link I posted, but simply make the change in the 
.conf first, then download the source from CPAN, then install it.

Is that the correct order of things?
I'm pretty much ready to do this, as I have MySQL installed and working 
(with PHP). I just need to get the Perl access side of things going.

Thanks,
Mark


Re: problem with installing DBD::mysql

2005-03-15 Thread Mark Wheeler
On Mar 15, 2005, at 5:02 PM, Ted Zeng wrote:
Hi,
I tried to install DBD::mysql after I installed DBI.
I run
sudo perl -MCPAN -e install DBD::mysql
It got the source , but always failed like any other perl module.
I cd to the source directory and do
sudo make
and got the following error:
LD_RUN_PATH=/Library/MySQL/lib/mysql:/usr/lib /usr/bin/perl myld 
MACOSX_DEPLOYMENT_TARGET=10.3 cc  -bundle -undefined dynamic_lookup 
-L/usr/local/lib dbdimp.o mysql.o  -o 
blib/arch/auto/DBD/mysql/mysql.bundle   -L/Library/MySQL/lib/mysql 
-lmysqlclient -lz -lm -L/usr/lib -lssl -lcrypto
make: *** [blib/arch/auto/DBD/mysql/mysql.bundle] Error 255

Anybody has the same problem?
ted zeng
-
Hi Ted,
I don't know if this will help, but here is a link that I found to a 
problem with installing DBD::mysql on Panther. Let me know if it 
works/is helpful, as I need to install it, too. I did the research for 
installing it (that's how I found the link) but haven't got around to 
it yet. Here's the link:

http://www.truerwords.net/articles/osx/install_dbd_mysql.html
Let me know if this is the fix.
Mark


Sorting a more efficient way

2005-03-09 Thread Mark Wheeler
Hi,
First, thanks again for all who helped me with sorting dates with 
Date::Manip. That's working great.

I have another question. Below is a sample of a larger script. I have 
it working great, but I'm pretty sure the sorting and manipulation of 
file data is inefficient. What I'm asking is, how do I make the code 
more efficient? Here's the code and what it does.

Here is a sample of what the data file looks like:
CATAGORY!:CATAGORY2:CATAGORY3CATAGORY4
3245:CATAGORY2:7:July 7,2005:data:data:data
5764:CATAGORY1:3:April 27, 2005:data:data:data
8749:CATAGOTY2:4:April 13, 2005:data:data:data
9874:CATAGORY4:7:February 10, 2006:data:data:data
0276:CATAGORY1:4:November 20, 2005:data:data:data
The script reads in the data file, the sorts all the records by the 
CATAGORY order found in the first line of the data file. Then each line 
item (now delimited by a +) within each CATAGORY is sorted by date. 
After they are sorted, they are joined again by the + so I can 
display each line of data within each catagory. Here is the code:

CODE
my ($i, $html, @sorted);
open (DEALS,  $pathtodatafile) || die $!;
flock (DEALS, 2);
my @current_deals = DEALS;
close (DEALS);
chomp ($current_deals[0]);
my @order = split(/:/, $current_deals[0]);
#
# Sort deals into catagory and date order
#
my ($found, $count) = 0;
foreach (@order) {
 for ($i=1; $i=$#current_deals; $i++) {
  my ($deal, $catagory, $y) = split (/:/, $current_deals[$i]);
  if ($catagory eq $_) {
   $sorted[$count] .= $current_deals[$i].+;
   $found = 1;
  }
 }
 if ($found == 1) {
  chop ($sorted[$count]);
 }
 $count++;
 $found = 0;
}
for ($i=0; $i=$#sorted; $i++) {
my @sorted_split_temp = split (/\+/, $sorted[$i]);
my @sorted_split_final = sort {
Date_Cmp(ParseDate((split /:/, $a)[3]), ParseDate((split /:/, $b)[3]));
} @sorted_split_temp;
$sorted[$i] = join (\+, @sorted_split_final);
}
/CODE
After this part of the script is executed, it is then displayed in 
CATAGORY order on the screen.

Again This all works nicely, but is very inefficient. I'm sure there 
must be a better way to write this, but this is the best I can do for 
now. If anyone has any suggestions, on how to make this better, I'd 
appreciate your input.

Thanks,
Mark


Re: Sorting year and month

2005-03-01 Thread Mark Wheeler
Hi Sherm,
Thanks for taking the time to explain it. That makes sense.
Mark
On Mar 1, 2005, at 12:59 AM, Sherm Pendley wrote:
On Mar 1, 2005, at 2:48 AM, Mark Wheeler wrote:
Hi Sherm,
That works perfectly. Could you give me a brief rundown on how the 
sort works with Date::Manip, so I can understand what is going on?

On Feb 28, 2005, at 1:03 AM, Sherm Pendley wrote:
my @sorted = sort { Date_Cmp(ParseDate($b), ParseDate($a)); } 
@dates;
I'm not certain how much detail you need, so I'll start at the 
beginning, with sort(). Sort() allows you to provide a block of code 
that's used as a comparison function. Two arguments are passed to that 
function - $a and $b - and the return value should mimic that of = or 
cmp - that is,  0 if $a  $b, 0 if $a == $b, and  0 if $a  $b.

So, suppose we have a list of hashes, like this:
my @garbled = (
{ 'foo'='trouble', 'sort_by'=3 },
{ 'foo'='hubble', 'sort_by'=0 },
{ 'foo'='toil', 'sort_by'=2 },
{ 'foo'='bubble', 'sort_by'=1 },
);
We could sort it according to the sort_by field like this:
my @spell = sort { $a-{'sort_by'} = $b-{'sort_by'} } @garbled;
Note that there's no comma between the comparison function and 
@garbled. If there were, Perl would treat the block as the first 
element in the list to be sorted. Also, $a and $b are magic - you don't 
have to declare them with my() or our(), or shift them off of @_. 
They're just there. Also, strict knows about them, although not in 
detail; you can use an undeclared $a or $b *anywhere*, not just with a 
sort(), without hearing a peep from strict.

So anyway, how's that work with Date::Manip?
The ParseDate() function takes a date in a variety of formats, and 
returns it in a normalized format: mmddhh:mm:ss. Date_Cmp() 
compares two of these normalized date strings, and returns a value 
that's consistent with = or cmp - that is, 0, 0, or 0 - as expected 
by sort.

You *could* simply use cmp to compare these strings - in fact that's 
basically all Date_Cmp() does right now - but the Date::Manip docs 
indicate that the normalized format will be extended at some future 
point, to include various flags such as the time zone. At that point, 
Date_Cmp() will also be updated to take the flags into account, whereas 
cmp will no longer work. So, using Date_Cmp() is optional at the 
moment, but it's more future-proof than cmp.

sherm--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


Re: Variables in external file

2005-02-28 Thread Mark Wheeler
Hi all,
Thanks for all you input. I'm mulling it all over to decide what works 
best for me. That's the beauty of it all - there's always more than one 
way to get what you want. Thanks again.

Mark
On Feb 18, 2005, at 11:37 AM, Rich Morin wrote:
At 8:39 AM -0800 2/18/05, Mark Wheeler wrote:
Is it possible to have a bunch of variables in a separate file
and then require that file in the script file?
Possible, yes.  Advisable, no.  I tend to use YAML (www.yaml.org)
for this sort of thing, as:
  # some_data.yml
  List:
-  1
-  2
-  3
-  4
-  5
Then, after loading the file, I access the data as:
  foreach $item (@{ $r-{List} }) {
print $item;
  }
YAML is easy to read and edit, maps well to Perl data structures,
is language-independent, loads safely, etc.
-r
--
email: [EMAIL PROTECTED]; phone: +1 650-873-7841
http://www.cfcl.com- Canta Forda Computer Laboratory
http://www.cfcl.com/Meta   - The FreeBSD Browser, Meta Project, etc.
http://www.ptf.com/dossier - Prime Time Freeware's DOSSIER series


Sorting year and month

2005-02-28 Thread Mark Wheeler
Hi,
I have a quick question regarding sorting. I have a list of dates and 
years in the following format:

October-2004
December-2004
September-2004
January-2005
November-2004
I need to sort them so the final outcome is:
January-2005
December-2004
November-2004
October-2004
September-2004
Of course the list will eventually include all 12 months, but the above 
is just an example. What is the best way to go about doing this? I'm 
not too familiar with using sort, but I'm sure that is the way to go. 
Any help would be appreciated.

Thanks,
Mark


Re: Sorting year and month

2005-02-28 Thread Mark Wheeler
Hi Sherm,
That works perfectly. Could you give me a brief rundown on how the sort 
works with Date::Manip, so I can understand what is going on?

Thanks,
Mark
On Feb 28, 2005, at 1:03 AM, Sherm Pendley wrote:
On Feb 28, 2005, at 3:41 AM, Mark Wheeler wrote:
I have a quick question regarding sorting. I have a list of dates and 
years in the following format:

October-2004
December-2004
September-2004
January-2005
November-2004
I need to sort them so the final outcome is:
January-2005
December-2004
November-2004
October-2004
September-2004
Of course the list will eventually include all 12 months, but the 
above is just an example. What is the best way to go about doing this? 
I'm not too familiar with using sort, but I'm sure that is the way 
to go. Any help would be appreciated.
Have a look at Date::Manip - it has date parsing and comparison 
functions you can use with sort(). Example:

#!/usr/bin/perl
use warnings;
use strict;
use Date::Manip;
my @dates = qw(
October-2004
December-2004
September-2004
January-2005
November-2004
);
my @sorted = sort { Date_Cmp(ParseDate($b), ParseDate($a)); } 
@dates;

for (@sorted) { print $_, \n; }
sherm--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


Re: MySQL

2004-12-11 Thread Mark Wheeler
Hi Sherm,
Thanks for the advice. I am using the standard Perl install, so I will 
go with fink.

Thanks,
Mark
On Dec 11, 2004, at 12:12 AM, Sherm Pendley wrote:
On Dec 9, 2004, at 2:49 PM, Mark Wheeler wrote:
1. First, I'll check the archives on installing DBD::mysql. Then I'll 
actually install MySQL using Sherm's link. One question regarding 
that. Which would be the best to install? There are three versions - 
Standard, Max, and Debug. I'm presuming Standard or Max.
I've never needed Max - but I install it anyway, thinking it would be 
better to have it and not need it, than to need it and not have it.

2. After that is installed, I'm leaning (without having looked at the 
archives, yet) toward using fink to install DBD::mysql. I installed 
Image/PerlMagick with fink and that went fine, so I thought I'd try it 
again with DBD::mysql.
It depends on your system. If you use the standard Apple-supplied Perl 
and have no plans to upgrade to another Perl, you should be just fine 
using Fink to install your modules.

On the other paw, Fink-installed modules can cause you pain if you're 
using one or more user-installed Perls. Fink adds its Perl library path 
to the PERL5LIB environment variable, which means that all the Perls 
you've installed will look there. But in the case of XS modules 
(including DBD::mysql), not all of your Perls will be compatible with 
the Fink-installed modules.

 However, on CPAN there are two different versions. DBD::mysql and 
Bundle::DBD::mysql. The bundle looks tempting, but is all that is 
installed necessary?
It doesn't really look all that useful, IMNSHO. There's only four 
modules in the bundle; two of them (DBI, DBD::mysql) would be installed 
via Fink, if you go that route, and one (Mysql) is obsolete. The one 
module that's left (Data::ShowTable) could just as well be installed 
alone, without the bundle.

sherm--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


Re: MySQL

2004-12-09 Thread Mark Wheeler
Hi all,
Thanks so much for your input. I think my plan of attack, for now is as 
follows.

1. First, I'll check the archives on installing DBD::mysql. Then I'll 
actually install MySQL using Sherm's link. One question regarding that. 
Which would be the best to install? There are three versions - 
Standard, Max, and Debug. I'm presuming Standard or Max.

2. After that is installed, I'm leaning (without having looked at the 
archives, yet) toward using fink to install DBD::mysql. I installed 
Image/PerlMagick with fink and that went fine, so I thought I'd try it 
again with DBD::mysql. However, on CPAN there are two different 
versions. DBD::mysql and Bundle::DBD::mysql. The bundle looks tempting, 
but is all that is installed necessary?

Does the above sound, well, sound?
Thanks,
Mark


MySQL

2004-12-08 Thread Mark Wheeler
Hi,
Well, I'm about to take the plunge and begin to learn MySQL. I have 
Apache and Perl all running great (stock installs), but I'm not sure 
how to get started with installing MySQL. I guess what I'm asking is, 
can some one share some good links/pointers on installing MySQL. As 
well, links on USING MySQL with Perl. I'm not planning on doing any 
huge things with multiple databases, just some basic info to be stored 
and then searched through when needed.

I could do what I need in a flat file DB, but want to learn how to use 
MySQL.

Any pointers anyone could give would be greatly appreciated.
Thanks,
Mark


Safari Bookmarks comparison

2004-10-08 Thread Mark Wheeler
Hi,
This might be slightly OT, but... I work in two different locations, 
and have two different safari bookmark files, obviously. I was thinking 
about writing a script that would log into one computer, d/l that 
computer's safari bookmarks, compare that bookmark list to the one on 
the current computer, make one file that includes all the bookmarks and 
save that file to both computers. In short, keep the bookmark files 
synced up.

The reason I come to the list is before I venture out on this, is to 
ask, has this already been done? And if so, where do I go find the 
script?

Thanks,
Mark


Re: Safari Bookmarks comparison

2004-10-08 Thread Mark Wheeler
Hi Charles,
So help me out a little, here. I did a little research (quickly) on 
cvs. (http://www.loria.fr/~molli/cvs/doc/cvs_16.html), but I still 
don't understand how that works here. I understand the concept, I 
think. But how do commit and update differ from each other? Also, it 
sounds like I need to set a working directory and a repository. Any 
more input would be helpful.

Thanks,
Mark
On Oct 8, 2004, at 4:48 PM, Charles Albrecht wrote:
On Fri, Oct 08, 2004 at 03:20:22PM -0700, Mark Wheeler wrote:
Hi,
This might be slightly OT, but... I work in two different locations,
and have two different safari bookmark files, obviously. I was thinking
about writing a script that would log into one computer, d/l that
computer's safari bookmarks, compare that bookmark list to the one on
the current computer, make one file that includes all the bookmarks and
save that file to both computers. In short, keep the bookmark files
synced up.
What's wrong with:
  cvs update Library/Safari/Bookmarks.plist
followed by something like:
  cvs commit Library/Safari/Bookmarks.plist -m `hostname` at `date`
(or subversion's equivalent..)
-Charles
 [EMAIL PROTECTED]


Re: Safari Bookmarks comparison

2004-10-08 Thread Mark Wheeler
I just found this site - 
http://developer.apple.com/internet/opensource/cvsoverview.html - why 
didn't I look there first. That may be helpful, too.

Mark
On Oct 8, 2004, at 5:25 PM, Mark Wheeler wrote:
Hi Charles,
So help me out a little, here. I did a little research (quickly) on 
cvs. (http://www.loria.fr/~molli/cvs/doc/cvs_16.html), but I still 
don't understand how that works here. I understand the concept, I 
think. But how do commit and update differ from each other? Also, it 
sounds like I need to set a working directory and a repository. Any 
more input would be helpful.

Thanks,
Mark
On Oct 8, 2004, at 4:48 PM, Charles Albrecht wrote:
On Fri, Oct 08, 2004 at 03:20:22PM -0700, Mark Wheeler wrote:
Hi,
This might be slightly OT, but... I work in two different locations,
and have two different safari bookmark files, obviously. I was thinking
about writing a script that would log into one computer, d/l that
computer's safari bookmarks, compare that bookmark list to the one on
the current computer, make one file that includes all the bookmarks and
save that file to both computers. In short, keep the bookmark files
synced up.
What's wrong with:
  cvs update Library/Safari/Bookmarks.plist
followed by something like:
  cvs commit Library/Safari/Bookmarks.plist -m `hostname` at `date`
(or subversion's equivalent..)
-Charles
 [EMAIL PROTECTED]


Re: ImageMagick/PerlMagick on Panther

2004-09-23 Thread Mark Wheeler
Ok, I installed fink, no problems.
I used $ sudo apt-get install imagemagick and installed imagemagick - 
no problems.

I then used $ sudo apt-get install perlmagick-pm581 and got an error, 
couldn't find package perlmagick-pm581, so I'm guessing that is 
didn't install because fink couldn't find anything to install.

I checked on cpan and found PerlMagick 6.02, which requires ImageMagick 
6.0.0 or above for PerlMagick 6.02 to work correctly. I checked the 
PerlMagick.org site and found that PerlMagic 6.0.6 is the latest 
version. When I looked through the install process in the Terminal, I 
noticed that it was version 5.5.1.

So I'm a little at a loss. Do I need to update the installation of 
ImageMagick to 6.0.6 then install PerlMagick 6.02 after that? If so how 
do I update ImageMagick? Also, do all the libraries that were installed 
with fink need to be updated? After I update ImageMagick (however you 
do that) can I simply use the following to install PerlMagick 6.02?

sudo perl -MCPAN -e 'install Image::Magick'
As of now I'll wait for your advice, as I think this is a good place to 
slow down.

Thanks,
Mark


Re: ImageMagick/PerlMagick on Panther

2004-09-23 Thread Mark Wheeler
Sorry if I am prematurely coming to the list. That's the last thing I 
want to do. I'm learning as I go. And... I just learned some more. When 
I tried to install perlmagick, it gave me an error, could not find cc 
or gcc. I did a little looking around and it seems that it can't find a 
compiler. I have never installed the developer tools, and from what 
I've read, the default install of OS X (which is what I have) doesn't 
include a compiler. So I guess I need to install the developer tools. 
Xcode 1.5 is the latest, so I'll d/l the 1.1 version, install it, then 
update to 1.5. Then try again. Does that sound right?

Thanks,
Mark
On Sep 23, 2004, at 4:20 AM, Chris Devers wrote:
On Thu, 23 Sep 2004, Mark Wheeler wrote:
Ok, I installed fink, no problems.
I used $ sudo apt-get install imagemagick and installed imagemagick - 
no
problems.

I then used $ sudo apt-get install perlmagick-pm581 and got an error,
couldn't find package perlmagick-pm581, so I'm guessing that is 
didn't
install because fink couldn't find anything to install.
It meant that there isn't a binary available. That's okay, we can just
build it from source instead:
% fink --help
Fink 0.22.2
Usage: fink [options] command [package...]
   fink install pkg1 [pkg2 ...]
[... etc, snipped. run it yourself to see the options ...]
% fink list | grep -i magick
 imagemagick[virtual package]
 imagemagick-dev[virtual package]
 imagemagick-shlibs [virtual package]
 i  imagemagick 6.0.8-1 Image manipulation tools
imagemagick-dev 6.0.8-1 Image manipulation tools
imagemagick-nox 6.0.8-1 Image manipulation tools
imagemagick-nox-dev 6.0.8-1 Image manipulation tools
imagemagick-nox-shlibs  6.0.8-1 Image manipulation tools
 i  imagemagick-shlibs  6.0.8-1 Image manipulation tools
perlmagick-pm5815.5.6-11Perl interface to 
ImageMagick
% sudo fink install perlmagick-pm581

Please consider looking over the documentation for the tools that are
being suggested before coming back to the list at every speed bump that
you hit :-)

So I'm a little at a loss. Do I need to update the installation of 
ImageMagick
to 6.0.6 then install PerlMagick 6.02 after that?
Stop. Turn around. You were almost there. Finish the way you started.
You've almost got it, and if you had tried `fink --help` or `man fink`,
you may well have been able to figure out the rest on your own.

--
Chris Devers


Re: ImageMagick/PerlMagick on Panther

2004-09-23 Thread Mark Wheeler
Yes, I'm sure you are right on all counts, but I'm a glutton for a 
little punishment, I guess. :) Trust me when I say I'm still keeping it 
in mind. I would just like to understand a bit more about what's going 
on under the hood. I like to be creative, but the other side of my 
brain likes a little poking, too.

Thanks for the reminder,
Mark
On Sep 23, 2004, at 9:48 AM, Bill Stephenson wrote:
Really, you could have been using three different graphic engine API's 
since early yesterday if you had just downloaded and installed Sherm's 
Fat Camel and/or GraphicsKit. The guy built these awesome installers 
and you're completely ignoring it. In fact, here we are re-hashing 
some of the same issues that actually started this list a few years 
ago when OS X was in beta.

I guess I'm just lazy, but I really don't see the point in all this. 
If you have broadband, you can be using ImageMagick almost before you 
can reply to this message. Just install it, and start using it!

Kindest Regards,
Bill Stephenson



ImageMagick/PerlMagick on Panther

2004-09-22 Thread Mark Wheeler
Hi,
I am about to install my first module. I've been learning perl for the
past several years and am building a web site that needs
ImageMagick/PerlMagick.
First, how difficult is it to install these modules?
Second, are there any idiosyncrasies is installing these modules on
Panther?
Third, is there anything I should be aware of with using these modules
under Panther?
If any one has has experience with ImageMagick/PerlMagick, I'd love to
hear from you.
Thanks so much,
Mark


Re: ImageMagick/PerlMagick on Panther

2004-09-22 Thread Mark Wheeler
You'll have to help me a little here. Who is Sherm Pendley and what is 
Fat Camel /Graphics Kit?

Thanks,
Mark
On Sep 22, 2004, at 9:22 AM, Bill Stephenson wrote:
I installed it (but have not used it) on Panther without any trouble 
at all using Sherm Pendley's Fat Camel  GraphicsKit. I highly 
recommend it, but I'd ask Sherm about any idiosyncrasies that you 
might run across.

Kindest Regards,
Bill Stephenson
On Sep 22, 2004, at 11:16 AM, Mark Wheeler wrote:
Hi,
I am about to install my first module. I've been learning perl for the
past several years and am building a web site that needs
ImageMagick/PerlMagick.
First, how difficult is it to install these modules?
Second, are there any idiosyncrasies is installing these modules on
Panther?
Third, is there anything I should be aware of with using these modules
under Panther?
If any one has has experience with ImageMagick/PerlMagick, I'd love to
hear from you.
Thanks so much,
Mark




Re: ImageMagick/PerlMagick on Panther

2004-09-22 Thread Mark Wheeler
So I need to use sudo or is that neccasary in this case?
Thanks,
Mark
On Sep 22, 2004, at 9:29 AM, Ryan Perry wrote:
Learn to use CPAN.  on newer versions of perl you can type:
cpan
you'll then get a new command line:
cpan
type install ModuleNameHere, so:
cpan install PerlMagick
sometimes you have to use force:
cpan force install PerlMagick
It will ask you some simple (sometimes complex) questions and take 
care of any dependencies.  Great thing.  Use CPAN as much as you can.  
It's incredible!

Ryan
On Sep 22, 2004, at 11:16 AM, Mark Wheeler wrote:
Hi,
I am about to install my first module. I've been learning perl for the
past several years and am building a web site that needs
ImageMagick/PerlMagick.
First, how difficult is it to install these modules?
Second, are there any idiosyncrasies is installing these modules on
Panther?
Third, is there anything I should be aware of with using these modules
under Panther?
If any one has has experience with ImageMagick/PerlMagick, I'd love to
hear from you.
Thanks so much,
Mark





Re: ImageMagick/PerlMagick on Panther

2004-09-22 Thread Mark Wheeler
In regards to the pre-install package, would I need to install both the 
Fat Camel AND Fat Camel - GraphicsKit, or just the GraphicsKit?

What I am intending to use the ImageMagick for is to manipulate images 
that are uploaded and display them in different formats, basically a 
photo gallery for my family. Yes, I know there are galleries all ready 
out there, but how will I get better at Perl if I don't write it 
myself. :)

So If the Install of the Fat Camel/GraphicsKit are much more than I 
need, let me know and I'll (as I should) learn how to use cpan and 
install the libraries and c libraries. And of course, all your help 
would be much appreciated as I go through this process.

Thanks,
Mark
On Sep 22, 2004, at 10:20 AM, Sherm Pendley wrote:
On Sep 22, 2004, at 12:16 PM, Mark Wheeler wrote:
I am about to install my first module.
And for that you've chosen Image::Magick? Nothing like jumping into 
the deep end first, eh? :-)

First, how difficult is it to install these modules?
There are quite a few C libraries that are needed first, but if I 
remember correctly everything built and installed fairly smoothly. The 
large number of C libraries made it a tedious and time-consuming task 
though.

Third, is there anything I should be aware of with using these modules
under Panther?
Well, you might want to be aware that there's a pre-packaged installer 
for them, although it might be more than you want to install - you'll 
wind up with a newer (5.8.4) Perl, Image::Magick, GD, Ghostscript, 
CamelBones, and a few other things.

Have a look at the CamelBones page at 
http://www.sf.net/projects/camelbones/, and download the Fat Camel 
and Fat Camel - GraphicsKit packages if you're interested.

These packages will install under /usr/local/cb/perl5.8.4/ - but by 
default, symlinks are created in /usr/bin/ that point to each file in 
/usr/local/cb/perl5.8.4/bin/. If you don't want that to happen, do an 
advanced install and deselect the sub-package that creates the 
symlinks.

Here's a list of modules  other stuff included in Fat Camel:
CamelBones Developer (Runtime, sample code, Xcode project templates, 
etc.)

Perl 5.8.4
DBI
DBD::mysql
Mac::Carbon

Here's a list of the libraries  modules included in GraphicsKit:
libjpeg (C library)
libungif (C library)
libpng (C library)
libtiff (C library)
freetype (C library)
jasper (C library)
GD (C library)
ImageMagick (C library)
Ghostscript (Application)
Ghostscript fonts
GD
GD::Barcode
GD::Chart
GD::Convert
GD::Dashboard
GD::Graph
GD::Graph3d
GD::Graph::Map
GD::Graph::XY
GD::OrgChart
GD::Polyline
GD::SecurityImage
GD::SIRDS
GD::SVG
GD::Text
GD::Text::Arc
GD::XYScale
Image::Info
Image::Magick
Image::Size
Imager
SVG
sherm--



Re: ImageMagick/PerlMagick on Panther

2004-09-22 Thread Mark Wheeler
Imager? I've not heard of that one. Can you give me a bit more info on 
it? How is is different from ImageMagick?

Thanks,
Mark
On Sep 22, 2004, at 11:11 AM, william ross wrote:
On 22 Sep 2004, at 17:16, Mark Wheeler wrote:
Hi,
I am about to install my first module. I've been learning perl for the
past several years and am building a web site that needs
ImageMagick/PerlMagick.
First, how difficult is it to install these modules?
I really really wouldn't start out by trying to install imagemagick. 
it's horrible even if you're used to that sort of thing. Unless you're 
relying on an application that uses IM, you'll be much happier with 
Imager. You still have to install the graphics-handling C libraries 
first (typically libgif, libtiff, libjpeg and libpng, and probably 
zlib for compression), but after that it's very straightforward.

If you do have to use imagemagick, in the archives of this list you 
will find several weary howto's from people who finally wrestled the 
monster to the ground and limped home, including at least two from me. 
to have any chance at all of making it work you must first install 
fink (see fink.sourceforge.net) and then read this from Randal 
Schwartz:

http://www.nntp.perl.org/group/perl.macosx/3812
The most important hint in there is that the versions of imagemagick 
and perlmagick must match exactly and preferably come out of the same 
source tree at the same time.

Second, are there any idiosyncrasies is installing these modules on
Panther?
there are idiosyncracies in installing IM on any platform.
Third, is there anything I should be aware of with using these modules
under Panther?
No. Once installed they're the same on Panther as anywhere else.
If any one has has experience with ImageMagick/PerlMagick, I'd love to
hear from you.
good luck.
will



Re: ImageMagick/PerlMagick on Panther

2004-09-22 Thread Mark Wheeler
There are instructions for installing ImageMagic on the ImageMagick 
site. Should I just follow the Unix instructions? As well, it sounds 
like I need to install the C libraries first, then ImageMagick. Also, 
from what I gather, after I install the C libraries and ImageMagick, 
then I need to install PerlMagick, right?

It sounds, too, that things could go wrong in the installation. Is 
there a way to Uninstall the files and start over?

And finally, I guess, this is basically all I want to use the 
ImageMagick for:

Image resizing.
Image compression - jpg
Finding image DPI
Finding image size
Clean up image (sharpen, etc.)
That's pretty much it. This is why I'm looking at ImageMagick. Am I 
going in the right direction here, or is there something else (Imager?) 
that will do the same thing with less of an installation procedure?

Just had a thought. Is installing a C library a different process then 
installing a perl module?

Thanks again for your help,
Mark
On Sep 22, 2004, at 11:57 AM, Chris Devers wrote:
On Wed, 22 Sep 2004, Sherm Pendley wrote:
On Sep 22, 2004, at 2:11 PM, william ross wrote:
any chance at all of making it work you must first install fink
Nonsense. You must first install the C libraries you need. Fink is 
*one* way
to get them, not the only one.
It's certainly a very easy  painless way though:
  % sudo fink -y install imagemagick
  % sudo perl -MCPAN -e 'install Image::Magick'
This gets you 90% of the way there, at least.
The ability to do this by hand can obviously be valuable, but it can
hardly be easier :-)

--
Chris Devers



Re: ImageMagick/PerlMagick on Panther

2004-09-22 Thread Mark Wheeler
Well the nice thing here is, it's for my family, not for work. This 
particular project is done my spare time.. you know between 12am and 
3am. :) So time wise, it's not a problem.

Mark
On Sep 22, 2004, at 2:05 PM, Sherm Pendley wrote:
On Sep 22, 2004, at 4:13 PM, Chris Devers wrote:
If you really want to prove to yourself how much rounder your wheel 
will
be, then yes, use the Unix instructions.
Or, if you want to see how that wheel got so round. I'm all for 
self-improvement! My only concern in this particular instance is that 
Mark says it his first module install. Image::Magick might be a little 
too hairy for a first attempt.

It's also worth noting that self-improvement can take time - when 
deadlines are looming and your schedule is tight, it might not be a 
good time to try something new and difficult.

Lots of Perl modules are written partly in C (or XS, whatever), so in
some ways there isn't much of a difference. But more broadly, yeah, a
pure C library is often installed in ways similar to Perl libraries.
Broadly speaking, yes - configure it, then run make, then run 
self-tests (if any), then install. The typical commands for the 
process vary from Perl to C though:

1.  Perl: perl Makefile.PL
C: ./configure
Both can require additional options to the command
2.  Both: make
3.	Perl: make test. Most Perl modules have some form of self-tests.
	C: Varies - make test and make check are common, if there are 
tests at all.

4.  Both: sudo make install
The CPAN shell helps a great deal for those modules that don't need 
special configuration options, environment variables, etc. Some 
modules *do* need such things though, so it's important to familiarize 
yourself with the manual process, even if you use the automated shell 
99% of the time.

sherm--



Re: ImageMagick/PerlMagick on Panther

2004-09-22 Thread Mark Wheeler
Ok... it seems to me that my two best options are as follows:
1. Install fink and then install ImagaMagick (as per below)
2. Install PerlMagick
3. Install the addition C libraries so as to have access to image 
manipulation and compression and such

or
1. Install the Darwin port of ImageMagick.
First, I think it wise to not install ImagaMagick as my first library. 
I don't have enough perl testosterone to make that jump. Second, I'm 
not afraid to try stuff out of depth of understanding. It's just good 
to know where my limits are and build from there.

So with that being said, I guess the next question would be about the 
Darwin port. How is that an advantage over fink (et al)? I know of 
darwin but don't know anything about it. And finally, which would be 
the probable best route to take -- fink or darwin?

Thanks,
Mark
On Sep 22, 2004, at 11:57 AM, Chris Devers wrote:
On Wed, 22 Sep 2004, Sherm Pendley wrote:
On Sep 22, 2004, at 2:11 PM, william ross wrote:
any chance at all of making it work you must first install fink
Nonsense. You must first install the C libraries you need. Fink is 
*one* way
to get them, not the only one.
It's certainly a very easy  painless way though:
  % sudo fink -y install imagemagick
  % sudo perl -MCPAN -e 'install Image::Magick'
This gets you 90% of the way there, at least.
The ability to do this by hand can obviously be valuable, but it can
hardly be easier :-)

--
Chris Devers



Re: ImageMagick/PerlMagick on Panther

2004-09-22 Thread Mark Wheeler
Agreed. Somtimes I overthink things and foget what the goal was in the 
first place. I'll install fink then use you oneliner to install 
image/perl magick. I'll let you know how it all goes.

Thanks again,
Mark
On Sep 22, 2004, at 3:31 PM, Chris Devers wrote:
On Wed, 22 Sep 2004, Mark Wheeler wrote:
Ok... it seems to me that my two best options are as follows:
1. Install fink and then install ImagaMagick (as per below)
2. Install PerlMagick
3. Install the addition C libraries so as to have access to image 
manipulation
and compression and such
The third step automatically happens as a subset of the first here.
It can be done as a oneliner:
fink install imagemagic perlmagick-pm581
(Though, of course, installing Fink is a separate step :-)
1. Install the Darwin port of ImageMagick.
I guess so; I know almost nothing about the Darwinports project. (I 
seem
to remember rumors about them replacing system commands like make  
gcc,
so I was scared off from using it, but that may not actually be true.)

So with that being said, I guess the next question would be about the 
Darwin
port. How is that an advantage over fink (et al)? I know of darwin 
but don't
know anything about it. And finally, which would be the probable best 
route to
take -- fink or darwin?
Darwin is the kernel  base operating system for OSX -- if you're using
Perl on a Mac, you're using Darwin. Darwinports, on the other hand, is 
a
project that uses BSD tools to port Unix software to OSX, just as the
Fink project uses Debian Linux tools to port the same software.

I say use Fink, but it's subjective -- others will have perfectly valid
reasons for preferring Darwinports. I just happen to know  use Debian
far more often than I've ever used *BSD, so I'm more comfortable 
working
with that set of tools (apt-get, dpkg, etc). YMMV.

In any case, stop agonizing over it, pick one -- you can't really go
wrong either way -- and install the software you want  get going.
You're getting hung up on the least interesting part of programming! 
:-)


--
Chris Devers



Re: Download images/movies

2004-08-25 Thread Mark Wheeler
Hi Andy,
Yup, that was it. I was using a relative path, not abslute. That fixed  
it. I script now works great in Netscape and Safari, but not in IE.  
(All on a Mac - I'll check out the PC tomorrow). IE just displays the  
graphic but doesn't download it. The script does not seem to be  
overriding whatever the settings are in IE regarding MIME types and  
what to do with them -- I'm guessing. Is there a way to override that?

Thanks again for your help.
Mark
On Aug 24, 2004, at 6:17 PM, Andrew Mace wrote:
$path is a system path, right?  As in, like, not relative to the  
webserver?  Just making sure...

Also, I messed up and used $length in one place and $size in another,  
though that doesn't explain your troubles.

I mean, you could do a lot of things to debug.  A quick thing you could  
do would be to change the content type to image/jpeg and remove the  
Content-Disposition and see what gets put into your browser.  Since  
you're writing the HTTP headers before attempting to open the file, my  
suspicion is that there's something wrong with the path to the file and  
your script is exiting prematurely.

Andy


On Aug 24, 2004, at 8:23 PM, Mark Wheeler wrote:
Hi Andy,
Thanks for the input. I should have check the read/write method --  
my bad.

I tried both the slurp and the read methods, but the same thing still  
happens. On a PC the save dialog comes up but the file saved is 0k,  
and on a Mac, the the progress bar is just a spinning barber poll. Any  
ideas?

Thanks,
Mark
On Aug 24, 2004, at 3:56 PM, Andrew Mace wrote:
Hey Mark -
A few things.
- You want to open the file for reading, not to write.
- You should undef $/ to slurp the file if you're using   to read.
- You should stat the file before opening it to add the  
Content-Length header, if you want.
- For larger files, it would make more sense to use read() calls  
instead of slurping the entire file into memory.

So here's an updated version:
#!/usr/bin/perl -w
use strict;
use CGI ':standard';
my $filename = param('picname');
my $path = /images/$filename;
my $length = (stat($path))[7]; # the size, in bytes
binmode STDOUT;
print Content-Length: $size\n;
print Content-Disposition: attachment;filename=$filename\n;
print Content-Type: application/octet-stream\n\n;
open (FILE,  $path) || die(Can't open($filename): $!);
binmode(FILE);
# slurp method:
undef $/;
my $data = FILE;
close (FILE);
print $data;
# read() method would be:
while(read(FILE,$data,4096)) {
print $data;
}
close(FILE);
exit;
Good luck
Andy

On Aug 24, 2004, at 6:19 PM, Mark Wheeler wrote:
Hi all,
Here is my first attempt to write this script. I will be adding the  
protection/whitelisting/etc. after I get the basic this running.  
Here is what I have so far, and here is what happens. On a PC, the  
dialog box comes up and saves the file, but it is 0K -- nothing in  
it. On a Mac, the Downloads dialog box comes up, but the progress  
bar keeps spinning and nothing happens. Below is the HTML that calls  
the script and the CGI script itself. What did I forget/do wrong?

Thanks,
Mark
-
html
head
titleUntitled Page/title
/head
body
a  
href=javascript:window.location='cgi-bin/download.cgi? 
picname=Upload-Background.gif'picture link/a
/body
/html

-
#!/usr/bin/perl -w
use strict;
use CGI ':standard';
my $filename = param('picname');
my $path = /images/$filename;
binmode STDOUT;
print Content-Disposition: attachment;filename=$filename\n;
print Content-Type: application/octet-stream\n\n;
open (FILE,  $path) || die(Can't open($filename): $!);
my $data = FILE;
close (FILE);
print $data;
exit;
-
On Aug 23, 2004, at 2:45 PM, Joel Rees wrote:
I think that's what I'm looking for. One question. What do you  
mean whitelist the filepaths. My only reference point is email.  
Whitelist for me means that email address on my whitelist  
always get through, even though the spam software might initially  
think it's spam. Can you clarify?
If the script I posted was readable, you might have noticed that it  
accepts one parameter and sets the directories only if that  
parameter matches correctly. It looks like a waste, but it's one  
way of what he was calling whitelisting in a fairly strict way, but  
allowing the same script to be used on multiple sets of images. You  
do have to add a little code for each set of images, of course.

That script needs some comments.
--
Joel Rees
Getting involved in the neighbor's family squabbles is  
dangerous.
But if the abusive partner has a habit of shooting through  
his/her roof,
the guy who lives upstairs is in a bit of a catch-22.







Re: Download images/movies

2004-08-25 Thread Mark Wheeler
Hi Joel,
Thanks for your input. In regards to filename, I'm assuming you are  
talking about the filename passed within the HTML, right? I think what  
I will probably do is pass an ID number to the script and then process  
it that way. I will still check for ../ andywhere the passed ID, as  
well as / at the beginning of the ID. You mentioned that V is /.  
Im afraid you lost me there. Can you explain?

Thanks,
Mark
On Aug 25, 2004, at 8:16 AM, Joel Rees wrote:
Just a few nosy comments --
html
head
titleUntitled Page/title
/head
body
a  
href=javascript:window.location='cgi-bin/download.cgi? 
picname=Upload-Background.gif'picture link/a
Not sure why you want to bother with javascript in there. ICBW, but I  
don't think it buys you anything. And some of your family may decide  
to turn javascript in their browsers off.

/body
/html
-
#!/usr/bin/perl -w
use strict;
use CGI ':standard';
I didn't notice that you had used anything from CGI in the script.  
Might as well comment it out.

my $filename = param('picname');
Did you follow what was said about ../../ someodd with /etc at the end?
It's a good way to dump all sorts of things about your machine into  
someone else's browser, including user names and ids, the entire  
httpd.conf file, and so forth.

That's why I don't usually accept filenames in scripts. But if you do,  
you need to check for / at the top or ../ anywhere, and balk if you  
get those. It can get kind of tricky, since \/ is /.

my $path = /images/$filename;
For instance, somebody puts this in their browser:
 
http://your.domain.com/cgi-bin/download.cgi?picname=../etc/httpd/ 
httpd.conf

binmode STDOUT;
print Content-Disposition: attachment;filename=$filename\n;
print Content-Type: application/octet-stream\n\n;
If you _had_ been using CGI, the above two lines could have created  
some subtle conflicts.

open (FILE,  $path) || die(Can't open($filename): $!);
This is why you got the attempted download that stalled, of course.  
That die statement won't do much useful. Well, if it were going out  
STDOUT, it might have shown up as your downloaded file.

You'll want to look into using a logging file or the http version of  
carp.

my $data = FILE;
close (FILE);
print $data;
exit;
--
Joel Rees
Nothing to say today
so I'll say nothing:
Nothing.



Re: Download images/movies

2004-08-25 Thread Mark Wheeler
Hi Andy,
I'll give it a try and let you know. I just tried the current version  
of the script (the one that IE Mac has a problem with) on a PC and it  
works great. So it seems to just be IE Mac. So I'll try the new thing  
and let you know.

Thanks,
Mark
On Aug 25, 2004, at 5:47 AM, Andrew Mace wrote:
 IE just displays the graphic but doesn't download it. The script  
does not seem to be overriding whatever the settings are in IE  
regarding MIME types and what to do with them -- I'm guessing. Is  
there a way to override that?
You could try changing the Content-Type to application/download.  The  
problem is Mac IE will show the save as prompt, but it will be the  
name of your script (download.pl) and not the filename you specified  
in the HTTP header.  I haven't found any workaround for this.  When  
I've done things like this in the past I've ended up using Apache conf  
settings like Chris' suggestion, though I'm realizing as I'm writing  
this that using $ENV{PATH_INFO} instead of the query string might  
solve that problem - take a look at the other Andy's suggestion for  
how to use that:

a  
href=javascript:window.location='cgi-bin/download.cgi/Upload- 
Background.gif'picture link/a

my $filename = $ENV{'PATH_INFO'};

Good luck
Andy

On Aug 24, 2004, at 6:17 PM, Andrew Mace wrote:
$path is a system path, right?  As in, like, not relative to the  
webserver?  Just making sure...

Also, I messed up and used $length in one place and $size in another,  
though that doesn't explain your troubles.

I mean, you could do a lot of things to debug.  A quick thing you  
could do would be to change the content type to image/jpeg and remove  
the Content-Disposition and see what gets put into your browser.   
Since you're writing the HTTP headers before attempting to open the  
file, my suspicion is that there's something wrong with the path to  
the file and your script is exiting prematurely.

Andy


On Aug 24, 2004, at 8:23 PM, Mark Wheeler wrote:
Hi Andy,
Thanks for the input. I should have check the read/write method --  
my bad.

I tried both the slurp and the read methods, but the same thing  
still happens. On a PC the save dialog comes up but the file saved  
is 0k, and on a Mac, the the progress bar is just a spinning barber  
poll. Any ideas?

Thanks,
Mark
On Aug 24, 2004, at 3:56 PM, Andrew Mace wrote:
Hey Mark -
A few things.
- You want to open the file for reading, not to write.
- You should undef $/ to slurp the file if you're using   to read.
- You should stat the file before opening it to add the  
Content-Length header, if you want.
- For larger files, it would make more sense to use read() calls  
instead of slurping the entire file into memory.

So here's an updated version:
#!/usr/bin/perl -w
use strict;
use CGI ':standard';
my $filename = param('picname');
my $path = /images/$filename;
my $length = (stat($path))[7]; # the size, in bytes
binmode STDOUT;
print Content-Length: $size\n;
print Content-Disposition: attachment;filename=$filename\n;
print Content-Type: application/octet-stream\n\n;
open (FILE,  $path) || die(Can't open($filename): $!);
binmode(FILE);
# slurp method:
undef $/;
my $data = FILE;
close (FILE);
print $data;
# read() method would be:
while(read(FILE,$data,4096)) {
print $data;
}
close(FILE);
exit;
Good luck
Andy

On Aug 24, 2004, at 6:19 PM, Mark Wheeler wrote:
Hi all,
Here is my first attempt to write this script. I will be adding  
the protection/whitelisting/etc. after I get the basic this  
running. Here is what I have so far, and here is what happens. On  
a PC, the dialog box comes up and saves the file, but it is 0K --  
nothing in it. On a Mac, the Downloads dialog box comes up, but  
the progress bar keeps spinning and nothing happens. Below is the  
HTML that calls the script and the CGI script itself. What did I  
forget/do wrong?

Thanks,
Mark
-
html
head
titleUntitled Page/title
/head
body
a  
href=javascript:window.location='cgi-bin/download.cgi? 
picname=Upload-Background.gif'picture link/a
/body
/html

-
#!/usr/bin/perl -w
use strict;
use CGI ':standard';
my $filename = param('picname');
my $path = /images/$filename;
binmode STDOUT;
print Content-Disposition: attachment;filename=$filename\n;
print Content-Type: application/octet-stream\n\n;
open (FILE,  $path) || die(Can't open($filename): $!);
my $data = FILE;
close (FILE);
print $data;
exit;
-
On Aug 23, 2004, at 2:45 PM, Joel Rees wrote:
I think that's what I'm looking for. One question. What do you  
mean whitelist the filepaths. My only reference point is  
email. Whitelist for me means that email address on my  
whitelist always get through, even though the spam software  
might initially think it's spam. Can you clarify?
If the script I posted was readable, you might have noticed that  
it accepts one parameter

Re: Download images/movies

2004-08-24 Thread Mark Wheeler
Hi all,
Here is my first attempt to write this script. I will be adding the  
protection/whitelisting/etc. after I get the basic this running. Here  
is what I have so far, and here is what happens. On a PC, the dialog  
box comes up and saves the file, but it is 0K -- nothing in it. On a  
Mac, the Downloads dialog box comes up, but the progress bar keeps  
spinning and nothing happens. Below is the HTML that calls the script  
and the CGI script itself. What did I forget/do wrong?

Thanks,
Mark
-
html
head
titleUntitled Page/title
/head
body
a  
href=javascript:window.location='cgi-bin/download.cgi?picname=Upload- 
Background.gif'picture link/a
/body
/html

-
#!/usr/bin/perl -w
use strict;
use CGI ':standard';
my $filename = param('picname');
my $path = /images/$filename;
binmode STDOUT;
print Content-Disposition: attachment;filename=$filename\n;
print Content-Type: application/octet-stream\n\n;
open (FILE,  $path) || die(Can't open($filename): $!);
my $data = FILE;
close (FILE);
print $data;
exit;
-
On Aug 23, 2004, at 2:45 PM, Joel Rees wrote:
I think that's what I'm looking for. One question. What do you mean  
whitelist the filepaths. My only reference point is email.  
Whitelist for me means that email address on my whitelist always  
get through, even though the spam software might initially think it's  
spam. Can you clarify?
If the script I posted was readable, you might have noticed that it  
accepts one parameter and sets the directories only if that parameter  
matches correctly. It looks like a waste, but it's one way of what he  
was calling whitelisting in a fairly strict way, but allowing the same  
script to be used on multiple sets of images. You do have to add a  
little code for each set of images, of course.

That script needs some comments.
--
Joel Rees
Getting involved in the neighbor's family squabbles is dangerous.
But if the abusive partner has a habit of shooting through his/her  
roof,
the guy who lives upstairs is in a bit of a catch-22.




Re: Download images/movies

2004-08-24 Thread Mark Wheeler
Hi Andy (another andy),
I tried your changes, but not go. On a PC, a 0k file is saved. On a  
Mac, the browser (Safari 1.2.2) gives me a blank screen with nothing  
d/l or a save dialog box - nothing. Any ideas?

Thanks,
Mark
On Aug 24, 2004, at 4:10 PM, Andy Turner wrote:
I would also recommend using PATH_INFO instead of a query string.   
This will
more reliably set the filename then the content disposition will.

The HTML would be:
html
head
titleUntitled Page/title
/head
body
a  
href=javascript:window.location='cgi-bin/download.cgi/Upload- 
Background.gif'picture link/a
/body
/html

I would agree that slurping the entire file is a bad idea.  However you
don't need to use read.  You can do it by setting $/ (the
INPUT_RECORD_SEPARATOR) to whatever block size you want.
The result looks like this:
#!/usr/bin/perl -w
use strict;
my $filename = $ENV{'PATH_INFO'};
my $path = /images/$filename;
my $length = (stat($path))[7]; # the size, in bytes
binmode STDOUT;
print Content-Length: $size\n;
print Content-Disposition: attachment;filename=$filename\n;
print Content-Type: application/octet-stream\n\n;
open (FILE,  $path) || die(Can't open($filename): $!);
binmode(FILE);
# Use 4k blocks
$/ = \4_096;
print while FILE;
close (FILE);
exit;
--
Andy [EMAIL PROTECTED]



Re: Download images/movies

2004-08-24 Thread Mark Wheeler
Hi Chris,
I'm not at home (where the server is) so I'll give that a try, too. The 
drawback on this method would be that I would only be able to use it on 
a server that I had access to the Apache config file. This works well 
at home, but not so well with a paid outside hosting service. But I'm 
gonna try it! I'll let you know how it goes.

Thanks,
Mark
On Aug 24, 2004, at 4:34 PM, Chris Devers wrote:
On Tue, 24 Aug 2004, Andy Turner wrote:
I would agree that slurping the entire file is a bad idea.
This whole project is, in hindsight, a bad idea.
This can be done more safely  easily in the Apache config.
Assume that the image tree lives in 
/Library/WebServer/Documents/photos, and is ordinarily accessible at 
the url http://site/photos/.

Do this in your shell:
ln -s /Library/WebServer/Documents/photos{,-dl}
Do this in your httpd.conf:
Alias /photo-dl /Library/WebServer/Documents/photos-dl
Directory /Library/WebServer/Documents/photos-dl
AddType application/octet-stream .jpg
/Directory
Restart Apache.
fin.
The image tree will now be available for regular browsing at 
http://site/photos/ as before, but also for downloading at 
http://site/photo-dl/.

No mucking around with whitelists.
No risk of nasty path ../foo tricks.
It should Just Work.
And if it doesn't, your script wouldn't have either :-)

--
Chris Devers  [EMAIL PROTECTED]
http://devers.homeip.net:8080/blog/
np: 'Il Buono, Il Brutto, Il Cattivo - Titoli Di Testa'
 by Ennio Morricone
 from 'Le Colonne Sonore Originali Dei Film Di Sergio Leone'



Re: Download images/movies

2004-08-23 Thread Mark Wheeler
Hi William,
I think that's what I'm looking for. One question. What do you mean 
whitelist the filepaths. My only reference point is email. 
Whitelist for me means that email address on my whitelist always 
get through, even though the spam software might initially think it's 
spam. Can you clarify?

Thanks,
Mark
On Aug 23, 2004, at 3:17 AM, william ross wrote:
On Sat, 21 Aug 2004, Mark Wheeler wrote:
I have a picture gallery I building for my family. When a movie or 
picture is displayed, I want them to be able to save it. But... if I 
just provide a link in the coding to the actual file, it will open up 
in the browser window and be displayed. Is there a way to have 
download, either automatically or by a Save As... dialog box, the 
file rather then displaying it? I hope that was clear. :)
This is untested, but I'm guessing that you could write a simple CGI 
script that takes the URL for an image as an argument -- maybe just 
using $ENV{'HTTP_QUERY_STRING'} so that the url can be simple like --

http://site/images/fetch.pl?path/to/image/file.jpg
-- and then have your script find path/to/image/file.jpg and spool 
it back to the client with a Content-type of 
application/octet-stream instead of image/jpeg.\
No need. On apache, at least, you can change the mime-type in an 
.htaccess file. Assuming the AllowOverride settings permit it, which 
they normally would:

AddType application/octet-stream jpg
should do it. This will mean that jpegs in that directory can't ever be 
used on pages, but as long as your thumbnails are stored in another 
directory I expect that's ok.

if you prefer the control offered by the scripted approach, you will 
also need to think about file names, or it is likely that any 
downloaded image will arrive with the title of your script, display the 
wrong kind of icon and cause great confusion (especially if the 
intended audience struggles to right-click). The official but not 
always reliable way to deal with this is to send a Content-Disposition 
header as well as the Content-Type. Something like:

binmode STDOUT;
print Content-Disposition: attachment;filename=$filename\n;
print Content-Type: application/octet-stream\n\n;
print while FILE;
is supposed to throw up a save dialog with $filename filled in. I think 
all modern browsers will work with this, but in the old days it was 
patchily supported. The older sneakier way is to use path-info rather 
than query string to pass in the file path. That gives a url like 
/download.pl/photos/unclebob.jpg, which the browser will usually do the 
right thing with.

And you will of course whitelist the file paths you are allowing people 
to download... :)

best
will


This can probably be done with about half a dozen lines of code, and 
if the browser is well behaved -- that'll be the part that's a pain to 
verify -- the alternate content type should force the right behavior.

Let me know if you find this description unclear...
--
Chris Devers  [EMAIL PROTECTED]
http://devers.homeip.net:8080/blog/
np: 'Ham 'n' Eggs'
 by A Tribe Called Quest
 from 'People's Instinctive Travels And Paths Of Rhythm'



Re: Download images/movies

2004-08-23 Thread Mark Wheeler
Hi Pete,
I'll keep that in mind. Gotta love IE...
Mark
On Aug 23, 2004, at 6:58 AM, Pete Prodoehl wrote:
william ross wrote:
On 21 Aug 2004, at 20:07, Chris Devers wrote:
On Sat, 21 Aug 2004, Mark Wheeler wrote:
This is untested, but I'm guessing that you could write a simple CGI 
script that takes the URL for an image as an argument -- maybe just 
using $ENV{'HTTP_QUERY_STRING'} so that the url can be simple like --

http://site/images/fetch.pl?path/to/image/file.jpg

This can probably be done with about half a dozen lines of code, and 
if the browser is well behaved -- that'll be the part that's a pain 
to verify -- the alternate content type should force the right 
behavior.
Since the phrase if the browser is well behaved is in there, I should 
mention experience I've had with Internet Explorer. In trying to serve 
up text files to IE with application/octet-stream, IE was ignoring the 
mime-type and using the file extension instead, so that:

  http://site/images/fetch.pl?path/to/file.txt
was being displayed in the browser. A quick fix was this:
  http://site/images/fetch.pl?path/to/file.txtiesux
to prevent IE from seeing .txt at the end of the url...
Pete



Download images/movies

2004-08-21 Thread Mark Wheeler
Hi,
I have a picture gallery I building for my family. When a movie or 
picture is displayed, I want them to be able to save it. But... if I 
just provide a link in the coding to the actual file, it will open up 
in the browser window and be displayed. Is there a way to have 
download, either automatically or by a Save As... dialog box, the 
file rather then displaying it? I hope that was clear. :)

Thanks,
Mark


Re: Download images/movies

2004-08-21 Thread Mark Wheeler
Hi Chris,
That makes sense. I'll give it a try and let you know.
Thanks,
Mark
On Aug 21, 2004, at 12:07 PM, Chris Devers wrote:
On Sat, 21 Aug 2004, Mark Wheeler wrote:
I have a picture gallery I building for my family. When a movie or 
picture is displayed, I want them to be able to save it. But... if I 
just provide a link in the coding to the actual file, it will open up 
in the browser window and be displayed. Is there a way to have 
download, either automatically or by a Save As... dialog box, the 
file rather then displaying it? I hope that was clear. :)
This is untested, but I'm guessing that you could write a simple CGI 
script that takes the URL for an image as an argument -- maybe just 
using $ENV{'HTTP_QUERY_STRING'} so that the url can be simple like --

http://site/images/fetch.pl?path/to/image/file.jpg
-- and then have your script find path/to/image/file.jpg and spool it 
back to the client with a Content-type of application/octet-stream 
instead of image/jpeg.

This can probably be done with about half a dozen lines of code, and if 
the browser is well behaved -- that'll be the part that's a pain to 
verify -- the alternate content type should force the right behavior.

Let me know if you find this description unclear...
--
Chris Devers  [EMAIL PROTECTED]
http://devers.homeip.net:8080/blog/
np: 'Ham 'n' Eggs'
 by A Tribe Called Quest
 from 'People's Instinctive Travels And Paths Of Rhythm'


Re: Download images/movies

2004-08-21 Thread Mark Wheeler
Hi Bill,
That's pretty much what Chris said, too. I'll give it a try and let you 
know.
On Aug 21, 2004, at 11:27 AM, Bill Stephenson wrote:

Hey Mark,
I sympathize with you, it should be easy to ask them just to right 
click, or control click but most of my family just doesn't grasp the 
concept any better than I do the GameCube keypad commands my son tells 
me to use when he's whupping me on a Football game.

I think if you filter the link through a cgi script you can change the 
header to force the browser to download the file, or you might just 
create a copy of each file, zip them up, and create a link to them.

Kindest Regards,
Bill Stephenson
417-546-5593
On Aug 21, 2004, at 1:06 PM, Mark Wheeler wrote:
Hi,
I have a picture gallery I building for my family. When a movie or 
picture is displayed, I want them to be able to save it. But... if I 
just provide a link in the coding to the actual file, it will open up 
in the browser window and be displayed. Is there a way to have 
download, either automatically or by a Save As... dialog box, the 
file rather then displaying it? I hope that was clear. :)

Thanks,
Mark



Re: Download images/movies

2004-08-21 Thread Mark Wheeler
Thanks. I'll check it out.
Mark
On Aug 21, 2004, at 4:17 PM, Joel Rees wrote:
http://reiisi.homedns.org/~joel/cs/shared_code/showpics.pl.text


Re: SoccerDirector ready

2004-07-25 Thread Mark Wheeler
Hi,
As a person who subscribes to the [EMAIL PROTECTED] mailing list, I was 
struck funny by the your email to Warren, Marc, Clarc, and Eddy. I 
could be wrong, but... I think this email might not have been for all 
of us on the list. Am I wrong? Just didn't want anyone to get into deep 
weeds over it. Just checking...

Mark
On Jul 25, 2004, at 4:40 PM, [EMAIL PROTECTED] wrote:
Dear Warren, Marc, Clark, Eddy:
SoccerDirector is ready for the division heads to use. Writing the User 
Guide
resulted in some more features being added. I think I probably spent 
more
time on it than I should have, so I'm happy to hand it off now and move 
on to
other projects.

I've uploaded it to my own ftp site for you to access. The ftp setup is:
Host: ftp.paginatem.com
User: anonymous
Password: (none)
Directory: /incoming
There are three files to get and post:
SoccerDirector Mac.sit
SoccerDirector Startup.pdf
SoccerDirector Windows.sit
If you have trouble accessing the site, I can probably put the files on 
a CD
and walk it over.

The Startup document is a one-page description on how to:
- install the program
- launch it for the first time
- view the User Guide
- input the WSSL password (wssl)
Users will need to use Expander from Aladdin Systems to uncompress the 
.sit
files. It's a free utility available from several sources. Some
browsers/email systems include it, like AOL.

I'll leave it to you as to how to setup a download page. I think the 
page
should be password protected and include the following text:

The West Side Soccer League has permission to make SoccerDirector 
available
for the use of its Division Heads and Board Members. SoccerDirector is
copyrighted software and cannot be re-distributed or sold to other 
parties. By
downloading this software you are agreeing to these terms.

Thanks for posting these files. Let me know if you need any help.
I hope your summer is going well.
Best regards,
Alan


Copy error with File::Copy

2004-05-04 Thread Mark Wheeler
Hi,
I used the File::Copy module to copy() 4 files from a PC server to a 
Mac external firewire drive. Three of the four files copied great! 
(Thanks for all your help on that.) The one file that didn't copy was a 
QuickBooks database file. When the perl script ran, I got the following 
error:

Can't copy file /Volumes/PRINCETON;DELLSERVER-1/DatabaseQB.QBW to 
/Volumes/10GB Firewire Drive/DatabaseQB.QBW-05-04-04.bak - Resource 
deadlock avoided

A file called DatabaseQB.QBW-05-04-04.bak WAS created, BUT it had 0k in 
the file.

The other three copied fine. Just this one gave me the error. What is 
thei Resource deadlock avoided?

Thanks,
Mark


Re: Copy file from PC to Mac on network using cron and perl

2004-05-02 Thread Mark Wheeler
Hi Ronan,
Here is the script in it's functioning state. You can easily modify it  
to your specs. It's not very complicated.

Marny thanks, again, to all who helped out on this project.
Mark
 
-
#!/usr/bin/perl -w

use strict;
use File::Copy;
# Name of files to copy, as many as you need
my @dbname = (db1.txt,db2.txt,db3.txt,db4.txt);
# Pathway after the main server name - Pathways must match the files  
above, array number for array number
my @dbpath =  
(pathway/to/files,pathway/to/files,pathway/to/files,pathway/to/ 
files);

# Basic root directory for where the files will be copied TO
my $dirto = /Volumes/OEMWorkgroup\;OEMCOMPUTER/; # Example of the  
root server path to a shared folder on a PC

# Basic root directory for where the files will be copied FROM
my $dirfrom = /Users/xx/Documents/;
my ($backup, $i);
my $timetest = time;
my ($sec,$min,$hour,$mday,$mon,$year,$wday) = localtime($timetest);
$year = substr(1900 + $year,2,2);
$mon++;
if ($mon   10) { $mon  = 0$mon;  }
if ($mday  10) { $mday = 0$mday; }
my $date = $mon-$mday-$year;
for ($i=0; $i=$#dbname; $i++) {
  $backup = $dbname[$i]-$date.bak;
  copy ($dirfrom$dbpath[$i]/$dbname[$i], $dirto$backup) or warn  
Can't copy file $dirfrom$dbpath[$i]/$dbname[$i] to $dirto$backup -  
$!\n;
  if (-e $dirto$backup) {
  print $dbname[$i] backed up.\n;
  } else {
  print $dbname[$i] NOT backed up!\n;
  }
}

print Backup Complete.\n;
 


On May 2, 2004, at 5:57 PM, Ronan O Ciosoig wrote:
did you get this up and running?
I need to get a backup script running myself now as well on a Win2k  
server. Not sure how to do it. What's the equivalent to cron on  
Windows?

Thanks.
On 29 Apr 2004, at 04:28, Mark Wheeler wrote:
Hi Ronan,
Could you elaborate? I'm not familiar with 'scp'.
Thanks,
Mark
On Apr 28, 2004, at 1:22 AM, Ronan O Ciosoig wrote:
You should use 'scp' - secure copy or ftp.
scp /path/to/file [EMAIL PROTECTED]:/Users/username/path/to/backup
or something like that.
Ronan.





Re: Access External Hard Drive - Local and Network

2004-05-02 Thread Mark Wheeler
Hi all,
I posted this on this forum but under a different Subject. Here is the  
finished script for those who might be interested.

Thanks to all who helped me with this.
Mark
 
---
#!/usr/bin/perl -w

use strict;
use File::Copy;
# Name of files to copy, as many as you need
my @dbname = (db1.txt,db2.txt,db3.txt,db4.txt);
# Pathway after the main server name - Pathways must match the files  
above, array number for array number
my @dbpath =  
(pathway/to/files,pathway/to/files,pathway/to/files,pathway/to/ 
files);

# Basic root directory for where the files will be copied TO
my $dirto = /Volumes/OEMWorkgroup\;OEMCOMPUTER/; # Example of the  
root server path to a shared folder on a PC

# Basic root directory for where the files will be copied FROM
my $dirfrom = /Users/xx/Documents/;
my ($backup, $i);
my $timetest = time;
my ($sec,$min,$hour,$mday,$mon,$year,$wday) = localtime($timetest);
$year = substr(1900 + $year,2,2);
$mon++;
if ($mon   10) { $mon  = 0$mon;  }
if ($mday  10) { $mday = 0$mday; }
my $date = $mon-$mday-$year;
for ($i=0; $i=$#dbname; $i++) {
  $backup = $dbname[$i]-$date.bak;
  copy ($dirfrom$dbpath[$i]/$dbname[$i], $dirto$backup) or warn  
Can't copy file $dirfrom$dbpath[$i]/$dbname[$i] to $dirto$backup -  
$!\n;
  if (-e $dirto$backup) {
  print $dbname[$i] backed up.\n;
  } else {
  print $dbname[$i] NOT backed up!\n;
  }
}

print Backup Complete.\n;
 


On May 1, 2004, at 9:11 AM, Sherm Pendley wrote:
On May 1, 2004, at 11:59 AM, Mark Wheeler wrote:
OK, I think I got it. When I get to work tomorrow I'll test it out.  
One last question. Is there a web site or book I can read that goes  
through all that you've shared with me? I'd like to learn more.
The Perl side of things is described in 'perldoc perlop', in the  
section Quote and Quote-like Operators.

I haven't read it, but I've heard Good Things about O'Reilly's  
Learning Unix for Mac OS X Panther:

http://www.oreilly.com/catalog/lunixpanther/
sherm--



Re: Access External Hard Drive - Local and Network

2004-05-01 Thread Mark Wheeler
So all I need to do is fix my spelling error and (add the N) and I'm 
good to go, right? Then when I'm in the command line in the Terminal, 
to access the PRINCETON;DELLSERVER directory, I would use, for example:

% ls -l /Volumes/'PRINCETON;DELLSERVER'/
or
% ls -l /Volumes/PRINCETON\\;DELLSERVER/
or
% ls -l /Volumes/'PRINCETON\\;DELLSERVER'/
Am I getting warm?
Thanks,
Mark
On Apr 30, 2004, at 10:50 PM, Sherm Pendley wrote:
On May 1, 2004, at 1:37 AM, Mark Wheeler wrote:
With that changed, does everything in the script look in order to 
function correctly? Or do I need to change it to 
/Volumes/PRINCETON\;DELLSERVER/;
No, you're using Perl's built-in copy() function, so the back-slash 
isn't needed. It's only needed if you're calling an external tool such 
as cp or CpMac, for example, and passing the file name.

Note that, as it stands, the backslash in the source code isn't 
actually making it into the string. The string is double-quoted, so \; 
is interpreted as an escape sequence. Since \; isn't a valid escape 
sequence, the backslash is ignored and the result is just a semicolon. 
To insert a literal backslash into a double-quoted string, you need to 
double it - \\.

sherm--



Re: Access External Hard Drive - Local and Network

2004-05-01 Thread Mark Wheeler
OK, I think I got it. When I get to work tomorrow I'll test it out. One 
last question. Is there a web site or book I can read that goes through 
all that you've shared with me? I'd like to learn more.

Thanks,
Mark
On May 1, 2004, at 8:34 AM, Sherm Pendley wrote:
On May 1, 2004, at 11:00 AM, Mark Wheeler wrote:
Then when I'm in the command line in the Terminal, to access the 
PRINCETON;DELLSERVER directory, I would use, for example:

% ls -l /Volumes/'PRINCETON;DELLSERVER'/
Yes. The single-quotes in the above will prevent the shell from 
parsing the ';' as the end of the command.

% ls -l /Volumes/PRINCETON\\;DELLSERVER/
Only a single back-slash is needed when you type it directly.
Two back-slashes are needed if you define it in a double-quoted string 
in a Perl script, but only one to define it in a single-quoted string, 
like so:

my $path = /Volumes/FOO\\;BAR/;
system(ls -l $path);
$path = '/Volumes/FOO\;BAR/';
system(ls -l $path);
In double-quoted strings, Perl uses back-slashes for escape sequences 
too, like \t, \s, and \n. So, to include a literal back-slash, it has 
to be doubled. Single-quoted strings in Perl aren't processed for 
escape sequences, so doubling the back-slashes aren't needed. So both 
of the above Perl snippets will run the same command, passing a single 
back-slash to the shell:

ls -l /Volumes/FOO\;BAR/
% ls -l /Volumes/'PRINCETON\\;DELLSERVER'/
The shell follows the same quoting rules as Perl. So when you use 
single quotes here, the back-slashes aren't parsed as escapes - as a 
result, ls will look for a path that actually has two back slashes in 
it. Which is a legal file name here - this ain't MSDOS. ;-)

sherm--



Re: Access External Hard Drive - Local and Network

2004-04-30 Thread Mark Wheeler
Hi,
Thanks for the help. Below is the code and (although from memory) a  
listing of the /Volumes/ directory.

/Volumes/:
10 GB Firewire Drive
eDrive
PRINCETON;DELLSERVER
PRINCETON;DELLSERVER-1
PRINCETON;DELLSERVER-2
PRINCETON;DELLSERVER-3
And the perl code:
 
-
#!/usr/bin/perl -w

use strict;
use File::Copy;
my @dbname = (file 1.dat,file 2.dat,file 3.dat,file 4.dat);
my @dbpath = (directory 1,directory 2/subdirectory  
2,SharedDocs,SharedDocs);
my $dirto = /Volumes/10GB Firewire Drive/;
my $dirfrom = /Volumes/PRICETON;DELLSERVER/;
my ($backup, $i);

my $timetest = time;
my ($sec,$min,$hour,$mday,$mon,$year,$wday) = localtime($timetest);
$year = substr(1900 + $year,2,2);
$mon++;
if ($mon   10) { $mon  = 0$mon;  }
if ($mday  10) { $mday = 0$mday; }
my $date = $mon-$mday-$year;
for ($i=0; $i=$#dbname; $i++) {
  $backup = $dbname[$i].-$date.bak;
  copy ($dirfrom$dbpath[$i]/$dbname[$i], $dirto$backup) or warn  
Can't copy file $dirfrom$dbpath[$i]/$dbname[$i] to $dirto$backup -  
$!\n;
  if (-e $dirto$backup) {
  print $dbname[$i] backed up.\n;
  } else {
  print $dbname[$i] NOT backed up!\n;
  }
}

print Backup Complete.\n;
 


I hope this makes things more clear.
Thanks,
Mark
On Apr 30, 2004, at 8:54 PM, Chris Devers wrote:
On Fri, 30 Apr 2004, Mark Wheeler wrote:
[snip] In the Volumes directory, it lists the following as the mounted
folder:
PRINCETON;DELLSERVER
How do I get into the server? The pathway I tried is:
/Volumes/PRINCETON;DELLSERVER/
That didn't work.
These kinds of things are *always* easier for people to debug when we
can actually see, at a minimum, a sample of the code in question. In
this case, seeing a directory listing wouldn't hurt either:
   $ ls -l /Volumes/
At a guess, the semi-colon may need to be escaped with a backslash.
These shell commands try to show why:
$ ls -l PR*
ls: PR*: No such file or directory
$ touch PRINCETON;DELLSERVER
bash: DELLSERVER: command not found
$ ls -l PR*
-rw-r--r--  1 cdevers  admin0 Apr 30 23:44 PRINCETON
$ touch PRINCETON\;DELLSERVER
$ ls -l PR*
-rw-r--r--  1 cdevers  admin0 Apr 30 23:44 PRINCETON
-rw-r--r--  1 cdevers  admin0 Apr 30 23:44 PRINCETON;DELLSERVER
$ rm PR*
$ touch 'PRINCETON;DELLSERVER'
$ ls -l PR*
-rw-r--r--  1 cdevers  admin0 Apr 30 23:45 PRINCETON;DELLSERVER
$ rm PR*
$ touch PRINCETON;DELLSERVER
$ ls -l PR*
-rw-r--r--  1 cdevers  admin0 Apr 30 23:46 PRINCETON;DELLSERVER
$ rm PR*
$ touch PRINCETON\;DELLSERVER
$ ls -l PR*
-rw-r--r--  1 cdevers  admin0 Apr 30 23:46  
PRINCETON\;DELLSERVER

See what's going on? With a backslash or quotes, I'm able to create the
file. With no backslash, I create a file with everything up until the
semi-colon as the name; with quotes and a backslash the file ends up
having the literal backslash character.
So, it's hard to say what you need to do without knowing what your code
looks like, but bear in mind that Perl's rules for this kind of thing
will be similar to what the shell is doing here. Just note that you
probably *must* quote the string, or Perl will treat the text as a
bareword and throw ugly warnings  errors at you, so you need some way
of balancing quotes  backslashes appropriately. Make sense?
It may be easier for you to just symlink the semi-colon version of the
name to an easier equivalent:
$ ln -s /Volumes/PRINCETON\;DELLSERVER /Volumes/dellserver
And things should be much easier in Perl-land after that...

--
Chris Devers



Re: Access External Hard Drive - Local and Network

2004-04-30 Thread Mark Wheeler
Hi Sherm,
Yes, it's copy-n-pasted! I can't believe I missed that! With that 
changed, does everything in the script look in order to function 
correctly? Or do I need to change it to 
/Volumes/PRINCETON\;DELLSERVER/;

Thanks,
Mark
On Apr 30, 2004, at 10:30 PM, Sherm Pendley wrote:
On May 1, 2004, at 1:08 AM, Mark Wheeler wrote:
PRINCETON;DELLSERVER

my $dirfrom = /Volumes/PRICETON;DELLSERVER/;
Is that code copy-n-pasted? If it is, it's missing an 'N'. ;-)
sherm--



Re: Copying files

2004-04-29 Thread Mark Wheeler
Bingo! That helped me see that it was my date being set to xx/xx/xx 
which of course was seen as directories within the script. I changed 
for date format to xx-xx-xx and the problem is solved.

Thanks again for your help.
Mark
On Apr 28, 2004, at 8:48 PM, Sherm Pendley wrote:
On Apr 28, 2004, at 11:32 PM, Mark Wheeler wrote:
  copy ($dirfrom$dbpath[$i]/$dbname[$i], $dirto$backup) or warn 
Can't copy file: $dbname[$i] - $!\n;
You might want to try a more verbose error message, like:
warn Can't copy file $dirfrom$dbpath[$i]/$dbname[$i] to $dirto$backup 
- $!\n;

That would verify that it's trying to copy what you think it's trying 
to copy.

sherm--



Access External Hard Drive - Local and Network

2004-04-29 Thread Mark Wheeler
Hi all,
OK, this is kind of part two of my backup project. How do I access an 
external (or secondary internal, for that matter) hard drive within 
perl? I tried the following:

.
.
copy (/Users/xx/Documents/db.txt,/Fire1/db.txt.bak);
.
.
That didn't work. How do I access the external drive? As well, this 
question would seg into accessing a PC drive on my network. I was 
guessing all I would need is the pathway, but I'm thinking that I need 
to use a module... or something.

This may seem simple but it's new for me. Thanks for you help.
Mark


Access External Hard Drive - Local and Network

2004-04-29 Thread Mark Wheeler
OK... the Fire1 is the name of my external hard drive. Forgot to 
mention that.

Sorry,
Mark


Re: Access External Hard Drive - Local and Network

2004-04-29 Thread Mark Wheeler
Thanks Jeff and Joseph,
You're right. It's in /Volumes/
I'm not on the network right now, but I'm presuming that the PC 
drive(s) would appear in the /Volumes/ directory as well. Can you 
confirm that?

Thanks,
Mark
On Apr 29, 2004, at 9:14 AM, Joseph Alotta wrote:
Mark,
Look around in /Volumes/... for something that looks like Fire1.
Joe.
On Apr 29, 2004, at 10:57 AM, Mark Wheeler wrote:
Hi all,
OK, this is kind of part two of my backup project. How do I access an 
external (or secondary internal, for that matter) hard drive within 
perl? I tried the following:

.
.
copy (/Users/xx/Documents/db.txt,/Fire1/db.txt.bak);
.
.
That didn't work. How do I access the external drive? As well, this 
question would seg into accessing a PC drive on my network. I was 
guessing all I would need is the pathway, but I'm thinking that I 
need to use a module... or something.

This may seem simple but it's new for me. Thanks for you help.
Mark





Re: Access External Hard Drive - Local and Network

2004-04-29 Thread Mark Wheeler
Perfect. Thanks so much for your help. I'll implement the directory 
changes and we should be good to go.

Thanks,
Mark
On Apr 29, 2004, at 9:35 AM, Chris Devers wrote:
On Thu, 29 Apr 2004, Mark Wheeler wrote:
I'm not on the network right now, but I'm presuming that the PC
drive(s) would appear in the /Volumes/ directory as well. Can you
confirm that?
Yes -- as a general rule, OSX mounts all filesystems other than the one
you booted from under the /Volumes tree. This includes external drives,
other locally attached physical discs (CD/DVD drives, Zip drives, etc),
network shared drives (AFP, Samba, FTP, WebDAV, etc), and mounted disc
images. I may have omitted some, but that gives you the idea.
The only way this is typically overridden is when, for example, you 
have
a NFS mounted /home directory tree, but that's probably more common 
with
bigger networks than home machines (I assume). That or when you have an
alias or symlink from /Volumes/$foo to /path/to/$bar, but even then 
it's
not that /Volumes isn't being used, it's just being supplemented.

So as the earlier mail you got suggested, everything is in /Volumes.
--
Chris Devers



Re: Copying files

2004-04-28 Thread Mark Wheeler
Well, it looks like it was the line endings. They were mac, I changed 
them to Unix, chmod the hello world script to 755, and the basic Hello 
world script fired off great. Next step is to read the file and print 
it's contents to an email.

Mark

On Apr 27, 2004, at 8:23 PM, Ken Williams wrote:

On Apr 27, 2004, at 5:07 PM, Mark Wheeler wrote:

Yup. You're right. I missed that one. Here's what I did to simplify 
the testing of the script.

#!/usr/bin/perl -w

use strict;
use File::Copy;
copy(/Users/xx/Documents/db1.txt, 
/Users/xx/Documents/db1.txt.bak) or warn Can't copy file: $!;

print Backup Completed.;

exit;
-
I know the cron is firing off the request, because when first tried 
it, I got Permission Denied in my email box. So I changed the 
permission to 755 and it still doesn't copy the file. And I get 
nothing in my email box. I'm a little confused. What am I missing?
First rule when it looks like a script isn't doing anything on OS X: 
check the line endings.  Make sure they're unix-style.  If they're 
Mac-Classic style, running the script won't actually do anything.

First rule when setting up cron jobs: make sure cron itself is 
running.  Set up a job with the same timings as the script in 
question, but make its action echo foo or something like that.  You 
should get an email when it runs.  If not, then cron's the problem, 
not perl.  I know you said it worked before, but just to make sure...

 -Ken




Re: Copying files

2004-04-28 Thread Mark Wheeler
Ok, It's working great, now. Thank you Ken and Bruce and anyone else I 
am forgetting. Now the to finish the ride, all I have to do now is 
figure out how to get the file from my PC and copy to an external hard 
drive. I'm resuming all I need are the paths to the PC and the drive. 
Does that sound right?

Thanks,

Mark

On Apr 27, 2004, at 11:23 PM, Mark Wheeler wrote:

Well, it looks like it was the line endings. They were mac, I changed 
them to Unix, chmod the hello world script to 755, and the basic Hello 
world script fired off great. Next step is to read the file and print 
it's contents to an email.

Mark

On Apr 27, 2004, at 8:23 PM, Ken Williams wrote:

On Apr 27, 2004, at 5:07 PM, Mark Wheeler wrote:

Yup. You're right. I missed that one. Here's what I did to simplify 
the testing of the script.

#!/usr/bin/perl -w

use strict;
use File::Copy;
copy(/Users/xx/Documents/db1.txt, 
/Users/xx/Documents/db1.txt.bak) or warn Can't copy file: 
$!;

print Backup Completed.;

exit;
-
I know the cron is firing off the request, because when first tried 
it, I got Permission Denied in my email box. So I changed the 
permission to 755 and it still doesn't copy the file. And I get 
nothing in my email box. I'm a little confused. What am I missing?
First rule when it looks like a script isn't doing anything on OS X: 
check the line endings.  Make sure they're unix-style.  If they're 
Mac-Classic style, running the script won't actually do anything.

First rule when setting up cron jobs: make sure cron itself is 
running.  Set up a job with the same timings as the script in 
question, but make its action echo foo or something like that.  You 
should get an email when it runs.  If not, then cron's the problem, 
not perl.  I know you said it worked before, but just to make sure...

 -Ken





Re: Copying files

2004-04-28 Thread Mark Wheeler
Hi Ken,

I switched that because it was suggested that writing files over system 
boundaries might be a problem. What is the difference between the two? 
It sounds like, from your comment, that they do very different things.

Thanks,

Mark

On Apr 28, 2004, at 9:41 AM, Ken Williams wrote:

On Apr 28, 2004, at 2:11 AM, Mark Wheeler wrote:

Ok, It's working great, now. Thank you Ken and Bruce and anyone else 
I am forgetting. Now the to finish the ride, all I have to do now is 
figure out how to get the file from my PC and copy to an external 
hard drive. I'm resuming all I need are the paths to the PC and the 
drive. Does that sound right?
Yup, sounds right.  By the way, I note that you've switched from using 
rename() to using copy(), so your new script is doing something 
different than your old script.  Make sure it's what you want. =)

 -Ken




Re: Copying files

2004-04-28 Thread Mark Wheeler
And thank you for pointing that module out for me. I'd never used it 
before. And I definitely want to use the copy() function. That's 
exactly what I want. The docs were very clear and helpful.

Thanks,

Mark

On Apr 28, 2004, at 10:12 AM, Wiggins d Anconia wrote:

On Apr 28, 2004, at 11:48 AM, Mark Wheeler wrote:

Hi Ken,

I switched that because it was suggested that writing files over
system boundaries might be a problem. What is the difference between
the two? It sounds like, from your comment, that they do very
different things.
Yeah - rename() moves the file, and copy() makes a copy of it.

If we are going to get technical we might as well go further, rename()
changes link information in the inode which is why it doesn't work
across filesystem boundaries, copy() copies a file, then there is 
move()
which moves a file, doing a rename if possible, failing that then it
does a copy and unlink, etc.

Which is why I suggested File::Copy it provides copy() and move(),
assuming the docs got read then Mark could decide between his subject
line Copying files and his code rename ...
http://danconia.org




Re: Copying files

2004-04-28 Thread Mark Wheeler
Hi,
Well, I guess I'm not out of the woods yet. Below is the script as it  
is now. But, I keep getting an error/warning, each time the copy is  
invoked:

Can't copy file: db1.txt - No such file or directory
db1.txt NOT backed up!
Can't copy file: db2.txt - No such file or directory
db2.txt NOT backed up!
Can't copy file: db3.txt - No such file or directory
db3.txt NOT backed up!
Can't copy file: db4.txt - No such file or directory
db4.txt NOT backed up!
I can do a single file, such as /Users/xx/Documents/db1.txt, as  
in the commented line of code below, but using strings, it's not  
happening. I'm missing something, and as usual, it's probably right in  
front of my face. Any help would be appreciated.

Thanks,
Mark
--
#!/usr/bin/perl -w
use strict;
use File::Copy;
my @dbname = (db1.txt,db2.txt,db3.txt,db4.txt);
my @dbpath = (Documents,Documents,Documents,Documents);
my $dirto = /Users/xx/Documents/;
my $dirfrom = /Users/xx/;
my ($from, $to, $backup, $i);
my $timetest = time;
my ($sec,$min,$hour,$mday,$mon,$year,$wday) = localtime($timetest);
$year = substr(1900 + $year,2,2);
$mon++;
if ($mon   10) { $mon  = 0$mon;  }
if ($mday  10) { $mday = 0$mday; }
my $date = $mon/$mday/$year;
#copy (/Users/xx/Documents/db1.txt,  
/Users/xx/Documents/db1.txt.bak) or warn Can't copy file:  
$dbname[$i] - $!\n;

for ($i=0; $i=$#dbname; $i++) {
  $backup = $dbname[$i];
  $backup  =~ s/^(.+)\.(.+)$/$1-$date\.$2/g;
  copy ($dirfrom$dbpath[$i]/$dbname[$i], $dirto$backup) or warn  
Can't copy file: $dbname[$i] - $!\n;
  if (-e $dirto$backup) {
  print $dbname[$i] backed up.\n;
  } else {
  print $dbname[$i] NOT backed up!\n;
  }
}

print \n\nBackup Complete.\n;
 
-

On Apr 27, 2004, at 10:06 PM, Mark Wheeler wrote:
OK... I got the foo in my mailbox, so cron is working. So I'll go  
with the next step of a basic perl script.

Mark
On Apr 27, 2004, at 8:23 PM, Ken Williams wrote:
On Apr 27, 2004, at 5:07 PM, Mark Wheeler wrote:
Yup. You're right. I missed that one. Here's what I did to simplify  
the testing of the script.

#!/usr/bin/perl -w

use strict;
use File::Copy;
copy(/Users/xx/Documents/db1.txt,  
/Users/xx/Documents/db1.txt.bak) or warn Can't copy file:  
$!;

print Backup Completed.;
exit;
-
I know the cron is firing off the request, because when first tried  
it, I got Permission Denied in my email box. So I changed the  
permission to 755 and it still doesn't copy the file. And I get  
nothing in my email box. I'm a little confused. What am I missing?
First rule when it looks like a script isn't doing anything on OS X:  
check the line endings.  Make sure they're unix-style.  If they're  
Mac-Classic style, running the script won't actually do anything.

First rule when setting up cron jobs: make sure cron itself is  
running.  Set up a job with the same timings as the script in  
question, but make its action echo foo or something like that.  You  
should get an email when it runs.  If not, then cron's the problem,  
not perl.  I know you said it worked before, but just to make sure...

 -Ken




Copying files

2004-04-27 Thread Mark Wheeler
Hi,

Thanks all for the help on the mail question a few days back. That's 
fixed. Now I've run into another problem. I'm trying to copy a file on 
a local network (off a PC) to my Mac. But when the script is called 
from within cron, it seems that the script doesn't run. The cron looks 
like this:

* * * * * /Users//Library/Scripts/backup.pl

The script is as follows:

#!/usr/bin/perl -w

use strict;

my @files = db1.txt, db2.txt, db3.txt, db4.txt;

foreach (@files) {
   rename /path/to/pc/file/$_, /Users//Documents/$_..bak;
}
exit;

And finally, should I even use perl to do this? I'm comfortable with 
the little perl I know, but should I use some sort of bash file -- I've 
never messed with bash before, but maybe now is a good time to learn. I 
don't even know if I am referencing bash correctly here.

Thanks for you help.

Mark



Re: Copying files

2004-04-27 Thread Mark Wheeler
Yup. You're right. I missed that one. Here's what I did to simplify the 
testing of the script.

#!/usr/bin/perl -w

use strict;
use File::Copy;
copy(/Users/xx/Documents/db1.txt, 
/Users/xx/Documents/db1.txt.bak) or warn Can't copy file: $!;

print Backup Completed.;

exit;
-
I know the cron is firing off the request, because when first tried it, 
I got Permission Denied in my email box. So I changed the permission to 
755 and it still doesn't copy the file. And I get nothing in my email 
box. I'm a little confused. What am I missing?

Mark

On Apr 27, 2004, at 1:31 PM, Ken Williams wrote:

On Apr 27, 2004, at 11:59 AM, Wiggins d Anconia wrote:
The script is as follows:

#!/usr/bin/perl -w

use strict;

my @files = db1.txt, db2.txt, db3.txt, db4.txt;

foreach (@files) {
rename /path/to/pc/file/$_, /Users//Documents/$_..bak;
You should always check that 'rename' succeeded (as apparently it 
isn't).

rename $oldfile, $newfile or warn Can't rename file: $!;

$! will then provide you more information as to why its not working.
I'd be willing to bet that it will be because there's no file called

  /path/to/pc/file/db1.txt, db2.txt, db3.txt, db4.txt

on your system.  Perhaps you mean:

  my @files = (db1.txt, db2.txt, db3.txt, db4.txt);

or just

  my @files = qw(db1.txt db2.txt db3.txt db4.txt);

Anyway, Wiggins is right - if you'd checked the error status, $! would 
have told you...

-Ken




Re: Copying files

2004-04-27 Thread Mark Wheeler
Hi Bruce,

Good question. Here are the results.

The permissions for the /Users/xx/Documents directory is:

drwx--   7 xx  xx   238 27 Apr 15:08 Documents

The permission for the /Users/xx/Library/Scripts directory is:

drwxr-xr-x   3 xx  xx   102 27 Apr 14:22 Scripts

Does that look write? Or should the Documents directory be the same as 
the Scripts Directory?

Thanks,

Mark

On Apr 27, 2004, at 3:24 PM, Bruce Van Allen wrote:

On 4/27/04 Mark Wheeler wrote:

Yup. You're right. I missed that one. Here's what I did to simplify 
the
testing of the script.

copy(/Users/xx/Documents/db1.txt,
/Users/xx/Documents/db1.txt.bak) or warn Can't copy file: $!;

-
I know the cron is firing off the request, because when first tried 
it,
I got Permission Denied in my email box. So I changed the permission 
to
755 and it still doesn't copy the file. And I get nothing in my email
box. I'm a little confused. What am I missing?
Is that Permission Denied for execution of your script? Perhaps it's
for writing the file. Check the write permissions of the
/Users/xx/Documents directory.
1;

- Bruce

__bruce__van_allen__santa_cruz__ca__




Re: Copying files

2004-04-27 Thread Mark Wheeler
OK... I changed the permissions. Still no change. The file is not being 
backed up. How do I check to see if the script is even executing? Is 
there a log I can look at? I haven't changed anything from the standard 
install for 10.3. I'm the only person on the machine. Do I need to 
activate perl like I need to when running apache?

Thanks so much for your help,

Mark

On Apr 27, 2004, at 3:46 PM, Bruce Van Allen wrote:

On 4/27/04 Mark Wheeler wrote:
Good question. Here are the results.
The permissions for the /Users/xx/Documents directory is:
drwx--   7 xx  xx   238 27 Apr 15:08 Documents
The permission for the /Users/xx/Library/Scripts directory is:

drwxr-xr-x   3 xx  xx   102 27 Apr 14:22 Scripts

Does that look right? Or should the Documents directory be the same as
Most likely your script is not running as owner, so you probably want
drwxrwxrwx
for the Documents directory ( chmod 0777, '/Users/xx/Documents' ).
The Scripts directory is correct.

On Apr 27, 2004, at 3:24 PM, Bruce Van Allen wrote:
Is that Permission Denied for execution of your script? Perhaps
it's for writing the file. Check the write permissions of the
/Users/xx/Documents directory.


1;
- Bruce
__bruce__van_allen__santa_cruz__ca__




Re: Copying files

2004-04-27 Thread Mark Wheeler
OK... I got the foo in my mailbox, so cron is working. So I'll go 
with the next step of a basic perl script.

Mark

On Apr 27, 2004, at 8:23 PM, Ken Williams wrote:

On Apr 27, 2004, at 5:07 PM, Mark Wheeler wrote:

Yup. You're right. I missed that one. Here's what I did to simplify 
the testing of the script.

#!/usr/bin/perl -w

use strict;
use File::Copy;
copy(/Users/xx/Documents/db1.txt, 
/Users/xx/Documents/db1.txt.bak) or warn Can't copy file: $!;

print Backup Completed.;

exit;
-
I know the cron is firing off the request, because when first tried 
it, I got Permission Denied in my email box. So I changed the 
permission to 755 and it still doesn't copy the file. And I get 
nothing in my email box. I'm a little confused. What am I missing?
First rule when it looks like a script isn't doing anything on OS X: 
check the line endings.  Make sure they're unix-style.  If they're 
Mac-Classic style, running the script won't actually do anything.

First rule when setting up cron jobs: make sure cron itself is 
running.  Set up a job with the same timings as the script in 
question, but make its action echo foo or something like that.  You 
should get an email when it runs.  If not, then cron's the problem, 
not perl.  I know you said it worked before, but just to make sure...

 -Ken




Simple perl script send email

2004-04-25 Thread Mark Wheeler
Hi,

I just installed 10.3 and am trying to get a cron job to fire off a 
perl script which will send an email saying the cron job was completed.

crontab listing

* * * * * /Users/blah/Library/Scripts/test.pl

Here is the script:

test.pl

#!/usr/bin/perl -w
use strict;

my $from = '[EMAIL PROTECTED]';
my $to = '[EMAIL PROTECTED]';
my $body = Success.;
open (SENDMAIL, | mail -t);

print SENDMAIL Subject: Backup Email Test\n;
print SENDMAIL From: $from\n;
print SENDMAIL To: $to\n\n;
print SENDMAIL $body;
close (SENDMAIL);
exit;
--
I have enabled Postfix to be running and have sent and received an 
email from the command line. I've also executed the script run from the 
command line. But the script doesn't seem to be sending an email. Do I 
need to get perl set to run in a settings file? I thought that I only 
needed to mess with settings files if I was going to use the web 
server. A little help would be appreciated.

Thanks,

Mark



Re: Simple perl script send email

2004-04-25 Thread Mark Wheeler
Ok, that's a little new for me. What I basically need to do is run a 
back up of some files on an internal network, then email myself saying 
everything went great. The files (databases) are on a PC and I'm going 
to back them up on my Mac. That's the rub. I was going to do it in 
Perl, because that's what I know, but is there another way?

Mark

On Apr 25, 2004, at 2:27 PM, Jerry LeVan wrote:

My daily.local file looks like:

/usr/bin/mail -s Crontab jerry DOC
Cron ran at `date`
`/usr/local/bin/dailyWakeup`
DOC
No need for perl if you have Postfix set up :)
Cron runs the daily.local file if it exists
in periodic daily
I requeue a wakeup request for the next morning...
see http://homepage.mac.com/levanj/Cocoa for
a way to make sure your cron jobs get run on time.
Jerry

On Apr 25, 2004, at 5:16 PM, Bill Stephenson wrote:

Just curious, did you run the crontab command? I know I sometimes 
just forget the simple stuff...

Kindest Regards,

Bill Stephenson

On Apr 25, 2004, at 4:28 AM, Mark Wheeler wrote:

Hi,

I just installed 10.3 and am trying to get a cron job to fire off a 
perl script which will send an email saying the cron job was 
completed.

crontab listing

* * * * * /Users/blah/Library/Scripts/test.pl

Here is the script:

test.pl

#!/usr/bin/perl -w
use strict;

my $from = '[EMAIL PROTECTED]';
my $to = '[EMAIL PROTECTED]';
my $body = Success.;
open (SENDMAIL, | mail -t);

print SENDMAIL Subject: Backup Email Test\n;
print SENDMAIL From: $from\n;
print SENDMAIL To: $to\n\n;
print SENDMAIL $body;
close (SENDMAIL);
exit;
--
I have enabled Postfix to be running and have sent and received an 
email from the command line. I've also executed the script run from 
the command line. But the script doesn't seem to be sending an 
email. Do I need to get perl set to run in a settings file? I 
thought that I only needed to mess with settings files if I was 
going to use the web server. A little help would be appreciated.

Thanks,

Mark






Re: Simple perl script send email

2004-04-25 Thread Mark Wheeler
Thanks. I'll give it a try. That makes sense. When you are talking 
about mail handling Perl mod, you are talking about NET::SMTP or 
something like that, right? Also, why would you not want to use mail 
directly?

Thanks,

Mark

On Apr 25, 2004, at 2:53 PM, Wiggins d'Anconia wrote:

Mark Wheeler wrote:

Hi,
I just installed 10.3 and am trying to get a cron job to fire off a 
perl script which will send an email saying the cron job was 
completed.
crontab listing
* * * * * /Users/blah/Library/Scripts/test.pl
Here is the script:
test.pl

#!/usr/bin/perl -w
use strict;
my $from = '[EMAIL PROTECTED]';
my $to = '[EMAIL PROTECTED]';
my $body = Success.;
open (SENDMAIL, | mail -t);
Check that open succeeded, and use a full path to 'mail', especially 
since under cron your PATH may be different/restricted.

open (SENDMAIL, | /usr/bin/mail -t) or die Can't pipe to sendmail: 
$!;

Having said that, I would suggest not using mail directly at all, 
instead install a mail handling Perl mod from CPAN, there are lots of 
them.

print SENDMAIL Subject: Backup Email Test\n;
print SENDMAIL From: $from\n;
print SENDMAIL To: $to\n\n;
print SENDMAIL $body;
close (SENDMAIL);
exit;
--
I have enabled Postfix to be running and have sent and received an 
email from the command line. I've also executed the script run from 
the command line. But the script doesn't seem to be sending an email. 
Do I need to get perl set to run in a settings file? I thought that I 
only needed to mess with settings files if I was going to use the web 
server. A little help would be appreciated.
HTH,

http://danconia.org




Re: Simple perl script send email

2004-04-25 Thread Mark Wheeler
I've been using MIME::Lite for a couple of years, now. I'll just use 
that one. It's quite friendly to work with. I'll give that a try and 
see what goes.

Thanks again,

Mark

On Apr 25, 2004, at 3:19 PM, Wiggins d'Anconia wrote:

Mark Wheeler wrote:

Thanks. I'll give it a try. That makes sense. When you are talking 
about mail handling Perl mod, you are talking about NET::SMTP or 
something like that, right? Also, why would you not want to use mail 
directly?
Mail is an incredibly complex thing, combine that with trying to 
handle IPC issues when shelling out, then you are reinventing a wheel 
that should definitely not be re-invented.   Net::SMTP is an example, 
though probably a more difficult one, there are lots,

http://search.cpan.org/modlist/Mail_and_Usenet_News/Mail

Mail::Mailer
Mail::Sender
MIME::Lite
Are some good choices, I use Mail::Box but generally it is way 
overkill, but since I know I will have it installed I usually default 
to it.

Generally using a module will be less error prone, easier to maintain, 
and more portable.

http://danconia.org

Thanks,
Mark
On Apr 25, 2004, at 2:53 PM, Wiggins d'Anconia wrote:
Mark Wheeler wrote:

Hi,
I just installed 10.3 and am trying to get a cron job to fire off a 
perl script which will send an email saying the cron job was 
completed.
crontab listing
* * * * * /Users/blah/Library/Scripts/test.pl
Here is the script:
test.pl

#!/usr/bin/perl -w
use strict;
my $from = '[EMAIL PROTECTED]';
my $to = '[EMAIL PROTECTED]';
my $body = Success.;
open (SENDMAIL, | mail -t);


Check that open succeeded, and use a full path to 'mail', especially 
since under cron your PATH may be different/restricted.

open (SENDMAIL, | /usr/bin/mail -t) or die Can't pipe to 
sendmail: $!;

Having said that, I would suggest not using mail directly at all, 
instead install a mail handling Perl mod from CPAN, there are lots 
of them.

print SENDMAIL Subject: Backup Email Test\n;
print SENDMAIL From: $from\n;
print SENDMAIL To: $to\n\n;
print SENDMAIL $body;
close (SENDMAIL);
exit;
--
I have enabled Postfix to be running and have sent and received an 
email from the command line. I've also executed the script run from 
the command line. But the script doesn't seem to be sending an 
email. Do I need to get perl set to run in a settings file? I 
thought that I only needed to mess with settings files if I was 
going to use the web server. A little help would be appreciated.




Re: File write/read problem

2003-09-25 Thread Mark Wheeler
In just checked the httpd.conf file and, yes, the user/group is set to
www/www. So I need to change it to what?

Mark

- Original Message - 
From: Paul Hoffman [EMAIL PROTECTED]
To: John Delacour [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Thursday, September 25, 2003 5:23 AM
Subject: Re: File write/read problem


 On Wednesday, September 24, 2003, at 10:44 PM,
 [EMAIL PROTECTED] wrote:

  OK, that makes perfect sense, but it is not working here. Here is a
  basic script which, when run, should create a new file called
  example.txt because it is not there when the open statement is used.
 
  #!/usr/bin/perl
 
  print Content-type: text/html\n\n;
 
  print Creating new file...;
 
  my $newtext = newtext from old;
 
  open (USER, example.txt);
  print USER $newtext;
  close USER;
 
  exit;
 
  As you've said, it should create the file in the same directory, in
  this case the cgi-bin, as the script (which is called write.cgi). I
  run the call the script from the browser and the script runs fine,
  except, no file is created. I added a || die ($!) at the file open
  call and add the CGI::CARP qw(fatalToBowser) at the top and get the
  following.
 
  Permission denied at /Library/WebServer/CGI-Executables/write.cgi
 
  All the permissions for each of these directories are 755. Something
  is a miss. So what can I do?! I'm very confused.

 Who owns the directories?  The Web server runs as user www (unless
 you're not running the stock httpd).  That's probably your problem.

 HTH,

 Paul.

 --
 Paul Hoffman :: Taubman Medical Library :: Univ. of Michigan
 [EMAIL PROTECTED] :: [EMAIL PROTECTED] :: http://www.nkuitse.com/




Re: File write/read problem

2003-09-25 Thread Mark Wheeler
Well, I gave it a wirl and it works great. I love learning new things!
Thanks so much for your help.

Does anyone know of a good site for me to learn more about UNIX permissions?

Thanks again,

Mark

- Original Message - 
From: Paul Hoffman [EMAIL PROTECTED]
To: Mark Wheeler [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Thursday, September 25, 2003 9:08 AM
Subject: Re: File write/read problem


 Mark,

 Leave the permissions on httpd.conf as they are, in case you're tempted
 to change them.  :-)  After you've read this message, I suggest you
 read up on UNIX permissions -- maybe someone else can recommend a good
 source of information.

 The key is that your CGI script runs as user www and group www.  All
 the permissions have to take that into account.  I'll describe one way
 to accomplish what (I think) you want; there may be others.

 What you need to do is change the owner and/or group of any directories
 to which your CGI script will be adding files, and of any *existing*
 files which your CGI script will be modifying.

 It sounds like you have the following setup:

/
  Library/
WebServer/
  CGI-Executables/
write.cgi
file1.txt
file2.txt
...

 First, it's not a good idea to create or modify files within the
 CGI-Executables (a.k.a. cgi-bin) directory, so I would *definitely* put
 any data files in a separate directory, called (say) CGI-Data:

  % cd /Library/WebServer
  % chmod o-w .# make sure permissions on /Library/WebServer are
 sane
  % sudo mkdir CGI-Data
  % ls -l
  drwxr-xr-x2 root admin 68 Sep 25 11:40 CGI-Data

 (I'll continue to edit the output of `ls -l' as I've done here.)

 If there are any existing files to move here, go ahead and move (or
 copy) them now:

  % sudo mv file1.txt file2.txt CGI-Data

 As it stands now, your CGI script won't be able to do anything in this
 directory or to its files -- you created it as root so, by default,
 root is its owner.  I'm assuming that you want to be able to read and
 write things in this directory yourself, so what you can do is make
 yourself the owner and www the group.  Let's say by some strange chance
 your user id is the same as mine, nkuitse:

  % sudo chown -R nkuitse:www CGI-Data
  % ls -l
  drwxr-xr-x   2 nkuitse  www  68 Sep 25 12:05 CGI-Data

 OK, so now you (nkuitse) can do anything you want to do in this folder,
 and (because of the -R option, which means and do the same to the
 directory's contents, recursively) you can do anything to the files
 within it.

 But your CGI script still can't touch them, because the group
 permissions are still r-x.  That's easy to fix:

  % chmod -R 775 CGI-Data
  % ls -l
  drwxrwxr-x   2 nkuitse  www  68 Sep 25 12:05 CGI-Data

 Note two things:

1. sudo wasn't needed because now you're the owner, and you have
 write permission (unless you took away write permission from the files
 you moved, before you moved them)

2. chmod also has an -R option with the same effect as chown's

 Now all you have to do is modify your script so it writes to
 ../CGI-Data/file1.txt, etc. instead of just file1.txt, etc.  Or you can
 use absolute paths like /Library/WebServer/CGI-Data/file1.txt if you
 prefer (this is less portable but that may not matter in your case).

 If you want to get fancy, you can set up individual subdirectories
 within CGI-Data, setting the permissions for one so your CGI script can
 only modify *existing* files, and setting them for the other so your
 CGI script can modify existing files *and* add files.

 HTH,

 Paul.

 On Thursday, September 25, 2003, at 10:08  AM, Mark Wheeler wrote:

  In just checked the httpd.conf file and, yes, the user/group is set to
  www/www. So I need to change it to what?
 
  Mark
 
  - Original Message -
  From: Paul Hoffman [EMAIL PROTECTED]
  To: John Delacour [EMAIL PROTECTED]
  Cc: [EMAIL PROTECTED]
  Sent: Thursday, September 25, 2003 5:23 AM
  Subject: Re: File write/read problem
 
 
  On Wednesday, September 24, 2003, at 10:44 PM,
  [EMAIL PROTECTED] wrote:
 
  OK, that makes perfect sense, but it is not working here. Here is a
  basic script which, when run, should create a new file called
  example.txt because it is not there when the open statement is used.
 
  #!/usr/bin/perl
 
  print Content-type: text/html\n\n;
 
  print Creating new file...;
 
  my $newtext = newtext from old;
 
  open (USER, example.txt);
  print USER $newtext;
  close USER;
 
  exit;
 
  As you've said, it should create the file in the same directory, in
  this case the cgi-bin, as the script (which is called write.cgi). I
  run the call the script from the browser and the script runs fine,
  except, no file is created. I added a || die ($!) at the file open
  call and add the CGI::CARP qw(fatalToBowser) at the top and get the
  following.
 
  Permission denied at /Library/WebServer/CGI-Executables/write.cgi

File write/read problem

2003-09-24 Thread Mark Wheeler
Hi,

This is my first post to this group. Please forgive me if this is the wrong
group for this question.

I've been coding for a short time (a year or so) and love it. I've been
using other hosts for my scripts, and am now setting up my OSX server. I've
run into a snag. I can't figure it out. When I try to read (or write, for
that matter) to a file nothing happens. Below is an example script. If the
file is there, nothing. If the files is not there, nothing. I get the
initial print statement about the file contents, but that's it. Is this a
permissions problem? I've checked the permissions of the folder and it's
775, everything looks good. What am I missing.

Again, forgive me if this post is misplaced.

Mark

--
#!/usr/bin/perl -w

use strict;

print Content-type: text/html\n\n;

print The contents of the file: brbr;

open (DATA, example.txt) || die (Could not open file br $!);
my @text = DATA;
print @text;
close (DATA);

exit;

---



Re: File write/read problem

2003-09-24 Thread Mark Wheeler
Yes, I am running this as a cgi. I called it from a web browser. IE 6 on a
PC. Yes, the script has no Mac line endings. I wrote it on a PC using a text
editor. I've done nothing different than I have for all my other scripts. I
just don't understand. Here is the  path:

tonedeaf.redirectme.net/cgi-bin/write.cgi

The script is in the /Library/WebServer/CGI-Executables/ folder. I can get
other scripts to run fine, but just can't read or write files. Any ideas you
may have would be greatly appreciated.

Thanks,

Mark

- Original Message - 
From: Hannes [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Cc: Mark Wheeler [EMAIL PROTECTED]
Sent: Wednesday, September 24, 2003 8:35 AM
Subject: Re: File write/read problem


 On 9/24/03 6:37 AM, Mark Wheeler [EMAIL PROTECTED] wrote:

  Hi,
 
  This is my first post to this group. Please forgive me if this is the
wrong
  group for this question.
 
  I've been coding for a short time (a year or so) and love it. I've been
  using other hosts for my scripts, and am now setting up my OSX server.
I've
  run into a snag. I can't figure it out. When I try to read (or write,
for
  that matter) to a file nothing happens. Below is an example script. If
the
  file is there, nothing. If the files is not there, nothing. I get the
  initial print statement about the file contents, but that's it. Is this
a
  permissions problem? I've checked the permissions of the folder and it's
  775, everything looks good. What am I missing.
 
  Again, forgive me if this post is misplaced.
 
  Mark
 
  --
  #!/usr/bin/perl -w
 
  use strict;
 
  print Content-type: text/html\n\n;
 
  print The contents of the file: brbr;
 
  open (DATA, example.txt) || die (Could not open file br $!);
  my @text = DATA;
  print @text;
  close (DATA);
 
  exit;
 
  ---

 The above runs for me just fine (perl 5.8.0/ 10.2.8) from within bbedit.
 Since you get the initial statement - e.g. Part of your program are
actually
 run through the interpreter I assume that you've taken care of the path to
 perl and also made sure you got Unix and NOT Mac line breaks. You probably
 intend to run this as a cgi script - thus how did you actually run the
 script?

 /h




Re: File write/read problem

2003-09-24 Thread Mark Wheeler
That's a good idea, but I'm not at that location, and my remote login is
turned off, right now. I can try it when I get there later today. Presuming
it IS a CGI problem, what would I need to check? And opposite of that, what
would I need to check?

Thanks again,

Mark

- Original Message - 
From: Hannes [EMAIL PROTECTED]
To: Mark Wheeler [EMAIL PROTECTED]
Sent: Wednesday, September 24, 2003 9:09 AM
Subject: Re: File write/read problem


 On 9/24/03 7:57 AM, Mark Wheeler [EMAIL PROTECTED] wrote:

  Yes, I am running this as a cgi. I called it from a web browser. IE 6 on
a
  PC. Yes, the script has no Mac line endings. I wrote it on a PC using a
text
  editor. I've done nothing different than I have for all my other
scripts. I
  just don't understand. Here is the  path:
 
  tonedeaf.redirectme.net/cgi-bin/write.cgi
 
  The script is in the /Library/WebServer/CGI-Executables/ folder. I can
get
  other scripts to run fine, but just can't read or write files. Any ideas
you
  may have would be greatly appreciated.
 
  Thanks,

 Just to see if it is a cgi problem, have you tried running it on the
 commandline with:

 /usr/bin/perl example.txt

 from the directory where example.txt is located?

 Cheers/h




Re: File write/read problem

2003-09-24 Thread Mark Wheeler
In the example.txt, that was created by the same text editor that created
the script. As well, if I change the script to write to example.txt file (or
any file), and there is no file there to write to, it should create a file,
but it does not. I'll add the CGI::carp... and see what info I can glean
from there.

Thanks,

Mark

- Original Message - 
From: Adam Witney [EMAIL PROTECTED]
To: Mark Wheeler [EMAIL PROTECTED]
Sent: Wednesday, September 24, 2003 10:14 AM
Subject: Re: File write/read problem



 Ah, good point! :-) although it may still be suffering line endings
problems
 in the example.txt file.

 Best thing would be to try what someone else suggested and get the errors
 onto the web page.. As was mentioned die errors do not show up.

 I used to add this line

 use CGI::Carp qw(fatalsToBrowser);

 to the top of the script, and this would send more errors to the
browser...
 (although I haven't tried it in a while and may not have all the syntax
 correct)

 Adam



  Thanks for the link. It makes sense, but if there were line ending
problems,
  wouldn't they be throughout the entire script, and thus the script
wouldn't
  work at all? The script is running (no errors), it just can't read (or
  write) files.
 
  Mark
 
  - Original Message -
  From: Adam Witney [EMAIL PROTECTED]
  To: Mark Wheeler [EMAIL PROTECTED]
  Sent: Wednesday, September 24, 2003 9:48 AM
  Subject: Re: File write/read problem
 
 
 
  This is a common problem when taking files from a PC onto the mac...
You
  can
  usually tell if they are the wrong line endings by opening up a
terminal
  and
  just displaying the file using
 
  more perl.pl
 
  ... In the relevant directory
 
  I always use BBEdit to convert them... But you can add a line to your
perl
  code to take care of it I think... can't remember what at the moment
  though!!
 
  This may help though...
 
  http://bumppo.net/lists/macperl/1997/09/msg00039.html
 
  Remember to check example.txt as well for the correct endings
 
  Adam
 
 
  Well, I've been using this editor for about a year, now, and have not
  had a
  problem with line-endings on my other hosts before. What should I look
  for
  to check the line-endings?
 
  Mark
 
  - Original Message -
  From: Adam Witney [EMAIL PROTECTED]
  To: Mark Wheeler [EMAIL PROTECTED]
  Sent: Wednesday, September 24, 2003 9:26 AM
  Subject: Re: File write/read problem
 
 
 
  But if you wrote it on a PC then it probably has PC line endings, not
  unix.
  You will probably need to convert them first to unix line endings.
 
 
  Yes, I am running this as a cgi. I called it from a web browser. IE
6
  on
  a
  PC. Yes, the script has no Mac line endings. I wrote it on a PC
using
  a
  text
  editor. I've done nothing different than I have for all my other
  scripts. I
  just don't understand. Here is the  path:
 
  tonedeaf.redirectme.net/cgi-bin/write.cgi
 
  The script is in the /Library/WebServer/CGI-Executables/ folder. I
can
  get
  other scripts to run fine, but just can't read or write files. Any
  ideas
  you
  may have would be greatly appreciated.
 
  Thanks,
 
  Mark
 
  - Original Message -
  From: Hannes [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Cc: Mark Wheeler [EMAIL PROTECTED]
  Sent: Wednesday, September 24, 2003 8:35 AM
  Subject: Re: File write/read problem
 
 
  On 9/24/03 6:37 AM, Mark Wheeler [EMAIL PROTECTED] wrote:
 
  Hi,
 
  This is my first post to this group. Please forgive me if this is
  the
  wrong
  group for this question.
 
  I've been coding for a short time (a year or so) and love it. I've
  been
  using other hosts for my scripts, and am now setting up my OSX
  server.
  I've
  run into a snag. I can't figure it out. When I try to read (or
  write,
  for
  that matter) to a file nothing happens. Below is an example
script.
  If
  the
  file is there, nothing. If the files is not there, nothing. I get
  the
  initial print statement about the file contents, but that's it. Is
  this
  a
  permissions problem? I've checked the permissions of the folder
and
  it's
  775, everything looks good. What am I missing.
 
  Again, forgive me if this post is misplaced.
 
  Mark
 
  --
  #!/usr/bin/perl -w
 
  use strict;
 
  print Content-type: text/html\n\n;
 
  print The contents of the file: brbr;
 
  open (DATA, example.txt) || die (Could not open file br $!);
  my @text = DATA;
  print @text;
  close (DATA);
 
  exit;
 
  ---
 
  The above runs for me just fine (perl 5.8.0/ 10.2.8) from within
  bbedit.
  Since you get the initial statement - e.g. Part of your program are
  actually
  run through the interpreter I assume that you've taken care of the
  path
  to
  perl and also made sure you got Unix and NOT Mac line breaks. You
  probably
  intend to run this as a cgi script - thus how did you actually run
  the
  script?
 
  /h
 
 
 
 
  -- 
  This message has been scanned for viruses and
  dangerous content by MailScanner

Re: File write/read problem

2003-09-24 Thread Mark Wheeler
OK, here's the latest. I put in the CGI::CARP...and got my errors to the
screen. On both the read and write to the file (example.txt) if the file
exists and the permissions are sett correctly, for example.txt, everything
works great. BUT two things I noticed:

1. When I ftp a file to the cgi-bin, for the first time, the permission
setting are automatically set to 640, not 644 which is what I am used to, so
I didn't check that till just now. Obviously, when changed to 644, the read
and writing process works.

2. And here's the rub for the whole deal, I think (and my lack of
programming skill). When I try to open the file, and it doesn't exist, I get
the error of can't open a file it can't find. BUT I was under the impression
that when I used the  or  or  in an open command i.e.:

open (DATA,  example.txt);

that it would creat the file if it wasn't there (with the appropriate
[default?] permissions...at least that's what happens on my other hosts. And
if that is true, is there a place in the httpd.conf file to set the default
permissions for newly created files/folders, as well as allowing new files
to be created if not found? Why is it  that on my other host
(Hostcentric.com) that files are created when not found but on my Mac
(10.2.6) they are not? Any ideas, anyone.

As always, thanks for the help.

Mark



Re: File write/read problem

2003-09-24 Thread Mark Wheeler
OK, that makes perfect sense, but it is not working here. Here is a 
basic script which, when run, should create a new file called 
example.txt because it is not there when the open statement is used.

#!/usr/bin/perl

print Content-type: text/html\n\n;

print Creating new file...;

my $newtext = newtext from old;

open (USER, example.txt);
print USER $newtext;
close USER;
exit;

As you've said, it should create the file in the same directory, in 
this case the cgi-bin, as the script (which is called write.cgi). I run 
the call the script from the browser and the script runs fine, except, 
no file is created. I added a || die ($!) at the file open call and 
add the CGI::CARP qw(fatalToBowser) at the top and get the following.

Permission denied at /Library/WebServer/CGI-Executables/write.cgi

All the permissions for each of these directories are 755. Something is 
a miss. So what can I do?! I'm very confused.

Mark

---

On Wednesday, September 24, 2003, at 03:02  PM, John Delacour wrote:

At 11:54 am -0700 24/9/03, Mark Wheeler wrote:

.. I was under the impression that when I used the  or  or  
in an open command i.e.:

open (DATA,  example.txt);

that it would creat the file if it wasn't there (with the appropriate
[default?] permissions...at least that's what happens on my other 
hosts. And
if that is true, is there a place in the httpd.conf file to set the 
default
permissions for newly created files/folders, as well as allowing new 
files
to be created if not found? Why is it  that on my other host
(Hostcentric.com) that files are created when not found but on my Mac
(10.2.6) they are not? Any ideas, anyone.


For example:

http://cgi.bd8.com/cgi-bin/showdate.pl has the script:

#!/usr/bin/perl
$f = textfiles/date.txt ;
open F, $f ;
print F scalar localtime;
open F, $f ;
$s = F;
print Content-Type: text/html\n\nh1$s/h1 ;


showdate.pl   has permissions 755
texfiles/ has permissions 777
 date.txtis created by showdate.pl with permissions 644