Re: Resetting of the dataset

2004-12-16 Thread Nicolay A. Vasiliev
Hi!
Yes, you are near of the truth :). But if I use some complicated joining 
query to few large tables I think this is not too comfortable for the 
server.

Brian Barto wrote:
I just realized I was way off base from your original question. :) You want
to start over again from the beginning with fetchrow_array(). I think it's
just a matter of running the execute statement again to reset it...
-Original Message-
From: Nicolay Vasiliev [mailto:[EMAIL PROTECTED]
Sent: Thursday, December 16, 2004 10:14 AM
To: [EMAIL PROTECTED]
Subject: Resetting of the dataset
Hello there!
I have some dataset got by the executing of some query. For example:
my $sth = $dbh->prepare('select * from sometable');
$sth->execute();
Going through this dataset by $sth->fetchrow_array() I need to go back 
inside this proccess. Sorry, but I have no idea how can I do this. How 
can I reset this dataset to move to the first record?

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


Database handler passing

2005-01-14 Thread Nicolay A. Vasiliev
Hello there!
Is this correct to pass DB handle ($dbh) as subroutine parameter? I 
don't want to make DB connection everytime when I need to get some data 
from DB. But if I connected once I'd like to pass one db handler.

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



Re: Database handler passing

2005-01-15 Thread Nicolay A. Vasiliev
Thank you, Chris!
Chris Devers wrote:
Of course you can, and should, do things this way. 

...
Etc., where the subroutines are defined later, and the database and 
statement handles get declared once and then passed around as needed.



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



Re: Mail::POP3Client Doesn't Work on Win32 perl

2004-06-30 Thread Nicolay A. Vasiliev
Hello, John!
That's very strange, I use this and this works fine (and at Uniz 
web-server too). How did you install this module and how do you use this?

I have 
This is perl, v5.6.1 built for MSWin32-x86-multi-thread
(with 1 registered patch, see perl -V for more detail)

I also have the Mail::POP3Client but it doen;t connect to anywhere.
Could you help me with that?
john
 


--
-
Nicolay A. Vasiliev
http://www.spamliquidator.com - Real spam fighter
http://www.soft411.com - Excellent soft archive
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>



Re: Mail::POP3Client Doesn't Work on Win32 perl

2004-07-01 Thread Nicolay A. Vasiliev
Sorry, let me do this later because I haven't this script at my 
workplace, only at my home PC.

Could you give me the script which you use to check POP3?
- Original Message - 
From: "Nicolay A. Vasiliev" <[EMAIL PROTECTED]>
To: "John" <[EMAIL PROTECTED]>
Sent: Thursday, July 01, 2004 9:49 AM
Subject: Re: Mail::POP3Client Doesn't Work on Win32 perl

 

I did the same but all works fine under Win98 and ActivePerl 5.8.4.
   

I installed the module via ppm : install Mail::POP3Client
 

http://www.soft411.com - Excellent soft archive
http://www.spamliquidator.com - Kill spam
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>



URL links parsing

2004-07-05 Thread Nicolay A. Vasiliev
Hello there!
I am newbie in Perl and like it more and more especially reading such 
diamonds as Lama-book, Camel-book and Cookbook.
Nevertheless I get questions and I need to be explained.

I know I can get the URL's list by standart Perl module (I have read 
about this in Cookbook). But there are only web-links. How could I get 
the pairs link => link name list by the the same way or something like that?

Thanks in advance.
Nicolay Vasiliev
--
http://www.soft411.com - Excellent soft archive
http://www.spamliquidator.com - Kill spam
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



Re: URL links parsing

2004-07-05 Thread Nicolay A. Vasiliev
Hello!
I didn't try something yet, I'd like to know the approximate way where 
should I find the correct solution.


Nicolay A. Vasiliev wrote:
I know I can get the URL's list by standart Perl module (I have
read about this in Cookbook). But there are only web-links. How
could I get the pairs link => link name list by the the same way or
something like that?

What have you tried? Show us some code.
(I suppose you have read "perldoc -q URLs".)
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>



Shareit information via Perl

