Re: Using perl to parse specific lines by date...

2003-12-26 Thread u235sentinel
26/Dec

FYI.. playing with it a bit.  I discovered there must be a carriage 
return (new line) after the line processes.  I changed my original code 
to do this

chomp(my $date = `date +%d/%b`);

This fixed the problem.  hehehe... I should have thought of this.  Oh 
well.. not bad after a few weeks of perl coding

So now I've learned a few new ways to pull stuff into perl. 

Thx guys!



R. Joseph Newton wrote:

u235sentinel wrote:

 

While I've already done this with a simple shell script using grep, I
was trying to figure out how I can do the same thing in perl.
I have an access_log  from my apache web server and while I can manually
enter a date for my pattern match (which works fine), I can't seem to
get it automated properly.  I suspect the $date variable may be passing
`date +%d/%b` instead of  26/Dec to the pattern matching if statement.
FYI...  when I run the program I pass the name of the file I want parsed
( example:   code.pl access_log )
Any thoughts on my mistake?

Thx

-

Script I'm using.

#!/usr/bin/perl

 $date=`date +%d/%b`;
   

Since you have a question about what the $date variable contains, here would
be an excellent place to:
print "I see the date as $date\n";
Let us know what prints.

Joseph

 



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



Re: Using perl to parse specific lines by date...

2003-12-26 Thread R. Joseph Newton
u235sentinel wrote:

> While I've already done this with a simple shell script using grep, I
> was trying to figure out how I can do the same thing in perl.
>
> I have an access_log  from my apache web server and while I can manually
> enter a date for my pattern match (which works fine), I can't seem to
> get it automated properly.  I suspect the $date variable may be passing
> `date +%d/%b` instead of  26/Dec to the pattern matching if statement.
>
> FYI...  when I run the program I pass the name of the file I want parsed
> ( example:   code.pl access_log )
>
> Any thoughts on my mistake?
>
> Thx
>
> -
>
> Script I'm using.
>
> #!/usr/bin/perl
>
>   $date=`date +%d/%b`;

Since you have a question about what the $date variable contains, here would
be an excellent place to:
print "I see the date as $date\n";

Let us know what prints.

Joseph


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: Using perl to parse specific lines by date...

2003-12-26 Thread u235sentinel
Thx to everyone on this.  I chucked the system date function I 
originally wrote and used strftime and localtime. Guess I haven't read 
that part of the perl book yet ;-)

So when I wrote the program originally, was it populating $date 
incorrectly?  I'm hoping to understand why it didn't work in the first 
place. 

FYI... %e would have blank padded what I was looking for.  The access 
logs in apache have the / between the month and day.  The error logs 
however would have worked with %e since they space out the month& day.

Thx again!!



John W. Krahn wrote:

U235sentinel wrote:
 

While I've already done this with a simple shell script using grep, I
was trying to figure out how I can do the same thing in perl.
I have an access_log  from my apache web server and while I can manually
enter a date for my pattern match (which works fine), I can't seem to
get it automated properly.  I suspect the $date variable may be passing
`date +%d/%b` instead of  26/Dec to the pattern matching if statement.
FYI...  when I run the program I pass the name of the file I want parsed
( example:   code.pl access_log )
Any thoughts on my mistake?

Thx

-

Script I'm using.

#!/usr/bin/perl
   

use warnings;
use strict;
 

 $date=`date +%d/%b`;
   

There is no need to run an external program to get the date:

my @mons = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
my $date = sprintf '%02d/%s', (localtime)[3], $mons[ (localtime)[4] ];
Or:

use POSIX 'strftime';
my $date = strftime '%d/%b', localtime;
 

 print "\n";
 print "Current search pattern is $date";
 print "\nStarting parse routine...\n\n";
 while (<>) {
   if (m|$date|) {
   

This should work.  Are you sure that the day of the month format is %d
and not %e?
 

 print $_;
  } else {
 #  print "No match.\n";
  }
}
   



John
 



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



Re: Using perl to parse specific lines by date...

