"Mihir Kamdar" <[EMAIL PROTECTED]> writes:
> 1. (*) text/plain
>
> hi,
>
> I am a beginner in Perl. I am trying to automatically generate a perl test
> case file which, on executing, would return HTTP response code and response
> time,etc. In the output file that I am getting I want the
updating the target db
as you go.
For large sets of data, option '1' can use up available memory, and
option '2' can be very slow due to the number of 'round trips' to and
from the databases. So a 'batching' solution might be a good idea. Of
course, if t
eParser->new(\$r->content) or die "Parse
> error in $page: $!";
> # just printing what was collected
> print Dumper get_thread($stream);
> # would instead have database insert statement at this point
>} else {
&
merlyn@stonehenge.com (Randal L. Schwartz) writes:
>>>>>> "Robin" == Robin Norwood <[EMAIL PROTECTED]> writes:
>
> Robin> But Google does use the data in indexes for personal gain...it derives
> Robin> significant revenue from the advertising don
merlyn@stonehenge.com (Randal L. Schwartz) writes:
>>>>>> "Robin" == Robin Norwood <[EMAIL PROTECTED]> writes:
>
>>> DO NOT ATTEMPT TO DO THIS
>
> Robin> Really? If I understood the OP correctly, all he wants to do is
> 'screen
&
ing calls to sleep inside
some of those loops. After he gets the data, he could do something
unethical with it - like republish it. But just getting the data
doesn't seem wrong to me.
As I said above, I am not a lawyer! The above should not be taken to
mean I think it is legal to do this. But it
gt; af = a...x name=taga_0 #...d name=tagb_0 f...r name=tagc_0 xxnn
> b4 = h...e name=taga_4 t...g name=tagb_4 k name=tagc_4 nn
> af = h...e name=taga_1 t...g name=tagb_1 k name=tagc_1 nn
>
> Any help will be greatly appreciated.
> jwm
--
Robin Norwood
Red Hat, Inc.
"The
e of a specific function such
> as splice. Which line code am I supposed to issue? I
> tried perldoc splice or perldoc perlfunc splice but it
> didn't work.
--
Robin Norwood
Red Hat, Inc.
"The Sage does nothing, yet nothing remains undone."
-Lao Tzu, Te Tao Ching
--
uot;)->children("guy"))
> {
> print " User: " . $element->child("user")->value . "\n";
>
> print " Date of Birth: " .
> $element->child("date-of-birth")->value . "\n";
>
> p
nt $string;
returns:
How much quod quuld a quodchuck chuck if a quodchuck could chuck
quod?
Note the 'g' tacked on to the end of the substitution...
-RN
--
Robin Norwood
Red Hat, Inc.
"The Sage does nothing, yet nothing remains undone."
-Lao Tzu, Te Tao Ching
--
To unsub
tures, etc. If I had to guess, I'd say
$5/mo.
-RN
--
Robin Norwood
Red Hat, Inc.
"The Sage does nothing, yet nothing remains undone."
-Lao Tzu, Te Tao Ching
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
xcessively precise in unimportant matters)
> or 'foppish' (affectedly refined in manners). Also there is no
> 'persnickety' which must be American English. Divided by a common
> one eh?
I imagine you're correct on the 's' version being American English -
I'
eaded, snooty, snot-nosed,
snotty, stuck-up, too big for one's breeches, uppish]
Which doesn't sound very flattering... :-)
I think we can safely assume that Jamie meant the other definition...
-RN ("a snotty little scion of a degenerate family")
--
Robin
d five are extracted to a list. Sub-string four is extracted to its
> own variable.
>
> Suggestions?
Well, a slice instead of pushing individual elements helps a little bit:
@list = (@tmp_list[0 .. 3], $tmp_list[5]);
-RN
--
Robin Norwood
Red Hat, Inc.
"The Sage does nothing, yet n
perl/deep_copy.pl
Use of uninitialized value in concatenation (.) or string at perl/deep_copy.pl line 19.
what type is ? at perl/deep_copy.pl line 19.
While with the corrected line gives the following (correct) error:
$ perl perl/deep_copy.pl
what type is SCALAR(0x8107e04)? at perl/deep_copy.pl line 20
# empty hashref
@{$times}{qw/atime mtime ctime/} = # a slice of the hashref...
(stat("filename"))[8 .. 10]; # to which we map some of the fields of stat()
print $times->{mtime}; # should yield the same as (stat("filename"))[9]
Don't worry if the last snippe
he above is:
foreach my $order (@orders) {
print $order->order_number();
}
This iterates over each element in the array @orders, and places them
in turn in a variable called '$order'. Do it this way, and you don't
have to worry about the index of the array at all.
-
ct_id
# in cs2600.pm
}
}
# One of the important bits in the above is that while ipaddress() is
# found in NetDevice.pm, in this case it is a method of the
# NetDevice::Cisco::cs2600 *object* ($self) we just created.
$self->_init; # _init() from cs2600 if
, %valid_fields) }
sub object_id {
my $self = shift;
my $id = shift;
if (defined $id) {
$self->{object_id} = $id;
}
return $self->{object_id};
}
1;
__END__
testme.pl:
use Data::Dumper;
use NetDevice::Cisco::cs2600;
my $cisco = new NetDevice::Cisco::cs2600(ipaddress => &q
5/s
(n=1)
As you can see, grep_compare performs somewhat worse than
keys_compare, and short_circuit cleans up.
Of course, short_circuit won't perform quite as well as the other two
when dealing with arrays that are usually unique, but as far as I can
tell, short_circuit's worst
uld be:
if (grep {$seen{$_}++} @array) {
> # at least one element is twice
>} else {
> # unique
>}
> }
-RN
--
Robin Norwood
Red Hat, Inc.
"The Sage does nothing, yet nothing remains undone."
-Lao Tzu, Te Tao Ching
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
ank, or if you have a line like 'Bill Clinton,' ($phone ends up
being undef)
> --i'm going to test this to see if i can
> --use my text file to put data into the
> --query ...
>
> --it may just be that i will have to do
> --this in a two or three step process.
Yes, you will need to do two steps - at least I know of no other way.
Good luck!
-RN
--
Robin Norwood
Red Hat, Inc.
"The Sage does nothing, yet nothing remains undone."
-Lao Tzu, Te Tao Ching
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
($owner, $columns, $def) = $sth->fetchrow) {
# ...whatever...
}
So this should get all of the tables owned by 'Bill' with 32 or fewer
columns. When the query is run, the question marks are replaced by
the params to 'execute', in order. The technical details are best
lef
27;ll notice I used strftime to get the date instead of parsing
`date` - probably easier and more correct.
For my script, I also check to make sure the directory in $target_dir
doesn't already exist - this may or may not apply for your
application, though.
-RN
--
Robin Norwood
Red Hat, Inc.
"The Sage does nothing, yet nothing remains undone."
-Lao Tzu, Te Tao Ching
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
doesn't really
> validate the entry but you got me thinking about what I can do with
> the split. (You also forced me to read up on s/printf and scalar
> context to figure out what the heck you were doing.)
Peter,
You should probably also look at the Date::Parse module, it can p
ash2Ref );
print Data::Dumper->Dump([(%containerHash)]);
foreach my $hkey (keys %containerHash) { # 'hash1', then 'hash2'
foreach my $intkey (keys %{$containerHash{$hkey}}) { # the keys of $intHash1Ref and
$intHash2Ref
my $value = $containerHash{$hkey}->{$intkey};
print "$hkey: key = '$intkey', value = '$value'";
}
}
-RN
--
Robin Norwood
Red Hat, Inc.
"The Sage does nothing, yet nothing remains undone."
-Lao Tzu, Te Tao Ching
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
dodgy) parser. If fact I'm trying to do it this way because I have found multiple
>errors in the original configuration file parser for my program!
Well, since you mention that Freezethaw wasn't available, I assume
installing from CPAN isn't an option - if it is, you could
quot;american_phone",
zipcode => '/^\s*\d{5}(?:[-]\d{4})?\s*$/',
state => "state",
},
}, #<should be ';'
# County names; region email, county em
#x27;t in your path - IIRC cmd.exe is
the windows 2000 equivelent of 'command.com' - the dos shell. That
being said, I don't think I remember where it's located - good luck.
:-)
-RN
--
Robin Norwood
Red Hat, Inc.
"The Sage does nothing, yet nothing remains undone.&quo
'$100,000,000'
);
foreach my $key (keys %repl) {
$temp =~ s/\{$key\}/$repl{$key}/gi;
}
print $temp;
'
Replacing 'print $temp', with whatever e-mail code you wish to send.
You could, for instance, loop over an array of user records, do the
substitution for eac
david <[EMAIL PROTECTED]> writes:
> Robin Norwood wrote:
> > From david's headers:
> >
> > User-Agent: KNode/0.7.1
> >
> > Time to change news readers, I think... :-)
> >
> > -RN
> >
>
> just curious. what news reader y
busy doing something else...
> yes, the reason why the string is much shorter is becasue i am lazy to
> type... believe it or not, my news reader do not allow(for some unknown
> reason) me to copy and paste outside of it's own window!
>From david's headers:
User-Agent: KNod
ber that is:
>74a6b3b0.d1cd11d4.896e.00:b0:d0:83:b4:9b
>
> how do i get that the easiest way? all $_ are the same they are all within brackets
>[text here variables, exept . and :]
>
> //Dave
'
m/\[uuid\s+(.*)\]/;
my $uuid = $1;
'
Should be sufficient.
-RN
-
e fields found! '@line'\n"; #or whatever you need to do
}
elsif (scalar @line == 2) {
print "Two fields found! '@line'\n"; #or whatever...
}
else {
print "Unusual line! ",scalar @line," columns found. '@line'\n";
}
}
close FILE;
'
--
Robin Norwood
Red Hat, Inc.
"The Sage does nothing, yet nothing remains undone."
-Lao Tzu, Te Tao Ching
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
# '1029438722'
print scalar localtime($time); # 'Thu Aug 15 15:12:02 2002'
'
Run both your dates through Date::Parse, and compare them numerically.
Good enough?
-RN
--
Robin Norwood
Red Hat, Inc.
"The Sage does nothing, yet nothing remains
is 'unixtime'. localtime in array context returns a 'time
array', whose format you can read about in the docs.
strftime uses an ansi c standard time format string - there are
several places you can look up the possible arguments.
-RN
--
Robin Norwood
Red Hat, Inc.
"
Kevin Pfeiffer <[EMAIL PROTECTED]> writes:
> Robin Norwood writes:
> > Samuel Brown <[EMAIL PROTECTED]> writes:
> > > Hi ya,
> > >
> > > I'm teaching myself Perl and I have a log file around 1GB that I need
> > > to sort by month |
ered;
#The tm_conv function just strips out the ':'s - I'm assuming the
#timestamps are in '24-hour' format. Calling this function in the
#middle of the sort like this is absolutely terrible; it will slow
#down the sort tremendously. I should be shot for writing this code.
sub tm_conv {
my $tm = shift;
$tm =~ tr/://d;
return $tm;
}
'
-RN (Who should never be allowed near a keyboard again)
--
Robin Norwood
Red Hat, Inc.
"The Sage does nothing, yet nothing remains undone."
-Lao Tzu, Te Tao Ching
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
;) or die
> "Cannot fork for send mail: $! \n";
> print SENDMAIL<<"EOF";
> From: ltran\@my
> To: you\@yourhost
> cc: myboss\@my
> Subject: Report
>
> Howdy,
> I'm sending you bla bla
> EOF
> while (){
> print SENDMAIL $
size of an < >document - but someone more knowledgable will have to answer that
> >part.
>
> I was under the impression that a variable size is limited only by what your
> hardware can handle before currently available memory is filled.
Well yeah...'as big as you need, limited by
File::Spec->splitpath( $test );
But I still recommend that you read over the documentation for it - it
has several other useful functions.
-RN
"FlashGuy" <[EMAIL PROTECTED]> writes:
> I took a look on www.perldoc.com and checked out "split". I can't figure ou
the last "\" and put that into
>a variable.
> There could only be one "\" in the path or possibly more. This will vary based on
>directory structure.
>
> How would I go about this?
use File::Spec->splitpath -
Look for 'splitpath' in `perldoc File
_;
}
close(INPUT);
> close(SENDMAIL) or warn "sendmail dinnot close
> nicely";
> }# end sendownermail
This way, no more than one line of is in memory at one time.
-RN
--
Robin Norwood
Red Hat, Inc.
"The Sage does nothing, yet nothing remains undone."
-Lao Tzu, Te Tao Ching
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
RACT_log' - use either the
number of elements in the aray '$u < @KEY_SNR_RACT_LOG', or the index
of the last element in the array '$u <= $#KEY_SNR_RACT_LOG' in the
inner for loop. The second method is much more correct, actually.
There are better ways to do this, but this post is getting long enough
as it is. I would recommend a good look at the references and data
structures chapters of 'Programming Perl'. They should help with
understanding how to deal with more complicated data like this.
Wow, that was a long post. Hope it made sense...
All of this code is pretty much completely untested. Beware typos,
logic errors, and gremlins.
-RN
--
Robin Norwood
Red Hat, Inc.
"The Sage does nothing, yet nothing remains undone."
-Lao Tzu, Te Tao Ching
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
hree one two five/;
my @uniq;
%seen = ();
foreach $item (@list) {
push (@uniq, $item) unless $seen{$item}++;
}
#@uniq now contains qw/one two three five/;
'@list' is the original array, and '@uniq' is the unique elements from
that array. This method does not change @
e the first '$' in the substitution part of your regexp:
#!/usr/bin/perl -lw #the 'l' adds a newline to the end of any 'print'
my $foo = '${bar}';
print $foo;
$foo =~ s/\$\{(\w+)\}/\$$1/g;
print $foo;
OUTPUT -
${bar}
$bar
You are getting the warning
7; found at index(es): " . join(", ", @locations);
}
else {
print "String '$value' not found.";
}
display:
String 'BCDE' found at: 0, 4
If you find yourself using 'for', it's often best to stop and think
for a bit about a more '
47 matches
Mail list logo