Re: Fwd: Re: LWP/Protocol Errors

2015-05-27 Thread Mike Blezien

  
  

On 5/25/2015 12:31 PM, Lawrence Statton
  wrote:


  
  I sent this to the list, but it seems to have gotten clogged in
  the tubes ... here's another copy
  
  
   Forwarded Message 
  
  Subject: Re: LWP/Protocol Errors
  
  Date: Mon, 25 May 2015 12:13:11 -0500
  
  From: Lawrence Statton lawre...@cluon.com
  
  To: beginners@perl.org
  
  
  
  
  On 05/25/2015 12:02 PM, Mike Blezien wrote:
  
  Hello,


I recently setup a Paypal IPN script which worked fine for some
time now

but now all of a sudden I keep getting these error message:

*

**Can't connect to www.paypal.com:443 (certificate verify
failed)**

**LWP::Protocol::https::Socket: SSL connect attempt failed with
unknown

error error:14090086:SSL

routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
at

/usr/local/share/perl5/LWP/Protocol/http.pm line 41.


*I use same IPN script on other servers without any issues
except one.

Is it possible that port 443 is being block or not open due a
firewall

on the server?


Any suggestion would be appreciated.


--

  
  
  While it is *POSSIBLE* that a blocked port is causing your grief,
  that
  
  is not the most likely explanation.
  
  
  Has it *NEVER* worked on this server, or worked until recently?
  Your
  
  email was vague on this point.
  
  
  The exact error is telling you that the OpenSSL library (which is
  
  ultimately where LWP gets its SSL support) cannot verify the
  origin of
  
  the certificate chain that Paypal is offering.
  
  
  Compare the contents of /etc/ssl/certs (the exact directory will
  vary
  
  based on which Linux distribution you are using, but it will be
  
  something similar) on a 'working' server with the 'not-working'
  server.
  
  
  openssl s_client will allow you to attempt a connection and turn
  on
  
  substantial diagnostics to see the certificate that is being
  offered by
  
  the server, and (most importantly) the issuer for that certificate
  and
  
  the issuer's hash -- which will lead you to find the correct CA
  cert you
  
  need to add.
  
  
  (Alternatively, if your problem *is* a blocked port, you will get
  enough
  
  diagnostic from s_client to show you that it can't even GET the
  server's
  
  cert -- but the error message makes me 99% certain that you are
  already
  
  past that point in the SSL handshake)
  
  

After further investigation running the following command from
  the shell prompt:
  
  openssl s_client -host paypal.com -port 443
  
  I get these results:
  
  CONNECTED(0003)
  ---
  no peer certificate available
  ---
  No client certificate CA names sent
  ---
  SSL handshake has read 0 bytes and
  written 0 bytes
  ---
  New, (NONE), Cipher is (NONE)
  Secure Renegotiation IS NOT supported
  Compression: NONE
  Expansion: NONE
  ---
  
  This is first time using this paypal script on this server and has
  not worked yet. I've used similar script on other servers without
  issues or other problems. Is this a port issue or something
else?

thanks,

Mike


  


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: [Bulk] Re: Fwd: Re: LWP/Protocol Errors

2015-05-27 Thread Mike Blezien

  
  

On 5/27/2015 7:46 AM, Lawrence Statton
  wrote:


  
  
  On 05/27/2015 07:33 AM, Mike Blezien wrote:
  
  *CONNECTED(0003) --- no peer
certificate available --- No client

certificate CA names sent --- SSL handshake has read 0 bytes and
written

0 bytes --- New, (NONE), Cipher is (NONE) Secure Renegotiation
IS NOT

supported Compression: NONE Expansion: NONE ---*

  
  
  Yeah - I retract everything I've thus far said -- that's pretty
  clear evidence that you're not getting the SSL handshake started.
  
  
  


That's what I thought. Will check that the port is open on that
server and try again.

thanks,

Mike
  


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




LWP/Protocol Errors

2015-05-25 Thread Mike Blezien

  
  
Hello,

I recently setup a Paypal IPN script which worked fine for some
time now but now all of a sudden I keep getting these error
message:

Can't connect to
  www.paypal.com:443 (certificate verify failed)
LWP::Protocol::https::Socket: SSL connect attempt failed
  with unknown error error:14090086:SSL
  routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
  at /usr/local/share/perl5/LWP/Protocol/http.pm line 41.
  
I use same IPN script on other servers without any issues
except one. Is it possible that port 443 is being block or not
open due a firewall on the server?

Any suggestion would be appreciated.

  -- 
Mike(mickalo)Blezien

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Thunder Rain Internet Publishing
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: LWP/Protocol Errors

2015-05-25 Thread Mike Blezien

  
  

On 5/25/2015 12:27 PM, Lawrence Statton
  wrote:


  
  
  On 05/25/2015 12:02 PM, Mike Blezien wrote:
  
  Hello

*I use same IPN script on other servers without any issues
except one.

Is it possible that port 443 is being block or not open due a
firewall

on the server?

  
  
  Another tidbit of information that just burbled to the top of my
  brain.  On SOME platform (but I can't remember which now) when LWP
  was compiled to use openssl, the builder elected not to have ANY
  default CA path.
  
  
  This will require you to explicitly set the PERL_LWP_SSL_CA_PATH
  environment variable (or the 'all-in-one file variant'- read
  perldoc LWP ) to point to the local store of CA certificates.
  
  

Ok thank you I'll check this out.


  


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Regrex Question

2013-11-25 Thread Mike Blezien
Hello,

Regular expression have never been my strong suite so hoping to get a litte 
help with a line in file I need to extract a portion of it.

The text I need to extract from this line is November 21, 2013 from this line 
in the file, just the date:

Posted by a href=mailto:someem...@email.com;Some Name/a on November 21, 
2013 at 23:21:58:p

what would be the regrex to use to extract the date from the line ?

Thanks,

Mike(mickalo)Blezien
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Thunder Rain Internet Publishing
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Re: Regrex Question

2013-11-25 Thread Mike Blezien
Thank you for your and the other list members suggestions, gives me a good 
place to start.


Mike(mickalo)Blezien
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Thunder Rain Internet Publishing
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  - Original Message - 
  From: Jim Gibson 
  To: Perl List 
  Sent: Monday, November 25, 2013 1:23 PM
  Subject: Re: Regrex Question



  On Nov 25, 2013, at 10:55 AM, Mike Blezien wrote:

   Hello,

   Regular expression have never been my strong suite so hoping to get a litte 
help with a line in file I need to extract a portion of it.

   The text I need to extract from this line is November 21, 2013 from this 
line in the file, just the date:

   Posted by a href=mailto:someem...@email.com;Some Name/a on November 
21, 2013 at 23:21:58:p

   what would be the regrex to use to extract the date from the line ?

  The usual advice applies: don't use regular expressions to parse HTML. 
However, lots of people do it anyway, myself included. Your success at 
extracting usable data depends upon how rigid the format of the HTML is from 
page to page.

  In your case, if the date always follows a link ('/a') followed by 'on', 
and the date is always followed by 'at' and a time. you can use this:

if( $line =~ m{ /a \s+ on \s+ (\w+ \s \d{1,2} , \s \d{4}) \s at}x ) {
  print The date is $1\n;
}else{
  print No match\n;
}

  Note I am using the extended regular expression syntax with the x modifier.


  -- 
  To unsubscribe, e-mail: beginners-unsubscr...@perl.org
  For additional commands, e-mail: beginners-h...@perl.org
  http://learn.perl.org/




MIME::Lite setup

2012-08-03 Thread Mike Blezien
Hello,

We've been using the MIME Lite module for some time now. I need to set it up 
now so one of our scripts so the when some one replies to an email sent that 
the replies to a 'Reply-To' address instead of the 'From' address. Here how I 
have it coded now:

my($msg);

$msg = MIME::Lite-new(
 From= 'f...@mydomain.com',
 To= 't...@anotherdomain.com',
 Reply-To= 'repl...@mydomain.com',
 Subject = 'Simple Test Email',
 Data= This is a simple test message using 
MIME::Lite.,
 );
$msg-send() or die $!;

when the email is sent out, and you click the reply it stills goes to the 
'From' address instead of the 'Reply-To' address? I went through the docs for 
the module and I though it support the Reply-To field ? I'm I missing something 
here ? Any suggestions would be appreciated


Mike(mickalo)Blezien
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Thunder Rain Internet Publishing
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Re: MIME::Lite setup

2012-08-03 Thread Mike Blezien
Thanks for the correction. It works prefectly now.


Mike(mickalo)Blezien
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Thunder Rain Internet Publishing
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  - Original Message - 
  From: Lawrence Statton 
  To: beginners@perl.org 
  Sent: Friday, August 03, 2012 9:04 AM
  Subject: Re: MIME::Lite setup


  On 08/03/2012 06:17 AM, Mike Blezien wrote:
   Hello,
  
   We've been using the MIME Lite module for some time now. I need to set it 
up now so one of our scripts so the when some one replies to an email sent that 
the replies to a 'Reply-To' address instead of the 'From' address. Here how I 
have it coded now:
  
   my($msg);
  
$msg = MIME::Lite-new(
 From=  'f...@mydomain.com',
 To=  't...@anotherdomain.com',
 Reply-To=  'repl...@mydomain.com',
 Subject =  'Simple Test Email',
 Data=  This is a simple test message using 
MIME::Lite.,
 );
   $msg-send() or die $!;
  
   when the email is sent out, and you click the reply it stills goes to the 
'From' address instead of the 'Reply-To' address? I went through the docs for 
the module and I though it support the Reply-To field ? I'm I missing something 
here ? Any suggestions would be appreciated
  
  
   Mike(mickalo)Blezien
   =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
   Thunder Rain Internet Publishing
   -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

  You need to quote 'Reply-To' ... - is not in the list of characters 
  that will be auto-quoted by = separator.

  If you had used strictures, you would have gotten an error about the 
  bareword Reply.

  What it did was take the value of Reply subtract the value of To 
  (with the result being 0) and assigned the repl...@mydomain.com to the 
  0 header - which was cheerfully ignored.

  --L

  -- 
  To unsubscribe, e-mail: beginners-unsubscr...@perl.org
  For additional commands, e-mail: beginners-h...@perl.org
  http://learn.perl.org/




SMS services

2012-06-29 Thread Mike Blezien

Hello,

we would like to setup a Perl script for sending SMS messages. I found several 
different Perl modules on CPAN for doing this and was wondering if there are 
recommended messaging services that others have used with these modules that 
they could recommend. And what module(s) they recommend.


Thank you,

Mike(mickalo)Blezien
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Thunder Rain Internet Publishing
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- 



--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: SMS services

2012-06-29 Thread Mike Blezien
Ok I'll need to check into this SMPP server, not real sure what that is though

thanks,

Mike(mickalo)Blezien
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Thunder Rain Internet Publishing
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  - Original Message - 
  From: Kwaku Addo Ofori 
  To: Mike Blezien 
  Cc: beginners@perl.org 
  Sent: Friday, June 29, 2012 3:42 PM
  Subject: Re: SMS services


  Hi Mike,

  You can try the code below after you have installed the module:

  --code-begins--

  #!/usr/bin/perl

  use Net::SMPP;

  $smpp = Net::SMPP-new_transceiver('127.0.0.1', port=1234, 
system_id='username', password='password') or die;
  $resp_pdu = $smpp-submit_sm(destination_addr = '+123456789', source_addr = 
'4567', short_message = 'Test send sms to mobile') or die;

  exit(0);

  --code-ends--

  You can replace new_transceiver with new_transmitter - you should still be 
able to send sms. Replace 127.0.0.1 with the IP of the SMPP server, replace 
1234 with the port of the SMPP server, put in a valid username and password. 
Put in a valid destination address - phone number you want to send the text 
message to. Put in a valid source address - shortcode or phone number you want 
to send message from, this should be allowed by the SMPP server. You can then 
put in your message.

  NB. I only use this script and variations of it to test my SMPP server from 
time to time. It's not very clean but it should work fine.


  On Fri, Jun 29, 2012 at 8:31 PM, Mike Blezien mick...@frontiernet.net wrote:

Hello,

I was looking at this module you referred too. would you happen to have an 
example of coding used to send a simple text message to a cell number by chance 
that I could use as a sample, would appreciate it. All I need to do is send a 
message to one cell number.

Thanks,

Mike(mickalo)Blezien
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Thunder Rain Internet Publishing
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  - Original Message - 
  From: Kwaku Addo Ofori 
  To: Mike Blezien 
  Cc: Perl List 
  Sent: Friday, June 29, 2012 2:05 PM
  Subject: Re: SMS services


  Hi Mike,

  If you want a simple smpp client, check out Net::SMPP. I've been using it 
for years as a simple smpp client test tool without any issues. It's quite 
simple to use.

  Kwaku.


  On Fri, Jun 29, 2012 at 6:52 PM, Mike Blezien mick...@frontiernet.net 
wrote:

Hello,

we would like to setup a Perl script for sending SMS messages. I found 
several different Perl modules on CPAN for doing this and was wondering if 
there are recommended messaging services that others have used with these 
modules that they could recommend. And what module(s) they recommend.

Thank you,

Mike(mickalo)Blezien
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Thunder Rain Internet Publishing
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- 

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/








Formatting Numbers

2012-02-12 Thread Mike Blezien

Hello,

Need a little assistance formatting numbers pulled from a databaes. Many are 
like this:


179550, 45960, 890458 etc.

what I need to do is format these values with a comma so they look like this:

179,550, 45,960, 890,458

What is the easiest way to do this?

Thank you,

Mike(mickalo)Blezien
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Thunder Rain Internet Publishing
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- 



--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Formatting Numbers

2012-02-12 Thread Mike Blezien
Thank you Rob this helps allot and should do the trick.


Mike(mickalo)Blezien
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Thunder Rain Internet Publishing
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  - Original Message - 
  From: Rob Dixon 
  To: Perl Beginners 
  Cc: Mike Blezien 
  Sent: Sunday, February 12, 2012 10:46 AM
  Subject: Re: Formatting Numbers


  On 12/02/2012 16:14, Mike Blezien wrote:
  
   Need a little assistance formatting numbers pulled from a databaes. Many
   are like this:
  
   179550, 45960, 890458 etc.
  
   what I need to do is format these values with a comma so they look like
   this:
  
   179,550, 45,960, 890,458
  
   What is the easiest way to do this?

  Hi Mike

  I suggest the subtitution s/(\d+?)(?=(\d{3})+\b)/$1,/g which looks for
  all sequences of digits that are followed by a multiple of three digits
  and puts a comma after each of them. The program below illustrates this.

  HTH,

  Rob


  use strict;
  use warnings;

  for (qw/ 179550 45960 890458 -12345678 1/) {
 (my $n = $_) =~ s/(\d+?)(?=(\d{3})+\b)/$1,/g;
 print $n\n;
  }

  **OUTPUT**

  179,550
  45,960
  890,458
  -12,345,678
  1,000,000,000,000


Remote User Enviorment

2011-06-17 Thread Mike Blezien

Hello,

Is there away to generate a remote_user enviorment without having to use the 
apache popup login form? What we are thinking of doing is create a static login 
form, they enter their username/password, then directing them to a password 
protected folder with the .htaccess file in the folder.


This is setup as a password protected folder right now but what we would like to 
do, if possible, is to direct users to a static login form 1st., so they can 
enter their username/password, the same as the ones stored in the .htpasswd file 
used by the .htaccess file in the password protected folder. If they login 
successfully they would then be directed to the password protected folder but 
wouldn't need to enter their access info again. But I assume the remote_user 
enviorment would need to be created when they log in from a static form. Is this 
possible to do with Perl ?


What the whole idea is if they attempt to bypass the static login form and try 
to go directly to the password protect folder then they would be prompted to 
enter their username/password via the apache popup window login, but if they 
successfully login via the static form then go directly to the password 
protected folder without having to enter their username/password again. Hope I 
explained this clearly :)


thanks,

Mike(mickalo)Blezien
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Thunder Rain Internet Publishing
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- 



--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Remove all HTML tags

2011-05-18 Thread Mike Blezien

Hello,

Is there a perl module available, or a regex method, that will prase an HTML 
formatted file then remove ALL the HTML elements so you end up with just the 
text content of the file?


Any help/suggestions appreciated.

Mike(mickalo)Blezien
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Thunder Rain Internet Publishing
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- 



--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Better Regrex

2011-03-23 Thread Mike Blezien
Hello,

