Showing posts with label perl. Show all posts
Showing posts with label perl. Show all posts

Tuesday, November 3, 2015

Trying to get source code of a webpage in PERL

use strict;
use warnings;
use LWP::Simple;

print "ExaCodigo\tEctCodigo\tExcCodigo\tTUSS\tSQL";

open(IN,'db')or die $!;

while(<IN>){
    chomp;
    my($ExaCodigo,$EctCodigo,$ExcCodigo)=split (/\t/,$_);
    my $link = "http\:\/\/conmedhsaude.com.br\/tuss.php\?c\=\&e\=$ExcCodigo\&p=\&q\=\&consultar\=";
    my $page = get($link) or die "cannot retrieve code\n";
    $page =~ s/\n//g;
    my $TUSS = $1 if ($page =~ /\sTUSS:\s(\d+)\<\/span\>\s+/);
    unless($TUSS) { $TUSS = 'null' }
    print "$ExaCodigo\t$EctCodigo\t$ExcCodigo\t$TUSS\tinsert into ExameCodigoTipo ExaCodigo      values ($TUSS) where ExaCodigo = $ExaCodigo and EctCodigo = $EctCodigo\n";

}
close(IN); _________________________________________________________________________________
DB 16 1 28061144 23 1 28040350 26 1 28061098 33 1 28050037 44 1 28150082 48 1 28060156 64 1 28061608 65 1 28061667 66 1 28061594 67 1 28061748 69 1 28050070 75 1 28060725 77 1 28060229 81 1 28061756 89 1 28060342 90 1 28100140 102 1 28060423
_________________________________________________________________________________ HTML