2004-07-12 Thread Nicolay A. Vasiliev
Hello, there!
I am trying to connect into ShareIt system. I need to refresh my sales 
information automatically. I know LWP is power to help me, but I try and 
get nothing positive yet.

What I am doing:
#!/usr/bin/perl
use LWP::UserAgent;
use LWP::Simple;
use HTTP::Request::Common qw(POST);
use strict;
use warnings;
print "Content-type: text/html; charset=windows-1251\n\n";
$|++;
my $cont = get("https://secure.shareit.com/shareit/cp/login/index.html";);
my ($uri, $sessid, $random);
if ($cont =~ /.*=(\d+)&.*=(\w+)"/g) {
	$uri = 
"https://secure.shareit.com/shareit/cp/login/index.html?sessionid=$1&random=$2";;
	($sessid, $random) = ($1, $2);
}

my $ua = LWP::UserAgent->new();
$ua->agent("Superzilla/v4.11 Platinum");
my $req = POST $uri,
[PUBLISHER_ID => "mylogin",
PASSWORD => "password"];
$cont = $ua->request($req)->as_string;
print $cont;
exit();
When I make POST and print then the variable $cont I get the login page 
again. Where is a mistake?

Thank you in advance.
Nicolay A. Vasiliev
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>



Re: Extracting headers of a Table in Perl.

2004-07-14 Thread Nicolay A. Vasiliev
Hello, Jason Corbett!
You need to learn about $sth->{'NAME'}. Use perldoc dbd::mysql.
I want to query a database and get data, but the headers don't come back. Is there a 
way that I can extract the headers of a table using Perl? Would it be easier to create 
a format, or should this be done in my SQL script? I don't have 'write' authority to 
the script. I just call it or read it and then run the script from where its at on the 
server.
Thanks,
JC
 


--
-
Nicolay A. Vasiliev
http://www.spamliquidator.com - Real spam fighter
http://www.soft411.com - Excellent soft archive

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



Get .exe or .zip file from the server via perl script

2004-07-25 Thread Nicolay A. Vasiliev
Hello, there!
I need to implement the thing in the subject described.
Conceptually there are two steps:
1) logging into the system at some web-server;
2) getting some binary (zip or exe) and putthing this at my web-server.
I imagine approximately how can I implement the first step. But I don't 
know anything how to download the file via perl script. Is this possible 
at all?

Any help is very appreciated.
Thank you all in advance,
Nicolay.
--
-
Nicolay A. Vasiliev
http://www.spamliquidator.com - Real spam fighter
http://www.soft411.com - Excellent soft archive
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>



Re: Get .exe or .zip file from the server via perl script

2004-08-04 Thread Nicolay A. Vasiliev
Hello, Gunnar!
Thanmk you and sorry for delay!
Gunnar Hjalmarsson wrote:
Nicolay A. Vasiliev wrote:
I don't know anything how to download the file via perl script.

This code, which I copied from a program of mine, may get you started:
open FILE, "< $dir/$file" or die "Can't open ... $!";
binmode FILE;
binmode STDOUT;
print "Content-Type: application/zip\n",
  "Content-Disposition: attachment; filename=$file\n",
  'Content-Length: ' . (stat "$dir/$file")[7] . "\n\n";
while () { print }
close FILE;
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>



Re: Becoming Disenheartened - Everyone talks about Python and says Perl is old news.

2004-10-01 Thread Nicolay A. Vasiliev
Hello!
This is very interesting thread. So, let me add some words to this. 
(Sorry in advance my English).

Best of all, let me express my respect to Mr. Schwartz. I read your 
Lama-book and I think that's very useful for every Perl newbie. I got 
such chain: Lama-book, Camel-book and Cook-book :).

I love Perl and work with it more often than Python, but...
Randal L. Schwartz wrote:
"Gavin" == Gavin Henry <[EMAIL PROTECTED]> writes:
   

Gavin> I really like Perl, but lately everywhere I seem to go and talk
Gavin> to say I shouldn't be learning Perl as it's old and Python is
Gavin> better.
Perl is more powerful.  Python is simpler.  Python is for people
who don't want to master a language -- just use it casually.
 