I'm working on a simple regrex issue which I got to work but I think there's a 
better way to do this. This is what I have right now. I need to simply remove 
the string section in red.

my($marker);
my $message = Why are we here?  To bless, inspire and uplift one another. #TRB 
#inspiration #loa; 
   if($message =~ /\#(.*)/i) { $marker = $1; } 
   $message =~ s!$mark!!gi;
   $message =~ s!\#!!gi;

#Resulting String wanted:
  Why are we here?  To bless, inspire and uplift one another.

The method I'm using above works and we get the results wanted but I was 
looking at it again and I think there's a better way to do this. Any suggested 
would be appreciated.

Thx's
Mike(mickalo)Blezien
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Thunder Rain Internet Publishing
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Re: Better Regrex

2011-03-23 Thread Mike Blezien
- Original Message - 
From: Chas. Owens chas.ow...@gmail.com

To: Mike Blezien mick...@frontiernet.net
Cc: Perl List beginners@perl.org
Sent: Wednesday, March 23, 2011 8:42 AM
Subject: Re: Better Regrex


On Wed, Mar 23, 2011 at 09:05, Mike Blezien mick...@frontiernet.net wrote:

Hello,

I'm working on a simple regrex issue which I got to work but I think there's a 
better way to do this. This is what I have right now. I need to simply remove 
the string section in red.


my($marker);
my $message = Why are we here? To bless, inspire and uplift one another. #TRB 
#inspiration #loa;

if($message =~ /\#(.*)/i) { $marker = $1; }
$message =~ s!$mark!!gi;
$message =~ s!\#!!gi;

#Resulting String wanted:
Why are we here? To bless, inspire and uplift one another.

The method I'm using above works and we get the results wanted but I was 
looking at it again and I think there's a better way to do this. Any suggested 
would be appreciated.

snip

Removal can be done with one substitution:

$message =~ s/\s*#\S+\s*//g;

That will remove any whitespace characters followed by a # followed by
one or more non-whitespace characters and the whitespace that follows
it.

If you want to save the markers, you will need to match first, then remove them:

#!/usr/bin/perl

use strict;
use warnings;

my $message = Why are we here?  To bless, inspire and uplift one
another. #TRB #inspiration #loa;

my @markers = $message =~ /#(\S+)/g;
$message =~ s/\s*#\S+\s*//g;

print [$message]\nmarkers: , join(, , @markers), \n;

=

Thx's this work very well, allot cleaner.


Mike 



--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Extracting Data from PDF files

2011-03-03 Thread Mike Blezien
Hello,

I posted a question earlier about creating a PDF file from a PDF form 
submission which we now have working. We are able to create the PDF file to be 
attached to an email.

The issue I'm having now is the ability to extract some specific data from 
these PDF file created. We need to extract a couple of form field values from 
the PDF file created. I've been reviewing the various PDF modules and haven't 
been able to figure it out. The modules I've looking at are PDF::API2::Simple 
and PDF::FDF::Simple. These seem to just create/edit the PDF files, but I need 
to extract specific data from the created PDF file.

Is there another way to do this with these modules or some other method ?

Thanks,

Mike(mickalo)Blezien
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Thunder Rain Internet Publishing
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Re: Extracting Data from PDF files

2011-03-03 Thread Mike Blezien
- Original Message - 
From: shawn wilson ag4ve...@gmail.com

Cc: Perl List beginners@perl.org
Sent: Thursday, March 03, 2011 5:22 AM
Subject: Re: Extracting Data from PDF files



On Mar 3, 2011 6:07 AM, Mike Blezien mick...@frontiernet.net wrote:


Hello,

I posted a question earlier about creating a PDF file from a PDF form

submission which we now have working. We are able to create the PDF file to
be attached to an email.


The issue I'm having now is the ability to extract some specific data from

these PDF file created. We need to extract a couple of form field values
from the PDF file created. I've been reviewing the various PDF modules and
haven't been able to figure it out. The modules I've looking at are
PDF::API2::Simple and PDF::FDF::Simple. These seem to just create/edit the
PDF files, but I need to extract specific data from the created PDF file.


Is there another way to do this with these modules or some other method ?



Maybe I'm missing something but why don't you just dump all of the form data
into a db and then you can create as many pdf as you like? I mean, I've used
a pdf scraping module (you can even do ocr with one) but it isn't fun
because the data is generally not nicely formatted for this. This probably
isn't the case for you but who cares because you have access to the
pre-processed data.


Shawn,

you mean dump it into a database(db) ? the data is mostly all binary so not sure 
how you'd scrape it to extract the data but I'm not real fimilar with this 
approach :)


Mike 



--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Extracting Data from PDF files

2011-03-03 Thread Mike Blezien
- Original Message - 
From: shawn wilson ag4ve...@gmail.com

Cc: Perl List beginners@perl.org
Sent: Thursday, March 03, 2011 6:04 AM
Subject: Re: Extracting Data from PDF files



On Mar 3, 2011 6:35 AM, Mike Blezien mick...@frontiernet.net wrote:


- Original Message - From: shawn wilson ag4ve...@gmail.com
Cc: Perl List beginners@perl.org
Sent: Thursday, March 03, 2011 5:22 AM
Subject: Re: Extracting Data from PDF files




On Mar 3, 2011 6:07 AM, Mike Blezien mick...@frontiernet.net wrote:



Hello,

I posted a question earlier about creating a PDF file from a PDF form


submission which we now have working. We are able to create the PDF file

to

be attached to an email.



The issue I'm having now is the ability to extract some specific data

from


these PDF file created. We need to extract a couple of form field values
from the PDF file created. I've been reviewing the various PDF modules

and

haven't been able to figure it out. The modules I've looking at are
PDF::API2::Simple and PDF::FDF::Simple. These seem to just create/edit

the

PDF files, but I need to extract specific data from the created PDF file.



Is there another way to do this with these modules or some other method

?




Maybe I'm missing something but why don't you just dump all of the form

data

into a db and then you can create as many pdf as you like? I mean, I've

used

a pdf scraping module (you can even do ocr with one) but it isn't fun
because the data is generally not nicely formatted for this. This

probably

isn't the case for you but who cares because you have access to the
pre-processed data.



Shawn,

you mean dump it into a database(db) ? the data is mostly all binary so

not sure how you'd scrape it to extract the data but I'm not real fimilar
with this approach :)



You said your data was coming from pdf form, right? I've never done this per
se, however IIRC, the data is posted to a db, web cgi, or a text file. If
this is the case, why not get the text from the db - its plain text at that
point, no?


I wish it was that simple. All the data passed is basically all binary from the 
PDF form, haven't be able to figure out how to extract the actual specific form 
field data in the file.


Mike 



--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Creating PDF/FDF files

2011-03-01 Thread Mike Blezien
Hello,

I'm working on a small project that will require us to parse data submitted 
from an Adobe Reader form, i.e questionaires. Then we'll need to generate 
either a PDF or FDF temp file, attach it to an email, and send it to use. Now 
parsing the data from the Adobe Form with a Perl script shouldn't be a problem. 
My question is what is the best Perl module to use to create the PDF(needed for 
digital siginatures) or a FDF file for this type of application? I've been 
looking at CPAN for possible solutions but not real clear which is the best to 
handle this type of application for both PDF or FDF formats.

any suggestions or tips would be appreciated.

TIA,

Mike(mickalo)Blezien
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Thunder Rain Internet Publishing
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Re: Creating PDF/FDF files

2011-03-01 Thread Mike Blezien
- Original Message - 
From: David Christensen dpchr...@holgerdanske.com

To: beginners@perl.org
Sent: Tuesday, March 01, 2011 11:53 AM
Subject: Re: Creating PDF/FDF files



On 03/01/2011 07:58 AM, Mike Blezien wrote:
I'm working on a small project that will require us to parse data submitted 
from an Adobe Reader form, i.e questionaires. Then we'll need to generate 
either a PDF or FDF temp file, attach it to an email, and send it to use. Now 
parsing the data from the Adobe Form with a Perl script shouldn't be a 
problem. My question is what is the best Perl module to use to create the 
PDF(needed for digital siginatures) or a FDF file for this type of 
application? I've been looking at CPAN for possible solutions but not real 
clear which is the best to handle this type of application for both PDF or 
FDF formats.

any suggestions or tips would be appreciated.


http://rick.measham.id.au/pdf-api2/

PDF::API2
PDF::TextBlock


HTH,

David


Thanks David I'll check this out.

Mike 



--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Creating PDF/FDF files

2011-03-01 Thread Mike Blezien
- Original Message - 
From: Shawn H Corey shawnhco...@gmail.com

To: beginners@perl.org
Sent: Tuesday, March 01, 2011 10:09 AM
Subject: Re: Creating PDF/FDF files



On 11-03-01 10:58 AM, Mike Blezien wrote:

Hello,

I'm working on a small project that will require us to parse data submitted 
from an Adobe Reader form, i.e questionaires. Then we'll need to generate 
either a PDF or FDF temp file, attach it to an email, and send it to use. Now 
parsing the data from the Adobe Form with a Perl script shouldn't be a 
problem. My question is what is the best Perl module to use to create the 
PDF(needed for digital siginatures) or a FDF file for this type of 
application? I've been looking at CPAN for possible solutions but not real 
clear which is the best to handle this type of application for both PDF or 
FDF formats.


any suggestions or tips would be appreciated.


I would check out PDF::API2::Simple and PDF::FDF::Simple first.  They may do 
everything you want and they are simple.




Thanks Shawn, I like things simple :)

Mike 



--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Creating PDF/FDF files

2011-03-01 Thread Mike Blezien
This is kinda of a followup to my earlier message below and may not be directly 
related to Perl but hope there are some list members that are fimilar with 
Adobe.


According to the Acrobat Pro's documentation, when you use the baked in submit 
form function within Adobe Acrobat (as I am doing), Acrobat sends the data to 
the server in whatever file format you specify when setting up the submit 
button.


(Reference: 
http://help.adobe.com/en_US/Acrobat/9.0/Standard/WS58a04a822e3e50102bd615109794195ff-7dd6.w.html )



The way I'm understanding this reference, the end user's Acrobat software is 
submitting the format that I've specified in the submit button (within the PDF 
form) ... if that's the case, can't the script read the MIME data, save a temp 
file based on that MIME data, then attach that temp file to an e-mail address. 
This is the end results we like to accomplish. Have the Perl script interupted 
the PDF form and read the MIME data. Is this possible to do? If so how would the 
script read the MIME data or the correct way to do this within the script?


Thanks again for any assistance.

Mike
- Original Message - 
From: David Christensen dpchr...@holgerdanske.com

To: beginners@perl.org
Sent: Tuesday, March 01, 2011 11:53 AM
Subject: Re: Creating PDF/FDF files



On 03/01/2011 07:58 AM, Mike Blezien wrote:
I'm working on a small project that will require us to parse data submitted 
from an Adobe Reader form, i.e questionaires. Then we'll need to generate 
either a PDF or FDF temp file, attach it to an email, and send it to use. Now 
parsing the data from the Adobe Form with a Perl script shouldn't be a 
problem. My question is what is the best Perl module to use to create the 
PDF(needed for digital siginatures) or a FDF file for this type of 
application? I've been looking at CPAN for possible solutions but not real 
clear which is the best to handle this type of application for both PDF or 
FDF formats.

any suggestions or tips would be appreciated.


http://rick.measham.id.au/pdf-api2/

PDF::API2
PDF::TextBlock


HTH,

David

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/






--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Calling a PHP function from a Perl script.

2011-02-18 Thread Mike Blezien
Hello,

this is kinda of a crossover to PHP which I'm not that fimilar with.

I have a Perl script that needs to call up a specific function from a PHP 
script, Entry.php calls Social_preformPost() function. I simply need to pass 
2 variables to this function, SocialpreformPost($id,$message) 

My question is do I need to use the require ./Entry.php then call the 
function similar to the way you'd call a regular sub routine or how is this 
done?

thx's

Mike(mickalo)Blezien
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Thunder Rain Internet Publishing
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Re: Unable to determine error source

2011-02-15 Thread Mike Blezien
- Original Message - 
From: Rob Dixon rob.di...@gmx.com

To: beginners@perl.org
Cc: Mike Blezien mick...@frontiernet.net
Sent: Monday, February 14, 2011 10:29 PM
Subject: Re: Unable to determine error source



On 14/02/2011 16:10, Mike Blezien wrote:


I have a script that has been generating a strange error that I can't
seem to find the source. In the script, at the top, we have the
following to help trouble shoot it if any errors:

#!/usr/bin/perl
BEGIN { open (STDERR, ./scriptname_error.log); }

In the error_log file it generates we keep seeing the following
error:

Invalid offset:

And that's it. Normally it will indicate the line#, date, detailed
error, etc., like in the apache error_log file. but this is all it
shows. This is a cron script also.

Any ideas or help with this error would be much appreciated.


Searching my own Perl libraries, I find that exactly this error would be
produced by a call to DateTime::TimeZone-new with an undefined value
for the 'name' parameter. My version validates the parameters to the
call and produces a more informative error message, but it is very
likely that you have an earlier version that doesn't do that.

HTH,

Rob


Rob,

yes that was exactly it. finally found it after some extensive digging throught 
the script.


Thx's

Mike 



--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Unable to determine error source

2011-02-14 Thread Mike Blezien
Hello,

I have a script that has been generating a strange error that I can't seem to 
find the source. In the script, at the top, we have the following to help 
trouble shoot it if any errors:

#!/usr/bin/perl
BEGIN { open (STDERR, ./scriptname_error.log); }

In the error_log file it generates we keep seeing the following error:

Invalid offset:

And that's it. Normally it will indicate the line#, date, detailed error, etc., 
like in the apache error_log file. but this is all it shows. This is a cron 
script also.

Any ideas or help with this error would be much appreciated.

TIA,

Mike(mickalo)Blezien
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Thunder Rain Internet Publishing
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Re: Randomizing a 24hr time period

2011-02-09 Thread Mike Blezien
it isn't for spam I assure you. A client of ours sends out 25-50, 
messages/quotes, a day to various spiritual web sites. And they have already 
been approved by the web sites they are posted too. They just wanted a solution 
to randomize when the messages go out so they are like a surprize when they 
appear.

Mike(mickalo)Blezien
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Thunder Rain Internet Publishing
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  - Original Message - 
  From: Mike McClain 
  To: Perl List 
  Sent: Monday, February 07, 2011 10:31 PM
  Subject: Re: Randomizing a 24hr time period


  On Mon, Feb 07, 2011 at 03:30:03PM -0600, Mike Blezien wrote:
   I'm trying to come up with a function to send out X number of message per 
   day(24hr day) but we need to randomize the time factore each day. For 
  snip 
   Hope this makes sense, and someone may have done this before or may have 
   some info the I can look into.
   =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
   Thunder Rain Internet Publishing
   -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- 
   

  This sure looks like a spammer asking for help.
  What's the justification for this need?
  Mike

  -- 
  To unsubscribe, e-mail: beginners-unsubscr...@perl.org
  For additional commands, e-mail: beginners-h...@perl.org
  http://learn.perl.org/




Re: Randomizing a 24hr time period

2011-02-09 Thread Mike Blezien
Uri,

yes that does make sense but that's what the customer wants :) There always 
right aren't they !!

Mike(mickalo)Blezien
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Thunder Rain Internet Publishing
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  - Original Message - 
  From: Uri Guttman 
  To: Mike Blezien 
  Cc: Perl List ; Mike McClain 
  Sent: Wednesday, February 09, 2011 4:06 AM
  Subject: Re: Randomizing a 24hr time period


   MB == Mike Blezien mick...@frontiernet.net writes:

MB it isn't for spam I assure you. A client of ours sends out 25-50,
MB messages/quotes, a day to various spiritual web sites. And they
MB have already been approved by the web sites they are posted
MB too. They just wanted a solution to randomize when the messages go
MB out so they are like a surprize when they appear.

  given that email has random delays anyhow, why not just make them go out
  on a fixed period? the receivers will never know it wasn't random. and
  that is a lot of messages sent per day. if someone doesn't read email
  often, they will see a bunch in their inbox at a time. no randomness
  will be percieved there. i bet no one will ever say, they came in too
  regularly but i wanted more random spacing!

  uri

  -- 
  Uri Guttman  --  u...@stemsystems.com    http://www.sysarch.com --
  -  Perl Code Review , Architecture, Development, Training, Support --
  -  Gourmet Hot Cocoa Mix    http://bestfriendscocoa.com -


