Re: Need help to get text from javascript?

2002-02-10 Thread $Bill Luebkert

LSereb wrote:

> Hi,
> 
> Is anybody know some module that behave like JVM in
> IE, and how to use it.
> 
> I need to read information from page, URL to which is
> posable to get only from source, and link is invoking
> java applet. When I tried to copy shortcut from link I
> got "javascript:void(0);".
> 
> This is URL I got from source file:
> 
> http://www.dlis.dla.mil/CAGESearch/cagesearch_code.asp?CAGE=78286
> http://www.dlis.dla.mil/CAGESearch/cagesearch_code.asp?CAGE=18350
> http://www.dlis.dla.mil/CAGESearch/cagesearch_code.asp?CAGE=0YW97
> 
> They open pages in IE good, but when I put them into
> perl code to save it and read later, all necessary
> information gone.
> 
> This is code I use:
> 
> use LWP::Simple;
> 
> 
> #SavePage must get specified page, save it, and
> prepare it for analyzing
> # If specified file exists, clean it out.
> # SavePage use LWP::Simple
> # It accept 2 arguments: URL and File Name to store
> page.
>   #It converts:
>   #   Lowercase everything
>   #   Double quotes to single
>   #   Get rid of the linefeeds
>   #   Compress spaces/tabs
>   #   
> 
> 
> sub SavePage {
> 
> local *PAGE;
> my ($URL) = shift(@_);
> my ($Name) = shift(@_);
> 
> my $i = 1;
> my $bGot = 1;
> 
> my ($Page) = get ($URL); # Get the page
>   if($Page eq '') {
>   print ("Page is empty
> ");
>   
>   until ( $i == 3) { # 3 times try to get page
> 
>   print ("Page didn't got
> ");
> 
>   $i++;
>   sleep (2);
>   $Page = get ($URL); # Get the page
> 
>   if($Page ne '') {
>   print ("Page DOES got
> ");
>   $bGot = 0;
>   last;
>   }
> 
>   }# End of trying to get page
> 
>   unless ($bGot == 0) {
>   die "The starting URL was not valid.
> ";
>   }
>   }
> 
>   $Page =~ tr/A-Z/a-z/;  # Lowercase everything
>   $Page =~ s/"/'/g; # Double quotes to single
>   $Page =~ s/
> / /g; # Get rid of the linefeeds
>   $Page =~ s/s+/ /g;# Compress spaces/tabs
> 
>   open (PAGE, ">$Name") or die "Can't open page.txt.
> ";
>   
>   print PAGE "$Page
> ";
>   #close (PAGE);
> 
> }  # *PAGE automatically closes/disappears here
> 
> Thanks for any help.


I see no javascript problem here - works fine using my version:

use strict;
use LWP::Simple;

my @URLS = (
   'http://www.dlis.dla.mil/CAGESearch/cagesearch_code.asp?CAGE=78286',
   'http://www.dlis.dla.mil/CAGESearch/cagesearch_code.asp?CAGE=18350',
   'http://www.dlis.dla.mil/CAGESearch/cagesearch_code.asp?CAGE=0YW97',
);

for (my $ii = 0; $ii < @URLS; $ii++) {

(my $name = $URLS[$ii]) =~ s/^.*=(\w+)$/$1/;
SavePage ($URLS[$ii], "cage-$name.html");
}

sub SavePage {
my $URL = shift;
my $Name = shift;

# SavePage must get specified page, save it, and prepare it for analyzing
# 
If specified file exists, overwrite it.
# 
SavePage use LWP::Simple
# 
It accept 2 arguments: URL and File Name to store page.
# 
It converts:
# 
Lowercase everything
# 
Double quotes to single
# 
Get rid of the linefeeds
# 
Compress spaces/tabs

for (1 .. 3) {

print "$_: Getting $URL\n";
my $Page = get $URL or do {
print "Error getting $URL: $!\n";
sleep 2;
next;
};

$Page =~ tr/A-Z/a-z/;   # Lowercase everything
$Page =~ s/"/'/g;   # Double quotes to single
$Page =~ s/[\r\n]/ /g;  # Get rid of the linefeeds
$Page =~ s/\s+/ /g; # Compress spaces/tabs

open OUT, ">$Name" or die "Can't open $Name: $!\n";
print OUT $Page;
close OUT;
last;
}

}

__END__


-- 
   ,-/-  __  _  _ $Bill Luebkert   ICQ=14439852
  (_/   /  )// //   DBE Collectibles   Mailto:[EMAIL PROTECTED]
   / ) /--<  o // //  http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/_<_http://www.todbe.com/

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: The SMTP server was not found, error from mail::sender

2002-02-10 Thread Jenda Krynicky

From:   "Forrest Payne" <[EMAIL PROTECTED]>
To: "Perl PDK \(E-mail\)" <[EMAIL PROTECTED]>,
"Perl User \(E-mail\)" <[EMAIL PROTECTED]>,
"Perl Win32 Admin \(E-mail\)" <[EMAIL PROTECTED]>

Do not crosspost please!

> When I use mail::sender in a .pl everything works correctly. When I
> compile it I get the error "The SMTP server was not found" when the
> e-mail should be sent. If you use the following lines of code with
> mail::sender then you get an e-mail to send to you.  If you compile it
> using the PDK you will get the error "SMTP server  was not found"
> instead of sending an e-mail.  Can anyone see what I am doing wrong?
> 
> use Mail::Sender;
> $To = "payne\@berbee.com";
> $Msg = "From Test";
> $Subj = "From Test";
> $File = "C:\\TDPEXC.LOG";
> 
> &SendMail;
> 
> sub SendMail
> {
>  ref ($sender = new Mail::Sender()) or print "$Mail::Sender::Error\n";

The problem is that the Sender.config file that contains the default 
options you entered when installing Mail::Sender is either not 
packaged into the .exe or at least not found by Mail::Sender.

So you have to specify the SMTP server and from address in either 
the "new Mail::Sender" or ->MailFile() call.

I'll try to fix this.

Jenda


=== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==
There is a reason for living. There must be. I've seen it somewhere.
It's just that in the mess on my table ... and in my brain.
I can't find it.
--- me
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: Need help to get text from javascript?

2002-02-10 Thread LSereb

Thank you,

It helped, and information exists in .txt file as
well, what I couldn't get before in this situation.
Whith all other URL it worked good.

Thanks again,

Mark.

--- $Bill Luebkert <[EMAIL PROTECTED]> wrote:
> LSereb wrote:
> 
> > Hi,
> > 
> > Is anybody know some module that behave like JVM
> in
> > IE, and how to use it.
> > 
> > I need to read information from page, URL to which
> is
> > posable to get only from source, and link is
> invoking
> > java applet. When I tried to copy shortcut from
> link I
> > got "javascript:void(0);".
> > 
> > This is URL I got from source file:
> > 
> >
>
http://www.dlis.dla.mil/CAGESearch/cagesearch_code.asp?CAGE=78286
> >
>
http://www.dlis.dla.mil/CAGESearch/cagesearch_code.asp?CAGE=18350
> >
>
http://www.dlis.dla.mil/CAGESearch/cagesearch_code.asp?CAGE=0YW97
> > 
> > They open pages in IE good, but when I put them
> into
> > perl code to save it and read later, all necessary
> > information gone.
> > 
> > This is code I use:
> > 
> > use LWP::Simple;
> > 
> > 
> > #SavePage must get specified page, save it, and
> > prepare it for analyzing
> > #   If specified file exists, clean it out.
> > #   SavePage use LWP::Simple
> > #   It accept 2 arguments: URL and File Name to
> store
> > page.
> > #It converts:
> > #   Lowercase everything
> > #   Double quotes to single
> > #   Get rid of the linefeeds
> > #   Compress spaces/tabs
> > #   
> > 
> > 
> > sub SavePage {
> > 
> > local *PAGE;
> > my ($URL) = shift(@_);
> > my ($Name) = shift(@_);
> > 
> > my $i = 1;
> > my $bGot = 1;
> > 
> > my ($Page) = get ($URL); # Get the page
> > if($Page eq '') {
> > print ("Page is empty
> > ");
> > 
> > until ( $i == 3) { # 3 times try to get page
> > 
> > print ("Page didn't got
> > ");
> > 
> > $i++;
> > sleep (2);
> > $Page = get ($URL); # Get the page
> > 
> > if($Page ne '') {
> > print ("Page DOES got
> > ");
> > $bGot = 0;
> > last;
> > }
> > 
> > }# End of trying to get page
> > 
> > unless ($bGot == 0) {
> > die "The starting URL was not valid.
> > ";
> > }
> > }
> > 
> > $Page =~ tr/A-Z/a-z/;  # Lowercase everything
> > $Page =~ s/"/'/g; # Double quotes to single
> > $Page =~ s/
> > / /g; # Get rid of the linefeeds
> > $Page =~ s/s+/ /g;# Compress spaces/tabs
> > 
> > open (PAGE, ">$Name") or die "Can't open
> page.txt.
> > ";
> > 
> > print PAGE "$Page
> > ";
> > #close (PAGE);
> > 
> > }# *PAGE automatically closes/disappears here
> > 
> > Thanks for any help.
> 
> 
> I see no javascript problem here - works fine using
> my version:
> 
> use strict;
> use LWP::Simple;
> 
> my @URLS = (
>   
>
'http://www.dlis.dla.mil/CAGESearch/cagesearch_code.asp?CAGE=78286',
>   
>
'http://www.dlis.dla.mil/CAGESearch/cagesearch_code.asp?CAGE=18350',
>   
>
'http://www.dlis.dla.mil/CAGESearch/cagesearch_code.asp?CAGE=0YW97',
> );
> 
> for (my $ii = 0; $ii < @URLS; $ii++) {
> 
>   (my $name = $URLS[$ii]) =~ s/^.*=(\w+)$/$1/;
>   SavePage ($URLS[$ii], "cage-$name.html");
> }
> 
> sub SavePage {
>   my $URL = shift;
>   my $Name = shift;
> 
> # SavePage must get specified page, save it, and
> prepare it for analyzing
> # 
> If specified file exists, overwrite it.
> # 
> SavePage use LWP::Simple
> # 
> It accept 2 arguments: URL and File Name to store
> page.
> # 
> It converts:
> # 
>   Lowercase everything
> # 
>   Double quotes to single
> # 
>   Get rid of the linefeeds
> # 
>   Compress spaces/tabs
> 
> for (1 .. 3) {
> 
>   print "$_: Getting $URL\n";
>   my $Page = get $URL or do {
>   print "Error getting $URL: $!\n";
>   sleep 2;
>   next;
>   };
> 
>   $Page =~ tr/A-Z/a-z/;   # Lowercase everything
>   $Page =~ s/"/'/g;   # Double quotes to single
>   $Page =~ s/[\r\n]/ /g;  # Get rid of the linefeeds
>   $Page =~ s/\s+/ /g; # Compress spaces/tabs
> 
>   open OUT, ">$Name" or die "Can't open $Name: $!\n";
>   print OUT $Page;
>   close OUT;
>   last;
> }
> 
> }
> 
> __END__
> 
> 
> -- 
>,-/-  __  _  _ $Bill Luebkert  
> ICQ=14439852
>   (_/   /  )// //   DBE Collectibles  
> Mailto:[EMAIL PROTECTED]
>/ ) /--<  o // //  http://dbecoll.tripod.com/
> (Free site for Perl)
> -/-' /___/_<_ Magic http://www.todbe.com/
> 
> ___
> Perl-Win32-Users mailing list
> [EMAIL PROTECTED]
> To unsubscribe:
http://listserv.ActiveState.com/mailman/mysubs


__
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com

Re: Zero-suppression Regex

2002-02-10 Thread Jim Angstadt

Dear Joe and Dirk,

Thanks for getting me to look at assertions.

Expanding the requirement a little, 
here is what I have so far:

my @nums = qw/ 00123 04 004.01 000 00 0 .0
   0.01 0012.001 000.0001 /;
foreach ( @nums ) {
   s/(\b)0+(?=\d)(\.*.*)/$1$2/g; # fails on 0.01
   print $_, "\n"; 
}

Any ideas?

---
Jim

--- Dirk Bremer <[EMAIL PROTECTED]> wrote:

> s/0+(?=\d)(\d)/$1/g ?



__
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: Zero-suppression Regex

2002-02-10 Thread $Bill Luebkert

Jim Angstadt wrote:

> Dear Joe and Dirk,
> 
> Thanks for getting me to look at assertions.
> 
> Expanding the requirement a little, 
> here is what I have so far:
> 
> my @nums = qw/ 00123 04 004.01 000 00 0 .0
>0.01 0012.001 000.0001 /;
> foreach ( @nums ) {
>s/(\b)0+(?=\d)(\.*.*)/$1$2/g; # fails on 0.01
>print $_, "\n"; 
> }
> 
> Any ideas?


Try this one:

use strict;

my @nums = qw(00123 04 004.01 000 00 0 .0 0.01 0012.001 000.0001);
$_ = join ' ', @nums;   # save orig for bottom part

foreach (@nums) {
print "$_ => "; 
s/(?Mailto:[EMAIL PROTECTED]
   / ) /--<  o // //  http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/_<_http://www.todbe.com/

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: Zero-suppression Regex

2002-02-10 Thread Jim Angstadt

Very nice.  Thanks.

---
Jim

--- $Bill Luebkert <[EMAIL PROTECTED]> wrote:


> use strict;
> 
> my @nums = qw(00123 04 004.01 000 00 0 .0 0.01
> 0012.001 000.0001);
> $_ = join ' ', @nums; # save orig for bottom part
> 
> foreach (@nums) {
>   print "$_ => "; 
>   s/(?   print "$_\n"; 
> }
> # doing them all at once also works:
> print "$_\n"; 
> s/(? print "$_\n"; 


__
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs