RE: Some Help please

2006-07-18 Thread Leigh Sharpe
Try this:
use strict;
use warnings;
my $mac="00:14:85:50:A3:CF";
my @mac_address_fields = split(/:/,$mac);
foreach my $field (@mac_address_fields)
{
$field = chr(hex($field));
}
my $final_mac = join("", @mac_address_fields);

You now have the mac address in the appropriate format (I presume you are using 
SNMP to program it onto a device.)


Regards,
     Leigh
 
Leigh Sharpe
Network Systems Engineer
Pacific Wireless
Ph +61 3 9584 8966
Mob 0408 009 502
email [EMAIL PROTECTED]
web www.pacificwireless.com.au

-Original Message-
From: SolHai Haile [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, July 19, 2006 10:25 AM
To: perl-win32-users@listserv.ActiveState.com
Subject: Some Help please


Hi All,
I need to read mac address and program into a device:
Example:

my @mac = "00:14:85:50:A3:CF";
while (<@mac>)
{
  my ($oct0,$oct1,$oct2,$oct3,$oct4,$oct5) = split /:/,$_;

}
1. How do I convert $oct0..$oct5 to hex
 $oct0 = 0x00, $oct1=0x14, .., $oct5 = 0xcf
 The problem is I need to increment $oct5 by 1 and by 2 to have another 
two mac addresses.
2. Is my approch correct?

I appreciate for your help.


___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Easy One

2006-05-01 Thread Leigh Sharpe
This appears to work:

use strict;
use warnings;
my @input=("abcd1234","abc12345","abcde123");
foreach my $sample(@input)
{
print "$sample:\n";
$sample=~m/([a-zA-Z]*)([0-9]*)/;
my $letters=$1;
my $numbers=$2;
print "Letters $letters\tNumbers $numbers\n";
} 


Regards,
 Leigh
 
Leigh Sharpe
Network Systems Engineer
Pacific Wireless
Ph 9584 8966
Mob 0408 009 502
email [EMAIL PROTECTED]
web www.pacificwireless.com.au

-Original Message-
From: Ng, Bill [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 02, 2006 5:55 AM
To: perl-win32-users@listserv.ActiveState.com
Subject: Easy One

Real simple,

I have a string, "$a" for arguments sake, that contains a single word.  
The word will always have exactly 8 characters in it, most likely something 
like "ABCD1234".  I need to split this up into two strings ($b & $c), the first 
string needs to contain all the characters before the first number in the word 
("ABCD" in this example), the second string needs everything after, and 
including, the first number in the word "1234" in this example.

Now, substr() would be a walk in the park, except for the fact that I 
can't guarantee the first number will always be in the fifth position ... it 
might come in any position between 3 and 7.  How would YOU go about doing this? 
 Inquiring minds want to know.

Bill in Brooklyn

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: CGI & frames question

2005-07-21 Thread Leigh Sharpe
Just a thought: can you use a piece of javascript in the top form to
populate data in the right frame, and use onSubmit() (or onClick() on the
'submit') to issue a form.submit() on the right frame?
I'd have to test this out to be sure it work.



- Original Message - 
From: "Terry Vaughn" <[EMAIL PROTECTED]>
To: 
Sent: Thursday, July 21, 2005 10:48 PM
Subject: CGI & frames question


> Howdy all,
>
> I have been staring at the same piece of code for hours on end trying to
> perform the following:
>
> I am creating 3 frames in a CGI program: top, left, and right.  The
form(and
> fields within the form) are created and posted out of the top frame.  The
> "-target" of the top frame is the left frame.  However, I would also like
to
> post data to right frame concurrently with posting to the left frame.  I
> just can't figure out how to post to two frames from one frame containing
> the form.  Any ideas ?  Sample code would be highly appreciated.
>
> TEV
>
> ___
> Perl-Win32-Users mailing list
> Perl-Win32-Users@listserv.ActiveState.com
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
>

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: system() Conundrum

2005-06-30 Thread Leigh Sharpe
What about using Win32::Process::Create?

- Original Message - 
From: "Roy Olsen" <[EMAIL PROTECTED]>
To: 
Sent: Friday, July 01, 2005 11:56 AM
Subject: system() Conundrum


>
> I have a Perl script that receives programs and other files from a host
> system for editing.   Once the file is transferred the script launches my
> text editor and passes it the name of the file.  It works fine for me and
> several colleagues.  However, on one user's brand new system (with XP Pro
> and Perl v5.8.6) it won't launch the editor, instead it brings up the
> windows dialog for selecting which program to use.
>
> To make it flexible, I read an environment variable that contains the path
> to the editor.  Here's the relevant bits of code:
>
> $EDITOR = $ENV{BASIC_EDITOR};
> ...
> if ($EDITOR) {
>system( "start $EDITOR $file" );
> }
>
> It seems that windows is seeing something like:
>
>  start  SomeFile
>
> with the editor path being omitted.  To track down the cause of this I
> setup some one line test scripts we could run on this user's system.  This
> example launches Win.ini in notepad:
>
>  system( "start \"c:/program files/ultraedit/uedit32.exe\"
> c:/windows/WIN.ini" );
>
> Again, somehow the program name is disappearing or being ignored.
However,
> running this next script in "c:\program files\UltraEdit" opens Win.ini in
> UltraEdit like I'ld expect:
>
>  system( "start uedit32.exe c:/windows/WIN.ini" );
>
> Why would it work this way and only on one user's system??
>
> Roy Olsen
>
>
>
>
>
> ___
> Perl-Win32-Users mailing list
> Perl-Win32-Users@listserv.ActiveState.com
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
>

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Reading environment varible

2005-06-28 Thread Leigh Sharpe
This line:

> #$foo_token_value = $ENV{ BAR_DIR };
If I un-comment it, all looks good. Was this deliberately commented out? Or
was this just an oversight?
And you might want to change those "n"s to "\n"s.


- Original Message - 
From: <[EMAIL PROTECTED]>
To: 
Sent: Wednesday, June 29, 2005 9:20 AM
Subject: Reading environment varible


> Dear Perlgurus,
>
> I've got a problem, reading an environment variable.
> My environemt: Windows XP/2000 Perl 5.6.. If possilbe, I don't want to
update to 5.8.
>
> First I start the following cmd file:
>
> --- begin ---
> SET FOO_TOKEN=BAR
> CALL SET %FOO_TOKEN%_DIR=c:bar
> --- end ---
>
> After that I start in the _same_ environment (cmd) the following perl
code:
>
> --- beginn ---
> use strict;
> use warnings;
>
> my $foo_token_dir   = "%%FOO_TOKEN%_DIR%";
> my $foo_token_value = "";
>
> $foo_token_value = $ENV{ $foo_token_dir };
> #$foo_token_value = $ENV{ BAR_DIR };
>
> print "foo_token_dir:   " . $foo_token_dir   . "n";
> print "foo_token_value: " . $foo_token_value . "n";
> --- end ---
>
> My output is:
>
> foo_token_dir:   %%FOO_TOKEN%_DIR%
> Use of uninitialized value in concatenation (.) or string at 

Re: Photo EXIF information ????

2005-06-13 Thread Leigh Sharpe
Image::Info can do it.
For examples, have a look at the photo gallery software available at
www.fuzzymonkey.org

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Using sendmail

2005-06-07 Thread Leigh Sharpe
> > RCPT TO: error (550 5.7.1 Unable to relay for [EMAIL PROTECTED]). Is
This sounds like a sendmail configuration issue. Sendmail is rejecting your
mail because it is not permitted to relay to the destination domain. I
suggest you check that relaying is permitted from the IP address you are
connecting from (ie localhost or whatever the address of the machine is.)


- Original Message - 
From: "Chris" <[EMAIL PROTECTED]>
To: "perl-win32-users" 
Sent: Wednesday, June 08, 2005 8:38 AM
Subject: FW: Using sendmail


> > I used sendmail on my development environment (my laptop) and my app
> > worked fine. Now when I moved to production, it is not working. I get
> > RCPT TO: error (550 5.7.1 Unable to relay for [EMAIL PROTECTED]). Is
> > there a way to make this work on a server without Outlook installed on
> > it? I do not have a spare license to install Outlook in that server.
>
>
> How are you sending massages? Direct pipe to sendmail or via SMTP? Example
> would be helpful.
>
> ___
> Perl-Win32-Users mailing list
> Perl-Win32-Users@listserv.ActiveState.com
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
>

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Output image via http

2005-04-18 Thread Leigh Sharpe

You need to use binmode on both the input and output. Try this:

print "content-type:image/jpeg\n\n";
open (IMG,"<$filename");
binmode IMG;
binmode STDOUT;
my $size = -s "$filename";
read IMG,$data,$size || die"$!\n";
close IMG;
print "$data";



- Original Message - 
From: "Chris" <[EMAIL PROTECTED]>
To: "perl-win32-users" 
Sent: Tuesday, April 19, 2005 6:47 AM
Subject: Output image via http


> I know I've seen the answer to this question in the past but I can't seem
to
> find it in the archives or Google. How can I output an image directly from
> Perl? I've read about possibly using binmode, but haven't found a working
> example.
>
>
> print "Content-type: image/jpeg\n\n";
>
> open (data_In,"
> print ;
>
> close (data_In);
>
> ___
> Perl-Win32-Users mailing list
> Perl-Win32-Users@listserv.ActiveState.com
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
>

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: [OT] Spam to list

2005-03-31 Thread Leigh Sharpe
> 
> Obviously they don't like Aussies.
> 


That's not it.

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: LWP::UserAgent and post()

2005-03-30 Thread Leigh Sharpe
This appears to work OK.
I guess I'll have to delve a little further into the HTTP::Request::Common
documentation.
Thanks Bill.

- Original Message - 
From: "$Bill Luebkert" <[EMAIL PROTECTED]>
To: "Leigh Sharpe" <[EMAIL PROTECTED]>
Cc: "Perl-Win32-Users" 
Sent: Thursday, March 31, 2005 11:49 AM
Subject: Re: LWP::UserAgent and post()


> Leigh Sharpe wrote:
>
> > The script you supplied doesn't work for me. I still get the same error,
> > saying it can't find the object method "post" in LWP::UserAgent. Works
fine
> > on linux.
> > Hence my question, Is the LWP::UserAgent in a standard Actvestate
install
> > the same as I could expect to find on a linux machine?
> > The docs provided by Activestate don't mention the post() or get()
methods
> > anywhere for that package. It looks like a completely different package.
> >
> > BTW, I'm using V5.6.1, not the latest distribution.
>
> I'm on 5.8 B811.  If it's a version issue, you can always re-code it to
> something that works (they may have added post/get methods on 5.8).  Try
> this one:
>
> use strict;
> use warnings;
> use LWP::UserAgent;
> use HTTP::Request::Common qw(POST);
>
> my $url = 'http://localhost/cgi-bin/post.pl';
> my $username = 'username';
> my $password = 'password';
>
> my $ua = LWP::UserAgent->new;
> # $ua->agent("Mozilla/5.0"); # if needed
>
> my $req = POST $url, 'Content-Type' =>
'application/x-www-form-urlencoded',
>   Content => ['user' => $username, 'password' => $password,
>   'submit' => 'Login'];
>
> my $res = $ua->request($req);
>
> __END__
>
>
> -- 
>   ,-/-  __  _  _ $Bill LuebkertMailto:[EMAIL PROTECTED]
>  (_/   /  )// //   DBE CollectiblesMailto:[EMAIL PROTECTED]
>   / ) /--<  o // //  Castle of Medieval Myth & Magic
http://www.todbe.com/
> -/-' /___/_<_http://dbecoll.tripod.com/ (My Perl/Lakers stuff)
>

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: LWP::UserAgent and post()

2005-03-30 Thread Leigh Sharpe
The script you supplied doesn't work for me. I still get the same error,
saying it can't find the object method "post" in LWP::UserAgent. Works fine
on linux.
Hence my question, Is the LWP::UserAgent in a standard Actvestate install
the same as I could expect to find on a linux machine?
The docs provided by Activestate don't mention the post() or get() methods
anywhere for that package. It looks like a completely different package.

BTW, I'm using V5.6.1, not the latest distribution.

- Original Message - 
From: "$Bill Luebkert" <[EMAIL PROTECTED]>
To: "Leigh Sharpe" <[EMAIL PROTECTED]>
Cc: "Perl-Win32-Users" 
Sent: Wednesday, March 30, 2005 7:47 PM
Subject: Re: LWP::UserAgent and post()


> Leigh Sharpe wrote:
>
> > Hi all,
> >  Is the LWP::UserAget supplied with Activestate Perl the same as I would
> > get from a linux install?
> > The following code appears to work OK under linux, but not win32:
> >
> > $browser = LWP::UserAgent->new( );
> > $browser->env_proxy( ); # if we're behind a firewall
> >
> > # Login into the script
> > $response = $browser->post(
> > "$login",
> > [
> > 'user' => $username,
> > 'password' => $password,
> > 'submit' => 'Login'
> > ],
> > );
> >
> > where,
> > $login = the url script that processes the login data that the forms
> > submits;
> > $username, and $password are the credentials.
> >
> > However, under Windows, I get the following:
> >
> > Can't locate object method "get" via package "LWP::UserAgent" (perhaps
> > you forgo
> > t to load "LWP::UserAgent"?) at submittest.pl line 12.
> >
> > I'm confused.
>
> Always provide complete snippets when posting.  This works for me
> where the above didn't - note the Content_Type andd Content args.
>
> use strict;
> use warnings;
> use LWP::UserAgent;
>
> my $url = 'http://localhost/cgi-bin/post.pl';
> my $username = 'username';
> my $password = 'password';
> my $ua = LWP::UserAgent->new;
> my $resp = $ua->post($url, Content_Type => 'form-data',
>   Content => ['user' => $username, 'password' => $password,
>   'submit' => 'Login']);
>
> __END__
>
> -- 
>   ,-/-  __  _  _ $Bill LuebkertMailto:[EMAIL PROTECTED]
>  (_/   /  )// //   DBE CollectiblesMailto:[EMAIL PROTECTED]
>   / ) /--<  o // //  Castle of Medieval Myth & Magic
http://www.todbe.com/
> -/-' /___/_<_http://dbecoll.tripod.com/ (My Perl/Lakers stuff)
>

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