Re: Randomizing a 24hr time period

2011-02-09 Thread Mike Blezien
What they have right now are about 25 messages they wish to spread out through 
out a 24hr period so they are sent out randomly during this 24 period, not a 
pre determined every X minutes or X hours. Why  I'm not really sure, but 
that's what they want to do. I think I have it figured out though.

thx's

Mike(mickalo)Blezien
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Thunder Rain Internet Publishing
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  - Original Message - 
  From: Uri Guttman 
  To: Mike Blezien 
  Cc: Perl List ; Mike McClain 
  Sent: Wednesday, February 09, 2011 5:06 AM
  Subject: Re: Randomizing a 24hr time period


   MB == Mike Blezien mick...@frontiernet.net writes:

MB Uri,

MB yes that does make sense but that's what the customer wants :)
MB There always right aren't they !!

  then do something very simple. send a message every N minutes where N is
  randomly picked from say 5-10. they will never know it wasn't a more
  random distribution.

  uri

  -- 
  Uri Guttman  --  u...@stemsystems.com    http://www.sysarch.com --
  -  Perl Code Review , Architecture, Development, Training, Support --
  -  Gourmet Hot Cocoa Mix    http://bestfriendscocoa.com -


Re: Randomizing a 24hr time period

2011-02-09 Thread Mike Blezien
- Original Message - 
From: Uri Guttman u...@stemsystems.com

To: Mike Blezien mick...@frontiernet.net
Cc: Perl List beginners@perl.org; Mike McClain mike.j...@nethere.com
Sent: Wednesday, February 09, 2011 9:35 AM
Subject: Re: Randomizing a 24hr time period



MB == Mike Blezien mick...@frontiernet.net writes:


 MB What they have right now are about 25 messages they wish to spread
 MB out through out a 24hr period so they are sent out randomly during
 MB this 24 period, not a pre determined every X minutes or X
 MB hours. Why  I'm not really sure, but that's what they want to
 MB do. I think I have it figured out though.

as i said a simple solution is to slice up the 24 hours into fixed
intervals. then pick a random time INSIDE each interval. random enough
for those types of people. this is close to one message an hour so there
is plenty of variability within each hour. and the coding is trivial.

uri


Uri,

that's what I'm working on at the moment, trying to randomize the intervals 
after splitting up the 24hr period.


Thx's

Mike 



--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Randomizing a 24hr time period

2011-02-09 Thread Mike Blezien
- Original Message - 
From: Paul Johnson p...@pjcj.net

To: Uri Guttman u...@stemsystems.com
Cc: Mike Blezien mick...@frontiernet.net; Perl List beginners@perl.org
Sent: Wednesday, February 09, 2011 11:05 AM
Subject: Re: Randomizing a 24hr time period



On Wed, Feb 09, 2011 at 11:16:07AM -0500, Uri Guttman wrote:

 MB == Mike Blezien mick...@frontiernet.net writes:

   as i said a simple solution is to slice up the 24 hours into fixed
   intervals. then pick a random time INSIDE each interval. random enough
   for those types of people. this is close to one message an hour so there
   is plenty of variability within each hour. and the coding is trivial.

  MB Uri,

  MB that's what I'm working on at the moment, trying to randomize the
  MB intervals after splitting up the 24hr period.

so what is taking so long? it is about 2 lines of code! seriously, just
do int( rand( 60 ) and send it out that minute within the hour. (adjust
60 for the actual period from splitting the day).


For every complex problem there is an answer that is clear, simple, and
wrong.  H. L. Mencken.

Of course you can redefine the problem this way, but it's more interesting to
solve the original problem.

To go with Rob's solution, here's something that's (more) correct:



#!/usr/bin/perl

use strict; use warnings;
my ($messages, $time_period) = @ARGV;

# set up initial distribution
my @times = map rand, 1 .. $messages;
my $duration; $duration += $_ for @times;

# spread over required time period
my $factor = $time_period / $duration; $_ *= $factor for @times;

# calculate actual times
my $time = 0; $time = $_ += $time for @times;

# shift down
my $shift = rand $times[0]; $_ -= $shift for @times;

my $n; printf %2d. %02d:%02d\n, ++$n, $_, ($_ - int $_) * 60 for @times;


Paul,

this works quiet well too. Appreciate the code, it save me allot time :)

Mike 



--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Randomizing a 24hr time period

2011-02-09 Thread Mike Blezien
- Original Message - 
From: Paul Johnson p...@pjcj.net

To: Uri Guttman u...@stemsystems.com
Cc: Mike Blezien mick...@frontiernet.net; Perl List beginners@perl.org
Sent: Wednesday, February 09, 2011 11:05 AM
Subject: Re: Randomizing a 24hr time period



On Wed, Feb 09, 2011 at 11:16:07AM -0500, Uri Guttman wrote:

 MB == Mike Blezien mick...@frontiernet.net writes:

   as i said a simple solution is to slice up the 24 hours into fixed
   intervals. then pick a random time INSIDE each interval. random enough
   for those types of people. this is close to one message an hour so there
   is plenty of variability within each hour. and the coding is trivial.

  MB Uri,

  MB that's what I'm working on at the moment, trying to randomize the
  MB intervals after splitting up the 24hr period.