<input type="text" id="c" name="c" value="" style="margin-left:40px;" />                    Código AMB:<input type="text" id="e" name="e" value="28040481" style="margin-left:40px;" />                    Descrção TUSS: <input type="text" id="p" name="p" value="" style="margin-left:28px;" />                    Descrção AMB: <input type="text" id="q" name="q" value="" style="margin-left:25px;" />                 <input name="consultar" type="submit" class="botao" value="" style="border:none;" >                        </form>            </div> <div class='linhaguia'></div>             <div class="guiaitemsup">                        <div class="guiaitem">             <span class="nome">Código TUSS: 40304361</span>                <span class="esp"><span class="tit2">Descrição TUSS: HEMOGRAMA COM CONTAGEM DE PLAQUETAS OU FRACOES (ERITROGRAM</span></span>                <span class="end"><b>Código do grupo TUSS: </b>40308<br><b>Grupo TUSS: </b>MEDICINA LABORATORIAL  - IMUNOLOGIA<br><b>Código AMB: </b>28040481<br><b>Descrição AMB: </b>HEMOGRAMA COMPLETO (ERITOGRAMA+LEUCOGRAMA+AVALIACAO DE PLAQ<br></span>            </div>            </div>                                                     <div class="clear"></div> <div id='paginacao'><p class="MyriadCH"><span paginacaobot >1</span></p></div>                     </div>                        <div id="lateral">     <div class="clear"></div>    <!-- <a href="http://177.21.147.100:8086/mvautorizadorguias/" title="Autorizador" target="_blank" class="latitem latitemautorizador" ></a> -->    <a href="http://201.59.94.100:8086/mvautorizadorguias/" title="Autorizador" target="_blank" class="latitem latitemautorizador" ></a>    <a href="tuss.php" title="TUSS" class="latitem latitemtuss" ></a>    <a href="trabalheconosco.php" title="Trabalhe Conosco" class="latitem latitemtrabalhe" ></a>        <a href="perguntasfrequentes.php" title="Perguntas Frequentes" class="latitem latitemperguntas" ></a>    <a href="faleconosco.php" title="Central de Atendimento" class="latitem latitematend" ></a>    <a href="linksuteis.php" title="Links Úteis" class="latitem latitemtels" ></a> <a href="commaissaude.php" title="Com + Saúde" class="latitem latitemprevent" ></a>    <a href="imagens/redecredenciada.pdf" title="Rede Credenciada" target="_blank" class="latitem latitemrede" ></a>    <br><br>       <!-- <div id="abramgeans">        <a href="http://www.abramge.com.br/" target="_blank">        <img src="imagens/site/abramge.png" class="abramge">        </a>            <a href="http://www.ans.gov.br/" target="_blank">        <img src="imagens/site/ans.png" class="ans">        </a>    </div>-->    <div class="clear"></div></div>                        <div class="clear"></div>        </div> <div class="linha"></div> <div id="rodape"> <div class="central">     <a href="http://www.taticaweb.com.br/" class="taticaweb" target="_blank"></a>            <div id="abramgeans1" style="float: left;margin: -9px 0 0 0;">                <a href="http://www.abramge.com.br/" target="_blank">                <img src="imagens/site/abramge.png" class="abramge" width="58" height="41">                </a>                            <a href="http://www.ans.gov.br/" target="_blank">                <img src="imagens/site/ans.png" class="ans" width="" height="39">            </a>       </div>        <div class="rodapeatend">         <span class="cat">Central de Atendimento:</span><span class="tel">(24)4009-4545 | (24)4009-4519</span>         <span class="cat">Central de Vendas:</span><span class="tel">(24)4009-8803</span><br />            <span class="cat" style="padding-top:12px; margin-left:-98px;">SAC:</span><span class="tel">0800-0302015

_________________________________________________________________________________
OUTPUT
ExaCodigo EctCodigo ExcCodigo TUSS SQL

23 1 28040350 null insert into ExameCodigoTipo ExaCodigo values (null) where ExaCodigo = 23 and EctCodigo = 1
26 1 28061098 null insert into ExameCodigoTipo ExaCodigo values (null) where ExaCodigo = 26 and EctCodigo = 1
33 1 28050037 null insert into ExameCodigoTipo ExaCodigo values (null) where ExaCodigo = 33 and EctCodigo = 1
44 1 28150082 null insert into ExameCodigoTipo ExaCodigo values (null) where ExaCodigo = 44 and EctCodigo = 1
48 1 28060156 null insert into ExameCodigoTipo ExaCodigo values (null) where ExaCodigo = 48 and EctCodigo = 1
64 1 28061608 null insert into ExameCodigoTipo ExaCodigo values (null) where ExaCodigo = 64 and EctCodigo = 1
65 1 28061667 null insert into ExameCodigoTipo ExaCodigo values (null) where ExaCodigo = 65 and EctCodigo = 1
66 1 28061594 null insert into ExameCodigoTipo ExaCodigo values (null) where ExaCodigo = 66 and EctCodigo = 1
67 1 28061748 null insert into ExameCodigoTipo ExaCodigo values (null) where ExaCodigo = 67 and EctCodigo = 1
69 1 28050070 null insert into ExameCodigoTipo ExaCodigo values (null) where ExaCodigo = 69 and EctCodigo = 1
75 1 28060725 null insert into ExameCodigoTipo ExaCodigo values (null) where ExaCodigo = 75 and EctCodigo = 1
77 1 28060229 null insert into ExameCodigoTipo ExaCodigo values (null) where ExaCodigo = 77 and EctCodigo = 1
81 1 28061756 null insert into ExameCodigoTipo ExaCodigo values (null) where ExaCodigo = 81 and EctCodigo = 1
89 1 28060342 40306631 insert into ExameCodigoTipo ExaCodigo values (40306631) where ExaCodigo = 89 and EctCodigo = 1 

 

Tuesday, December 16, 2014

ORACLE - ORATOP

oratop - Utility for Near Real-time Monitoring of Databases, RAC and Single Instance (Doc ID 1500864.1)


oratop: Release 14.1.2
Usage: 
oratop [ [Options] [Logon] ]

Logon:
{username[/password][@connect_identifier] | / }
[AS {SYSDBA|SYSOPER}]

connect_identifier:
    o Net Service Name, (TNS) or
    o Easy Connect (host[:port]/[service_name])
Options:
    -d : real-time (RT) wait events, section 3 (default is Cumulative)
    -k : FILE#:BLOCK#, section 4 lt is (EVENT/LATCH)
    -m : MODULE/ACTION, section 4 (default is USERNAME/PROGRAM)
    -s : SQL mode, section 4 (default is process mode)
    -c : database service mode (default is connect string) 
    -f : detailed format, 132 columns (default: standard, 80 columns)
    -b : batch mode (default is text-based user interface)
    -n : maximum number of iterations (requires number)
    -i : interval delay, requires value in seconds (default: 5s)
    -v : oratop release version number
    -h : this help


[root@cacti tmp]# ./oratop.RDBMS_11.2_LINUX_X64 siltech/siltech@xe -f -s
Oracle 11g - Primary XE     09:10:05 up: 4.9d,   1 ins,    1 sn,   1 us, 561M mt,    4% fra,   0 er,                      17.1% db
ID %CPU LOAD %DCU   AAS  ASC  ASI  ASW  ASP  AST  UST MBPS IOPS IORL LOGR PHYR PHYW  %FR   PGA TEMP UTPS UCPS SSRT DCTR DWTR  %DBT
 1   23    0   19   0.7    2    0    0    0    2    2    0   40  42u  15k    0    0   96   63M  13M    0  141 244u  116    0   100

EVENT (C)                                                         TOTAL WAITS   TIME(s)  AVG_MS  PCT                    WAIT_CLASS
DB CPU                                                                             4580           59                              
resmgr:cpu quantum                                                     144969      2211    15.3   28                     Scheduler
log file parallel write                                                249928       414     1.7    5                    System I/O
log file sync                                                          186382       408     2.2    5                        Commit
control file parallel write                                            151533       211     1.4    3                    System I/O

ID  USERNAME  MODULE   ACTION  SQL_ID          SQL_TEXT               X  ELAP  CPUT  IOWT  WAIT  EXEC  ROWS  BUFG  DISK  BH%  LOAD
 1  LAURA     perl@ca          74vma1wu3pf7w   select * from all_tab  S   26m   25m    3u     0  4.3k   119   862     0  100     1

[root@cacti ~]# su - oracle
-bash-4.1$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.2.0 Production on Tue Dec 16 09:23:58 2014

Copyright (c) 1982, 2011, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production


SQL> select sql_text from v$sql where sql_id='74vma1wu3pf7w' union select username from v$session where sql_id='74vma1wu3pf7w';


SQL_TEXT
------------------------------------------------------------------------------------------------------------------------
LAURA
select * from all_tables


SQL> /





[oracle@orasrvteste ]$ ./oratop.RDBMS_11.2_LINUX_X64 -h
./oratop.RDBMS_11.2_LINUX_X64: error while loading shared libraries: libclntsh.so.11.1: cannot open shared object file: No such file or directory
[oracle@orasrvteste lib]$ cd $ORACLE_HOME/lib
[oracle@orasrvteste lib]$export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib;
[oracle@orasrvteste lib]$ ll libclntsh.so*
lrwxrwxrwx 1 oracle oinstall       17 May 14  2010 libclntsh.so -> libclntsh.so.10.1
-rwxrwx--- 1 oracle oinstall 20651386 May 14  2010 libclntsh.so.10.1
[oracle@orasrvteste lib]$ cp libclntsh.so.10.1 libclntsh.so.11.1
[oracle@orasrvteste lib]$ oratop.RDBMS_11.2_LINUX_X64 -h
oratop: Release 14.1.2
Usage:
         oratop [ [Options] [Logon] ]

         Logon:
                {username[/password][@connect_identifier] | / }
                [AS {SYSDBA|SYSOPER}]

                connect_identifier:
                     o Net Service Name, (TNS) or
                     o Easy Connect (host[:port]/[service_name])
         Options:
             -d : real-time (RT) wait events, section 3 (default is Cumulative)
             -k : FILE#:BLOCK#, section 4 lt is (EVENT/LATCH)
             -m : MODULE/ACTION, section 4 (default is USERNAME/PROGRAM)
             -s : SQL mode, section 4 (default is process mode)
             -c : database service mode (default is connect string)
             -f : detailed format, 132 columns (default: standard, 80 columns)
             -b : batch mode (default is text-based user interface)
             -n : maximum number of iterations (requires number)
             -i : interval delay, requires value in seconds (default: 5s)
             -v : oratop release version number
             -h : this help

[oracle@orasrvteste lib]$

Thursday, December 11, 2014

PERL - LINUX CONNECT SQLServer

[root@cacti SQLServer]# ./sql_connect.pl 

Successful Connection.

Current Connection Properties
---------------------------------------------------------------------------------------
    SQL Server Instance : SRV-DB
    SQL Server Version  : Microsoft SQL Server 2008 R2 (RTM) - 10.50.1600.1 (X64) 
    Current Database    : master
    Current User        : sa
    Client Machine      : blogger.blogger.com.br

Available Databases
-----------------------------------------------------------------
    DATABASE                                          35178.13 MB
    DTBTESTE                                          35178.13 MB
    DBTTESTE2                                         32835.31 MB
    MSSQL SYSTEM RESOURCE                                61.06 MB
    msdb                                                 21.25 MB
    ReportServer                                         17.81 MB
    tempdb                                                8.50 MB
    master                                                8.13 MB
    ReportServerTempDB                                    3.06 MB
    model                                                 3.00 MB

Disconnecting from SQL Server.

[root@cacti SQLServer]# cat sql_connect.pl 
#!/usr/bin/perl -w
use warnings;
use strict;

use DBI;


my $user   = "sa";
my $passwd = "passwd";
my $server = "122.128.0.0";


my $dbh = DBI->connect("DBI:Sybase:server=$server", $user, $passwd, {PrintError => 0});
my $sth;

my $sqlStatement;

unless ($dbh) {
    die "ERROR: Failed to connect to server ($server).\nERROR MESSAGE: $DBI::errstr";
} else {
print "\n";
print "Successful Connection.";
print "\n\n";
}

print "Current Connection Properties\n";
print "---------------------------------------------------------------------------------------\n";
$sqlStatement = "select \@\@servername, \@\@version, db_name(), system_user, host_name()";
unless ($sth = $dbh->prepare($sqlStatement)) {
$dbh->disconnect;
die "ERROR: Failed to prepare SQL statement.\nSQL: $sqlStatement\nERROR MESSAGE: $DBI::errstr";
}
unless ($sth->execute) {
$dbh->disconnect;
die "ERROR: Failed to execute query.\nSQL: $sqlStatement\nERROR MESSAGE: $DBI::errstr";
}
while ((  my $serverName, my $sqlServerVersion, my $currentDatabase, my $currentUser, my $clientMachine ) = $sth->fetchrow) {
(my $sqlServerVersion, my @dummy) = split(/\n/, $sqlServerVersion);

print "    SQL Server Instance : $serverName\n";
print "    SQL Server Version  : $sqlServerVersion\n";
print "    Current Database    : $currentDatabase\n";
print "    Current User        : $currentUser\n";
print "    Client Machine      : $clientMachine\n";
}

print "\n";
$sth->finish;
print "Available Databases\n";
print "-----------------------------------------------------------------\n";
$sqlStatement = "select isnull(db_name(dbid), 'MSSQL SYSTEM RESOURCE') as Name,
  str(convert(dec(15),sum(size))* 8192/ 1048576,10,2)+ N' MB' as Size
from sys.sysaltfiles group by dbid order by 2 desc";
unless ($sth = $dbh->prepare($sqlStatement)) {
$dbh->disconnect;
die "ERROR: Failed to prepare SQL statement.\nSQL: $sqlStatement\nERROR MESSAGE: $DBI::errstr";
}
unless ($sth->execute) {
$dbh->disconnect;
die "ERROR: Failed to execute query.\nSQL: $sqlStatement\nERROR MESSAGE: $DBI::errstr";
}
while (( my $databaseName, my $databaseSize) = $sth->fetchrow) {
printf("    %-40s %20s\n", $databaseName, $databaseSize);  
}

print "\n";
$sth->finish;
print "Disconnecting from SQL Server.\n\n";
$dbh->disconnect;
exit(0);

[root@cacti SQLServer]# 

Thursday, November 28, 2013

Oracle - Listener



Examples:

-- SQL> ALTER SYSTEM SET service_names='svr_oracle_prd.com.br' SCOPE=MEMORY SID='orcl_prd';

-- SQL> show parameter service_names;

NAME     TYPE VALUE
------------------------------------ ----------- ------------------------------
service_names     string svr_oracle_prd.com.br




oracle@svr-oracle01 trace]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 28-NOV-2013 10:05:19

Copyright (c) 1991, 2011, Oracle.  All rights reserved.

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Start Date                27-NOV-2013 01:08:38
Uptime                    1 days 8 hr. 56 min. 40 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/grid/11.2.0/grid/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/svr-oracle01/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.20.57)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.20.21)(PORT=1521)))