2003-12-26 Thread John W. Krahn
U235sentinel wrote:
> 
> While I've already done this with a simple shell script using grep, I
> was trying to figure out how I can do the same thing in perl.
> 
> I have an access_log  from my apache web server and while I can manually
> enter a date for my pattern match (which works fine), I can't seem to
> get it automated properly.  I suspect the $date variable may be passing
> `date +%d/%b` instead of  26/Dec to the pattern matching if statement.
> 
> FYI...  when I run the program I pass the name of the file I want parsed
> ( example:   code.pl access_log )
> 
> Any thoughts on my mistake?
> 
> Thx
> 
> -
> 
> Script I'm using.
> 
> #!/usr/bin/perl

use warnings;
use strict;


>   $date=`date +%d/%b`;

There is no need to run an external program to get the date:

my @mons = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
my $date = sprintf '%02d/%s', (localtime)[3], $mons[ (localtime)[4] ];

Or:

use POSIX 'strftime';
my $date = strftime '%d/%b', localtime;


>   print "\n";
>   print "Current search pattern is $date";
>   print "\nStarting parse routine...\n\n";
>   while (<>) {
> if (m|$date|) {

This should work.  Are you sure that the day of the month format is %d
and not %e?


>   print $_;
>} else {
>   #  print "No match.\n";
>}
> }


John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: Using perl to parse specific lines by date...

2003-12-26 Thread Randy W. Sims
On 12/26/2003 6:35 PM, u235sentinel wrote:

Are these date functions of perl part of the normal distribution or a 
CPAN module?

   if (m|\Q$date\U|)


This didn't seem to make a difference.

I noticed a couple of commands that may help.  System and exec.  
Apparently they were further in the Learning Perl book (I cheated.. 
flipped ahead ::grinz::)

If there is a perl function that will populate a variable with today's 
date please let me know.  I'll try the system/exec commands and cross my 
fingers :D

Thx

Sorry, I should have included it in my original message. The function 
you are looking for is 'localtime' (see 'perldoc -f localtime').

Randy.



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



Re: Using perl to parse specific lines by date...

2003-12-26 Thread u235sentinel
Are these date functions of perl part of the normal distribution or a 
CPAN module?

   if (m|\Q$date\U|)


This didn't seem to make a difference.

I noticed a couple of commands that may help.  System and exec.  
Apparently they were further in the Learning Perl book (I cheated.. 
flipped ahead ::grinz::)

If there is a perl function that will populate a variable with today's 
date please let me know.  I'll try the system/exec commands and cross my 
fingers :D

Thx

Randy W. Sims wrote:

On 12/26/2003 5:39 PM, u235sentinel wrote:

While I've already done this with a simple shell script using grep, I 
was trying to figure out how I can do the same thing in perl.

I have an access_log  from my apache web server and while I can 
manually enter a date for my pattern match (which works fine), I 
can't seem to get it automated properly.  I suspect the $date 
variable may be passing `date +%d/%b` instead of  26/Dec to the 
pattern matching if statement.
FYI...  when I run the program I pass the name of the file I want 
parsed ( example:   code.pl access_log )

Any thoughts on my mistake?

Thx

-

Script I'm using.

#!/usr/bin/perl

 $date=`date +%d/%b`;