so what is taking so long? it is about 2 lines of code! seriously, just
do int( rand( 60 ) and send it out that minute within the hour. (adjust
60 for the actual period from splitting the day).


For every complex problem there is an answer that is clear, simple, and
wrong.  H. L. Mencken.

Of course you can redefine the problem this way, but it's more interesting to
solve the original problem.

To go with Rob's solution, here's something that's (more) correct:



#!/usr/bin/perl

use strict; use warnings;
my ($messages, $time_period) = @ARGV;

# set up initial distribution
my @times = map rand, 1 .. $messages;
my $duration; $duration += $_ for @times;

# spread over required time period
my $factor = $time_period / $duration; $_ *= $factor for @times;

# calculate actual times
my $time = 0; $time = $_ += $time for @times;

# shift down
my $shift = rand $times[0]; $_ -= $shift for @times;

my $n; printf %2d. %02d:%02d\n, ++$n, $_, ($_ - int $_) * 60 for @times;



Paul,

quick question. my perl is a bit rusty, been away from it for awhile. But this
line in your coding:

my $n; printf %2d. %02d:%02d\n, ++$n, $_, ($_ - int $_) * 60 for @times;

I need to put the code:   %02d:%02dinto a variable to store it in a
database, the hour:minute, how would I go about putting them into a variable?

Thanks,

Mike 



--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Randomizing a 24hr time period

2011-02-09 Thread Mike Blezien
- Original Message - 
From: Jim Gibson jimsgib...@gmail.com

To: Perl List beginners@perl.org
Sent: Wednesday, February 09, 2011 4:04 PM
Subject: Re: Randomizing a 24hr time period



On 2/9/11 Wed  Feb 9, 2011  1:05 PM, Mike Blezien
mick...@frontiernet.net scribbled:


- Original Message -
From: Paul Johnson p...@pjcj.net
To: Uri Guttman u...@stemsystems.com
Cc: Mike Blezien mick...@frontiernet.net; Perl List 
beginners@perl.org

Sent: Wednesday, February 09, 2011 11:05 AM
Subject: Re: Randomizing a 24hr time period



On Wed, Feb 09, 2011 at 11:16:07AM -0500, Uri Guttman wrote:

MB == Mike Blezien mick...@frontiernet.net writes:



as i said a simple solution is to slice up the 24 hours into fixed
intervals. then pick a random time INSIDE each interval. random enough
for those types of people. this is close to one message an hour so there
is plenty of variability within each hour. and the coding is trivial.


  MB Uri,

  MB that's what I'm working on at the moment, trying to randomize the
  MB intervals after splitting up the 24hr period.

so what is taking so long? it is about 2 lines of code! seriously, just
do int( rand( 60 ) and send it out that minute within the hour. (adjust
60 for the actual period from splitting the day).


For every complex problem there is an answer that is clear, simple, and
wrong.  H. L. Mencken.

Of course you can redefine the problem this way, but it's more interesting 
to

solve the original problem.

To go with Rob's solution, here's something that's (more) correct:



#!/usr/bin/perl

use strict; use warnings;
my ($messages, $time_period) = @ARGV;

# set up initial distribution
my @times = map rand, 1 .. $messages;
my $duration; $duration += $_ for @times;

# spread over required time period
my $factor = $time_period / $duration; $_ *= $factor for @times;

# calculate actual times
my $time = 0; $time = $_ += $time for @times;

# shift down
my $shift = rand $times[0]; $_ -= $shift for @times;

my $n; printf %2d. %02d:%02d\n, ++$n, $_, ($_ - int $_) * 60 for @times;



Paul,

quick question. my perl is a bit rusty, been away from it for awhile. But 
this

line in your coding:

my $n; printf %2d. %02d:%02d\n, ++$n, $_, ($_ - int $_) * 60 for @times;

I need to put the code:   %02d:%02dinto a variable to store it in a
database, the hour:minute, how would I go about putting them into a variable?


%02:%02d is not code as such. It is part of the format specifier for the
printf function.

You can use a string variable for the format specifier:

my $fmt = %02d:%02d;
print $fmt, $hour, $min;

If that is not what you want, then maybe you want to put the string that is
printed according to the specified format into a variable instead of writing
to an output stream. To do that, use the sprintf function instead of printf:

my $hhmm = sprintf(%02:%02,$hour,$min);


Ok how would I go about getting this variable from this line or I'm I missing 
something:


my $n; printf %2d. %02d:%02d\n, ++$n, $_, ($_ - int $_) * 60 for @times;

instead of printing it output ? This where I get messed up.

Thx's
Mike


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Randomizing a 24hr time period

2011-02-09 Thread Mike Blezien
- Original Message - 
From: Jim Gibson jimsgib...@gmail.com

To: Perl List beginners@perl.org
Sent: Wednesday, February 09, 2011 6:15 PM
Subject: Re: Randomizing a 24hr time period



On 2/9/11 Wed  Feb 9, 2011  2:30 PM, Mike Blezien
mick...@frontiernet.net scribbled:


- Original Message -
From: Jim Gibson jimsgib...@gmail.com
To: Perl List beginners@perl.org
Sent: Wednesday, February 09, 2011 4:04 PM
Subject: Re: Randomizing a 24hr time period



On 2/9/11 Wed  Feb 9, 2011  1:05 PM, Mike Blezien
mick...@frontiernet.net scribbled:


- Original Message -
From: Paul Johnson p...@pjcj.net




Paul,

quick question. my perl is a bit rusty, been away from it for awhile. But
this
line in your coding:

my $n; printf %2d. %02d:%02d\n, ++$n, $_, ($_ - int $_) * 60 for @times;

I need to put the code:   %02d:%02dinto a variable to store it in a
database, the hour:minute, how would I go about putting them into a
variable?


%02:%02d is not code as such. It is part of the format specifier for the
printf function.

You can use a string variable for the format specifier:

my $fmt = %02d:%02d;
print $fmt, $hour, $min;

If that is not what you want, then maybe you want to put the string that is
printed according to the specified format into a variable instead of writing
to an output stream. To do that, use the sprintf function instead of printf:

my $hhmm = sprintf(%02:%02,$hour,$min);


Ok how would I go about getting this variable from this line or I'm I missing
something:

my $n; printf %2d. %02d:%02d\n, ++$n, $_, ($_ - int $_) * 60 for @times;

instead of printing it output ? This where I get messed up.


That statement is a little complex for a beginner's list (IMO), as is the
rest of Paul's program.

That one line above is equivalent to the following:

my $n;
for ( @times ) {
 printf( %2d. %02d:%02d\n, ++$n, $_, ($_ - int $_) * 60);
}

You are only interested in the hour:minute part of the output, so you can
ignore the counter $n, and for multi-line loops you should use an explicit
loop variable instead of the default $_, giving:

for my $hr ( @times ) {
 my $hhmm = sprintf( %02d:%02d, $hr, ($hr - int $hr) * 60);
 # do something with $hhmm
}

The @times array contains numerical values in hours, so $hhmm will contain a
string of the form 23:59, depending upon the values entered for the number
of messages and the duration.


thanks Jim. After playing around with it for a while finally figured it myself. 
just had look at a bit more. been out of the programming game for a while and 
still rusty. but it's coming back. Thanks to all the other help that was posted.


Mike 



--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Randomizing a 24hr time period

2011-02-07 Thread Mike Blezien

Hello,

I'm trying to come up with a function to send out X number of message per 
day(24hr day) but we need to randomize the time factore each day. For example if 
50 messages are scheduled to be sent out in 24 hr time period we want to 
randomize the times they go out during this time period instead of a fixed time 
period.


So if a message goes out at 1:25am, the next message goes out at some random 
time, the next message goes out at a random time, and so on. We will be setting 
up a cron job to run a script every minute to send out these messages but don't 
want to send them out a per determined times but to fully randomize the time 
factor for each 24 time period(ea day).


Hope this makes sense, and someone may have done this before or may have some 
info the I can look into.


Thx's

Mike(mickalo)Blezien
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Thunder Rain Internet Publishing
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- 



--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Randomizing a 24hr time period

2011-02-07 Thread Mike Blezien
Thanks Jim, this helps allot. You've given me a good starting point. Appreciate 
the help.

Mike
  - Original Message - 
  From: Jim Gibson 
  To: Perl List 
  Sent: Monday, February 07, 2011 5:52 PM
  Subject: Re: Randomizing a 24hr time period


  On 2/7/11 Mon  Feb 7, 2011  1:30 PM, Mike Blezien
  mick...@frontiernet.net scribbled:

   Hello,
   
   I'm trying to come up with a function to send out X number of message per
   day(24hr day) but we need to randomize the time factore each day. For 
example
   if 
   50 messages are scheduled to be sent out in 24 hr time period we want to
   randomize the times they go out during this time period instead of a fixed
   time 
   period.
   
   So if a message goes out at 1:25am, the next message goes out at some random
   time, the next message goes out at a random time, and so on. We will be
   setting 
   up a cron job to run a script every minute to send out these messages but
   don't 
   want to send them out a per determined times but to fully randomize the time
   factor for each 24 time period(ea day).

  You can generate uniform random numbers between 0 and 1 by using the
  built-in rand() function. See

  perldoc -f rand
  perldoc -q random:
Why aren't my random numbers random?
How do I get a random number between X and Y?

  So, for example, you can calculate a randomized time for the next message in
  the interval 1 to 59 with the expression (1 + int(rand(59)). The average
  interval will be 30 minutes, which will result in, on average, 48 messages
  per day. Some days will have more, some less. Intervals will range from 1 to
  59 minutes. If that is too much variation, you can use a different interval,
  e.g. 20 to 39, which still has an average interval of 30.

  If you are starting an instance of your program every minute, you will have
  to save the time for the next message and only send a message when that time
  occurs, then compute the time for the next message.

  You can also compute the probability of sending a message as 50/1440
  (0.0347222), compute a random number every minute, and only send the message
  if the random number is less than 0.0347222. You have no control over the
  interval between successive messages that way, however.

  If a uniform distribution is not desirable, see the Math::Random module for
  more distributions. The normal (gaussian) distribution (bell curve) is
  quite common in many applications.

  If having exactly 50 messages in a 24-hour period is important, then you
  will have to use a more adaptive probability calculator that looks at the
  number of messages issued so far in calculating whether or not to send a
  message at each minute.

  Search for probability distributions for more information.



  -- 
  To unsubscribe, e-mail: beginners-unsubscr...@perl.org
  For additional commands, e-mail: beginners-h...@perl.org
  http://learn.perl.org/




Directory Size

2010-10-27 Thread Mike Blezien

Hello,

I've been out of the programming game for a while and recently got back into 
some small programming projects. Just need to figure out if there is a Perl 
function to determine the total size of a folder and files? Meaning once we 
open/read a directory is to calculate the total, in MB's, the size of the files 
in a particular directory folder.


Thanks,


Mike(mickalo)Blezien
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Thunder Rain Internet Publishing
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- 



--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Directory Size

2010-10-27 Thread Mike Blezien
- Original Message - 
From: Owen rc...@pcug.org.au

To: Mike Blezien mick...@frontiernet.net
Cc: Perl List beginners@perl.org
Sent: Wednesday, October 27, 2010 8:17 PM
Subject: Re: Directory Size



Hello,

I've been out of the programming game for a while and recently got
back into
some small programming projects. Just need to figure out if there is a
Perl
function to determine the total size of a folder and files? Meaning
once we
open/read a directory is to calculate the total, in MB's, the size of
the files
in a particular directory folder.



http://www.perlmonks.org/?node_id=168974 may help.




--
Owen




Thanks Owen for the reference very helpful.

Mike

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Directory Size

2010-10-27 Thread Mike Blezien
- Original Message - 
From: Alan Haggai Alavi alanhag...@alanhaggai.org

To: beginners@perl.org; Mike Blezien mick...@frontiernet.net
Sent: Wednesday, October 27, 2010 8:13 PM
Subject: Re: Directory Size



On Thursday 28 Oct 2010 06:30:01 Mike Blezien wrote:

Hello,

I've been out of the programming game for a while and recently got back
into some small programming projects. Just need to figure out if there is
a Perl function to determine the total size of a folder and files? Meaning
once we open/read a directory is to calculate the total, in MB's, the size
of the files in a particular directory folder.

Thanks,


Mike(mickalo)Blezien
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Thunder Rain Internet Publishing
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-



Hi Mike,

You could make use of File::Find's find function along with stat.

=pod Example

use strict;
use warnings;

use File::Find;

my $size;
my $directory = '/path/to/some/directory';

sub determine_size {
   if ( -f $File::Find::name ) {
   $size += ( stat $File::Find::name )[7];
   }
}

find( \determine_size, $directory );

$size /= 1024 * 1024;

print Total size: $size MB\n;

=cut

Relevant documents to read:
`perldoc File::Find` - http://perldoc.perl.org/File/Find.html
`perldoc -f stat` - http://perldoc.perl.org/functions/stat.html


Regards,
Alan Haggai Alavi.



Thank you Alan I think this was exactly what I was looking for, now I recall how 
it's done again. :)


MIke 



--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Strange Error

2010-04-19 Thread Mike Blezien
Hello,

I'm getting a strange error and for the life of me can't figure out what 
causing it. All that's in the error log is the following:

[Mon Apr 19 13:01:37 2010] index.cgi: Invalid offset: 1

Would anyone have any ideas what to look for that would cause this type of 
error message ?

Thanks,

Mike(mickalo)Blezien
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Thunder Rain Internet Publishing
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Re: Strange Error

2010-04-19 Thread Mike Blezien

Hi Jim,

After futher digging we found the problem it had to do with a DateTime string.

Thanks for the help.

Mike(mickalo)Blezien
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Thunder Rain Internet Publishing
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

- Original Message - 
From: Jim Gibson jimsgib...@gmail.com

To: Perl List beginners@perl.org
Sent: Monday, April 19, 2010 4:14 PM
Subject: Re: Strange Error



On 4/19/10 Mon  Apr 19, 2010  11:07 AM, Mike Blezien
mick...@frontiernet.net scribbled:


Hello,

I'm getting a strange error and for the life of me can't figure out what
causing it. All that's in the error log is the following:

[Mon Apr 19 13:01:37 2010] index.cgi: Invalid offset: 1

Would anyone have any ideas what to look for that would cause this type of
error message ?


It could be an explicit test in the program that is running. It looks like
you are running a CGI program. Is it written in Perl? Do you have access to
the source code? If so, find the source code (index.cgi?) and search for the
string 'Invalid offset:' and look at the code just before it.

That string does not turn up in 'perldoc perldiag', so might be issued by
the program explicitly, or maybe a module used by the program.



--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




PayPal API

2010-02-15 Thread Mike Blezien
Hello,

we are in the process of setting up an API for Paypal's Masspay and was looking 
at the module:
 
Business::PayPal::API::MassPay

Has anyone had any experience using this module? Any bugs in it?

Thanks,

Mike(mickalo)Blezien
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Thunder Rain Internet Publishing
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

LWP error returned

2010-02-10 Thread Mike Blezien

Hello,

I've run into an error while using the LWP module which I haven't come accross 
before and was wondering what is means. This is the coding I'm using:


--
use LWP::UserAgent;

my $USERNAME = XX;
my $PASSWORD = XX;

my $URL = 
http://technet.rapaport.com/HTTP/RapLink/download.aspx?Polish=I,EX,VG,G,F,PSymm=I,EX,VG,G,F,PSortBy=ownerWhite=1Fancy=1Programmatically=yes;;
my $URL = 
qq~https://technet.rapaport.com/HTTP/RapLink/download.aspx?Shape=BCaratSizeFrom=0.4CaratSizeTo=3.5ColorFrom=DColorTo=JClarityFrom=FLClarityTo=SI1CutFrom=ICutTo=GGradeReport=GIA,AGSPolish=I,EX,VG,GSymmetry=I,EX,VG,GFluorescenceIntensity=N,VSL,F,M,SSellerLogin=67155,60745,32235,39321,43460,28426,43412,67000,68708,50841SortBy=ownerWhite=1Programmatically=yes~;


my $ua = LWP::UserAgent-new();
 $ua-timeout(60);
#create request
my $req = new HTTP::Request 'POST' = $URL;
 $req-content_type(application/x-www-form-urlencoded);

#add creadentials to request
$req-authorization_basic($USERNAME,$PASSWORD);
my $res = $ua-request($req);

my $content = $res-content();

---

The error/content is returns is Length Required  not exactly sure what 
that means.


Any help much appreciated.

TIA,

Mike(mickalo)Blezien
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Thunder Rain Internet Publishing
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 



--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: LWP error returned

2010-02-10 Thread Mike Blezien


- Original Message - 
From: Dermot paik...@googlemail.com

To: Perl List beginners@perl.org
Sent: Wednesday, February 10, 2010 10:14 AM
Subject: Re: LWP error returned


On 10 February 2010 15:47, Mike Blezien mick...@frontiernet.net wrote:

Hello,

I've run into an error while using the LWP module which I haven't come
accross before and was wondering what is means. This is the coding I'm
using:

--
use LWP::UserAgent;

my $USERNAME = XX;
my $PASSWORD = XX;

my $URL =
http://technet.rapaport.com/HTTP/RapLink/download.aspx?Polish=I,EX,VG,G,F,PSymm=I,EX,VG,G,F,PSortBy=ownerWhite=1Fancy=1Programmatically=yes;;
my $URL =
qq~https://technet.rapaport.com/HTTP/RapLink/download.aspx?Shape=BCaratSizeFrom=0.4CaratSizeTo=3.5ColorFrom=DColorTo=JClarityFrom=FLClarityTo=SI1CutFrom=ICutTo=GGradeReport=GIA,AGSPolish=I,EX,VG,GSymmetry=I,EX,VG,GFluorescenceIntensity=N,VSL,F,M,SSellerLogin=67155,60745,32235,39321,43460,28426,43412,67000,68708,50841SortBy=ownerWhite=1Programmatically=yes~;

my $ua = LWP::UserAgent-new();
$ua-timeout(60);
#create request
my $req = new HTTP::Request 'POST' = $URL;
$req-content_type(application/x-www-form-urlencoded);

#add creadentials to request
$req-authorization_basic($USERNAME,$PASSWORD);
my $res = $ua-request($req);

my $content = $res-content();

---

The error/content is returns is Length Required  not exactly sure what
that means.



A pure guess would be that the host requires a 'content-length' header
OR the web service requires a length parameter.



Is there something else I need to add to the coding the to pass this parameter 
??


Thx's

Mike(mickalo)Blezien
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Thunder Rain Internet Publishing
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Working with Excel spreadsheets

2010-01-25 Thread Mike Blezien

Hello,

we need to extract data from uploaded Excel spreadsheets, XLS binary files. What 
is the best perl module to accomplish this with ??


Thanks,


Mike(mickalo)Blezien
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Thunder Rain Internet Publishing
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 



--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Working with Excel spreadsheets

2010-01-25 Thread Mike Blezien


- Original Message - 
From: Owen rc...@pcug.org.au

To: Mike Blezien mick...@frontiernet.net
Cc: Perl List beginners@perl.org
Sent: Monday, January 25, 2010 6:14 PM
Subject: Re: Working with Excel spreadsheets





Hello,

we need to extract data from uploaded Excel spreadsheets, XLS binary
files. What
is the best perl module to accomplish this with ??




Updated yesterday, Spreadsheet::ParseExcel


Put 'excel' into the box at http://search.cpan.org/ and you may find
others, like  Spreadsheet::DataFromExcel


Thanks Owen. I was reading through that module but wanted to find something bit 
simpler to use, like the DataFromExcel or Excel2Text then work with the exported 
data. Think we'll do some testing and see which one will suite our need.


Thanks for the help

Mike 



--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Working with Excel spreadsheets

2010-01-25 Thread Mike Blezien
Yes this seem quiet easy to use also. I must have missed this one while 
browsing through CPAN's site.

thanks,

Mike
  - Original Message - 
  From: ANJAN PURKAYASTHA 
  To: Mike Blezien 
  Cc: rc...@pcug.org.au ; Perl List 
  Sent: Monday, January 25, 2010 7:59 PM
  Subject: Re: Working with Excel spreadsheets


  Spreadsheet::ParseExcel::Simple is the simplest module to use. Very user 
friendly. I use it often.
  HTH,
  Anjan


  On Mon, Jan 25, 2010 at 7:48 PM, Mike Blezien mick...@frontiernet.net wrote:


- Original Message - From: Owen rc...@pcug.org.au
To: Mike Blezien mick...@frontiernet.net
Cc: Perl List beginners@perl.org
Sent: Monday, January 25, 2010 6:14 PM
Subject: Re: Working with Excel spreadsheets






Hello,

we need to extract data from uploaded Excel spreadsheets, XLS binary
files. What
is the best perl module to accomplish this with ??




  Updated yesterday, Spreadsheet::ParseExcel


  Put 'excel' into the box at http://search.cpan.org/ and you may find
  others, like  Spreadsheet::DataFromExcel



Thanks Owen. I was reading through that module but wanted to find something 
bit simpler to use, like the DataFromExcel or Excel2Text then work with the 
exported data. Think we'll do some testing and see which one will suite our 
need.

Thanks for the help

Mike 


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/






  -- 
  =
  anjan purkayastha, phd *
  research associate*
  fas center for systems biology,  *
  harvard university  *
  =


Basic Domain and IP Info

2010-01-17 Thread Mike Blezien

Hello,

I've been looking for some basic domain/IP info that we can generate for 
domain/IP addresses entered from a form. I've been searching CPAN without much 
luck, but maybe looking in the wrong places. What I like to do is obtain the 
following information for the domain/IP address:


Name Servers for the domain name
IPs associated with the domain
What/How many sites are using the IP
Reverse IP Lookup
HTTP Status Code

Are there any Perl modules, toolkits, available that do these type of task?

any help or suggestion much appreciated,

Mike(mickalo)Blezien
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Thunder Rain Internet Publishing
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 



--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Basic Domain and IP Info

2010-01-17 Thread Mike Blezien
- Original Message - 
From: Jeff Peng jeffp...@netzero.net

To: Mike Blezien mick...@frontiernet.net
Cc: Perl List beginners@perl.org
Sent: Sunday, January 17, 2010 8:05 PM
Subject: Re: Basic Domain and IP Info



在 2010-01-17日的 11:16 -0600,Mike Blezien写道:

Hello,

I've been looking for some basic domain/IP info that we can generate for
domain/IP addresses entered from a form. I've been searching CPAN without 
much

luck, but maybe looking in the wrong places. What I like to do is obtain the
following information for the domain/IP address:

Name Servers for the domain name
IPs associated with the domain
What/How many sites are using the IP
Reverse IP Lookup
HTTP Status Code

Are there any Perl modules, toolkits, available that do these type of task?



Hi,

What you want is an integrative Perl program, not just a perl module.
The 1st,2nd and 4th could be done by Net::DNS module.
For the 3rd item, do you mean how many virtual hosts are located in an
IP? That is not easy to gather, unless you are the hostmaster of those
IPs.
For the 5th item, you may look at HTTP::Status following with
LWP::UserAgent module if I understand for you correctly.

HTH.



Thanks Jeff, this gives me some places to start with.

Regarding item#3 I was getting at how many domains share the same IP entered in 
a form. I.E. on one of our dedicated servers the main IP address is 75.125.1.226 
which has approx., 12 domains sharing that same IP address. Not that critical 
though. :)


Thx's

Mike(mickalo)Blezien
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Thunder Rain Internet Publishing
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=



--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




What does the __FILE__ mean?

2010-01-12 Thread Mike Blezien

Hello,

I have  sub routine in a module that creates a MD5 hash:

make_md5(__FILE__);

what exactly does this __FILE__ represent, the current filename ?

thanks for any help,


Mike(mickalo)Blezien
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Thunder Rain Internet Publishing
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: What does the __FILE__ mean?

2010-01-12 Thread Mike Blezien

Ok, thanks I think I found what I was looking for,


Mike(mickalo)Blezien
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Thunder Rain Internet Publishing
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- Original Message - 
From: Shawn H Corey shawnhco...@gmail.com

To: Mike Blezien mick...@frontiernet.net
Cc: Perl List beginners@perl.org
Sent: Tuesday, January 12, 2010 3:21 PM
Subject: Re: What does the __FILE__ mean?



Mike Blezien wrote:

Hello,

I have  sub routine in a module that creates a MD5 hash:

make_md5(__FILE__);

what exactly does this __FILE__ represent, the current filename ?


See `perldoc perldata` and search for /Special Literals/
http://perldoc.perl.org/perldata.html

--
Just my 0.0002 million dollars worth,
 Shawn

Programming is as much about organization and communication
as it is about coding.

I like Perl; it's the only language where you can bless your
thingy.


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Convert PHP functions to Perl

2009-12-27 Thread Mike Blezien
Hello,

I'm working on converting some PHP coding to a Perl system. come across a 
couple of functions I'm not familiar with and was hoping we have some 
experienced PHP programmer on the list that can help out. These are the 
functions I need to switch over to Perl:

str_shuffle()
microtime()

What is the Perl equivalent to these functions ?

thx's and happy holidays,

Mike(mickalo)Blezien
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Thunder Rain Internet Publishing
http://www.thunder-rain.com/
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Re: Convert PHP functions to Perl

2009-12-27 Thread Mike Blezien

Hi Shlomi,

- Original Message - 
From: Shlomi Fish shlo...@iglu.org.il

To: beginners@perl.org; Mike Blezien mick...@frontiernet.net
Sent: Sunday, December 27, 2009 7:38 AM
Subject: Re: Convert PHP functions to Perl



On Sunday 27 Dec 2009 15:12:24 Mike Blezien wrote:

Hello,



Hi Mike!


I'm working on converting some PHP coding to a Perl system. come across a
 couple of functions I'm not familiar with and was hoping we have some
 experienced PHP programmer on the list that can help out. These are the
 functions I need to switch over to Perl:

str_shuffle()
microtime()

What is the Perl equivalent to these functions ?



Here you go:


#!/usr/bin/perl

# Implement PHP's str_shuffle() and microtime() in Perl 5.
# Written by Shlomi Fish ( http://www.shlomifish.org/ )
#
# Copyright by Shlomi Fish, 2009 and licensed under the MIT/X11 License (
#  http://www.opensource.org/licenses/mit-license.php ).
#
# If you like this code, please consider contributing to either me:
# http://www.shlomifish.org/meta/how-to-help/ or the Perl Foundation:
# http://www.perlfoundation.org/ .

use strict;
use warnings;

use List::Util qw(shuffle);

# See
# http://php.net/manual/en/function.str-shuffle.php

sub str_shuffle
{
   my $string = shift;

   return join(, shuffle(split //, $string));
}

sub test_str_shuffle
{
   my $string = shift;

   print sprintf(qq{Shuffling of %s is %s.\n},
   $string, str_shuffle($string)
   );
}

use Time::HiRes qw(gettimeofday);

# See:
# http://php.net/manual/en/function.microtime.php

sub microtime
{
   my $get_as_float = shift;

   my ($secs, $microsecs) = gettimeofday();

   if ($get_as_float)
   {
   return $secs + ($microsecs * 1e-6);
   }
   else
   {
   return $microsecs $secs;
   }
}

sub test_microtime
{
   my $get_as_float = shift;

   print Microtime( .
   ($get_as_float ? true : false) . ) =  .
   microtime($get_as_float) . \n
   ;
}

test_str_shuffle(HelloWorld);
test_str_shuffle(This sentence is false.);

test_microtime(1);
test_microtime();




microtime() seems like it is badly designed and you may wish using
Time::HiRes's gettimeofday() directly.


thx's and happy holidays,



Happy holidays and a happy new year to you too.

Regards,

Shlomi Fish



Works prefectly! Thank you. Using the gettimeofday() directly does work better 
:)


Have a safe and great new year ... to all :)

Mike(mickalo)Blezien
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Thunder Rain Internet Publishing
Custom Programming  Web Hosting Services
http://www.thunder-rain.com/
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 



--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: XML::Simple question

2009-12-23 Thread Mike Blezien


- Original Message - 
From: Jenda Krynicky je...@krynicky.cz

To: Perl List beginners@perl.org
Sent: Tuesday, December 22, 2009 6:44 PM
Subject: Re: XML::Simple question



From:   Mike Blezien mick...@frontiernet.net

Hello,

were using the XML/Simple module to process a XML response using the code 
below.
But for some reason the module can't read the $xmlresponse data unless we 
create
a temp file first to store the data then pass that to the module. Is there a 
way
to do this without having to create a temp file first. ?? Everything does 
work,
the response is return. We used the Data/Dumper module to verify the data 
first.


=
my $ua  = new LWP::UserAgent;
   $ua-timeout(10);
   $ua-agent(HTTP/1.1);
my $req = new HTTP::Request 'POST' = $xmlscript;


DO NOT QUOTE VARIABLES!

If the $variable already contains a string, you just unnecessary make
a copy. If it contains a number (well it can contain both, but I mean
the case when it contains just the number), you force Perl to convert
the number to string (and store that string alongside the number in
the variable) and make a copy of the string. And possibly later it
will have to convert the string back to number.

And these are the cases when it actually works, even if it's
inefficient. As soon as you quote like this a variable that contains
a reference or an object (a reference bless()ed to a package), you
end up with useles string, that will just look like a reference when
printed out. Do not quote variables!

my $req = new HTTP::Request 'POST' = $xmlscript;

is enough!


my $simple = new XML::Simple(KeyAttr=[]);
# read XML file
my $xmldata = $simple-XMLin($xmlresponse);


OK, you are safe from automatic key related transformations ... what
about tags with optional attributes? Or tags that are sometimes but
not always repeated?

See http://www.perlmonks.org/?node_id=697036

Jenda


Jenda,

thanks for the info, I nomarlly don't quote variables like that, just didn't 
catch that one.


Mike(mickalo)Blezien
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Thunder Rain Internet Publishing
http://www.thunder-rain.com/
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 



--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




XML::Simple question

2009-12-22 Thread Mike Blezien

Hello,

were using the XML/Simple module to process a XML response using the code below. 
But for some reason the module can't read the $xmlresponse data unless we create 
a temp file first to store the data then pass that to the module. Is there a way 
to do this without having to create a temp file first. ?? Everything does work, 
the response is return. We used the Data/Dumper module to verify the data first.


=
my $ua  = new LWP::UserAgent;
  $ua-timeout(10);
  $ua-agent(HTTP/1.1);
my $req = new HTTP::Request 'POST' = $xmlscript;
  $req-content_type(application/x-www-form-urlencoded);
  $req-content($xmlrequest);
my $res  = $ua-request($req);

my $error   = $res-is_error();
my $success = $res-is_success();

# Data returned in XML Format
my $xmlresponse = $res-content();

my $simple = new XML::Simple(KeyAttr=[]);
# read XML file
my $xmldata = $simple-XMLin($xmlresponse);
# can't read the response in this manner
===

Thanks and happy holidays,

Mike(mickalo)Blezien
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Thunder Rain Internet Publishing
http://www.thunder-rain.com/
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 



--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: XML::Simple question

2009-12-22 Thread Mike Blezien


- Original Message - 
From: Robert Wohlfarth rbwohlfa...@gmail.com

To: Perl List beginners@perl.org
Sent: Tuesday, December 22, 2009 5:47 PM
Subject: Re: XML::Simple question



On Tue, Dec 22, 2009 at 9:54 AM, Mike Blezien mick...@frontiernet.netwrote:


were using the XML/Simple module to process a XML response using the code
below. But for some reason the module can't read the $xmlresponse data
unless we create a temp file first to store the data then pass that to the
module. Is there a way to do this without having to create a temp file
first. ?? Everything does work, the response is return. We used the
Data/Dumper module to verify the data first.

=
my $ua  = new LWP::UserAgent;
 $ua-timeout(10);
 $ua-agent(HTTP/1.1);
my $req = new HTTP::Request 'POST' = $xmlscript;
 $req-content_type(application/x-www-form-urlencoded);
 $req-content($xmlrequest);
my $res  = $ua-request($req);

my $error   = $res-is_error();
my $success = $res-is_success();

# Data returned in XML Format
my $xmlresponse = $res-content();

my $simple = new XML::Simple(KeyAttr=[]);
# read XML file
my $xmldata = $simple-XMLin($xmlresponse);
# can't read the response in this manner
===



Try the parse_string method instead. The documentation says that XMLin
guesses based on the presence of  and  characters. It appears that
XMLin guesses wrong in your case.

parse_string explicitly expects an XML string. So there's no logic to
confuse.

--
Robert Wohlfarth


Thanks Robert, that did the trick :)

Mike(mickalo)Blezien
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Thunder Rain Internet Publishing
Custom Programming  Web Hosting Services
http://www.thunder-rain.com/
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Google/Checkout API

2009-12-15 Thread Mike Blezien

Hello,

We are in the process of setting up a checkout page using Paypal and Google's 
Checkout, using the Google Checkout HTML API. This is simple setup with 3 
different single items that can be ordered using Paypal or Google Checkout. Now 
setting up the Paypal API no problems there. But I haven't worked with the 
GoogleCheckout HTML API before and have been trying to figure out the best way 
to set it up. All we need to do is have a checkout button/form to process a 
single item purchase and receive instant notification that the payment was 
validated, sucessfull or not, similar to how Paypal works.


I've been trying to go through Google docs on their site and the info within the 
Perl API docs but it's a bit confusing to say the least :) I was hoping someone 
on the list may have worked with Google's Checkout API with a similar simple 
setup like this and can steer me in the right direction, creating the payment 
order form to submit the payment and which API module(s) need to be utilized. 
There are bunch of different modules/examples scripts used but I'm sure not all 
of them are needed to process a simple single item order payment and receive the 
notification.


Any help or suggestion would be appreciated.


Mike(mickalo)Blezien
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Thunder Rain Internet Publishing
http://www.thunder-rain.com/
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 



--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Tucows OpenSRS Module

2009-09-15 Thread Mike Blezien

Hello,

I'm trying to use the Net::OpenSRS module to post new domain registrations for 
the Tucows API. I've been attempting to grasp the method for posting a new 
domain registration but haven't been able to understand how this module works 
for posting to Tucows. I've looked at the module info posted on Cpan but haven't 
grasp how this works yet. Was hoping someone has used the module and maybe share 
an example of how to post the request.


Any help would be appreciated.

TIA,

Mike(mickalo)Blezien
===
Thunder Rain Internet Publishing
Providing Internet Solution that Work
http://www.thunder-rain.com
=== 



--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Using MIME::Lite to send via SMTP

2008-08-14 Thread Mike Blezien

Hello,

we've been trying to setup MIME::Lite to send email via SMTP but keep getting
the following error:
-
SMTP auth() command failed:  Incorrect authentication data
-

we have verified that the SMTP information, smtp host, username and password are
correct. the code that sends out the email:

$msg-send('smtp',$host,AuthUser=$user,AuthPass=$pwd,Timeout=60) or die $!;

Now I've setup the identical script on a different server, which uses the same
MTA(Exim) and it worked fine just changed the host, username and password.

If we use the Mail::Sender module on this same server which has the problem
sending it with MIME::Lite, to send out SMTP email, then it works fine, and
using the same identical host, username and password info as used in the
MIME::Lite script. I realize we can use the Mail::Sender module instead, as this
works fine, but would prefer to use MIME::Lite ... just a personal preference :)
So I was wondering if there is some sort of trick to get MIME::Lite to work
correctly. I have also verified that the MIME::Base64  Authen::SASL modules, 
used by MIME::Lite, are installed.