Edit: 
vim | vi  $ORACLE_HOME/network/admin/tnsnames.ora



NAME_ALIAS_BASE =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = IP_BASE )(PORT = PORT_LISTENER ))
    (CONNECT_DATA =
    (SERVER = DEDICATED)
   (SERVICE_NAME = SERVICE_NAMES )
             )
    )






Wednesday, November 27, 2013

Oracle - CONNECT_PERL_CMD


use strict;
use warnings;


my $connect_string = 'username/password@server'; # connection to the DB
my $file = 'test.sql'; # location of SQL file. The file must end with "exit"

my $sqlcmd = "sqlplus -S $connect_string \@$file"; # sqlcommand
system $sqlcmd; # executes command

-

use warnings;
use DBI;
use strict;

my $user = 'system';
my $passwd = 'pass';
my $dbh = DBI->connect("dbi:Oracle:host=192.168.0.208;sid=ORAPRD;  port=1521", $user, $passwd)  || die "Database connection not made: $DBI::errstr";
$dbh->disconnect;

Thursday, April 25, 2013

Bytecode [ Perlcc is dead on RedHat 6.* -> PP new Solution ]


#Commands
CD_IN='cd'
CD_OUT='cd ..'
TAR='tar -xvzf'
PERL_MAKEFILE='perl Makefile.PL'
MAKE='make'
MAKE_INSTALL='make install'
CHMOD='chmod +x Makefile'