This is no serious statement. Python is simple and power too. Read 
please Bruce Eckel why he left Perl and came to Python.
At least, it's really object-oriented as against Perl and it has more 
funny syntax :).

However, if you're gonna spend two or more hours a day hacking code,
Perl is definitely the right place to be.  Still.
Those Python weenies are all just casual programmers complaining
that for Perl, "with great power comes great responsibility".  Let'em.
Perl's support only grows.  I used to be able to follow the CPAN "new
modules list" by examining the daily run at search.cpan.org/recent.
But no more.  Look at all the new modules just in the past *seven*
days.  (It's typically a full web page for each day!) If that doesn't
show you an intense activity in the Perl community, I really don't
know what else I could show you.
 

Python community is large too (of course not yet as perl community 
because it's more young), and it grows too. Let me know please why this 
is a good - such enormous modules number for one task? In this case I'd 
like to think noone from them is clever and bugs free. That's enough one 
or two clever modules like in Python, that even could be included into 
standart distribution.

Ask your Python friends where such a similar list exists. :)
Python may be newer, but Perl is more mature, and here to stay.
Remember "new coke", and how long we had that. (If you're old enough
to remember that fiasco.)
 

--
Best regards,
Nicolay
http://www.soft411.com - Excellent soft archive
http://www.spamliquidator.com - Kill spam
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



Re: Becoming Disenheartened - Everyone talks about Python and says Perl is old news.

2004-10-01 Thread Nicolay A. Vasiliev
I mean real OO, but no perls "dirty hack".
Perl has OO support. In my opinion those funny syntax get u the job
done quicker when your boss comes down to you with deadly deadlines.
~;-) I assume those syntax u are talking about is regular expression.
 

--
Best regards,
Nicolay
http://www.soft411.com - Excellent soft archive
http://www.spamliquidator.com - Kill spam
   

 


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



Re: Becoming Disenheartened - Everyone talks about Python and says Perl is old news.

2004-10-01 Thread Nicolay A. Vasiliev
Agreed!
Gabor Urban wrote:
Hi guys,
this thread seems to expand into something unworthy of this mailing
list. You can not compare a cup of tea with a horse, these are two
totally different things.
Both Perl and Python have it's place under the sun, both have very good
features, and some very difficult aspects, too. Both can be perfect for
the right tasks, but may be terrible choices for others. THe real point
if you write your code correct, know what you are doing and make
possible for others to understand your source. The difference is between
good and poor developer. IMHO I could write this about any other
language, for example Cobol, too :-
I am doing Python programming for living now, but create reports on my
log useng Perl. Perfect, smooth and efficient.
Gabaux
 

http://www.soft411.com - Excellent soft archive
http://www.spamliquidator.com - Kill spam
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



Re: Becoming Disenheartened - Everyone talks about Python and saysPerl is old news.

2004-10-01 Thread Nicolay A. Vasiliev
Absolutely :)
Gavin Henry wrote:
Could you guys keep this thread constructive or STOP it ... Please ?
   

It's been very constructive for me :-)
I have just read this famous peice:
http://www.linuxjournal.com/article.php?sid=3882&mode=&order=&thold=
I am going to learn both and make up my own mind. I think that's the best
for any hacker.
Gavin.
 

Best regards,
Nicolay
http://www.soft411.com - Excellent soft archive
http://www.spamliquidator.com - Kill spam
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



Re: Becoming Disenheartened - Everyone talks about Python and says Perl is old news.

2004-10-01 Thread Nicolay A. Vasiliev
Dear mr. Schwartz!
Let me be unagreed. Functionally complete OO language at least means the 
next thing: when I create some object (ie, declare some variable, maybe 
string), this already have necessary methods like Python or Ruby. Even 
C++ haven't such functionality. Of course Perl haven't this too.

I love Perl, it's great for concrete tasks class. But Python is good and 
clever too, don't you blacken this please even in a comedy form ;)

Randal L. Schwartz wrote:
"Nicolay" == Nicolay A Vasiliev <[EMAIL PROTECTED]> writes:
   