Any help or tips much appreciated,

Mike(mickalo)Blezien
===
Thunder Rain Internet Publishing
Providing Internet Solution that Work
http://www.thunder-rain.com
===


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Reading SQLite db

2008-01-24 Thread Mike Blezien

Hello

I've attached a sqlite db file and have been trying to find a way to read this 
type of file w/Perl. Is there a module or a way with Perl to read/extract data 
from this type of file ??


Thx's

Mike(mickalo)Blezien
===
Thunder Rain Internet Publishing
=== 


Copy of sms.db
Description: Binary data
-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Re: Reading SQLite db

2008-01-24 Thread Mike Blezien

Chas,

Worked like a charm! thanks so much for the help :)

Mike
- Original Message - 
From: Chas. Owens [EMAIL PROTECTED]

To: Mike Blezien [EMAIL PROTECTED]
Cc: Perl List beginners@perl.org
Sent: Thursday, January 24, 2008 1:30 PM
Subject: Re: Reading SQLite db



On Jan 24, 2008 1:49 PM, Mike Blezien [EMAIL PROTECTED] wrote:

Hello

I've attached a sqlite db file and have been trying to find a way to read 
this
type of file w/Perl. Is there a module or a way with Perl to read/extract 
data

from this type of file ??

snip

Use the DBI module with DBD::SQLite:

#! /usr/bin/perl

use strict;
use warnings;

use DBI;

my $dbh = DBI-connect(
dbi:SQLite:dbname=sms.db,
'',
'',
{
ChopBlanks = 1,
AutoCommit = 1,
PrintError = 0,
RaiseError = 1,
FetchHashKeyName = 'NAME_lc'
}
) or die DBI-errstr;

my $sth = $dbh-prepare(select * from message order by 1);
$sth-execute;
while (my $row = $sth-fetch) {
print join(, , @$row), \n;
}



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




SoapLite Error

2007-10-29 Thread Mike Blezien

Hello,

we're trying to put together a SOAP::Lite application but keep getting this
error message:
===
soaptest.cgi: Element 'XMLRequest' can't be allowed in valid XML message. Died.
at /usr/lib/perl5/site_perl/5.8.8/SOAP/Lite.pm
===

this is a snip of code being used, the line
 SOAP::Data-name(XMLRequest=$xmllines), 

seems to be causing the error.
===
my $soap = SOAP::Lite
   - uri('https://www.edentifyservices.com/')
   - proxy('https://www.edentifyservices.com/XMLGateway/Request.asmx')
   - on_action( sub { return 'http://tempuri.org/ProcessRequest' });

# Format the SOAP envelope
my $method = SOAP::Data-name('ProcessRequest')-attr({xmlns
='http://tempuri.org/'});

# Format the SOAP body
my $query = SOAP::Data-name(ProcessRequest = SOAP::Data-value(
SOAP::Data-name(ServiceName='idalert'),
SOAP::Data-name(XMLRequest=$xmllines),
SOAP::Data-name(Userid=$conf{edentify}-{Userid}),
SOAP::Data-name(password=$conf{edentify}-{Password}),
SOAP::Data-name(Options=''))
);

# Query the web service
my $result = $soap-call($method = $query);
=

This is the way it suppose to be setup according to documentation provided by
the service provider, Edentify. The $xmllines is a XML request formatted file
sent in the request. The $xmllines looks like this and passed to the 
'XMLRequest= :

=

idalertusernameTotalPayroll/usernamecandidatescandidate
firstnameKaren/firstnamemiR/milastnameJones/lastname
suffix/suffixssn339448854/ssndob6/25/1965/doblocatorDD-987654321/locator
addressaddress18585 N. Center Ave./address1address2/address2
cityJonestown/citystateNE/statezip66654/zip/address
/candidate/candidates/idalert

=

Any help would be much appreciated. This is my first crack using SoapLite :)

Thx's
Mike(mickalo)Blezien
===
Thunder Rain Internet Publishing
Providing Internet Solution that Work
===


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Paypal integrations

2007-08-11 Thread Mike Blezien

Hello,

we have been looking for a Perl written shopping cart that has the PayPal's 
Website Payments Pro integrated with it, but haven't found any. There several 
PHP carts that do have it, but prefer to stay with Perl. Was hoping someone on 
the list may know of a Perl cart that has this feature. Look at the 
Business-PayPal-API modules which would also do the trick, but was hoping to 
find something already setup, if there is one :)


thx's for any feedback.

Mike(mickalo)Blezien
===
Thunder Rain Internet Publishing
=== 


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Parsing large XML file - Revisited

2007-07-25 Thread Mike Blezien

Mirod,

- Original Message - 
From: mirod [EMAIL PROTECTED]

To: beginners@perl.org
Sent: Monday, July 23, 2007 12:42 PM
Subject: Re: Parsing large XML file - Revisited



On Jul 22, 3:33 am, [EMAIL PROTECTED] (Dr.Ruud) wrote:

Mike Blezien schreef:

   my $article_number = $elt-first_child_text('article_number');
   my $dist_number= $elt-first_child_text('distributor_number');
   my $dist_name  = $elt-first_child_text('distributor_name');
   my $artist = $elt-first_child_text('artist');
   my $ean_upc= $elt-first_child_text('ean_upc');
   my $set_total  = $elt-first_child_text('set_total');

That looks awful. Isn't there some way with the module to do it cleaner?

Or do it more like:

  my @text_tags = qw(article_number distributor_number etc);
  my %data;

  for my $tag (@text_tags) {
  $data{_text}{$tag} = $elt-first_child_text($tag);
  }


just a quick note, that first_child_text can also be written field,
which often
makes more sense in a data oriented context.

--
mirod


that was an excellent idea :) Alot cleaner and alot less coding involved. Still 
fairly new working with XML parsing.


Mike 


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Parsing large XML file - Revisited

2007-07-25 Thread Mike Blezien

Rob,
- Original Message - 
From: Rob Dixon [EMAIL PROTECTED]

To: beginners@perl.org
Cc: Mike Blezien [EMAIL PROTECTED]
Sent: Wednesday, July 25, 2007 10:57 AM
Subject: Re: Parsing large XML file - Revisited



Mike Blezien wrote:


Mirod wrote:


On Jul 22, 3:33 am, [EMAIL PROTECTED] (Dr.Ruud) wrote:


Mike Blezien schreef:

   my $article_number = $elt-first_child_text('article_number');
   my $dist_number= $elt-first_child_text('distributor_number');
   my $dist_name  = $elt-first_child_text('distributor_name');
   my $artist = $elt-first_child_text('artist');
   my $ean_upc= $elt-first_child_text('ean_upc');
   my $set_total  = $elt-first_child_text('set_total');

That looks awful. Isn't there some way with the module to do it cleaner?

Or do it more like:

  my @text_tags = qw(article_number distributor_number etc);
  my %data;

  for my $tag (@text_tags) {
  $data{_text}{$tag} = $elt-first_child_text($tag);
  }


just a quick note, that first_child_text can also be written field,
which often makes more sense in a data oriented context.


that was an excellent idea :) Alot cleaner and alot less coding involved. 
Still fairly new working with XML parsing.


Hi Mike

Using a shorter synonym for a method isn't a significant improvement. I prefer
the 'first_child_text' name as it is more descriptive, and if I was using
exactly the code above I would rewrite it as:

 my ($article_number, $dist_number, $dist_name, $artist, $ean_upc, $set_total) 
= map {

   $elt-first_child_text($_)
 } qw/article_number distributor_number distributor_name artist ean_upc 
set_total/


But I made no changes to your code apart from to correct the semantics as it 
wasn't
at all obvious what you're doing. The code you posted just extracts XML field 
text
values into a number of lexical variables and then discards them. If you give 
us an
idea what your final intention is then I'm sure we can help, and it probably 
won't
involve using 'field' instead of 'first_child_text'; but it is likely that a 
hash

structure would be more appropriate.

As I mentioned in an earlier post, it's important to separate XML nodes from 
their
textual content. XML::Twig methods return both types of data and it's best not 
to mix
them up. More importantly, you can always extract the text data value from an 
XML node,

but the reverse isn't true.


Obviously there are several approaches to accomplish this task. With the help of 
yourself and others who posted, I have been able to put together a fairly 
efficient script, as we need to process  parse approx., 5000+ XML files 
averaging 9-1000KB's in size. So far it has been working smoothly :)


Mike 


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Parsing large XML file - Revisited

2007-07-21 Thread Mike Blezien