#Module
M1=IO-Compress-2.060
M2=Archive-Zip-1.30
M3=Getopt-ArgvFile-1.11
M4=Module-ScanDeps-1.10
M5=PAR-1.007
M6=PAR-Dist-0.49
M7=AutoLoader-5.73
M8=Compress-Raw-Zlib-2.060
M9=AutoLoader-5.73
M10=CPAN-Meta-Requirements-2.122
M11=CPAN-Meta-YAML-0.008
M12=JSON-PP-2.27202
M13=Parse-CPAN-Meta-1.4404
M14=version-0.9902
M15=CPAN-Meta-2.130880
M16=Perl-OSType-1.003
M17=Module-Metadata-1.000011
M18=Module-Build-0.4004
M19=Text-ParseWords-3.29
M20=Test-Harness-3.26
M21=Time-Local-1.2300
M22=File-Path-2.09
M23=File-Temp-0.2301
M24=Test-Simple-0.98
M25=PathTools-3.40
M26=ExtUtils-MakeMaker-6.66
M27=IO-1.25

#Uncompress
FILE_GZ=`ls *.gz`
for i in ${FILE_GZ} ; do \
       ${TAR} ${i}
done;

#Execute Install
for i in ${M1} ${M2} ${M3} ${M4} ${M5} ${M6} ${M7} ${M8} ${M9} ${M10} ${M11} ${M12} ${M13} ${M14} ${M15} ${M16} ${M17} ${M18} ${M19} ${M20} ${M21} ${M22} ${M23} ${M24} ${M25} ${M26} ${M27} ${M28} ${M29} ; do \
${CD_IN} ${i}
${PERL_MAKEFILE}
${CHMOD}
${MAKE}
${MAKE_INSTALL}
${CD_OUT}
done;