LWP::UserAgent and post()

2005-03-29 Thread Leigh Sharpe



Hi all,
 Is the LWP::UserAget supplied with 
Activestate Perl the same as I would get from a linux install?
The following code appears to work OK under linux, 
but not win32:
 
$browser = LWP::UserAgent->new( );$browser->env_proxy( ); # if 
we're behind a firewall# Login into the script$response = 
$browser->post("$login",['user' => $username,'password' 
=> $password,'submit' => 'Login'],);where,$login = 
the url script that processes the login data that the forms 
submits;$username, and $password are the credentials.However, under Windows, I get the following:
 
Can't locate object method "get" via package 
"LWP::UserAgent" (perhaps you forgot to load "LWP::UserAgent"?) at 
submittest.pl line 12.
 
I'm confused.
 
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Encoding TNEF

2005-03-28 Thread Leigh Sharpe



Hi All,
    Does anybody have any references 
on how to encode something into TNEF format?
 
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Win32::ODBC and ExtendedFetch

2005-03-23 Thread Leigh Sharpe



Hi All,
 I'm having trouble talking to an ODBC Data 
source with Win32::ODBC. I get a 911 error, saying "[Microsoft][ODBC Driver 
Manager] Driver does not support this function" afterr issuing 
 
  $db->FetchRow() ;