Nicolay> I mean real OO, but no perls "dirty hack".
There is nothing "dirty" or "hack" about Perl's OO.  It is as
functionally complete as nearly any other programming language.
 

--
Best regards,
Nicolay
http://www.soft411.com - Excellent soft archive
http://www.spamliquidator.com - Kill spam
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>



Re: Becoming Disenheartened - Everyone talks about Python and says Perl is old news.

2004-10-01 Thread Nicolay A. Vasiliev
To Randal and Chris. You all don't understand me. CGI is a module, 
earlier wrote and stored in a separate files. I don't mean such objects.

Python and Ruby don't write the code for me. But look at this Python code:
s = "I am Perl guru";
new_s = s.replace("Perl", "Python");
Huh? Remark, no addition modules.
The similar way is in Ruby and other nice.
By the way, these languages have people friendly exceptions handling ;) with 
try-except in Python and begin-rescue in Ruby.
http://www.soft411.com - Excellent soft archive
http://www.spamliquidator.com - Kill spam
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



Re: substitution and assignment fun ( was RE: Becoming Disenheartened )

2004-10-01 Thread Nicolay A. Vasiliev
No doubt please, I know about regular expressions and Python/Ruby 
support them fully. I only showed the approach of method calling. There 
could be not "replace" method.

William M West wrote:

Python and Ruby don't write the code for me. But look at this Python
code:
s = "I am Perl guru";
new_s = s.replace("Perl", "Python");

i always had trouble doing this in perl- just worked around it- then
realized that this shouldn't be hard when reading your post... so i
played...
$s = "I am Perl guru";
$new_s = ($s =~ s/erl/ython/);
print "$s \t $new_s \n";  #oops!  Prints  I am a Python guru
1"
#but
($new_s = $s) =~ s/erl/ython/;
print "$s \t $new_s \n";  

#prints   I am a Perl guru  I am a Python guru
Perl can be surprisingly intuitive-  using precedence rules to get this
done makes good sense to me :)


Huh? Remark, no addition modules.

*shrug*  eh- go figure

willy
http://www.hackswell.com/corenth
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



Re: Becoming Disenheartened - Everyone talks about Python and says Perl is old news.

2004-10-01 Thread Nicolay A. Vasiliev
Chris Devers wrote:
>>CGI is a module, earlier
>>wrote and stored in a separate files. I don't mean such objects.
>>
>>
>
>And Python objects live where -- the sky? The stars?
>  
>
To create $cgi = new CGI you should make declaration "use CGI", 
shouldn't you? I meant only this

>  
>
>>Python and Ruby don't write the code for me. But look at this Python 
code:
>>
>>s = "I am Perl guru";
>>new_s = s.replace("Perl", "Python");
>>
>>
>
>No, you're using Python's built in string operators. Perl has them too:
>  
>

Python doc quotation:
"2.3.6.1 String Methods
...
replace( old, new[, count])
Return a copy of the string with all occurrences of substring old 
replaced by new. If the optional argument count is given, only the first 
count occurrences are replaced.
"

> $s = "I am a Perl guru";
> ( $new_s = $s ) =~ s/perl/python/;
>
>Remark, no additional modules.
>  
>
Agreed, but this is RE approach. This is supported by Python/Perl, but I 
meant another thing (hope you understand me).

>
>
>You haven't come across eval{...} yet, have ya?  
>
>The differences among Perl, Python, and Ruby are mostly semantic -- each
>of them can accomplish all the same tasks, but they wrap up the way to
>implement these tasks in ever-so-slightly different syntax. But so what?
>  
>
Agreed. I am against the blacking of these languages expressed by Mr. 
Randal.

--
-
Nicolay A. Vasiliev
http://www.spamliquidator.com - Real spam fighter
http://www.soft411.com - Excellent soft archive
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>



Re: Becoming Disenheartened - Everyone talks about Python and says Perl is old news.

2004-10-01 Thread Nicolay A. Vasiliev
I didn't mean CGI, only standart types.
JupiterHost.Net wrote:
 >>CGI is a module, earlier
 >>wrote and stored in a separate files. I don't mean such objects.
 >>>>
 >
 >And Python objects live where -- the sky? The stars?
 >  >