Wednesday, January 23, 2013

Perl with SQLServer -> =)


use DBI;

my $dsn = 'DBI:ODBC:Driver={SQL Server}';
my $host = 'WINSRV';
my $database = 'Relatorios';
my $user = 'sa';
my $auth = 'm1f1g1f4$';


my $dbh = DBI -> connect( "dbi:ODBC:driver={SQL Server};server={$host};Trusted Connection=yes, $user, $auth { PrintError => 0,RaiseError => 0,}") or die "\n\nthe mssql connection died with the following error: \n\n$DBI::errstr\n\n";

my $sth = $dbh->prepare('SELECT *  FROM sys.tables');

$sth->execute();

while(my @result = $sth->fetchrow_array() ){
        print join ("\t",@result),"\n";
}

$dbh->disconnect();




Tuesday, December 11, 2012

Rman / ORACLE


$rman target / nocatalog

Recovery Manager: Release 10.2.0.5.0 - Production on Tue Dec 11 16:05:05 2012

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

connected to target database: SFT (DBID=2981456125)
using target database control file instead of recovery catalog

RMAN> delete noprompt archivelog until time 'sysdate-2/24';

Thursday, November 29, 2012

Friday, November 9, 2012

Thursday, November 8, 2012

Windows [ Add Variables PATH ] Oracle