Rob,

- Original Message - 
From: Rob Dixon [EMAIL PROTECTED]

To: Perl List beginners@perl.org
Cc: Mike Blezien [EMAIL PROTECTED]
Sent: Sunday, July 15, 2007 7:49 PM
Subject: Re: Parsing large XML file



Mike Blezien wrote:


we need to parse some very large XML files, approx., 900-1000KB's filesize. A 
sample of a typical XML file can be view here that would be parsed: 
http://projects.thunder-rain.com/uploads/01.xml


I was planning on using the XML::Twig module to do this, using the following 
code snip to loop through each of the product  /product elements. Not 
every single element is needed but most within each loop of each 
product/product


# Code snip:

my $xmlfile = '/path/to/upload/01.xml';
my $cgi = new CGI();
my $twig = new XML::Twig(twig_handlers = {
  product = \get_products,
 });
$twig-parsefile($xmlfile);

sub get_products {
my($t,$elt) = @_;
# loop through each product.

 my $article_number = $elt-first_child_text('article_number');
 my $ean_upc= $elt-first_child_text('ean_upc');
 my $distributor_number = $elt-first_child_text('distributor_number');
 my $distributor_name   = $elt-first_child_text('distributor_name');
 my $artist = $elt-first_child_text('artist');

# now loop through each 
tracksnumber_of_tracks/number_of_tracksplaytime/playtime

   # track sound /sound /track/tracks for each product.
   # number_of_tracks element determines total tracks .. track sound 
/sound /track .. /tracks

#  # in loop.

$t-purge();
}

exit();
#

Now the areas I'm have alot of problem is with the elements within each 
product, the
tracks   /tracks and looping through each of the tracks child 
elements and sound/sound

-
product
...
tracks
number_of_tracks/number_of_tracksplaytime/playtime
  track 
 sound ..
 /sound
  /track
/tracks

/product


Is there a better way to do this to obtain all the data within each of the 
product ... /product elements? I've never really worked with XML files 
this large and complex tree. Any help or suggestions would be much 
appreciated.


Hi Mike

Your application of XML::Twig seems exactly right. I'm not sure what it is you
don't understand, but if you use this as your 'get_products' subroutine I hope
it answers some questions. All it does is print the title of the product and
the title of all the tracks in that product. Post again if you have any 
trouble

understanding what I've written.

 sub get_products {

   my $product = $_;

   my $product_title = $product-first_child('title');
   print $product_title-trimmed_text, \n;

   my $tracks = $product-first_child('tracks');
   return unless $tracks;

   foreach my $track ($tracks-children('track')) {
 my $track_title = $track-first_child('title');
 print '  ', $track_title-trimmed_text, \n;
   }

   print \n;
 }


we've run a few test and everything seems to be working as expected, but got one 
little problem I haven't been able to figure out, we keep getting this error 
(code snipt below)


Can't call method first_child_text on an undefined value
at .. /sample.cgi line 56  which is this line my $tracknums = 
$tracks-first_child_text('number_of_tracks');


a value for the $tracknums is returned and all other values are presented 
after it parses the XML file. Haven't been able to figure out why I keep getting 
this error??



my $twig= new XML::Twig(twig_handlers = { product = \get_products });
  $twig-parsefile($xmlfile); $twig-purge();

sub get_products {
my($t,$elt) = @_;
my($track_title,$trackno,$setno,$soundtype,$codec,$file);

# process each product loop.
 my $article_number = $elt-first_child_text('article_number');
 my $dist_number= $elt-first_child_text('distributor_number');
 my $dist_name  = $elt-first_child_text('distributor_name');
 my $artist = $elt-first_child_text('artist');
 my $ean_upc= $elt-first_child_text('ean_upc');
 my $set_total  = $elt-first_child_text('set_total');

 my $tracks= $elt-first_child('tracks');
 # LINE 56 here
 my $tracknums = $tracks-first_child_text('number_of_tracks');

 return unless $tracks;

 for my $track ($tracks-children('track'))
  {
$track_title = $track-first_child_text('title');
$trackno = $track-first_child_text('trackno');
$setno   = $track-first_child_text('setno');

   for my $sound ($track-children('sound'))
{
  $soundtype =  $sound-first_child_text('sound_type');
  $codec =  $sound-first_child_text('codec');
  $file  =  $sound-first_child_text('file');~;
}

  } # close for $track loop
# free up memory
$t

Re: Parsing large XML file - Revisited

2007-07-21 Thread Mike Blezien

Rob,

- Original Message - 
From: Rob Dixon [EMAIL PROTECTED]

To: Perl List beginners@perl.org
Cc: Mike Blezien [EMAIL PROTECTED]
Sent: Saturday, July 21, 2007 12:12 PM
Subject: Re: Parsing large XML file - Revisited



Mike Blezien wrote:


Rob Dixon wrote:


Mike Blezien wrote:

[snip]


we've run a few test and everything seems to be working as expected,
but got one little problem I haven't been able to figure out, we keep
getting this error (code snipt below)

Can't call method first_child_text on an undefined value
at .. /sample.cgi line 56  which is this line my $tracknums = 
$tracks-first_child_text('number_of_tracks');


a value for the $tracknums is returned and all other values are presented 
after it parses the XML file. Haven't been able to figure out why I keep 
getting this error??


 
my $twig = new XML::Twig(twig_handlers = { product = \get_products });

$twig-parsefile($xmlfile);
$twig-purge();
 
sub get_products {

my($t,$elt) = @_;
my($track_title,$trackno,$setno,$soundtype,$codec,$file);

# process each product loop.
 my $article_number = $elt-first_child_text('article_number');
 my $dist_number= $elt-first_child_text('distributor_number');
 my $dist_name  = $elt-first_child_text('distributor_name');
 my $artist = $elt-first_child_text('artist');
 my $ean_upc= $elt-first_child_text('ean_upc');
 my $set_total  = $elt-first_child_text('set_total');

 my $tracks= $elt-first_child('tracks');
 # LINE 56 here
 my $tracknums = $tracks-first_child_text('number_of_tracks');

 return unless $tracks;

 for my $track ($tracks-children('track'))
  {
$track_title = $track-first_child_text('title');
$trackno = $track-first_child_text('trackno');
$setno   = $track-first_child_text('setno');

   for my $sound ($track-children('sound'))
{
  $soundtype =  $sound-first_child_text('sound_type');
  $codec =  $sound-first_child_text('codec');
  $file  =  $sound-first_child_text('file');~;
}

  } # close for $track loop
# free up memory
$t-purge();
}


Hello Mike

First of all, your call

 $twig-parsefile($xmlfile);

should properly be

 $twig-parsefile($xmlfile);

as there is no point in forcing Perl to interpolate a string when the result
is simply the string itself.

Your code works fine on the sample 01.xml file that you posted. What must
be happening is that there is a product in your live data that has no tracks
element. The line

 return unless $tracks;

is meant to protect against this, but you have use the value of $tracks before
the check. If you change your code to:

 my $tracks = $elt-first_child('tracks');
 return unless $tracks;

 my $numtracks = $tracks-first_child_text('number_of_tracks');

 for my $track ($tracks-children('track')) {
   :
 }

then your warning should go away, although you may want to do more than just
ignore any products without a tracks tag.

An alternative method, which checks the actual number of tracks instead of
relying on the accuracy of the number_of_tracks value is to put the track
elements into an array and measure its size before iterating over it:

 my $tracks = $elt-first_child('tracks');
 return unless $tracks;
 my @tracks = $tracks-children('track');

 my $numtracks = @tracks;

 for my $track (@tracks) {
   :
 }

Which of these techniques you choose is up to you.


That's exactly what the problem was, some of the XML files do not have the 
tracks elements, which I wasn't aware of till just now. After making some code 
changes, the error has gone away. :)


Again, thank you for your very useful help and information. Save me alot of 
head-scratching!


Mike 


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Parsing large XML file

2007-07-16 Thread Mike Blezien

Rob,

- Original Message - 
From: Rob Dixon [EMAIL PROTECTED]

To: beginners@perl.org
Cc: Mike Blezien [EMAIL PROTECTED]
Sent: Monday, July 16, 2007 5:04 AM
Subject: Re: Parsing large XML file



Mike Blezien wrote:


Rob Dixon wrote:


Mike Blezien wrote:


we need to parse some very large XML files, approx., 900-1000KB's filesize.


[snip]


Your application of XML::Twig seems exactly right. I'm not sure
what it is you don't understand, but if you use this as your
'get_products' subroutine I hope it answers some questions. All it
does is print the title of the product and the title of all the
tracks in that product. Post again if you have any trouble understanding 
what I've written.


 sub get_products {

   my $product = $_;

   my $product_title = $product-first_child('title');
   print $product_title-trimmed_text, \n;

   my $tracks = $product-first_child('tracks');
   return unless $tracks;

   foreach my $track ($tracks-children('track')) {
 my $track_title = $track-first_child('title');
 print '  ', $track_title-trimmed_text, \n;
   }

   print \n;
 }

HTH,

Rob


Ok, this helps getting me in the right direction, much appreciate the help.

The only question I have now, is while looping through the track /track 
we have another loop inside each for the track

.
.
  sound
file ... /file
sound_type ... /sound_type
codec ... /codec
bitrate ... /bitrate
channelsmono/channels
/sound
..
...
/track
can one do something like this:

foreach my $track ($tracks-children('track'))
{
 for my $sound ($track-first_child('sound'))
   {
  my $soundtype =  $sound-first_child_text('sound_type');
  my $codec   =  $sound-first_child_text('codec');
   }
  my $track_title = $track-first_child('title');
 print '  ', $track_title-trimmed_text, \n;
}

Would this work or is there a better way to do this ?


Almost right. You need

 for my $sound ($track-children('sound')) {
   :
 }

(and you also need to test it!)

One thing to be careful of is that all the variables in my code were XML
nodes which could be both used to locate child nodes and to extract their
text values. You have variables which contain just the text values such as

 my $codec = $sound-first_child_text('codec');

which is ok as long as you understand the difference and can keep track
of which is which. You may want to stick with variables being XML nodes
throughout, such as:

 my $codec = $sound-first_child('codec');
 print $codec-trimmed_text, \n;

HTH,

Rob


Ok, appreciate all your help  advise. Going to do some testing later and see 
how well this all works ;)


Thanks,
Mike 


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Parsing large XML file

2007-07-15 Thread Mike Blezien

Hello,

we need to parse some very large XML files, approx., 900-1000KB's filesize. A 
sample of a typical XML file can be view here that would be parsed: 
http://projects.thunder-rain.com/uploads/01.xml


I was planning on using the XML::Twig module to do this, using the following 
code snip to loop through each of the product  /product elements. Not 
every single element is needed but most within each loop of each 
product/product


# Code snip:

my $xmlfile = '/path/to/upload/01.xml';
my $cgi = new CGI();
my $twig = new XML::Twig(twig_handlers = {
  product = \get_products,
 });
$twig-parsefile($xmlfile);

sub get_products {
my($t,$elt) = @_;
# loop through each product.

 my $article_number = $elt-first_child_text('article_number');
 my $ean_upc= $elt-first_child_text('ean_upc');
 my $distributor_number = $elt-first_child_text('distributor_number');
 my $distributor_name   = $elt-first_child_text('distributor_name');
 my $artist = $elt-first_child_text('artist');

# now loop through each 
tracksnumber_of_tracks/number_of_tracksplaytime/playtime

   # track sound /sound /track/tracks for each product.
   # number_of_tracks element determines total tracks .. track sound 
/sound /track .. /tracks

#  # in loop.

$t-purge();
}

exit();
#

Now the areas I'm have alot of problem is with the elements within each product, 
the
tracks   /tracks and looping through each of the tracks child elements 
and sound/sound

-
product
...
tracks
number_of_tracks/number_of_tracksplaytime/playtime
  track 
 sound ..
 /sound
  /track
/tracks

/product


Is there a better way to do this to obtain all the data within each of the 
product ... /product elements? I've never really worked with XML files this 
large and complex tree. Any help or suggestions would be much appreciated.


TIA
Mike(mickalo)Blezien
===
Thunder Rain Internet Publishing
Providing Internet Solution that Work
=== 


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Parsing large XML file

2007-07-15 Thread Mike Blezien

Rob,

- Original Message - 
From: Rob Dixon [EMAIL PROTECTED]

To: Perl List beginners@perl.org
Cc: Mike Blezien [EMAIL PROTECTED]
Sent: Sunday, July 15, 2007 7:49 PM
Subject: Re: Parsing large XML file



Mike Blezien wrote:


we need to parse some very large XML files, approx., 900-1000KB's filesize. A 
sample of a typical XML file can be view here that would be parsed: 
http://projects.thunder-rain.com/uploads/01.xml


I was planning on using the XML::Twig module to do this, using the following 
code snip to loop through each of the product  /product elements. Not 
every single element is needed but most within each loop of each 
product/product


# Code snip:

my $xmlfile = '/path/to/upload/01.xml';
my $cgi = new CGI();
my $twig = new XML::Twig(twig_handlers = {
  product = \get_products,
 });
$twig-parsefile($xmlfile);

sub get_products {
my($t,$elt) = @_;
# loop through each product.

 my $article_number = $elt-first_child_text('article_number');
 my $ean_upc= $elt-first_child_text('ean_upc');
 my $distributor_number = $elt-first_child_text('distributor_number');
 my $distributor_name   = $elt-first_child_text('distributor_name');
 my $artist = $elt-first_child_text('artist');

# now loop through each 
tracksnumber_of_tracks/number_of_tracksplaytime/playtime

   # track sound /sound /track/tracks for each product.
   # number_of_tracks element determines total tracks .. track sound 
/sound /track .. /tracks

#  # in loop.

$t-purge();
}

exit();
#

Now the areas I'm have alot of problem is with the elements within each 
product, the
tracks   /tracks and looping through each of the tracks child 
elements and sound/sound

-
product
...
tracks
number_of_tracks/number_of_tracksplaytime/playtime
  track 
 sound ..
 /sound
  /track
/tracks

/product


Is there a better way to do this to obtain all the data within each of the 
product ... /product elements? I've never really worked with XML files 
this large and complex tree. Any help or suggestions would be much 
appreciated.


Hi Mike

Your application of XML::Twig seems exactly right. I'm not sure what it is you
don't understand, but if you use this as your 'get_products' subroutine I hope
it answers some questions. All it does is print the title of the product and
the title of all the tracks in that product. Post again if you have any 
trouble

understanding what I've written.

 sub get_products {

   my $product = $_;

   my $product_title = $product-first_child('title');
   print $product_title-trimmed_text, \n;

   my $tracks = $product-first_child('tracks');
   return unless $tracks;

   foreach my $track ($tracks-children('track')) {
 my $track_title = $track-first_child('title');
 print '  ', $track_title-trimmed_text, \n;
   }

   print \n;
 }

HTH,

Rob


Ok, this helps getting me in the right direction, much appreciate the help.

The only question I have now, is while looping through the track /track we 
have another loop inside each for the track

.
.
  sound
file ... /file
sound_type ... /sound_type
codec ... /codec
bitrate ... /bitrate
channelsmono/channels
/sound
..
...
/track
can one do something like this:

foreach my $track ($tracks-children('track'))
{
 for my $sound ($track-first_child('sound'))
   {
  my $soundtype =  $sound-first_child_text('sound_type');
  my $codec   =  $sound-first_child_text('codec');
   }
  my $track_title = $track-first_child('title');
 print '  ', $track_title-trimmed_text, \n;
}

Would this work or is there a better way to do this ?

Mike 


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: [OT] Email Notifications

2007-07-13 Thread Mike Blezien


- Original Message - 
From: Rob Dixon [EMAIL PROTECTED]

To: beginners@perl.org
Sent: Friday, July 13, 2007 7:47 AM
Subject: Re: [OT] Email Notifications



Mike Blezien wrote:


we have been using the Disposition-Notification-To: from in the mail 
header(Request Read Receipt) to be notified when an email has been 
received, but this does require the recipient to respond Yes or No to send 
response.


I was just wondering if there was another way to track a mailing to see if it 
was read, automatically
or other means of tracking email that has been received/read without the 
recipient intervention?


Are there any type of Perl Mail modules that can do this, we use MIME::Lite, 
among some of the other more popular modules, but haven't come accross a 
programable way of doing this. Any suggestion would be appreciated.


You're asking how to spy on people. Can't be done. Shouldn't be done.

Rob