You could use perl's date functions for this.

 print "\n";
 print "Current search pattern is $date";
 print "\nStarting parse routine...\n\n";
 while (<>) {
   if (m|$date|) {


Any time you get a string you want to match from an external source, 
you should probably quote it:

   if (m|\Q$date\U|) {


 print $_;
  } else {
 #  print "No match.\n";
  }
}







--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



Re: Using perl to parse specific lines by date...

2003-12-26 Thread Randy W. Sims
On 12/26/2003 5:39 PM, u235sentinel wrote:
While I've already done this with a simple shell script using grep, I 
was trying to figure out how I can do the same thing in perl.

I have an access_log  from my apache web server and while I can manually 
enter a date for my pattern match (which works fine), I can't seem to 
get it automated properly.  I suspect the $date variable may be passing 
`date +%d/%b` instead of  26/Dec to the pattern matching if statement.
FYI...  when I run the program I pass the name of the file I want parsed 
( example:   code.pl access_log )

Any thoughts on my mistake?

Thx

-

Script I'm using.

#!/usr/bin/perl

 $date=`date +%d/%b`;
You could use perl's date functions for this.

 print "\n";
 print "Current search pattern is $date";
 print "\nStarting parse routine...\n\n";
 while (<>) {
   if (m|$date|) {
Any time you get a string you want to match from an external source, you 
should probably quote it:

   if (m|\Q$date\U|) {


 print $_;
  } else {
 #  print "No match.\n";
  }
}




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



Using perl to parse specific lines by date...

2003-12-26 Thread u235sentinel
While I've already done this with a simple shell script using grep, I 
was trying to figure out how I can do the same thing in perl.

I have an access_log  from my apache web server and while I can manually 
enter a date for my pattern match (which works fine), I can't seem to 
get it automated properly.  I suspect the $date variable may be passing 
`date +%d/%b` instead of  26/Dec to the pattern matching if statement. 

FYI...  when I run the program I pass the name of the file I want parsed 
( example:   code.pl access_log )

Any thoughts on my mistake?

Thx

-

Script I'm using.

#!/usr/bin/perl

 $date=`date +%d/%b`;
 print "\n";
 print "Current search pattern is $date";
 print "\nStarting parse routine...\n\n";
 while (<>) {
   if (m|$date|) {
 print $_;
  } else {
 #  print "No match.\n";
  }
}


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



Re: Hi & a question

2003-12-26 Thread John McKown
On Fri, 26 Dec 2003, R. Joseph Newton wrote:

> 
> Hi John,
> 
> I'd suggest that both approaches can be somewhat lacking in portability.  The
> command line is something of a kludge, IMHO, as it still depends largely on
> users typing in the correct parameters.  I think ini files would be portable
> across a much wider variety of systems.  Just write the ini file per
> installation configuration.
> 
> Joseph
> 

Actually, I considered an "ini" or "cfg" file, but rejected it. I was 
wanting something more "standalone" in this case. First, it seemed a bit 
much for only 4 parms. Second, I didn't want to maintain a separate file. 
Third, I didn't want to parse an "ini" file, although there is likely a 
CPAN module around to do that. And I already use LWP::UserAgent and 
HTTP::Request::Common, so requiring another CPAN modules is not really a 
big deal. I really appreciate CPAN!

--
Maranatha!
John McKown


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Bundle::CPAN reinstall problem

2003-12-26 Thread glidden, matthew
Each time I use the CPAN module, it prompts me to install a new version of
CPAN. When I do, it stalls during the make test:

...
t/mirroredby.ok
t/signature.. (here it hangs)

Pretty sure I have gnupg installed correctly. Any guesses on what else would
be wrong? CPAN itself works okay, this is more of an irritation than a big
deal.

Thanks,
Matthew

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: Newbie problems with > in a string

2003-12-26 Thread Rob Dixon
Albert Browne wrote:
>
> I am using the code below in part of a subroutine. It displays ok later in
> the routine within a  block.
> But when I try to use $Meta elsewhere the string appears to be empty.
> Further investigation shows the string is ok until it gets to the >
> in the string.  The string  looks like this and does in the TEXTAREA
> block which is correct.
> I have tried printing the string a bit at a time it is ok until it gets to
> the >. The string then appears to be empty. What am I missing?
>
> Regards
>
> Albert
>
> $title = $query->param("Title");
>
> if ($title ne "") {$Meta = "\n"} ;
>
> $Owner = $query->param("Owner");
>
> if ($Author ne "") {$Meta .= "\n"} ;

Hi Albert.

I have to confess I don't really know what you mean. In particular, what do you
mean by

  the string is ok until it gets to the > in the string

? Do you mean it's missing ">\n" off the end?

Anyway, I have a few comments for you. Firstly, please put

  use strict;
  use warnings

at the head of your program. This will help enormously with a lot of spurious
problems. You will have to declare your variables with 'my', preferably as
close as possible to the point of use.

Secondly, if you're embedding double quotes in a string it's better to change
the delimiter to avoid escaping the quotes.

Thirdly, the test

  if ($Author ne "")

is tidier written as

  if ($Author)

Leaving us with the code below:

  use strict;
  use warnings;

  my $query;
  my $Meta;

  my $title = $query->param("Title");
  $Meta = qq|\n| if $title;

  my $Author;
  my $Owner = $query->param("Owner");  # Should this be $Author?
  $Meta .= qq|\n| if $Author;

You may well need to show us more of your code before we can give a
proper answer.

I hope this helps for now.

Rob



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: Problems with LWP::UserAgent

2003-12-26 Thread Dan Anderson
> "Fair use" is copyright law -- I don't know whether you're infringing
> anybody's copyright, but you're certainly violating O'Reilly's Terms of
> Service, which requires that you agree:
> 
> not to use "Web spiders" or any other automated retrieval
> mechanisms when using the Service other than what is provided
> by the Service
> 
I guess I should stop then, but I was looking at O'Reilly's
robots.txt file (http://safari.oreilly.com/robots.txt):

User-Agent: *
Allow: /

Which made me think spidering was alright.

-Dan


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Timeout for backtick and rsh?

2003-12-26 Thread glidden, matthew
In my current script, I'm polling machines for data, mostly by using rsh and
the backtick. For example:

my $retVal = `rsh $hostname -l root "/usr/local/blah"`;

I'd like the backticks to timeout at 30 seconds, to prevent getting stuck. I
already added a ping test before the call, but some pinged hosts get stuck
waiting at the rsh call anyway. Can I do this with the backticks or do I
need a different command here?

Thanks,
Matthew

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




RE: Newbie problems with > in a string

2003-12-26 Thread Steven Kreuzer
Try changing
$title = $query->param("Title");

to

$title = $query->param('Title');

and do the same thing for the owner param

Also, if you have an if statement that only executes one line of code
when the statement evaluates true, you can do this:

$Meta = "\n" if ($title ne "");

IMHO, this is much "cleaner", just thought I would throw that in there.

Steven Kreuzer
Linux Systems Administrator
Etagon, Inc
W: 646.728.0656
F: 646.728.0607
E: [EMAIL PROTECTED]


-Original Message-
From: Albert Browne [mailto:[EMAIL PROTECTED] 
Sent: Friday, December 26, 2003 11:16 AM
To: [EMAIL PROTECTED]
Subject: Newbie problems with > in a string

I am using the code below in part of a subroutine. It displays ok later
in
the routine within a  block.
But when I try to use $Meta elsewhere the string appears to be empty.
Further investigation shows the string is ok until it gets to the >
in the string.  The string  looks like this and does in the TEXTAREA
block which is correct.
I have tried printing the string a bit at a time it is ok until it gets
to
the >. The string then appears to be empty. What am I missing?

Regards

Albert

$title = $query->param("Title");

if ($title ne "") {$Meta = "\n"} ;

$Owner = $query->param("Owner");

if ($Author ne "") {$Meta .= "\n"}
;


-- 
[EMAIL PROTECTED]
http://www.allroadsleadhere.co.uk





-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Newbie problems with > in a string

2003-12-26 Thread Albert Browne
I am using the code below in part of a subroutine. It displays ok later in
the routine within a  block.
But when I try to use $Meta elsewhere the string appears to be empty.
Further investigation shows the string is ok until it gets to the >
in the string.  The string  looks like this and does in the TEXTAREA
block which is correct.
I have tried printing the string a bit at a time it is ok until it gets to
the >. The string then appears to be empty. What am I missing?

Regards

Albert

$title = $query->param("Title");

if ($title ne "") {$Meta = "\n"} ;

$Owner = $query->param("Owner");

if ($Author ne "") {$Meta .= "\n"}
;


-- 
[EMAIL PROTECTED]
http://www.allroadsleadhere.co.uk





-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Art Gallery Perl Script

2003-12-26 Thread Joe Echavarria
Hi there,

  I am looking for Art Gallery Perl script available,
can anyone recomend me one ?, thanks.

__
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: Hi & a question

2003-12-26 Thread R. Joseph Newton
John McKown wrote:

> I'm new here and a very novice Perl coder. And I have a question, of
> course .
>
> Is it more "Perl-like" to get information from the shell via UNIX
> Environment Variables or via the command line? For an example, I have
> writing a Perl program which reacts to messages sent to it. It has four
> input parameters. The current program gets this information, which is two
> distinct subdirectories, a port number, and an IP address, via four
> different environment variables. My question is should I do it that way or
> should I pass this information in via the command line.
>
> E.g.
>
> export DIR1=...
> export DIR2=...
> export IPADDR=...
> export IPPORT=...
> perl-script.perl
>
> or
>
> perl-script.perl DIR1 DIR2 IPADDR IPPORT
>
> Although my current code uses the first way, I'm beginning to think that
> the second is preferrable because it would be more portable to non-UNIX
> environments.
>
> I hope everybody is having a good holiday.
>
> --
> Maranatha!
> John McKown

Hi John,

I'd suggest that both approaches can be somewhat lacking in portability.  The
command line is something of a kludge, IMHO, as it still depends largely on
users typing in the correct parameters.  I think ini files would be portable
across a much wider variety of systems.  Just write the ini file per
installation configuration.

Joseph


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: Hi & a question

2003-12-26 Thread R. Joseph Newton
Pandey Rajeev-A19514 wrote:

> hey !!!
>
> do you celebrate only perl even in the christmas vacation !!!
> Take a break !! Have a kit kat christmas cake.
> Merry Christmas to this perl group 
>
> Rajeev

I might remind you--not everyone even celbrates that particular holiday.  I
join my family in the celebration, and finds that it works fine that way as a
celebration of the solstice.  I cetainly don't feel, though, that I have to
stop creative engagements, to celbrate a holiday.

Joseph


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: Problems with LWP::UserAgent

2003-12-26 Thread Steve Grazzini
On Fri, Dec 26, 2003 at 12:52:06PM -0500, Dan Anderson wrote:
> So, all in all, I think that my usage falls under the term fair use.
> I have no desire to circumvent Safari's security -- I'm just looking
> to speed up something I do which conforms to the TOS of the web site.



"Fair use" is copyright law -- I don't know whether you're infringing
anybody's copyright, but you're certainly violating O'Reilly's Terms of
Service, which requires that you agree:

not to use "Web spiders" or any other automated retrieval
mechanisms when using the Service other than what is provided
by the Service

-- 
Steve

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: Problems with LWP::UserAgent

2003-12-26 Thread Dan Anderson
> Call me an old fogy, but I think that some of the mechanization of Web
> communications has gone too far.  Providing interactive features in the CGI
> is one thing.  It provides services for both sides of any transaction
> involved.  Batch harvesting of pages meant for human perusal, like batch
> dialing of persons homes at mealtimes, strays across a line into misuse of
> technology, IMHO.  Apparently, the folks at O'Reilly agree.  Since some of
> them at least, have been around the CGI since its inception, you might have
> a bit of a challenge in thwarting their intended use of their site.

Well, Safari *does* provide for printing of pages from a book
and e-mailing copies of them to other people.  My intention is not to
twahrt them, but -- for instance -- when I go on a trip for christams
instead of having to print out each and every chapter to the Perl
Cookbook I can just send a script to do it.  IMHO not a violation of
the Safari terms of service.

Not only that Safari has a number of features in place that I
couldn't get around if I wanted to.  For instance, all books must be
kept on the bookshelf for at least 30 days -- which (short of hacking
their server) is not going to be circumvented.

So, all in all, I think that my usage falls under the term
fair use.  I have no desire to circumvent Safari's security -- I'm
just looking to speed up something I do which conforms to the TOS of
the web site.  :-D

-Dan


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




RE: Hi & a question

2003-12-26 Thread Harvey, Bruce T.
I'm not a 'perl' pro, but I am a pro at using different shells, programs and
so on in different environments.  

It depends on the environment in which you're running.

For example, running on some type of *NIX at a command line, you might very
well want command line options so that people and scripts can easily change
the arguments (it is a pain to change environment variables ... more typing
and saving and exporting and what not).

However, if your perl script is called from other perl scripts (since people
aren't typing it), you may want to change the environment.

Of course, you may want to hide the arguments, in which case, variables in a
file readable by the script would be the choice, so that no one could see
the arguments (*NIX ps -elf) or the environment (*NIX ps axe).

IMHO, it really depends on what the best use is ... how much a pain ...
what's the protection ... do different people need different environments
but NEVER change it once they have that environment (the case for
Environment variables) ... etc.

I don't run much under M$ Windows, but that may very well point you in a
particular direction, based on what's easily available.

Bruce T. Harvey
Legg Mason Wood Walker, Inc.
Corporate Technology - UNIX Admin.
Red Run 2nd Floor - Owings Mills, MD
(410) 580-7383 - [EMAIL PROTECTED]
---



-Original Message-
From: John McKown [mailto:[EMAIL PROTECTED]
Sent: Friday, December 26, 2003 12:38 PM
To: Perl Beginners Mailing List
Subject: Hi & a question


I'm new here and a very novice Perl coder. And I have a question, of 
course .

Is it more "Perl-like" to get information from the shell via UNIX 
Environment Variables or via the command line? For an example, I have 
writing a Perl program which reacts to messages sent to it. It has four 
input parameters. The current program gets this information, which is two 
distinct subdirectories, a port number, and an IP address, via four 
different environment variables. My question is should I do it that way or 
should I pass this information in via the command line. 

E.g.

export DIR1=...
export DIR2=...
export IPADDR=...
export IPPORT=...
perl-script.perl

or

perl-script.perl DIR1 DIR2 IPADDR IPPORT

Although my current code uses the first way, I'm beginning to think that 
the second is preferrable because it would be more portable to non-UNIX 
environments.

I hope everybody is having a good holiday.

--
Maranatha!
John McKown


IMPORTANT:  The security of electronic mail  sent through the Internet 
is not guaranteed.  Legg Mason therefore recommends that you do not 
send confidential information to us via electronic mail, including social 
security numbers, account numbers, and personal identification numbers.

Delivery, and timely delivery, of electronic mail is also not 
guaranteed.  Legg Mason therefore recommends that you do not send time-sensitive 
or action-oriented messages to us via electronic mail, including 
authorization to  "buy" or "sell" a security or instructions to conduct any 
other financial transaction.  Such requests, orders or instructions will 
not be processed until Legg Mason can confirm your instructions or 
obtain appropriate written documentation where necessary.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




RE: Hi & a question

2003-12-26 Thread Steven Kreuzer
Why not just make DIR1, DIR2, IPADDR AND IPPORT global variables within
the script, rather then requiring user to set env variables, which can
become a pain in the ass.

Your best bet would be to set them to some default variable, and then if
the user needs to, she can override the default values by passing the
new values as parameters. Hope that helps.

Steven Kreuzer
Linux Systems Administrator
Etagon, Inc
W: 646.728.0656
F: 646.728.0607
E: [EMAIL PROTECTED]


-Original Message-
From: John McKown [mailto:[EMAIL PROTECTED] 
Sent: Friday, December 26, 2003 12:38 PM
To: Perl Beginners Mailing List
Subject: Hi & a question

I'm new here and a very novice Perl coder. And I have a question, of 
course .

Is it more "Perl-like" to get information from the shell via UNIX 
Environment Variables or via the command line? For an example, I have 
writing a Perl program which reacts to messages sent to it. It has four 
input parameters. The current program gets this information, which is
two 
distinct subdirectories, a port number, and an IP address, via four 
different environment variables. My question is should I do it that way
or 
should I pass this information in via the command line. 

E.g.

export DIR1=...
export DIR2=...
export IPADDR=...
export IPPORT=...
perl-script.perl

or

perl-script.perl DIR1 DIR2 IPADDR IPPORT

Although my current code uses the first way, I'm beginning to think that

the second is preferrable because it would be more portable to non-UNIX 
environments.

I hope everybody is having a good holiday.

--
Maranatha!
John McKown


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




RE: Hi & a question

2003-12-26 Thread Pandey Rajeev-A19514
hey !!!

do you celebrate only perl even in the christmas vacation !!!
Take a break !! Have a kit kat christmas cake.
Merry Christmas to this perl group 

Rajeev 

-Original Message-
From: John McKown [mailto:[EMAIL PROTECTED]
Sent: Friday, December 26, 2003 11:08 PM
To: Perl Beginners Mailing List
Subject: Hi & a question


I'm new here and a very novice Perl coder. And I have a question, of 
course .

Is it more "Perl-like" to get information from the shell via UNIX 
Environment Variables or via the command line? For an example, I have 
writing a Perl program which reacts to messages sent to it. It has four 
input parameters. The current program gets this information, which is two 
distinct subdirectories, a port number, and an IP address, via four 
different environment variables. My question is should I do it that way or 
should I pass this information in via the command line. 

E.g.

export DIR1=...
export DIR2=...
export IPADDR=...
export IPPORT=...
perl-script.perl

or

perl-script.perl DIR1 DIR2 IPADDR IPPORT

Although my current code uses the first way, I'm beginning to think that 
the second is preferrable because it would be more portable to non-UNIX 
environments.

I hope everybody is having a good holiday.

--
Maranatha!
John McKown


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Hi & a question

2003-12-26 Thread John McKown
I'm new here and a very novice Perl coder. And I have a question, of 
course .

Is it more "Perl-like" to get information from the shell via UNIX 
Environment Variables or via the command line? For an example, I have 
writing a Perl program which reacts to messages sent to it. It has four 
input parameters. The current program gets this information, which is two 
distinct subdirectories, a port number, and an IP address, via four 
different environment variables. My question is should I do it that way or 
should I pass this information in via the command line. 

E.g.

export DIR1=...
export DIR2=...
export IPADDR=...
export IPPORT=...
perl-script.perl

or

perl-script.perl DIR1 DIR2 IPADDR IPPORT

Although my current code uses the first way, I'm beginning to think that 
the second is preferrable because it would be more portable to non-UNIX 
environments.

I hope everybody is having a good holiday.

--
Maranatha!
John McKown


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: Problems with LWP::UserAgent

2003-12-26 Thread R. Joseph Newton
zentara wrote:

> On 24 Dec 2003 16:05:16 -0500, [EMAIL PROTECTED] (Dan Anderson) wrote:
> >
> >I am trying to create a  spider to grab my books off of Safari
> >for a  batch printing job so I  don't need to go  through each chapter
> >myself and hit the Print button.  So I used this script to try and log
> >myself in to the safari site:
>
> Watch out, Safari monitors for this, and I believe it's in there EULA.
> I was warned for "surfing too fast", and wasn't even using a script.
>
> You should slow down your script, and randomize times, maybe
> spread it out over the whole day too.

Either that, or just respect their intent.  The open-source world is made of
balances.  One of them is the willingness of authors to make materials
available online, under conditions that still encourage people to buy the
books or materials.  It doesn't seem unreasonable at all to ask that people
at least look at the page they are downloading.

Call me an old fogy, but I think that some of the mechanization of Web
communications has gone too far.  Providing interactive features in the CGI
is one thing.  It provides services for both sides of any transaction
involved.  Batch harvesting of pages meant for human perusal, like batch
dialing of persons homes at mealtimes, strays across a line into misuse of
technology, IMHO.  Apparently, the folks at O'Reilly agree.  Since some of
them at least, have been around the CGI since its inception, you might have
a bit of a challenge in thwarting their intended use of their site.

Joseph


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Scripting a CLI command on Windows 2000

2003-12-26 Thread Norrgard, Nate
Hello, all.
 
I am a formerly competent perl scripter that has been away from some time working in 
other languages. Suffice to say, my perl is a bit rusty. If I weren't under a time 
constraint, I would find the answer to my own question after hours of research and 
trial and error.
 
However, I have a command line program on Windows 2000 that I need to execute about 
1,400 times in succession with different parameters. Needless to say, I'd rather not 
do it at my keyboard. The problem is, that after I run this command (passing in 
appropriate arguments) it comes back with a password prompt interactively. This is 
where I am struggling.
 
I need to have this password passed in before the command will execute. I then want to 
move the next command, which will prompt for a password, etc.
 
So, the question is: how can I feed the password in after the CLI program prompts for 
it?
 
Thanks, in advance.

Nathan J. Norrgard 
Senior Specialist 
The NASDAQ Stock Market, Inc. 
203.385.6598 (v) 
[EMAIL PROTECTED]

 


using SSL unable to write file

2003-12-26 Thread Motherofperls
Hi everyone,

I'm trying to send info with (https) SSL and my program comes to a halt when 
writing a file and sending an email.

SSL was set up by my hosting service with an unauthenticated certificate that 
I had them set up for demo purposes.  Does this have something to do with it? 
Or is it a security problem unrelated to the fact that it's in demo mode?  

I'm trying to learn more about SSL.  Does anyone have some good leads?

Thanks!


Re: Problems with LWP::UserAgent

2003-12-26 Thread Rob Dixon
Dan Anderson wrote:
>
> I am trying to create a  spider to grab my books off of Safari
> for a  batch printing job so I  don't need to go  through each chapter
> myself and hit the Print button.  So I used this script to try and log
> myself in to the safari site:
>
> # BEGIN CODE
> #! /usr/bin/perl
>
> use strict;
> use warnings;
> use LWP;
> use LWP::UserAgent;

Use one or the other, but not both. LWP is a module that just 'require's
LWP::UserAgent.

> # variables
> my $cookie_jar_file = "./cookies.txt";
> my @headers = (
>   'User-Agent'  => 'Mozilla/4.76 [en] (Win98; U)',
>   'Accept'  => 'image/gif, image/x-bitmap, image/jpeg,
> image/pjpeg, image/png, */*',
>   'Accept-Charset'  => 'iso-8859-1,*',
>   'Accept-Language' => 'en-US',
>   "catid" => "",
>   "s" => "1",
>   "o" => "1",
>   "b" => "1",
>   "t" => "1",
>   "f" => "1",
>   "c" => "1",
>   "u" => "1",
>   "r" => "",
>   "l" => "1",
>   "g" => "",
>   "usr" => "myemail",
>   "pwd" => "mypassword",
>   "savepwd" => "1",
> );
> # end variables
>
> my $user_agent = LWP::UserAgent->new;
> $user_agent->cookie_jar({file => $cookie_jar_file});
> my $response = $user_agent->post(
> 'http://safari.oreilly.com/JVXSL.asp',
> @headers,
> );
> # END CODE
>
> Now I know that this is the form I should post to because
> I stripped the following forms out of the web page (and there is
> no Javascript to modify the forms):
>
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>  border="0" align="absmiddle">
> 
>
> When I pull up this web page there's nothing in
> $response->content.  I know that safari.oreilly.com will return a
> blank page if it doesn't like the user agent, and upon signing in
> it'll return to the safari.oreilly.com page with a very large number
> of get variables.  Does anyone know what I might be doing wrong?

You can't put form input into header fields! Use LWP to fetch the
Safari home page and HTML::Form to parse the form and enter
field values. None of the 'Accept' headers are necessary. Take a look
at this:


  use strict;
  use warnings;

  use LWP;
  use HTML::Form;

  my $ua = new LWP::UserAgent(agent => 'Mozilla/4.76 [en] (Win98; U)');
  $ua->cookie_jar({});

  my $resp = $ua->get('http://safari.oreilly.com/');
  die $resp->status_line unless $resp->is_success;

  # There are two forms on the page. Find the one with an input named 'Login'.
  #
  my $login;

  foreach (HTML::Form->parse($resp)) {
if ($_->find_input('Login')) {
  $login = $_;
  last;
}
  }

  $login->param('usr', '[EMAIL PROTECTED]');
  $login->param('pwd', 'secret');

  $resp = $ua->request($login->click);
  die $resp->status_line unless $resp->is_success;


HTH,

Rob




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]