pdftotext VERY different from 10.5.x to 10.6.x ?

2010-03-13 Thread Riccardo Perotti
Greetings:


Maybe somebody can help me figure out where the architecture changed so much 
between Leopard and Leopard Snow concerning PDFs. I had this perl script that 
would handle text extracted from a PDF and parse its contents quite nicely. 
When I upgraded to Leopard Snow, the results went down the drain. 

The outputs shown below are the first parts of exactly the same PDF file copied 
in Leopard and then in Leopard Snow. The result is same whether copying 
directly from the PDF (cmd-A, cmd-C, cmd-V) or using pdftotext:

*** Copied / pdftotext'd in Leopard ***
AFC Corp  AFC FC Corp 
19205 So. Lourel Park Rd. 
Rancho Dominguez, CA 90220 
Phone: 310-604-3200 
Premium Tuna Shiping List 

*** Copied / pdftotext'd in Leopard Snow ***
AFC FC Corp
19205 So. Lourel Park Rd. Rancho Dominguez, CA 90220 Phone: 310-604-3200
PUBLIX's Group Only ** Full Service and Part Time storeonly
AFC Corp
SouthEast12
Premium Tuna Shiping List


The lines missing from the latter in the former (ej.:'SouthEast12') simply 
appear afterwards in the former.

Any clues at all?  

Any solutions / suggestions?


Thank you!

--
pero...@pobox.com
www.riccardoperotti.com





return status code from sendmail in macosx

2006-01-18 Thread Riccardo Perotti

Hi all:

I have a typical mail cgi script written in perl and can't figure out  
why I don`t get an error when the message is not sent.


My script does the typical:

open (MAIL, |/usr/sbin/sendmail -t -i -F'$from_name' - 
f'$from_mail') or die can't open sendmail: $!;

- etc -
close MAIL or die can't close sendmail: $!;

The problem is that it does not die even though the message is not sent.

I've tried checking $? (child error) but nothing (it is '0').

I have read the sendmail and postfix man pages to no avail.

I've also tried Mail::Mailer, Mail::Send, MIME::Lite and other  
modules, but the problem is still the same: I don't get an error even  
though mail is not sent.


BTW: I know that mail is not sent because I'm checking the result in  
Console.app.


What is it that I'm missing? Is there another way of checking for  
sendmail's success from your script?


Thanks in advance,

Riccardo Perotti
--
[EMAIL PROTECTED]
www.riccardoperotti.com



Re: return status code from sendmail in macosx

2006-01-18 Thread Riccardo Perotti


On Jan 18, 2006, at 4:49 PM, Brian McKee wrote:


On 18/01/06, Riccardo Perotti [EMAIL PROTECTED] wrote:

Hi all:

I have a typical mail cgi script written in perl and can't figure out
why I don`t get an error when the message is not sent.

My script does the typical:

open (MAIL, |/usr/sbin/sendmail -t -i -F'$from_name' -
f'$from_mail') or die can't open sendmail: $!;
- etc -
close MAIL or die can't close sendmail: $!;

The problem is that it does not die even though the message is not  
sent.


I've tried checking $? (child error) but nothing (it is '0').

I have read the sendmail and postfix man pages to no avail.


maybe helpful info in /var/log/mail.log ?



Thank you brian:
By checking /var/log/mail.log (from Console.app) I know that the mail  
failed to be sent, but my perl script doesn't catch this, which is my  
problem.


Riccardo
--
[EMAIL PROTECTED]
www.riccardoperotti.com



Re: Long shot but worth a try...

2004-02-26 Thread Riccardo Perotti
On 2/26/04 11:24 AM, Sherm Pendley [EMAIL PROTECTED] wrote:

 On Feb 26, 2004, at 11:14 AM, Riccardo Perotti wrote:
 
 Can somebody point me in the right direction and / or contribute an
 idea for
 this?
 
 Have a look at the man page for the 'killall' command. In short, it
 signals processes by name, so you don't need to know the PID. You can
 use system() to run it from Perl, like this:
 
 #!/usr/bin/perl
 
 use warnings;
 use strict;
 
 system 'killall -KILL pppd';
 
 sherm--
 
 