C:\Users\Administrador>sqlplus /nolog
'sqlplus' não é reconhecido como um comando interno
ou externo, um programa operável ou um arquivo em lotes.

C:\Users\Administrador>echo %PATH%
C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\strawberry\c\bin;C:\s
trawberry\perl\site\bin;C:\strawberry\perl\bin;C:\Windows\System32\WindowsPowerS
hell\v1.0\

C:\Users\Administrador>set PATH=%PATH%;C:\oraclexe\app\oracle\product\11.2.0\ser
ver\bin

C:\Users\Administrador>echo %PATH%
C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\strawberry\c\bin;C:\s
trawberry\perl\site\bin;C:\strawberry\perl\bin;C:\Windows\System32\WindowsPowerS
hell\v1.0\;C:\oraclexe\app\oracle\product\11.2.0\server\bin

C:\Users\Administrador>sqlplus /nolog

SQL*Plus: Release 11.2.0.2.0 Production on Qua Nov 7 01:27:48 2012

Copyright (c) 1982, 2010, Oracle.  All rights reserved.

SQL> connect sys as sysdba
Informe a senha:
Conectado.
SQL>
SQL>

Monday, October 1, 2012

Makefile [ Automation modules for installation ] PERL

#Commands
CD_IN='cd'
CD_OUT='cd ..'
TAR='tar -xvf'
PERL_MAKEFILE='perl Makefile.PL'
MAKE='make'
MAKE_INSTALL='make install'
CHMOD='chmod +x Makefile'

#Module
M1=List-MoreUtils-0.33
M2=ExtUtils-MakeMaker-6.62
M3=Perl-OSType-0.005
M4=Module-Metadata-1.000011
M5=PathTools-3.33
M6=Locale-Maketext-Simple-0.21
M7=Module-CoreList-2.73
M8=Module-Load-0.22
M9=Params-Check-0.36
M10=Module-Load-Conditional-0.54
M11=IPC-Cmd-0.78
M12=ExtUtils-CBuilder-0.280205
M13=ExtUtils-ParseXS-3.15
M14=Test-Simple-0.98
M15=Perl-OSType-1.002
M16=Test-Harness-3.25
M17=Compress-Raw-Bzip2-2.055
M18=Compress-Raw-Zlib-2.056
M19=IO-Compress-2.055
M20=IO-Zlib-1.10M25=ExtUtils-Install-1.54

M21=Package-Constants-0.02
M22=Algorithm-Diff-1.1902
M23=Text-Diff-1.41

M24=Archive-Tar-1.90
M25=ExtUtils-Install-1.54
M26=Module-Build-0.4003
M27=Config-IniFiles-2.77
M28=DBD-Oracle-1.50
M29=DBI-1.622

#Uncompress
FILE_GZ=`ls *.gz`
for i in ${FILE_GZ} ; do \
        ${TAR} ${i}
done;

#Execute Install
for i in ${M1} ${M2} ${M3} ${M4} ${M5} ${M6} ${M7} ${M8} ${M9} ${M10} ${M11} ${M12} ${M13} ${M14} ${M15} ${M16} ${M17} ${M18} ${M19} ${M20} ${M21} ${M22} ${M23} ${M24} ${M25} ${M26} ${M27} ${M28} ${M29} ; do \
        ${CD_IN} ${i}
        ${PERL_MAKEFILE}
        ${CHMOD}
        ${MAKE}
        ${MAKE_INSTALL}
        ${CD_OUT}
done;

#Delete Dir
DIR=`ls -d */`
for i in ${DIR}; do \
        rm -rf ${i}
done;

Friday, September 28, 2012

PERLCC MODULE