Tracing the ODBC log tells me that the FetchRow() 
issued a  SQLExtendedFetch  against the DSN, which is causing the 
error.
However, according to the Win32::ODBC 
documentation:
 

FetchRow ( [ ROW [, TYPE ] ] 
)
Retrieves the next record from the keyset. When ROW and/or 
TYPE are specified, the call is made using 
SQLExtendedFetch instead of SQLFetch. 

 
So, Is there any way of forcing Win32::ODBC 
to do a SQLFetch and not an SQL:ExtendedFetch? I've called it without 
paramaters, so if the docs are accurate, it should work.
 
 
 
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Reading an Access Database

2005-03-22 Thread Leigh Sharpe
OK, it's portable. Any pointers on how to put it to use in this particular
case?
The database I have to read from is already locked into MS Access. I'd much
rather MySQL, but it's not possible, as the decision has already been made.



>  Not to mention the
> fact that Microsoft has their fingers in it.

He says on a win32-specific list.  



- Original Message - 
From: "Chris Wagner" <[EMAIL PROTECTED]>
To: "Perl-Win32-Users" 
Sent: Wednesday, March 23, 2005 3:34 PM
Subject: Re: Reading an Access Database


> The good thing about DBI is it's more portable.  So if u ever need to move
> between servers, databases, there'll be less code to rewrite.  Using a
pure
> Windows method locks u in to that interface.  I work in the Windows and
Unix
> worlds, it's just not worth it to even mess with ODBC.  Not to mention the
> fact that Microsoft has their fingers in it.
>
>
> At 06:59 PM 3/22/05 -0500, Paul Rogers wrote:
> >I like using Win32::ODBC although others will undoubtedly espouse the
> >virtues of DBI...
>
>
>
>
>
> --
> REMEMBER THE WORLD TRADE CENTER ---=< WTC 911 >=--
> "...ne cede males"
>
> 0100
>
> ___
> Perl-Win32-Users mailing list
> Perl-Win32-Users@listserv.ActiveState.com
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
>

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Reading an Access Database