I should have clarified. This is for a client who is sending out a new marketing 
email to his subscribers ONLY, listed in a mysql database and NO OTHER people. 
So this is only being sent to his members, NOT SPAM. But as stated, it probably 
is not a very good idea.


Thx's
Mickalo 


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: [OT] Email Notifications

2007-07-13 Thread Mike Blezien


- Original Message - 
From: yitzle [EMAIL PROTECTED]

To: Mike Blezien [EMAIL PROTECTED]
Cc: beginners@perl.org
Sent: Friday, July 13, 2007 8:41 AM
Subject: Re: [OT] Email Notifications



If you're using email, it can't be done.
What you /could/ do is set up a message system on a website and send
messages there. You can email them when a message gets sent and tell
them to log in to read the message.
In that scenario, you could monitor who read the message and who didn't.



Very good idea :)

Thx's
Mickalo

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




[OT] Email Notifications

2007-07-12 Thread Mike Blezien

Hello,

we have been using the Disposition-Notification-To: from in the mail 
header(Request Read Receipt) to be notified when an email has been received, 
but this does require the recipient to respond Yes or No to send response.


I was just wondering if there was another way to track a mailing to see if it 
was read, automatically
or other means of tracking email that has been received/read without the 
recipient intervention?


Are there any type of Perl Mail modules that can do this, we use MIME::Lite, 
among some of the other more popular modules, but haven't come accross a 
programable way of doing this. Any suggestion would be appreciated.


TIA,

Mike(mickalo)Blezien
===
Thunder Rain Internet Publishing
Providing Internet Solution that Work
=== 


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: XML Parsing

2007-06-26 Thread Mike Blezien


- Original Message - 
From: mirod [EMAIL PROTECTED]

To: beginners@perl.org
Sent: Tuesday, June 26, 2007 2:46 AM
Subject: Re: XML Parsing



On Jun 25, 3:47 am, [EMAIL PROTECTED] (Mike Blezien) wrote:
I need to parse a fairly largeXMLresponse file and would like some 
suggestions

on whichXMLmodule would work the best. We've been using theXML::Simple
module, but I don't think that's the right one for the job. Below is theXML
file we need to parse. In particular getting the data from the elements 
within

the message/message
Would theXML::Twigmodule work better for this ?? Any suggestion would be much
appreciated.


Hi Mike,

XML::Twig would probably work fine, you can for example do
XML::Twig-new( twig_roots = { message = sub { push @messages, $_-

text;  $_-purge;}, },)

  -parsefile( 'file.xml');

message texts will be in @messages

If you need more information than just the text of the message
elements, then you can use twig_handlers instead of
twig_roots, look at the docs for the difference.

That said if the files are the size of your example, that's really
small, so there should be no need to switch from a module that
loads the entire file in memory. OTOH if message elements can contain
mixed content (embedded markup like b for example),
then that would be a reason to avoid XML::Simple.

I hope that helps.

--
mirod


Yes, I've been looking through the info on XML::Twig, I think this will do the 
trick quiet nicely. Thanks for the info.


Mike 


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: XML Parsing

2007-06-26 Thread Mike Blezien

Karjala,
- Original Message - 
From: Karjala [EMAIL PROTECTED]

To: beginners@perl.org
Cc: Mike Blezien [EMAIL PROTECTED]
Sent: Tuesday, June 26, 2007 9:56 AM
Subject: Re: XML Parsing


You could use XML::MyXML for this job (works well), if you know the exact 
position in the XML tree where message is located.


Say $xml holds your XML.

Then:

   use XML::MyXML qw(:all);

   $obj = xml_to_object($xml)
   $msg_obj = 
$obj-path('response/idalertresponse/candidateresults/candidateactivity/messaging/raiserisklevel/message');

   $message = $msg_obj-value();

   print $message;


can this handle multiple elements with the same name? IE. the path used above 
may have more then one message/message element within the 
raiserisklevelmessage ... /messagemessage ... /message 
/raiserisklevel


Mike 


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: XML Parsing

2007-06-26 Thread Mike Blezien


- Original Message - 
From: mirod [EMAIL PROTECTED]

To: beginners@perl.org
Sent: Tuesday, June 26, 2007 2:46 AM
Subject: Re: XML Parsing



On Jun 25, 3:47 am, [EMAIL PROTECTED] (Mike Blezien) wrote:
I need to parse a fairly largeXMLresponse file and would like some 
suggestions

on whichXMLmodule would work the best. We've been using theXML::Simple
module, but I don't think that's the right one for the job. Below is theXML
file we need to parse. In particular getting the data from the elements 
within

the message/message
Would theXML::Twigmodule work better for this ?? Any suggestion would be much
appreciated.


Hi Mike,

XML::Twig would probably work fine, you can for example do
XML::Twig-new( twig_roots = { message = sub { push @messages, $_-

text;  $_-purge;}, },)

  -parsefile( 'file.xml');

message texts will be in @messages

If you need more information than just the text of the message
elements, then you can use twig_handlers instead of
twig_roots, look at the docs for the difference.

That said if the files are the size of your example, that's really
small, so there should be no need to switch from a module that
loads the entire file in memory. OTOH if message elements can contain
mixed content (embedded markup like b for example),
then that would be a reason to avoid XML::Simple.

I hope that helps.

--
mirod


XML Snip:
  raiserisklevel
   message . /message
   message . /message
  /raiserisklevel

When using the 'twig_handlers' which may have multiple child elements, IE:

my $twig = new XML::Twig(twig_handlers = {raiserisklevel =\print_message});
$twig-parsefile('/path/to/xml_file');

sub print_message {
my($t,$elt) = @_;

my $message =  $elt-first_child('message')-text;

print qq~Message: $message

$t-purge;
}

Will this print all the text within the message elements??

Mike 


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: XML Parsing

2007-06-26 Thread Mike Blezien


- Original Message - 
From: Karjala [EMAIL PROTECTED]

To: beginners@perl.org
Cc: Mike Blezien [EMAIL PROTECTED]
Sent: Tuesday, June 26, 2007 11:35 AM
Subject: Re: XML Parsing



Mike Blezien wrote:
can this handle multiple elements with the same name? IE. the path used above 
may have more then one message/message element within the 
raiserisklevelmessage ... /messagemessage ... /message 
/raiserisklevel


Mike



It can, as follows:


   my @message_objects = 
$obj-path('response/idalertresponse/candidateresults/candidateactivity/messaging/raiserisklevel/message');


   foreach my $msg_obj (@message_objects) {
  print $msg_obj-value();
   }


Ok, thanks for the info and help :)

Mike 


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




XML Parsing

2007-06-24 Thread Mike Blezien
I need to parse a fairly large XML response file and would like some suggestions 
on which XML module would work the best. We've been using the XML::Simple 
module, but I don't think that's the right one for the job. Below is the XML 
file we need to parse. In particular getting the data from the elements within 
the message/message
Would the XML::Twig module work better for this ?? Any suggestion would be much 
appreciated.

===
XML snip:
messaging
  raiserisklevel
   messageRecords exist which match your SSN and Last Name, but with a 
different first name/message

  /raiserisklevel
   lowerrisklevel/lowerrisklevel
informational
 messageThere has been a recent increase in records that match the 
consumers SSN but where the name bears little or no resumblance to 
consumers/message
 messageThere has been a recent increase in records which match your 
SSN and Last Name, but with a different first name/message

/informational
 /messaging


Entire XML file:
?xml version=1.0 encoding=utf-8?
EdentifyResponse
responsetypeSuccess/responsetype
code0/code
messageService Request Processed./message
transactionidf15fa75b-1982-4bb3-b9a0-891257c5aa4f/transactionid
response
 idalertresponse
  candidateinformation
   firstnameJerry/firstname
   middle /
   lastnameJone/lastname
   suffix /ssn***-**-4512/ssn
   DOB1/1/0001/DOB
   address1 /
   address2 /
   city /
   state /
   zip /
   recordlocatorDD-100510/recordlocator
   scandate6/24/2007/scandate
   scanid81273/scanid
   processedbyTotalPayroll/processedby
   nametypeu/nametype
  /candidateinformation
   candidateresults
candidateactivity
 messaging
  raiserisklevel
   messageRecords exist which match your SSN and Last Name, but with a 
different first name/message

  /raiserisklevel
   lowerrisklevel/lowerrisklevel
informational
 messageThere has been a recent increase in records that match the 
consumers SSN but where the name bears little or no resumblance to 
consumers/message
 messageThere has been a recent increase in records which match your 
SSN and Last Name, but with a different first name/message

/informational
 /messaging
   /candidateactivity
  /candidateresults
 resultssummary
  Other
   scandetail code = SMO count = 2 active = 12 yrs 10 mos  lastactive = 
1 yrs 3 mos  rundate = 200706 /

  /Other
  Suspects
   scandetail code = SU count = 24 active = 24 yrs 8 mos  lastactive = 
11 mos  rundate = 200706 /

  /Suspects
 /resultssummary
 ScanDetails permissableuse=false
   scandetail
riskgroup /
name /
ssn /
ssnvalid /
dob /
address /
sources
source vendor= type= //sources
  /scandetail
 /ScanDetails
/idalertresponse
/response
/EdentifyResponse
---

Mike(mickalo)Blezien
===
Thunder Rain Internet Publishing
=== 


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Using SOAP::Lite

2007-06-08 Thread Mike Blezien

Hello,

I appologize for the long posting, but  was hoping to get some feedback as to 
what we are doing wrong. We are trying to integrate with a XML Gateway that uses 
SOAP. This our first time at trying to use SOAP w/Perl and not having alot of 
luck. Below is the code snip and Request/Response structures used by the 
gateway. If you have experience with using SOAP and Perl, I'd really appreciate 
your assistance. If there is a better way to do this, please contact me directly 
off the list and be happy to discuss hiring you to put this together correctly.


#
# CODE SNIP
my $soap = SOAP::Lite
   - uri('https://www.edentifyservices.com/')
   - proxy('https://www.edentifyservices.com/XMLGateway/Request.asmx')
   - on_action( sub { return 'http://tempuri.org/ProcessRequest' });

# Format the SOAP envelope
my $method = SOAP::Data-name('ProcessRequest')-attr({xmlns 
='http://tempuri.org/'});


# Format the SOAP body
my $query = SOAP::Data-name(ProcessRequest = SOAP::Data-value(
SOAP::Data-name(ServiceName='idalert'),
SOAP::Data-name(XMLRequest='XMLRequestLine'), # THIS LINE PRODUCES SOAP ERROR
SOAP::Data-name(Userid='USERID'}),
SOAP::Data-name(password='PWD'),
SOAP::Data-name(Options='OPTIONS'))
);

# Query the web service
my $result = $soap-call($method = $query);

print $cgi-header();

if($result-fault)
{
   print Edentify Web Service Failed!\n;
   print join ', 
',$result-faultcode,$result-faultstring,$result-faultdetail;

}
else
{
 # Print out the results one by one
 print ResponseType =  . 
$result-valueof('//ProcessRequestResponse/ProcessRequestResult/EdentifyResponse/responsetype') 
. br;
 print Code =  . 
$result-valueof('//ProcessRequestResponse/ProcessRequestResult/EdentifyResponse/code') 
. br;
 print Message =  . 
$result-valueof('//ProcessRequestResponse/ProcessRequestResult/EdentifyResponse/message') 
. br;
 print TransID =  . 
$result-valueof('//ProcessRequestResponse/ProcessRequestResult/EdentifyResponse/transactionid') 
. br;

 # NO RESULTS RETURNED.
}
# END CODE SNIP

#
# XMLRequest format for above XMLRequest:
XMLRequestLine=idalertusernameUSERNAME/usernamecandidates
candidatefirstnameFNAME/firstnamemiMNAME/milastnameLNAME/lastname
suffixSUFFIX/suffix
locatorID/locatorssnSSN/ssndobBDAY/dob
addressaddress1ADDR1/address1address2ADDR2/address2cityCITY/city
stateSTATE/statezipZIP/zip/address/candidate/candidates/idalert


# SOAP REQUEST/RESPONSE STRUCTURES

# REQUEST
POST /XMLGateway/Request.asmx HTTP/1.1
Host: www.edentifyservices.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: http://tempuri.org/ProcessRequest;

?xml version=1.0 encoding=utf-8?
soap:Envelope xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xmlns:xsd=http://www.w3.org/2001/XMLSchema; 
xmlns:soap=http://schemas.xmlsoap.org/soap/envelope/;

 soap:Body
   ProcessRequest xmlns=http://tempuri.org/;
 ServiceNamestring/ServiceName
 XMLRequeststring/XMLRequest
 Useridstring/Userid
 passwordstring/password
 Optionsstring/Options
   /ProcessRequest
 /soap:Body
/soap:Envelope
###
RESPONSE
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length

?xml version=1.0 encoding=utf-8?
soap:Envelope xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xmlns:xsd=http://www.w3.org/2001/XMLSchema; 
xmlns:soap=http://schemas.xmlsoap.org/soap/envelope/;

 soap:Body
   ProcessRequestResponse xmlns=http://tempuri.org/;
 ProcessRequestResultstring/ProcessRequestResult
   /ProcessRequestResponse
 /soap:Body
/soap:Envelope
#


Mike(mickalo)Blezien
===
Thunder Rain Internet Publishing
=== 


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




ScanAlert XSS warnings

2007-05-31 Thread Mike Blezien

Hello,

there is a script on our site, that receives this warning from the HackSafe
scanalerts

--
 ... The remote web application appears to be vulnerable to cross site
scripting (XSS).

General Solution:
HTML encode data before sending it to the browser.

Filtering  and  alone will not solve all cross site scripting attacks.
It is suggested you also attempt to filter out open and closing parenthesis or
convert them to their encoded equivalents.  ... 


I have gone through the script serveral times and though we had it corrected. 
Has anyone on the list experience this problem and may have some suggestions on 
how to correct this XSS scripting. This takes a POST from a standard type 
registration form.


TIA,

Mike(mickalo)Blezien
===
Thunder Rain Internet Publishing
===


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: ScanAlert XSS warnings

2007-05-31 Thread Mike Blezien


Tom,

- Original Message - 
From: Tom Phoenix [EMAIL PROTECTED]

To: Mike Blezien [EMAIL PROTECTED]
Cc: Perl List beginners@perl.org
Sent: Thursday, May 31, 2007 1:46 PM
Subject: Re: ScanAlert XSS warnings



On 5/31/07, Mike Blezien [EMAIL PROTECTED] wrote:


there is a script on our site, that receives this warning from the HackSafe
scanalerts

--
 ... The remote web application appears to be vulnerable to cross site
scripting (XSS).


Have you seen these reference pages?

   http://www.cgisecurity.com/articles/xss-faq.shtml
   http://en.wikipedia.org/wiki/Cross-site_scripting

Hope this helps!

--Tom Phoenix
Stonehenge Perl Training



Thanks for the information.

Mike 



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Crypt::GCrypt error on new method

2007-05-23 Thread Mike Blezien


- Original Message - 
From: JOHN FISHER [EMAIL PROTECTED]

To: beginners@perl.org
Sent: Wednesday, May 23, 2007 10:32 AM
Subject: Crypt::GCrypt error on new method


I am attempting to use gcrypt using a Perl interface

I have perl -MCPAN -e 'install Crypt::GCrypt' and installed it successfully.

I attempted to run the code in Perldoc, but get this error
   Can't locate object method new via package GCrypt::Cipher (perhaps you 
forgot to load GCrypt::Cipher?) at gcrypt_testing.pl line 5.


Any ideas?

=
 use Crypt::GCrypt;

 $cipher = GCrypt::Cipher-new(
   type = 'cipher',
   algorithm = 'aes',
   mode = 'cbc'
 );
 $cipher-start('encrypting');

 $cipher-setkey('my secret key');

 $cipher-setiv('my init vector');

 $ciphertext = $cipher-encrypt('plaintext');
 $ciphertext .= $cipher-finish;

 $plaintext  = $cipher-decrypt($ciphertext);
==Thanks,John
=

Shouldn't that be

$cipher = Crypt::GCrypt-new(  . );

Mike 



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Parsing XML data

2007-05-21 Thread Mike Blezien

Hello,

I am working with a XML gateway system which sends back response results in XML 
format. I have been trying to work w/XML::Simple to parse the data, but not too 
much success. This is a sample of the XML response data, the * indicate the 
data we need to extract from XML file. I tried used Data::Dumper to help, but 
didn't get the results I though, any help would be much appreciated as the best 
way to parse this data.