Thanks Sherm! That definitely looks like a step in the right direction.

Now the only problem is that 'pppd' a process owned by root. Should my
script be run as 'root'? That sounds kind of dangerous! ... can it / should
it be done? When at the Terminal I have to 'sudo kill' and the get asked my
password. How would I do a 2 step process from 1 perl script?

Thanks again!


Riccardo



--
mailto:[EMAIL PROTECTED]
http://www.riccardoperotti.com




Long shot but worth a try...

2004-02-26 Thread Riccardo Perotti
This is not a problem/question with/about perl, but one that I think can be
solved *with* perl in macosx. Please forgive it's off-topicness:

Internet Connection in Panther 10.3.2 sometimes hangs forever in its
Disconnecting... status. I have not been able to find a reason nor a cure:
I've found people who also have this problem but the circumstances, causes
and systems all seem inconsistent. Restarting is the only solution for
GUI-only users (login out and back in won't do it).

I've been using the Terminal to find the process id whose name is 'pppd' via
top and then sudo-killing it (for some reason you have to kill it twice
before it finally dies [EMAIL PROTECTED]*!).

I though I'd write a perl script to do the process described above and share
it with the affected users community and feel good about it for a couple of
days. I've using perl for 5 years in self-contained programs that have
minimal interaction with the machine they run on, so it is only until now
that I come to realize my profound ignorance in this field: I was not even
able to take the first step : getting the process's id! I cannot find any
function resembling 'getpidbyname'.

Can somebody point me in the right direction and / or contribute an idea for
this?

TIA

Regards,


Riccardo
--
mailto:[EMAIL PROTECTED]
http://www.riccardoperotti.com




Re: Cron Progress Bar in OSX

2003-10-13 Thread Riccardo Perotti
On 10/13/2003 06:03 AM, Alan Fry [EMAIL PROTECTED] wrote:

 Doug McNutt wrote Thu, 9 Oct 2003 05:40:58 -0600:
 


 What I miss most is the MacPerl droplet, on which you could drop a
 file, extract the path (into ARGV) and do something with the file.
 For instance I have a droplet to decode Base64 -- drop and bingo
 there is the decoded file. And similarly with more complicated issues
 like translating a 'pod' file to 'pdf'.
 
 Is there anyway one can get back to this functionality in MacOS X?

 ... 
 
 Can anybody cheer me up?
 
 Alan

DropScript

Don't have an url, but I'm sure you can find it in Version Tracker.

Cheer Up!

Riccardo
--
mailto:perotti(at)pobox.com
http://www.riccardoperotti.com




Re: Another handy shell alias

2003-04-12 Thread Riccardo Perotti
On 04/12/2003 02:16 PM, Scott R. Godin [EMAIL PROTECTED] wrote:

 Riccardo Perotti wrote:
 
 Argh, that'll teach me (or realistically, won't) to test things before
 I send them.  Here's one that works:
 
 % alias pv 'perl -M\!* -le print \!* -VERSION()'
 % pv File::Spec
 0.82
 
 YES!! Thanks! a new alias for my (tiny) collection!
 
 
 another old standby of mine,
   
   alias cpansh 'perl -MCPAN -e shell'
 
 gets lots of use. :)

Actually, as of who-knows-when, just typing 'cpan' does the same thing! (I
discovered it by mistake).

Riccardo 
--
mailto:[EMAIL PROTECTED]
http://www.riccardoperotti.com




Re: CPAN Newbie: when to sudo?

2003-03-16 Thread Riccardo Perotti
On 03/16/2003 12:16 PM, Puneet Kishor [EMAIL PROTECTED] wrote:
 On Sunday, March 16, 2003, at 11:13  AM, Riccardo Perotti wrote:

 ... which leads me to think that I have to sudo at some point
 (right?).
 
 If so, when would the correct time be?
 ..
 
 right at the beginning.
 
 sudo perl -MCPAN -e shell
 
 that's how I do it and it works.
 
Great, Thanks!

... should I worry/do something about the

/bin/sh: /System/Library/Perl/darwin/perllocal.pod: Permission denied
make: [doc_site_install] Error 1 (ignored)