To create $cgi = new CGI you should make declaration "use CGI", 
shouldn't you? I meant only this

Err, you keep arguing about pointless things:
 #!/usr/local/bin/python
 import cgi
 cgi.test()
 ...
Does "cgi.test()" still work without the "import cgi" ?
--
-
Nicolay A. Vasiliev
http://www.spamliquidator.com - Real spam fighter
http://www.soft411.com - Excellent soft archive
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>



Re: RE : Becoming Disenheartened - Everyone talks about Python and says Perl is old news.

2004-10-02 Thread Nicolay A. Vasiliev
Dear friend!
I MEANT STANDART TYPES. ARE YOU ABLE TO SEE THE DIFFERENCE? If you 
assign the value for string variable it automaticaly gets the number of 
methods belonging to String object. And as an example I wrote the 
s.replace statement.. The similar approach has Ruby. Of course, if you 
need more complicated functionality you make "import" or another 
including of some module.

I wrote about this only to show what can the real OO language (Python of 
course could be figured as procedural language too).

Jose Nyimi wrote:
>  
>
>>-Message d'origine-
>>De : Nicolay A. Vasiliev [mailto:[EMAIL PROTECTED]
>>Envoyé : vendredi 1 octobre 2004 22:39
>>À : Perl Beginners List
>>Objet : Re: Becoming Disenheartened - Everyone talks about Python and
>>
>>
>says
>  
>
>>Perl is old news.
>>
>>I didn't mean CGI, only standart types.
>>
>>
>>
>
>s.replace(...) is a consequence of "everything is object" thinking.
>
>Look at the following:
>
>import re;
>m = re.match(r"(?P\d+)\.(\d*)", '3.14');
>//After performing this match
>//m.group(1) is '3', as is m.group('int')
>//and m.group(2) is '14'.
>
>There is a similar ugly thing in Java.
>All of this because you want everything to be an object.
>
>Can you tell us how will you perform the above
>matching without import re; :).
>
>In Perl you don't absolutely need a kind of use RE; to be able
>performing regular expression macthing.
>
>So, don't force my $s = "I am Perl Guru"; to be an object and contain a
>replace() method.
>
>$s is a string will be treated as is in Perl.
>
>José.
>
>
>
>  
>

--
-
Nicolay A. Vasiliev
http://www.spamliquidator.com - Real spam fighter
http://www.soft411.com - Excellent soft archive
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>



Copy image from one web server to another

2004-10-08 Thread Nicolay A. Vasiliev
Hello there!
I need to be adviced how to implement the subject. I have URL of an 
image and I need to copy this to another web-server. I tried to make it 
with ImageMagick, but I got an error opening the file by URL.

Which way could more correct to produce such operation?
--
Nicolay Vasiliev
http://www.soft411.com - Excellent soft archive
http://www.spamliquidator.com - Kill spam
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



Re: Copy image from one web server to another

2004-10-08 Thread Nicolay A. Vasiliev
Hallo, Chris!
Oh, in this library "getstore" is more matching I suppose.
Thank you!
Chris Devers wrote:
On Fri, 8 Oct 2004, Nicolay A. Vasiliev wrote:
I need to be adviced how to implement the subject. I have URL of an 
image and I need to copy this to another web-server. I tried to make 
it with ImageMagick, but I got an error opening the file by URL.

Which way could more correct to produce such operation?

The standard library for writing web clients -- which, in this 
context, your web server is acting as -- is LWP. The LWP::Simple 
module may be the easiest way to do this:

   use LWP::Simple;
   $image = get("http://www.sample.url/images/sample.jpg";);
   die "Couldn't get it!" unless defined $image;
At that point, just write the contents of $image to a file.
See the LWP::Simple perldoc for more info, or the LWP docs:
 <http://search.cpan.org/dist/libwww-perl/lib/LWP/Simple.pm>
Or see the e-book _Web Client Programming with Perl_ by Clinton Wong:
 <http://www.oreilly.com/openbook/webclient/>
It's a bit old, but still covers the basics.

http://www.soft411.com - Excellent soft archive
http://www.spamliquidator.com - Kill spam
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>