--
EdentifyResponse
 *responsetypesuccess/responsetype
*code100/code
 *message/message
 *transactionidde7556e-4875-8da1-26521e504ec9/transactionid
 response
   idalertresponse
 *fullnameJohn Smith/fullname
 *last4ssn1234/last4ssn
 *locatorLOCATOR/locator
 *datecreatedDATECREATED/datecreated
 *lastscandateLASTSCANDATE/lastscandate
 *riskratingRISKRATING/riskrating
 *confirmsCONFIRMS/confirms
 *chg_confirmsCHG_CONFIRMS/chg_confirms
 *suspectsSUSPECTS/suspects
 *chg_suspectsCHG_SUSPECTS/chg_suspects
 *surnamematchSURNAMEMATCH/surnamematch
 *chg_surnamematchCHG_SURNAMEMATCH/chg_surnamematch
 *differentsurnameDIFFERENTSURNAME/differentsurname
 *chg_differentsurnameCHG_DIFFERENTSURNAME/chg_differentsurname
 *ssnmatchonlySSSMATCHONLY/ssnmatchonly
 *chg_ssnmatchonlyCHG_SSNMATCHONLY/chg_ssnmatchonly
 *riskindicatorsRISHKINDICATORS/riskindicators
   /idalertresponse
 /response
/EdentifyResponse
---


Mike(mickalo)Blezien
===
Thunder Rain Internet Publishing
=== 



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Parsing XML data

2007-05-21 Thread Mike Blezien
- Original Message - 
From: David Moreno Garza [EMAIL PROTECTED]

To: beginners@perl.org
Sent: Monday, May 21, 2007 8:23 PM
Subject: Re: Parsing XML data



Mike Blezien wrote:

Hello,

I am working with a XML gateway system which sends back response results in 
XML format. I have been trying to work w/XML::Simple to parse the data, but 
not too much success. This is a sample of the XML response data, the * 
indicate the data we need to extract from XML file. I tried used 
Data::Dumper to help, but didn't get the results I though, any help would 
be much appreciated as the best way to parse this data.


I suggest you to use XML::TreePP.



thanks, I think this'll do the trick. 


Mike

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Assign a delimiter variable

2007-05-15 Thread Mike Blezien

Hello,

this one has been driving me nuts and I'm sure it's something very simple I 
maybe overlooking. I need to assign a delimiter variable IE: Pipe or Comma 
delimiter:


my $del = '|'; # use either a '|' or ','
my $dataline  = 0|1|2|3|4|5|6|7|8|9;
my @data = split(/$del/, $dataline);

This does not work, it won't split the file line with the '|' delimiter, and get 
no errors. But if I do this:


my $dataline  = 0|1|2|3|4|5|6|7|8|9;
my @data = split(/\|/, $dataline);

Then it works prefectly, it splits the line as expected. What am I missing ??


Mike(mickalo)Blezien
===
Thunder Rain Internet Publishing
=== 



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Assign a delimiter variable

2007-05-15 Thread Mike Blezien

Hello,

- Original Message - 
From: Xavier Noria [EMAIL PROTECTED]

To: Perl List beginners@perl.org
Sent: Tuesday, May 15, 2007 11:49 AM
Subject: Re: Assign a delimiter variable



On May 15, 2007, at 6:42 PM, Mike Blezien wrote:


Hello,

this one has been driving me nuts and I'm sure it's something very  simple I 
maybe overlooking. I need to assign a delimiter variable  IE: Pipe or Comma 
delimiter:


my $del = '|'; # use either a '|' or ','
my $dataline  = 0|1|2|3|4|5|6|7|8|9;
my @data = split(/$del/, $dataline);

This does not work, it won't split the file line with the '|'  delimiter, and 
get no errors. But if I do this:


my $dataline  = 0|1|2|3|4|5|6|7|8|9;
my @data = split(/\|/, $dataline);

Then it works prefectly, it splits the line as expected. What am I  missing 
??


The actual regexp is what you get _after_ interpolation.

Since the pipe is a metacharacter it is being interpreted as such, as  if you 
directly wrote


  split /|/, ...

To prevent this there's quotemeta(), which is available in literals  as \E:

  my @data = split(/\E$del/, $dataline);

-- fxn


Actually it was the /\Q that worked. Your suggestion got me looking back at the 
books and found it, thanks :)


Mike 



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Curl Process for Perl

2007-04-28 Thread Mike Blezien

Hello,

I have a PHP(..Ouch!! ..) snip using Curl to send data, in XML format, to a 
payment gateway, and would like to convert this into Perl coding, but can't seem 
to find any information or module(s) that implement Curl in the same manner. 
Below is the PHP snip.


SNIP
  $posturl = https://; . $host . $path;
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, $posturl);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($ch, CURLOPT_HTTPHEADER, Array(Content-Type: text/xml));
  curl_setopt($ch, CURLOPT_HEADER, 1);
  curl_setopt($ch, CURLOPT_POSTFIELDS, $content);
  curl_setopt($ch, CURLOPT_POST, 1);
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  $response = curl_exec($ch);
/SNIP

Was hoping someone may have used something similar in Perl or steer me in the 
right direction utilizing Curl w/Perl in the same manner or module that can be 
used.


TIA,
Mickalo 



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Asterisk Web-CallBack

2007-04-23 Thread Mike Blezien

Hello,

Where attempting to setup on a Asterisk server the follow using Perl:

A Web-CallBack Panel for Asterisk Server :
1. Provide a web form for end user fill with userID/psw  phone#1, Phone#2
2. Make two(2) call-out use the end user account thought Asterisk
1st call to phone#1
with time delay (optional) call to phone#2
phone#1 talk with phone#2
3. Billing count in two call (two channel)
4. Can custom messages..

Was wonder if someone has done this or something similar and may suggestion 
required Perl Module(s)(IE: Asterisk::AGI or other modules) or possibly an out 
of the box solution available, not much luck finding anything. Appreciate any 
info or feedback on this.


Thx's
Mike(mickalo)Blezien
===
Thunder Rain Internet Publishing
Providing Internet Solution that Work
=== 



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Mimic SMTP server

2007-03-26 Thread Mike Blezien

Hello,

I need to create a simple perl script that can mimic an SMTP server. Having some 
difficulty coming up with a workable solution.


The script will need to run as a daemon (24/7) accepting connections on port 25. 
When a request comes in,
the script will take in the email as any SMTP server, parse out the header and 
message.


What is the best way to accomplish this? Are there available modules to can do 
this?


Mickalo 



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




OT. Cron jobs

2007-03-10 Thread Mike Blezien

Hello,

Sorry for the OT question, but couldn't find the info I was looking for and 
thought could get a quick answer from the list.


We have a perl script that needs to run 4 times a minute. Can this be done via 
cron or is there an easier way to do this within the Perl script itself? This 4 
times a minute every day.


Mike(mickalo)Blezien
===
Thunder Rain Internet Publishing
=== 



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: OT. Cron jobs

2007-03-10 Thread Mike Blezien

Jay,

- Original Message - 
From: Jay Savage [EMAIL PROTECTED]

To: Beginners List beginners@perl.org; Mike Blezien
[EMAIL PROTECTED]
Sent: Saturday, March 10, 2007 5:11 PM
Subject: Re: OT. Cron jobs



On 3/10/07, Mike Blezien [EMAIL PROTECTED] wrote:

Hello,

Sorry for the OT question, but couldn't find the info I was looking for and
thought could get a quick answer from the list.

We have a perl script that needs to run 4 times a minute. Can this be done
via
cron or is there an easier way to do this within the Perl script itself? This
4
times a minute every day.



Mike,

As far as I know, cron doesn't have control finer-grained than a minute.

Your best best would be to create a script that continuously forks and
then sleeps for 15 seconds. See the docs for your system's deamon
management service (init on *ix, launchd on OS X) to find out how to
make sure it stays alive.

Since sleep only handle's whole seconds, you'll want to take a look at
Time::HiRes if you really need to execute exactly four times every
minute. That way you can time the fork() call and adjust the sleep
microseconds accordingly. Otherwise, you'll eventually get some
accumulated error in the sleep cycle. Not much, of course, but it
sounds like precision counts here.

HTH,

-- jay
--


thx's we'll check out the Time::HiRes module.

Mike


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Word counts

2007-02-20 Thread Mike Blezien

Hello,

we need to do read uploaded files(PDF  DOC files types), and count the words in 
these type of files. what would be the best approach to do this, and specific 
module(s) that can accomplish this fairly easily ? Just need to open the files 
when uploaded to do a word count, if this is possible to do.


any help of suggestions would be appreciated.

thx's

Mike(mickalo)Blezien
===
Thunder Rain Internet Publishing
=== 



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Word counts

2007-02-20 Thread Mike Blezien

David,

- Original Message - 
From: David Moreno Garza [EMAIL PROTECTED]

To: Mike Blezien [EMAIL PROTECTED]
Cc: Perl List beginners@perl.org
Sent: Tuesday, February 20, 2007 2:55 PM
Subject: Re: Word counts



Mike Blezien wrote:

we need to do read uploaded files(PDF  DOC files types), and count the
words in these type of files. what would be the best approach to do this,
and specific module(s) that can accomplish this fairly easily ? Just need
to open the files when uploaded to do a word count, if this is possible to
do.


This might help you a bit:
http://search.cpan.org/~clotho/CAM-PDF-1.08/lib/CAM/PDF.pm#Document_reading


thx's, looks like a good place to start w/PDF files, now to find some info on 
DOC files :)


Mike 



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: redirecting cgi via post method

2007-02-16 Thread Mike Blezien
You may also want to check out the WWW::Mechanize module this will do what your 
looking for.


Mike
- Original Message - 
From: Mumia W. [EMAIL PROTECTED]

To: Beginners CGI beginners-cgi@perl.org
Sent: Friday, February 16, 2007 12:49 PM
Subject: Re: redirecting cgi via post method



On 02/16/2007 12:00 PM, [EMAIL PROTECTED] wrote:

Greetings,

  I have a CGI that receives some parameters, and after processing them (it 
generates a file) it must be redirected to another CGI (external domain) to 
process it.


  What I want to do is similar to

redirect(http://somedomain.com/cgi-bin/myscript.cgi?param1=someparam2=stuff;); 
but using POST method instead of GET.



At first point, I imagine a solution with LWP::UserAgent using the POST 
method for the new user agent; but later, I don't know how to be redirected 
to the new address.


  my $ua_this = LWP::UserAgent-new;
  $ua_this-post(http://somedomain.com/cgi-bin/myscript.cgi;, [
param1 = some,
param2 = stuff
] );

 redirect($ua_this); # -this? I don't think so


Any help will be appreciated.


Alejandro


You probably want a status 307 redirect:

use strict;
use warnings;
use CGI;

# You set the $location.

print CGI::header(
-status = '307 Temporary Redirect',
-location = $location,
);

__HTH__

HTTP Spec: ftp://ftp.isi.edu/in-notes/rfc2616.txt




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/





--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




non-root module install

2006-10-19 Thread Mike Blezien

Hello,

I need to install a perl module, Crypt::SSLeay, for a client in their local 
folder, /home/username
it's been quiet some time since I've installed a module in this manner, to use 
to using either cpan or direct root installs. What is the correct procedure to 
installing modules in this manner, as a non-root user in their own directory?


TIA,

Mike 



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: non-root module install

2006-10-19 Thread Mike Blezien

Prefect! :)

thx's

Mike
- Original Message - 
From: Tom Phoenix [EMAIL PROTECTED]

To: Mike Blezien [EMAIL PROTECTED]
Cc: Perl List beginners@perl.org
Sent: Thursday, October 19, 2006 9:42 PM
Subject: Re: non-root module install



On 10/19/06, Mike Blezien [EMAIL PROTECTED] wrote:


I need to install a perl module, Crypt::SSLeay, for a client in their local
folder, /home/username
it's been quiet some time since I've installed a module in this manner, to 
use
to using either cpan or direct root installs. What is the correct procedure 
to

installing modules in this manner, as a non-root user in their own directory?


Does the perlmodinstall manpage cover what you need?

   http://perldoc.perl.org/perlmodinstall.html

Hope this helps!

--Tom Phoenix
Stonehenge Perl Training

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response






--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Automatied downloads

2006-10-14 Thread Mike Blezien

Hello,

I have a PHP script that automatically downloads a file from a hyper link:
a href=./download.php?file=somefile.pdfdown load here/a
CODE:

//* path to download folder *//
$filedir = '../temp/';
$filename = basename($_GET['file']);
$path = $filedir . $filename;
if (!is_file($path) OR connection_status() != 0) {  exit(); }

ob_end_clean();

header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Expires: '. gmdate('D, d M Y H:i:s', mktime(date('H')+2, date('i'), 
date('s'), date('m'), date('d'), date('Y'))).' GMT');

header('Last-Modified: '. gmdate('D, d M Y H:i:s').' GMT');
header('Content-Type: application/octet-stream');
header('Content-Length: '. @filesize($path));
header('Content-Disposition: attachment; filename='. $filename .'');
header('Content-Transfer-Encoding: binary');

if ($file = @fopen($path, 'rb'))
{
   while (!feof($file) AND connection_status() == 0)
   {
   echo fread($file, 1024 * 8);
   }
flush();
}
@fclose($file);
###

I've been trying to convert this to a Perl script with not much luck. Was hoping 
to get some tips on how to convert this to Perl or a similar method using Perl 
so when the link is clicked on, the file will be automatically downloaded 
instead of clicking on the link to do a Save As.


TIA
Mike(mickalo)Blezien
===
Thunder Rain Internet Publishing
Providing Internet Solution that Work
=== 



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: Automatied downloads

2006-10-14 Thread Mike Blezien

Hello,
- Original Message - 
From: Mumia W. [EMAIL PROTECTED]

To: Beginners List beginners@perl.org
Sent: Saturday, October 14, 2006 12:09 PM
Subject: Re: Automatied downloads



On 10/14/2006 06:05 AM, Mike Blezien wrote:

Hello,



Hello


[ php script snipped ]
###

I've been trying to convert this to a Perl script with not much luck. Was 
hoping to get some tips on how to convert this to Perl or a similar method 
using Perl so when the link is clicked on, the file will be automatically 
downloaded instead of clicking on the link to do a Save As.




Can you show us your Perl program for doing this?


Most likely it's just a matter of setting the Content-Disposition the way you 
did before.


This is what I've come up with so far, not tested yet tho:
# code snip
##
use CGI qw(:standard);
use strict;

my $bytes_read =0;
my $size='';
my $buffer ='';
my $download_dir = '/path/to/downloadable_files';
my $original_file = 'some_file.pdf';

$file = $download_dir/$original_file;
open (ZIP, $file) || die Can't open $file: $!;

# Not sure if this should be a 'inline' or 'attachement' here
print header(-type='application/octet-stream', 'Content-Disposition'=inline; 
filename=$original_file);


binmode(ZIP);

while ($bytes_read=read($file,$buffer,4096))
{
$size += $bytes_read;
print $buffer;
}
close (ZIP);

# End snip
#

but I think this should do the job ... maybe? Or is there a better way to 
accomplish this?


TIA,
Mike 



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




finding matches in multiple arrays

2006-09-17 Thread Mike Blezien

Hello,

I have two arrays, IE:

@arrayA = qw(1 3 5 6);

@arrayB = qw(2 3 6 4);

what I am attempting to do is finding a match from @arrayA in @arrayB ... what 
is the best way to accomplish this?


TIA,

Mike(mickalo)Blezien
Thunder Rain Internet Publishing 



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: finding matches in multiple arrays

2006-09-17 Thread Mike Blezien

Tom,
- Original Message - 
From: Tom Phoenix [EMAIL PROTECTED]

To: Mike Blezien [EMAIL PROTECTED]
Cc: Perl List beginners@perl.org
Sent: Sunday, September 17, 2006 10:10 AM
Subject: Re: finding matches in multiple arrays



On 9/17/06, Mike Blezien [EMAIL PROTECTED] wrote:


what I am attempting to do is finding a match from @arrayA in
@arrayB ... what is the best way to accomplish this?


Are you trying to find the intersection of two arrays? I believe this
is covered in the FAQ, and there's probably a module on CPAN as well.
Or are you trying to do something else? Cheers!


I found the List::Compare module on CPAN, which does exactly what I needed. 
Makes it alot easier. :)


thx's
Mike 



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




  1   2   3   >