... error?

Riccardo
--
mailto:[EMAIL PROTECTED]
http://www.riccardoperotti.com




2 /Library/Perl in @INC

2003-02-28 Thread Riccardo Perotti

I just did a 

perl -e 'print $_\n for @INC'

in Terminal and both /Library/Perl and /Network/Library/Perl are listed
twice. Why?

Riccardo
--
mailto:[EMAIL PROTECTED]
http://www.riccardoperotti.com




OT: macosx list?

2003-02-11 Thread Riccardo Perotti

Sorry for the OT, but I've been looking for a MacOSX mailing list, like this
one but not perl-only. Somewhere one could ask / discuss about apps, darwin,
etc.

Does anybody know where to find one?

Thanks

Riccardo 
--
mailto:[EMAIL PROTECTED]
http://www.riccardoperotti.com





Re: unix tip of the week

2002-12-16 Thread Riccardo Perotti
On 12/15/2002 11:21 PM, Puneet Kishor wrote:

 
 well, this is really very simple... geeks, please don't laugh. this is
 for newbies only.
 
 1. I have a directory called unixtips.
 2. I have the following files -- index.html, toc.pl, tipdetail.pl,
 unixtips.txt (files shown below)
 3. index.html is a simple frame of two columns with a table of contents
 on the left (toc), and the main body for the tip on the right
 (tipdetail)
 4. unixtips.txt contains the tips I copy from my email. Each tip starts
 with the words TIP:  and ends with . Any code that one types is
 bounded by -- before and after.
 5. that's it. ;-) I told you, it was simple. You can see the tips I
 have collected at
 209.83.8.226/unixtips/index.html. The site is for personal use only, so
 don't be sending a dos attack against it ;-).

[snip the codes]


mmh ... cool. First of all: I saw in your tipdetail.pl frame's html code
that it was output as xml. Why? Is CGI::Pretty doing that? I saw no evidence
of that in your tipdetail.pl script. Just curious...

Now, I guess I'm not that bad of a newbie! Pardon me you all respectable
geeks, but I'm going to dare a little exposure myself (please show mercy!):

I started working on something 'cause I realized I was really being lazy by
asking for a script right away. I did it kind of in a different approach,
basically because I'm stuck with switching between OS9 and OSX all the time
until I have enough money for Jaguar + all the software upgrades, so I had
to do a some pre AppleScripting ... (forgot to mention I use the #$@%/$%
Outlook Express for mail).

I'm definitely going to borrow your *frames* and *color coding* ideas, as
well as the good habit of using CGI.pm and friends instead of hand coding
all the HTML stuff.

Anyway, I wanted a one click solution, but believe it or not, I couldn't get
#$@%/$%  Outlook to open the message in a window via AppleScript command,
so I had to settle with a 2 click solution and open it manually (which is
where I'm going to add your code delimiters).

(1) My AppleScript takes the contents of the opened message window and
passes that to BBedit, which Cleans the mail's headers and footer and passes
the Tip's body to a unix filter UnixTip.pl.

(2) UnixTip.pl takes the tip's header, makes it a filename, writes the tip
in html format that filename and updates the index.htm file by looking for
the !--new-- token.


And here's the codes:
=== My AppleScript (watch out for wrapped long lines) 

property theContent : 
tell application Outlook Express
set theContent to the content of the front window
end tell

tell application BBEdit
make new window with properties {contents:theContent}

--clean up header
find \\r(=-)+=\\r\\r\\s+UNIX GURU UNIVERSE\\s+\\r\\s+UNIX HOT TIP\\s*
 return ¬
 \\s+.+\\r\\r\\s+.+\\r\\r(=-)+=\\r\\r\\r searching in text window
1 options {starting at top:true, search mode:grep} with selecting match
set selection to 

--clean up footer
find \\-+(.+\\r)+\\r(.+\\r)+\\r(.+\\r)+\\r searching in text window 1
options {starting at top:true, search mode:grep} with selecting match
set selection to 

--call perl filter to make html files
set theFilter to OS 9:Applications (Mac OS 9):Authoring:BBEdit
7.0:BBEdit Support:MacPerl Support:Perl Filters:20)MISC:UnixTip.pl
select every text of text window 1
run unix filter theFilter without replacing selection
end tell


=== UnixTip.pl===
#!usr/bin/perl

chomp (my @tip = ());

#get the Tip's title  wipe leading empty lines in body:
my $filename = $header = lc shift @tip;
while ($tip[0] =~ /^$/) { shift @tip }

# Make html filenames
$filename =~ s/ /_/g;
$filename .= '.htm';
my $tips_folder = Docs:Learning:Reference:UNIX:TipOfTheDay;
my $tip_file = $tips_folder:\L$filename\E; #$filename to lowercase!
my $index = $tips_folder:index.htm;

# Make header w/ title:
my $html_header = make_html_header(ucfirst $header);
my $html_footer = make_html_footer();

# Output file:
open OUTFILE, , $tip_file or die could not open $tip_file ($!);
print OUTFILE $html_header;
print OUTFILE $_\n for @tip;
print OUTFILE $html_footer;
close OUTFILE;

# Make it a BBedit file:
MacPerl::SetFileInfo('R*ch', 'TEXT', $tip_file);


# Update Index:
open INDEX, +, $index or die could not open $index ($!);
my @data = (INDEX);
truncate INDEX, 0;
seek INDEX, 0, 0;
for (@data) {
if (/!\-\-new\-\-/) {
print INDEX !--new--\nlia
href='$filename'\u$header/a/li\n;
}
else {
print INDEX $_;
}
}
close INDEX;


#Subs___:
sub make_html_header {
my $filename = shift;

return eo_head;
!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
http://www.w3.org/TR/html4/loose.dtd;
html
head
title$filename/title
style type=text/css media=screen
!--
a, a:link , a:visited, a:active {text-decoration: none; }
a:hover {text-decoration: underline;}
--
/style
/head
body bgcolor=#FF 

Re: unix tip of the week

2002-12-16 Thread Riccardo Perotti
I had written:

Too bad I only have one tip to test it on. Can't wait for next week's tip.

I just went back to www.ugu.com and discovered that one gets a Hot Unix
Tip *everyday*!
 
Great! There'll be plenty to test on (and hopefully learn some Unix!!)

Riccardo
--
mailto:[EMAIL PROTECTED]
http://www.riccardoperotti.com





Re: browser compatibility (was Re: new to unix: basic help)

2002-12-15 Thread Riccardo Perotti
Thank you guys for all your suggestions.

After (not) much though, I decided that the best thing to do is was to skip
the browser detection all together, since it really just boils down to the
size of the center frame, which is not as mission critical as it was when I
wrote this page (to tell the truth, I didn't really notice a big difference
anymore!).

...and sorry for taking this list so off-topic ...

kindest regards,

Riccardo


--
mailto:[EMAIL PROTECTED]
http://www.riccardoperotti.com





unix tip of the week

2002-12-15 Thread Riccardo Perotti
Puneet:

I just got my first unix tip of the week! (thanks to *your* tip)

I remember you said you used a script which placed each tip in some
browsable environment for future reference or something like that.

Would you care to share that script with me/us?

Thanks

Riccardo
--
mailto:[EMAIL PROTECTED]
http://www.riccardoperotti.com





Perl Music (was new to unix: basic help)

2002-12-15 Thread Riccardo Perotti
On 12/14/2002 7:21 PM, Chris Devers wrote:

 On Sat, 14 Dec 2002, Sherm Pendley wrote:
 
 On Saturday, December 14, 2002, at 04:44 PM, Riccardo Perotti wrote:
 
 But no, there's no way I'm giving up music ...
 
 You know... people use Perl to write poetry... why not music?
 
 Indeed.
 
 http://search.cpan.org/author/FOOCHRE/MIDI-Realtime-0.01/Realtime-0.01/Realtim
 e.pm
 
 There may be others as well, but MIDI::Realtime is pretty neat... :)
 
I've been long considering doing music with Perl, but I always thought of it
as *the lyrics* being written in Perl and probably even compile .. and maybe
even output something ... and even something meaningful ... or beautiful ...
you know, like some Perl poetry I've seen around (there was something
beautiful in the march edition of The Perl Review).