2005-03-22 Thread Leigh Sharpe



Hi All,
 Does anybody know of a way to read data from 
an Access database? All I need is read access, as I want to extract some data 
and present from a Perl script.
Any Ideas?
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Running a script from command line as well as browser

2004-09-01 Thread Leigh Sharpe
using CGI.pm is much easier.
eg:

use CGI qw/:standard/;
my $month=param(month);
my $day=param(day);
my $year=param(year);

-
Calling this as a cgi with appropriate values for day, month, year etc.
gives you the values you are after.
Calling it from the command line as follows also works:

scriptname.pl month=09 day=01 year=2004

HTH,
Leigh.


- Original Message -
From: "ashish srivastava" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, September 01, 2004 5:22 PM
Subject: Running a script from command line as well as browser


> Hi,
>
> I have a script which takes some values from a user(interactively e.g.
enter
> value for ..). Now i need to make a provision that this script be run from
a
> UI where the user inputs all the values in the form.
> presently i am checking whether @ARGV or $ENV{CONTENT_LENGTH} is defined
or
> not. IF @ARGV is defined i understand that the script has been called from
> command line and if
> $ENV{CONTENT_LENGTH} is defined i know that it has been accessed by a
> browser.
>
> IS THIS CORRECT?
>
> I am using :
> if (defined @ARGV) {
> }
> elsif (defined $ENV{CONTENT_LENGTH} || defined $ENV{QUERY_STRING}){
> }
>
> Any pointers?
>
> Thanks
> Ashish
>
> _
> Claim your Citibank Ready Cash today.
> http://citibank.mediaturf.net/pl/save_lp.jsp?referrer=Hmtgofline It's
fast,
> easy and affordable.
>
> ___
> Perl-Win32-Users mailing list
> [EMAIL PROTECTED]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
>

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


Re: perl mysql table row update

2004-07-29 Thread Leigh Sharpe
I think what you want is:


$sth=$dbh->do("UPDATE TableSLA set NodeID=\"$nodeid\" WHERE ID=\"$id\"");


- Original Message - 
From: "Viswanatha Rao" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: "'Rhesa Rozendaal'" <[EMAIL PROTECTED]>
Sent: Friday, July 30, 2004 2:23 PM
Subject: RE: perl mysql table row update


> I run an update on a row with following code:
> 
> my $id = '100';
> my $nodeid = "localhost";
> my $nodeid_in = $dbh->quote($nodeid);
> 
> print ("Updating a NODEID=$nodeid_in with SLA ID $id \n");
> my $sth = $dbh->do("update TableSLA set NodeID=? where ID= $id", 
> {}, 
> [$nodeid_in]);
> 
> It inserts some kind of Array Reference value for the field NodeID,
> instead of supplied value 'localhost'
> 
> Can someone help me out?
> 
> 
> 
> -Original Message-
> From: Rhesa Rozendaal [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, July 29, 2004 11:22 AM
> To: Viswanatha Rao
> Cc: [EMAIL PROTECTED]
> Subject: Re: perl mysql table row insert
> 
> Viswanatha Rao wrote:
> 
> > I am trying to populate a table row in mysql.
> > my $sla_id="100";
> > my $node_type="127.0.0.1";
> > my $operation_type = "add a node";
> > 
> > my $id = $dbh->quote($sla_id);
> > my $nodeid = $dbh->quote($node_type);
> > my $operation = $dbh->quote($operation_type);
> > 
> > The insert works with this piece of code:
> > 
> > my $sth = $dbh->prepare("insert into myTable(ID, NodeID,
> Operation_Type) 
> > values ($id, $nodeid, $operation)");
> 
> here you use $id, $nodeid and $operation.
> 
> > $sth->execute();
> > 
> > Whereas, if I use this cryptic version, insert fails without error:
> > 
> > $dbh->do("insert into myTable(ID, NodeID, Operation_Type) 
> > values(?,?,?)", undef, (param($id), param($nodeid), param($operation)
> ));
> 
> here you use param($id) etc.
> Change this to
> 
> $dbh->do("insert into myTable(ID, NodeID, Operation_Type) 
> values(?,?,?)", undef, $sla_id, $node_type, $operation_type);
> 
> Note that there is no need to call dbh->quote on those.
> 
> > Can someone tell me why the second version fails and how to fix it?
> Also 
> > I don't know what param does?
> 
> My guess would be is that it comes from the CGI module. It pulls out cgi
> 
> query variables passed to your script. It's highly likely there are no 
> parameters named "127.0.0.1" etc, so your query is called with empty
> values.
> 
> HTH,
> 
> Rhesa
> 
> ___
> Perl-Win32-Users mailing list
> [EMAIL PROTECTED]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
> 

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


Re: perl & mysql

2004-07-23 Thread Leigh Sharpe



DBD::Mysql is the perl interface to 
MySQL.
 
Specifically, to create a table:
 
use DBI;use DBD::mysql;
my 
$dbh=DBI->connect("DBI:mysql:host=$ip_address:database=$database","$username","$password");$sth=$dbh->do("create 
table $table_name ($table_definition)") or die "$!\n";
$dbh->disconnect();
 
Most of the variables in the above should be 
self-explanatory.
See the DBD::Mysql docs on CPAN for further 
details.
 
 
 

  - Original Message - 
  From: 
  Viswanatha 
  Rao 
  To: [EMAIL PROTECTED] 
  
  Sent: Friday, July 23, 2004 1:56 AM
  Subject: perl & mysql
  
  
  Can some one tell me how to create 
  a database and table in perl for mysql database?
   
  Thanks
   
   
   
  
  

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


GD::Graph y_max scale

2004-07-05 Thread Leigh Sharpe



Hi All,
  Can anybody tell me how to get the GD::Graph 
module to NOT auto-scale?
I have an application where I want the y-axis on a 
graph ALWAYS at 10.
By setting y_max to 10, it makes sure the y-axis 
never goes above 10, but in some circumstances, my data values don't go over, 
say, 2. GD::Graph automatically scales to a maximum Y value of 2. I need it to 
be 10.
Any ideas?
 
Regards, 
Leigh Leigh SharpeNetwork Systems EngineerPacific 
WirelessPh 9584 8966Mob 0408 009 502email [EMAIL PROTECTED]web 
www.pacificwireless.com.au
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Time::HiRes problems

2004-06-15 Thread Leigh Sharpe
Could be the problem. I'm using version 1.5
Is there a later one available for Perl 5.6? I can't use 5.8 on this
project.

- Original Message -
From: "Jan Dubois" <[EMAIL PROTECTED]>
To: "'Leigh Sharpe'" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Wednesday, June 16, 2004 11:22 AM
Subject: RE: Time::HiRes problems


> >I'm having some problems with the time reported by Time::HiRes::time().
> ...
> >Any idea what I'm doing wrong?
>
> Make sure that you are running version 1.53 of Time::HiRes or later:
>
> perl -MTime::HiRes -eprint$Time::HiRes::VERSION
>
> Earlier versions were acting more like Time::LoRes on Windows.
>
> Cheers,
> -Jan
>
>
>

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


Re: Time::HiRes problems

2004-06-15 Thread Leigh Sharpe

Darrell Gammill <[EMAIL PROTECTED]> wrote:

> What do you get if you get the time as an array using gettimeofday?  A
> difference would indicate it is a problem in the conversion of the
> system time format to a floating point format.

Yes I have tried it. Same results.


$Bill Luebkert <[EMAIL PROTECTED]> wrote:

>Some code might have helped.

 A little difficult, as it's large and convoluted, and inside a larger
program. I'll try to pull it apart if really necessary.

>use Time::HiRes qw(gettimeofday tv_interval usleep);
>my $t0 = [&gettimeofday ()];
>usleep (1234); # sleep 1.234 msecs
>printf "%.6f seconds\n", tv_interval ($t0);

This is interesting. Using your example, if I change the usleep to 1000, I
get a result of 0.010015 seconds.
Using usleep(999), I get 0.00 secs.
A difference of 1 uS in the usleep causes a difference of 10mS in the
result.




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