1.     List-MoreUtils-0.33.tar.gz
2.     ExtUtils-MakeMaker-6.62.tar.gz
3.     Perl-OSType-0.005.tar.gz
4.     Module-Metadata-1.000011.tar.gz
5.     PathTools-3.33.tar.gz
6.     Locale-Maketext-Simple-0.21.tar.gz
7.     Module-CoreList-2.73.tar.gz
8.     Module-Load-0.22.tar.gz
9.     Params-Check-0.36.tar.gz
10.  Module-Load-Conditional-0.54.tar.gz
11.  IPC-Cmd-0.78.tar.gz
12.  ExtUtils-CBuilder-0.280205.tar.gz
13.  ExtUtils-ParseXS-3.15.tar.gz
14.  Test-Simple-0.98.tar.gz
15.  Perl-OSType-1.002.tar.gz
16.  Test-Harness-3.25.tar.gz
17.  Compress-Raw-Bzip2-2.055.tar.gz
18.  Compress-Raw-Zlib-2.056.tar.gz
19.  IO-Compress-2.055.tar.gz
20.  IO-Zlib-1.10.tar.gz
21.  Package-Constants-0.02.tar.gz
22.  Algorithm-Diff-1.1902.tar.gz
23.  Text-Diff-1.41.tar.gz
24.  Archive-Tar-1.90.tar.gz
25.  ExtUtils-Install-1.54.tar.gz
26.  Module-Build-0.4003.tar.gz
27.  Config-IniFiles-2.77.tar.gz
28.  DBD-Oracle-1.50.tar.gz
29.  DBI-1.622.tar.gz

Friday, September 14, 2012

Wednesday, September 12, 2012

Perl - [ Create | Insert - DB Oracle ]


use strict;
use warnings;
use DBD::Oracle qw(:ora_types);
use DBI;

use constant SqlOracle => 'C:\oraclexe\app\oracle\product\10.2.0\server\BIN\sqlplus.exe\\';
use constant User => 'system';
use constant Pass => '12345';
use constant DB => 'XE';


print "Test Show Valeu : $0\n";


my $dbh = DBI->connect("dbi:Oracle:".DB,User,Pass) or die $!;

my $CreateTable = "CREATE TABLE EMPREGADO (codigo number(6) primary key, nome varchar2(25) not null, salario number(11,2))";

my $sth = $dbh->prepare($CreateTable);

$sth->execute();

$sth = $dbh->prepare( q{INSERT INTO EMPREGADO (codigo,nome,salario) VALUES(?,?,?)}) or die $dbh->errstr;

open(IN,"pessoas.txt") or die $!;

while(<IN>){
chomp;
my($codigo,$nome,$salario) = split (/\t/,$_);
$sth->execute($codigo,$nome,$salario) or die $dbh->errstr;

}
close(IN);

$dbh->disconnect;

------------------------------------------------------------------------------------------------------------


SQL> desc empregado;
 Nome                                      Nulo?    Tipo
 ----------------------------------------- -------- ----------------------------

 CODIGO                                    NOT NULL NUMBER(6)
 NOME                                      NOT NULL VARCHAR2(25)
 SALARIO                                            NUMBER(11,2)

SQL> select * from empregado;

    CODIGO NOME                         SALARIO
---------- ------------------------- ----------
         1 joao                              10
         2 maria                             80
         3 jose                              60

------------------------------------------------------------------------------------------------------------

pessoas.txt

1 joao 10
2 maria 80
3 jose 60


Perl - [ Perl DBI Oracle connect from Windows ]

use strict;
use warnings;
use DBD::Oracle qw(:ora_types);
use DBI;

use constant SqlOracle => 'C:\oraclexe\app\oracle\product\10.2.0\server\BIN\sqlplus.exe\\';
use constant User => 'system';
use constant Pass => '12345';
use constant DB => 'XE';

print "Create connection Oracle Database 10g Express Edition  ... 1\n";
my $dbh = DBI->connect("dbi:Oracle:".DB,User,Pass) or die $!;

print "Disconnect Oracle Database 10g Express Edition ...\n";
$dbh->disconnect;

print "Create connection Oracle Database 10g Express Edition  ... 2\n";
$dbh = DBI->connect("dbi:Oracle:".DB,User."/".Pass) or die $!;

print "Disconnect Oracle Database 10g Express Edition ...\n";
$dbh->disconnect;
print "Create connection Oracle Database 10g Express Edition  ... 3\n";
$dbh = DBI->connect("dbi:Oracle:",User."@".DB,Pass) or die $!;

print "Disconnect Oracle Database 10g Express Edition ...\n";
$dbh->disconnect;

Tuesday, September 11, 2012

Perl - USE [ Copy | Move | Constant ]


#!/usr/bin/perl
use strict;
use warnings;

use  File::Copy;
use constant WORK=>'/Users/als/';

copy(WORK."tmp.txt",WORK."tmp.txt.copy") or die "Copy failed $!";

move(WORK."tmp.txt",WORK."Desktop/tmp.txt") or die "Move failed $!";

print "Print constant\t:",WORK;