As to the musical part of music (!), I mean the MIDI stuff and such, I
haven't really looked into that, mainly because we have so much good
professional software that it'd seem like reinventing the wheel.

Please take that last statement as coming from a musician, ie: people who
bought their first Macintosh computer to be able to run their first Opcode
Systems or Mark of the Unicorn music software. I know I could probably put
together a Perl version of Studio Vision now, but I bought that license 10
years ago!

Anybody care to share their experiences with Perl + Music and/or their
vision of how both can be put together?

Maybe we can start a project: put music to Perl poetry ... print CDs and
sell them to the Perl community ... start a www.perlmusicians.com or
www.perlmusicmongers.com ... (TMTOWTDI!)

Riccardo


PD: I'm going to check out MIDI::Realtime and other MIDI modules anyway ...
I've been putting it off for too long.
--
mailto:[EMAIL PROTECTED]
http://www.riccardoperotti.com





Re: new to unix: basic help

2002-12-14 Thread Riccardo Perotti
Thank you Sherm, Trey, David, Adam, Puneet, Kriss, Rich  Stephano for your
input.

wow!

I've already subscribed to a couple more lists that look helpful .. and fun!
thanks Puneet. 

I was lucky to start learning Perl with O'Reilly Books, so I feel quite
comfortable with the language itself as long as it was on MacPerl. Going
Unix (Darwin) was something I had looked forward to, but quite scary at the
same time: somehow I know how to fix my Classic Mac (Sherm) even if
something goes really *wrong*, but feared that setting up the date  time in
OSX without the GUI would take a NASA Scientist (ok, I'm exaggerating a bit,
I'm actually quite exited playing around in the Terminal.app).

I'd downloaded David's article on compiling Apache with mod_perl (*and*
Kevin's Perl 5.8.0 as well) from pointers in this list and they've been
sitting on my Desktop waiting for my courage ... I guess I'll take a look at
expat first and see how I go.

Most important: I took up programming during one of my country's (Ecuador)
biggest crisis in 1999. I was lucky enough to have chosen Perl *randomly*
out of a list of at-that-time-all-greek-to-me languages. I've literally
fallen in love with it, sort of the way Bach would fall in love with
mathematics. But no, there's no way I'm giving up music ... it might be
tougher than most jobs, but it's sound in you soul is part of your God
given Salary. Luckily enough, thing are better now: for one thing Ecuador is
in better shape and I'm doing well (http://www.riccardoperotti.com), and for
another, I'm moving to Canada next year!

I haven't actually made any money with Perl until a couple of months ago,
but then again, Bach didn't make any money with Math either ... then again,
I'm hardly Bach  and then again, Bach didn't make any money with his
music either ... and aren't we all glad he didn't become a Math teacher
instead!!!

Stefano: I'm afraid that although my Italian father tough me how to defend
myself in Italian, I'm very poor at writing it. I'm not near Italy, as
noted before, but wish you the best with perlmongers.it and thank you for
the invitation! 

(too bad there's no www.perlmongers.ec)


Thank you all again, really. I'm off to perldoc-ing (first things first, I
guess).


Riccardo
--
mailto:[EMAIL PROTECTED]
http://www.riccardoperotti.com




new to unix: basic help

2002-12-13 Thread Riccardo Perotti
Hi all:

It's almost embarrassing to write to this list (I have books by of some of
you guys: Randal, Chris, etc.) and I regret to waste your time in something
so trivial as this, but I'm new to Programming (I'm a musician; took up 2
programming 2 years ago), new to Perl (1.5 years) and new to Unix (switching
from macos), so any time I see the install instructions say something like
The usual make, test, install routine, my eyes just stare at the distance
with a blank expression in my face.

Can somebody please supply with the actual commands involved in The usual
make, test, install routine, starting from the folder where my downloaded
software would be?


Thanks a lot and, wow!, it's really great to be in this list. Last night I
said to my wife See this guy's name in this book cover? Now take a look at
my Inbox here..., cool, eh!


Riccardo
--
mailto:[EMAIL PROTECTED]
http://www.riccardoperotti.com