Hi Gurus,
I need to write a perl script for a web spider that will crawl the web
looking for specific file(s) that I specify (such as .mp3) and store the
URL's into a mysql database. This needs to work on a linux server. I will
also require a skip list that will skip certain sites that I input in
If you don't need to login the site to catch files,I think you just
need LWP family.see perldoc lwpcook.
If the site require login for some authentication,you may need WWW::Mechanize.
I doubt there are also some modules on CPAN for this purpose.
2007/8/27, perl pra <[EMAIL PROTECTED]>:
> Hi Guru
sorry, I forgot to send my mail to the list:
Jeff Pang schrieb:
> > then use regex or other ways (I prefer substr) to get the prefix.
> > my $prefix = substr($string,1,3);
I think the problem is that some countrycodes are only 2 digits some are 3
( or more ? )
So you dont know how long your pre
Hi,
I think that WWW::Mechanize will be perfect for you.
It supports performing a sequence of page fetches including following links and
submitting forms. Each fetched page is parsed and its links and forms are
extracted.
see http://search.cpan.org/~petdance/WWW-Mechanize-1.30/lib/WWW/Mechaniz
hi All,
Thanks for all your replies...
Actually i tried the small program like below:
#!/usr/bin/perl
use CGI;
my $query =new CGI;
print $query->redirect('http://google.com');
When i run this code i am getting a blank page with the following
printed in
Hi all,
I have a hash and some prose text and want my perl to identify the keys of
the hash in this text and replace them with the corresponding values of
the keys.
I tried the following
foreach (keys %expan) {
if ($sbl =~ m/$_/g) {
$sbl =~ s/$_/$expan{$_}/g;
}
}
but it doesn't seem to
you may need the \Q for meta-character escape.
for (keys %expan) {
$sbl =~ s/\Q$_/$expan{$_}/g;
}
see also 'perldoc perlre' and search for '\Q'.
2007/8/27, Petra Vide Ogrin <[EMAIL PROTECTED]>:
> Hi all,
>
> I have a hash and some prose text and want my perl to identify the keys of
> the has
The sample code below on executing gives result as:-
Macau
Hong Kong
But there are 0 keys in the hash. I expected the result to be
Hong Kong
Macau
Why is the hash getting empty here?
#!/usr/bin/perl
my %countries = ('+852' => 'Hong Kong', '+853' => 'Macau' );
my @string = {'+8521235567','+853
Sorry, tried all that with escaping - doesn't work either
???
> you may need the \Q for meta-character escape.
>
> for (keys %expan) {
> $sbl =~ s/\Q$_/$expan{$_}/g;
> }
>
> see also 'perldoc perlre' and search for '\Q'.
>
> 2007/8/27, Petra Vide Ogrin <[EMAIL PROTECTED]>:
>> Hi all,
>>
>> I
2007/8/27, Mihir Kamdar <[EMAIL PROTECTED]>:
> The sample code below on executing gives result as:-
> Macau
> Hong Kong
>
> But there are 0 keys in the hash. I expected the result to be
> Hong Kong
> Macau
>
> Why is the hash getting empty here?
>
>
> #!/usr/bin/perl
>
> my %countries = ('+852' =>
I'm not sure what's your special situation.
But see this simple test,it can work.
$ perl -e '$hash{x}="33";
$s="xyzx";
for(keys %hash){
$s=~s/\Q$_/$hash{$_}/g
}
print $s '
33yz33
2007/8/27, Petra Vide Ogrin <[EMAIL PROTECTED]>:
> Sorry, tried all that with escaping - doesn't work eit
On Aug 27, 2007, at 10:59 AM, Petra Vide Ogrin wrote:
Hi all,
I have a hash and some prose text and want my perl to identify the
keys of
the hash in this text and replace them with the corresponding
values of
the keys.
I tried the following
foreach (keys %expan) {
if ($sbl =~ m/$_/g) {
On 8/27/07, Jeff Pang <[EMAIL PROTECTED]> wrote:
>
> 2007/8/27, Mihir Kamdar <[EMAIL PROTECTED]>:
> > The sample code below on executing gives result as:-
> > Macau
> > Hong Kong
> >
> > But there are 0 keys in the hash. I expected the result to be
> > Hong Kong
> > Macau
> >
> > Why is the hash ge
Hi,
do you understand my pseudo code, i think it should work for your hash?
Regards
Martin
> thanks,
>
> But i have a list of 65 countries, and I only want to implement for
> them. Also, as you said, definitely for some, prefix length is only 1
> digit, while for others, it is 2 or 3 digits. So,
On 8/27/07, Petra Vide Ogrin <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I have a hash and some prose text and want my perl to identify the keys of
> the hash in this text and replace them with the corresponding values of
> the keys.
>
> I tried the following
>
> foreach (keys %expan) {
> if ($sbl =
On Aug 24, 2:57 pm, [EMAIL PROTECTED] (Marian Bednar) wrote:
> Hi all,
>
> I am a newbie in this forum and Perl too ;-)
>
> I am trying writing script transfering files using module
> Net::SFTP::Foreign.
>
> I need to retrieve from remote directory only names of files (not
> directories, links,etc.
On 8/27/07, Martin Barth <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> do you understand my pseudo code, i think it should work for your hash?
>
> Regards
> Martin
Hi Martin,
Yes, I guess I understood yr code...if I am correct, i just need to know the
longest country code digits and store them in $pref
On 8/27/07, Mihir Kamdar <[EMAIL PROTECTED]> wrote:
snip
> But i have a list of 65 countries, and I only want to implement for them.
> Also, as you said, definitely for some, prefix length is only 1 digit, while
> for others, it is 2 or 3 digits. So, I was thinking to build a hash and then
> implem
i never worked with CSV so far but
http://search.cpan.org/~danboo/Tie-Handle-CSV-0.09/lib/Tie/Handle/CSV.pm
sounds quite good. (hope it can handle if you're writing something to the
hash too. I didn't read the code... if not there are a lot of CSV modules
at cpan. )
Country_Name Country_
On 8/27/07, salva <[EMAIL PROTECTED]> wrote:
> On Aug 24, 2:57 pm, [EMAIL PROTECTED] (Marian Bednar) wrote:
> > Hi all,
> >
> > I am a newbie in this forum and Perl too ;-)
> >
> > I am trying writing script transfering files using module
> > Net::SFTP::Foreign.
> >
> > I need to retrieve from remo
On 08/26/2007 07:47 PM, Gunnar Hjalmarsson wrote:
[...]
Btw, is this technique properly documented anywhere, or would it be a
suitable addition to perlfaq9?
It's not asked that frequently.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
htt
On 08/27/2007 03:50 AM, Praveena Vittal wrote:
hi All,
Thanks for all your replies...
Actually i tried the small program like below:
#!/usr/bin/perl
use CGI;
my $query =new CGI;
What other stuffs? If those other stuffs output body text, it'll be too
l
On 08/27/2007 03:59 AM, Petra Vide Ogrin wrote:
Hi all,
I have a hash and some prose text and want my perl to identify the keys of
the hash in this text and replace them with the corresponding values of
the keys.
I tried the following
foreach (keys %expan) {
if ($sbl =~ m/$_/g) {
$sbl =~
On 8/27/07, Mumia W. <[EMAIL PROTECTED]> wrote:
> On 08/27/2007 03:59 AM, Petra Vide Ogrin wrote:
> > Hi all,
> >
> > I have a hash and some prose text and want my perl to identify the keys of
> > the hash in this text and replace them with the corresponding values of
> > the keys.
> >
> > I tried
On 8/27/07, Chas Owens <[EMAIL PROTECTED]> wrote:
snip
> Rate join hard joinqropt qr
> join 42708/s ---0%-1% -11% -56%
> hard 42708/s 0% ---1% -11% -56%
> joinqr 43115/s 1% 1% -- -11% -56%
> opt48188/s13%13%12
On Aug 27, 2007, at 1:29 PM, Chas Owens wrote:
Bad idea*, at least until Perl 5.10 (and maybe not even then).
Well, it may or may not be a bad idea.
On the one hand that performance penalty may be negligible for the OP
problem and thus it just does not matter. On the other hand your
solut
On Friday 24 August 2007 21:00:37 John W. Krahn wrote:
> Stephen Kratzer wrote:
> > On Friday 24 August 2007 08:57:26 Marian Bednar wrote:
> >> I am a newbie in this forum and Perl too ;-)
> >>
> >> I am trying writing script transfering files using module
> >> Net::SFTP::Foreign.
> >>
> >> I need
I can't recommend reinventing the wheel, I would use the module to
> lookup the country name and the use hash where the country name is the
> key and the rate is the value to get the value, but if you are dead
> set on not using the module your best bet is something like this:
>
> #!/usr/bin/perl
>
Hi Chas,
I have written the program as follows:
use strict;
use Net::SFTP;
use Net::SFTP::Constants ':status';
my $user;
my($host) = "sacsun120";
# set up the arguments based on the command line options
my %args = (ssh_args => []);
$args{debug} = 1;
foreach (keys(%args)) {
print "$_ -> $arg
On 8/27/07, Mihir Kamdar <[EMAIL PROTECTED]> wrote:
>
>
>
> I can't recommend reinventing the wheel, I would use the module to
> > lookup the country name and the use hash where the country name is the
> > key and the rate is the value to get the value, but if you are dead
> > set on not using the
Let's forget for a moment that CGI::Ajax exists. Instead, imagine that all I
want to do is call a Perl script from my AJAX application. Having created all
the necessary communication lines I then pass the script URL with the GET method
to the "line" in order to execute said Perl script.
All the
On Aug 27, 2:36 am, [EMAIL PROTECTED] (Andreas Moroder)
wrote:
> I have to store more then one value in a hash array. I tried to store a
> array as value in the hash. But when I try to retriev it I don't get the
> array I have stroed.
>
> Can anyone please help me.
To read more about how to crea
Hi All,
Can anybody suggest me how can I implement my own Data::Dumper(a function
which work similar to perl Dumper).
Thanks and Regards
Nitesh
On Aug 27, 8:43 am, [EMAIL PROTECTED] (Mathew Snyder) wrote:
> Let's forget for a moment that CGI::Ajax exists. Instead, imagine that all I
> want to do is call a Perl script from my AJAX application. Having created all
> the necessary communication lines I then pass the script URL with the GET
>
nitesh kumar schrieb:
> Hi All,
> Can anybody suggest me how can I implement my own Data::Dumper(a function
> which work similar to perl Dumper).
>
> Thanks and Regards
> Nitesh
>
I think "ref" is your friend.
perldoc -f ref
HTH, Martin
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additio
On 8/27/07, Mihir Kamdar <[EMAIL PROTECTED]> wrote:
snip
> > > my %prefix_to_rate = (
> > > 12 => 0.30,
> > > 1234 => 0.35,
> > > 134 => 0.50,
> > > 44 => 0.70
> > > );
snip
> my %prefix_to_rate = (
>'+12' =>0.30,
>'+1234' =>0.35,
>'+13
On 8/27/07, Chas Owens <[EMAIL PROTECTED]> wrote:
>
> On 8/27/07, Mihir Kamdar <[EMAIL PROTECTED]> wrote:
> snip
> > > > my %prefix_to_rate = (
> > > > 12 => 0.30,
> > > > 1234 => 0.35,
> > > > 134 => 0.50,
> > > > 44 => 0.70
> > > > );
> snip
> > my %prefix_to_
On Sun, 26 Aug 2007 13:04:48 -0400, Mr. Shawn H. Corey wrote:
> I have worked in programming for 25 years and during that time I have
> never use a closure and have never seen one used.
Boggle. I don't think any program I write these days doesn't have one.
They're the most convenient way of re
On 8/27/07, kilaru rajeev <[EMAIL PROTECTED]> wrote:
snip
$sftp->get("/trading/tisissuer08260004.txt",".");
snip
> Couldn't stat remote file: No such file or directory at sample.pl line 32
> ERROR with get: No such file or directory
snip
> I am not getting what it meant. Could you please helpme?
sn
Paul Lalli wrote:
> On Aug 27, 8:43 am, [EMAIL PROTECTED] (Mathew Snyder) wrote:
>> Let's forget for a moment that CGI::Ajax exists. Instead, imagine that all I
>> want to do is call a Perl script from my AJAX application. Having created
>> all
>> the necessary communication lines I then pass th
On 8/27/07, Mihir Kamdar <[EMAIL PROTECTED]> wrote:
snip
> Even if my $cdr[3] field in few of the records matches with the keys in the
> hash, it is still not going to the if part at all.
> It just takes one of the not matching records and printing the else part in
> the $OUT_FILE.
>
> OUT_FILE con
>
> Not a one. Can you provide some test data?
>
Sure Chas...
Following is some sample records:-
2006/09/01 00:19:30,999,+60132868382,+126312437,,1,253,2006/09/01
00:15:17,350370010515510,515111061171520,00043,3,1,0.0
,7,1,1,1,,0,8,+60132868382,Normal,,TELMT,Alcatel,,,
2006/09/01 00:21:13,999,+6
On 8/27/07, nitesh kumar <[EMAIL PROTECTED]> wrote:
> Hi All,
> Can anybody suggest me how can I implement my own Data::Dumper(a function
> which work similar to perl Dumper).
>
> Thanks and Regards
> Nitesh
>
Before you implement your own version of Data::Dumper make sure you
really need to. The
Mumia W. wrote, On 08/27/2007 03:58 PM:
On 08/27/2007 03:50 AM, Praveena Vittal wrote:
hi All,
Thanks for all your replies...
Actually i tried the small program like below:
#!/usr/bin/perl
use CGI;
my $query =new CGI;
What other stuffs? If those ot
Paul Lalli wrote:
> On Aug 27, 8:43 am, [EMAIL PROTECTED] (Mathew Snyder) wrote:
>> Let's forget for a moment that CGI::Ajax exists. Instead, imagine that all I
>> want to do is call a Perl script from my AJAX application. Having created
>> all
>> the necessary communication lines I then pass th
Praveena Vittal wrote:
#!/usr/bin/perl
use CGI;
my $query =new CGI;
print $query->redirect('http://google.com');
When i run this code
How do you run it? Is the script URL in the action attribute when
POSTing an HTML form? In that case, and if you want
On 8/27/07, Mihir Kamdar <[EMAIL PROTECTED]> wrote:
> > Not a one. Can you provide some test data?
> >
> Sure Chas...
>
> Following is some sample records:-
snip
Seems to be working for me (with substr $cdr[3], 0, $len;). I get the output
the rate for +126312437 is 0.3: 3.795
the rate for +123
On 8/27/07, Chas Owens <[EMAIL PROTECTED]> wrote:
> On 8/27/07, Chas Owens <[EMAIL PROTECTED]> wrote:
> snip
> > Rate join hard joinqropt qr
> > join 42708/s ---0%-1% -11% -56%
> > hard 42708/s 0% ---1% -11% -56%
> > joinqr 43115/s 1%
Hi Chas,
Look at the following code. It does not change the $cdr[13] value after
processing as is desired.
#!/usr/bin/perl
use strict;
use warnings;
my $file_path =
'/home/user71/RangerDatasource/Customization/TelekomMalaysia/Scripts/Tests/cprogs/files/ratetest';
my $write_path =
'/home/user71/
On 8/27/07, Mihir Kamdar <[EMAIL PROTECTED]> wrote:
snip
> for my $len (reverse $shortest .. $longest) {
> my $key = substr $cdr[3],0,$len;
> last if $rate = $prefix_to_rate{$key};
>
> -Original Message-
> From: lists user [mailto:[EMAIL PROTECTED]
> Sent: Sunday, August 26, 2007 20:01
> To: beginners perl
> Subject: a division warning
>
> I run a perl command below,
>
> perl -Mstrict -Mwarnings -e 'eval {my $x=3;my
> $y=$x-3;$x/$y};print "hello"'
> Useless use of d
> -Original Message-
> From: news [mailto:[EMAIL PROTECTED] On Behalf Of Andreas Moroder
> Sent: Sunday, August 26, 2007 23:37
> To: beginners@perl.org
> Subject: store more values in a hash array
>
> Hello,
>
> I have to store more then one value in a hash array. I tried
> to store a
>
On 8/27/07, Chas Owens <[EMAIL PROTECTED]> wrote:
>
> On 8/27/07, Mihir Kamdar <[EMAIL PROTECTED]> wrote:
> snip
> > for my $len (reverse $shortest ..
> $longest) {
> > my $key = substr $cdr[3],0,$len;
> >
On 8/27/07, Mihir Kamdar <[EMAIL PROTECTED]> wrote:
>
>
> On 8/27/07, Chas Owens <[EMAIL PROTECTED]> wrote:
> > On 8/27/07, Mihir Kamdar <[EMAIL PROTECTED]> wrote:
> > snip
> > > for my $len (reverse
> $shortest .. $longest) {
> > > my
Hello,
I'm trying to process some UTF-8 encoded files (wikipedia's extracts)
through Text::MediawikiFormat.
Works rather fine as far as the HTML convertion goes, except that the
character set encoding gets lost along the way, e.g. what used to be
properly UTF-8 encoded Russian (вычислител
Hi Chas,
It works...but the problem I have is that some of the records are totally
lost. And also the output file keeps on writing multiple times and grows
into a huge size. almost 10 times, it keeps on growing until I kill the
script.
I checked few of the records which have calculated properly a
Good sense of humour! Actually i wanted to search for F:/Hindi/RHTDM
and i entered only /Hindi/RHTDM/
it didnt find anything. When i tried to print the list in which i
pushed the $File::Find::name it said
use of uninitialised ...
Actually i am unable to understand clearly from the docs for File::
Hi,
if you open your outputfile like
open(FH, ">>", $file)
you will append all the stuff to the file. Probably you want to
replace your file if you run your script again.
open(FH, ">", $file)
HTH, Martin
On Mon, 27 Aug 2007 22:53:16 +0530
"Mihir Kamdar" <[EMAIL PROTECTED]> wrote:
> Hi Chas,
Hi,
I dont use perl on windows, so if there are any special things about
File::Find your Filesystem I can't help you. Please show us the code
you're using to find the files you're looking for. Maybe we have some
hints for you.
HTH, Martin
On Tue, 28 Aug 2007 00:28:40 +0530
Somu <[EMAIL PROTECTE
On 8/27/07, Mihir Kamdar <[EMAIL PROTECTED]> wrote:
> Hi Chas,
>
> It works...but the problem I have is that some of the records are totally
> lost. And also the output file keeps on writing multiple times and grows
> into a huge size. almost 10 times, it keeps on growing until I kill the
> script.
"Chas Owens" schreef:
> Alternations are notoriously inefficient in Perl due to how the regex
> engine works. Perl 5.10 fixes this, at least somewhat, by using
> something called Tries (which are something like trees, but I don't
> fully understand them yet),
These tries are a method of optimisa
From: "Mihir Kamdar" <[EMAIL PROTECTED]>
> I have a csv file. I wanted to do some calculations on some of its fields,
> like multiplying the 7th field with the 13th field and overwriting the 13th
> field with the answer of my calculation.
>
> Regarding this, can I do the calculations on the input
From: Solidzh <[EMAIL PROTECTED]>
> Hello,
>
> My boss asked me to learn some Java but I said Perl can do anything
> that Java can do.So he asked me to write a driver for his wireless
> network card on Linux with Perl.I'm faint but,is there a way to do
> this?
Ahhh, those pointy
From: Chris <[EMAIL PROTECTED]>
> Ok, if anyone is interested, here is my answer:
>
> #!/usr/bin/perl -w
>
> # Testing code for Exercise 6-1. Your task is to write the sub
> # gather_mtime_between.
>
> use strict;
>
> use File::Find;
> use Time::Local;
>
> my ($start, $stop)
From: "Mr. Shawn H. Corey" <[EMAIL PROTECTED]>
> Ken Foskey wrote:
> > I always make that mistake 'if( $a = 10 ) {' that is why I always 'use
> > warnings' and, most importantly, correct the code. Pet peeve is 'use
> > warnings' and then not cleaning them up.
> >
>
> That's because way back in g
From: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> Here's my code
> sorry its long!
> its for trouble ticket express
>
> package TTXMail;
Forget this an use a higher level module than Net::SMTP!
MIME::Lite should make your life much easier, and will still give you
the option to us
From: "Mr. Shawn H. Corey" <[EMAIL PROTECTED]>
> Dr.Ruud wrote:
> >> Why do people who write these books have exercises of little
> >> practical value?
> >
> > An exercise needs to be educational.
>
> I have worked in programming for 25 years and during that time I have
> never use a closure an
Hi All,
see my comments inline
Gunnar Hjalmarsson wrote, On 08/27/2007 07:36 PM:
Praveena Vittal wrote:
#!/usr/bin/perl
use CGI;
my $query =new CGI;
print $query->redirect('http://google.com');
When i run this code
How do you run it? Is the scrip
Hi All,
I have a pattern, which reads as shown below:
my $comment= qr{\s* (?:/\* .*? \*/ \s*)*}xs;
my $identifier = qr{ [A-Za-z_]\w* }xs;
my $statement = qr{
\s*
($identifier)
\s+
($identifier)
\s*
On 8/28/07, Dharshana Eswaran <[EMAIL PROTECTED]> wrote:
> Hi All,
>
> I have a pattern, which reads as shown below:
>
> my $comment= qr{\s* (?:/\* .*? \*/ \s*)*}xs;
> my $identifier = qr{ [A-Za-z_]\w* }xs;
> my $statement = qr{
>\s*
>($identifier)
>
2007/8/28, Chris <[EMAIL PROTECTED]>:
> Yet another problem from Intermediate Perl, I've been given a log
> file. Here is a sample of its contents:
>
> Gilligan: 1 coconut
> Skipper: 3 coconuts
> Gilligan: 1 banana
> Professor: 3 coconuts
> MaryAnn: 2 papayas
> Thurston: 2 mangoes
>
> I am suppose
On 8/27/07, Jenda Krynicky <[EMAIL PROTECTED]> wrote:
> From: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> > Here's my code
> > sorry its long!
> > its for trouble ticket express
> >
> > package TTXMail;
>
> Forget this an use a higher level module than Net::SMTP!
> MIME::Lite should
When i write the condition
my @m = $fullStruct =~ /$DLstatement/g;
and try printing the array,
print "\nThe array is @m\n";
It prints nothing This is the problem...
Thanks and Regards,
Dharshana
On 8/28/07, Chas Owens <[EMAIL PROTECTED]> wrote:
>
> On 8/28/07, Dharshana Eswaran <[E
Yet another problem from Intermediate Perl, I've been given a log
file. Here is a sample of its contents:
Gilligan: 1 coconut
Skipper: 3 coconuts
Gilligan: 1 banana
Professor: 3 coconuts
MaryAnn: 2 papayas
Thurston: 2 mangoes
I am supposed to read the log file and output its contents into a
seri
On 8/28/07, Chris <[EMAIL PROTECTED]> wrote:
> Yet another problem from Intermediate Perl, I've been given a log
> file. Here is a sample of its contents:
>
> Gilligan: 1 coconut
> Skipper: 3 coconuts
> Gilligan: 1 banana
> Professor: 3 coconuts
> MaryAnn: 2 papayas
> Thurston: 2 mangoes
>
> I am
On 8/28/07, Jeff Pang <[EMAIL PROTECTED]> wrote:
> 2007/8/28, Chris <[EMAIL PROTECTED]>:
> > Yet another problem from Intermediate Perl, I've been given a log
> > file. Here is a sample of its contents:
> >
> > Gilligan: 1 coconut
> > Skipper: 3 coconuts
> > Gilligan: 1 banana
> > Professor: 3 coc
76 matches
Mail list logo