Server IP : 103.119.228.120 / Your IP : 3.149.24.192 Web Server : Apache System : Linux v8.techscape8.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64 User : nobody ( 99) PHP Version : 5.6.40 Disable Function : shell_exec,symlink,system,exec,proc_get_status,proc_nice,proc_terminate,define_syslog_variables,syslog,openlog,closelog,escapeshellcmd,passthru,ocinum cols,ini_alter,leak,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dl,dll,myshellexec,proc_open,socket_bind,proc_close,escapeshellarg,parse_ini_filepopen,fpassthru,exec,passthru,escapeshellarg,escapeshellcmd,proc_close,proc_open,ini_alter,popen,show_source,proc_nice,proc_terminate,proc_get_status,proc_close,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,dl,symlink,shell_exec,system,dl,passthru,escapeshellarg,escapeshellcmd,myshellexec,c99_buff_prepare,c99_sess_put,fpassthru,getdisfunc,fx29exec,fx29exec2,is_windows,disp_freespace,fx29sh_getupdate,fx29_buff_prepare,fx29_sess_put,fx29shexit,fx29fsearch,fx29ftpbrutecheck,fx29sh_tools,fx29sh_about,milw0rm,imagez,sh_name,myshellexec,checkproxyhost,dosyayicek,c99_buff_prepare,c99_sess_put,c99getsource,c99sh_getupdate,c99fsearch,c99shexit,view_perms,posix_getpwuid,posix_getgrgid,posix_kill,parse_perms,parsesort,view_perms_color,set_encoder_input,ls_setcheckboxall,ls_reverse_all,rsg_read,rsg_glob,selfURL,dispsecinfo,unix2DosTime,addFile,system,get_users,view_size,DirFiles,DirFilesWide,DirPrintHTMLHeaders,GetFilesTotal,GetTitles,GetTimeTotal,GetMatchesCount,GetFileMatchesCount,GetResultFiles,fs_copy_dir,fs_copy_obj,fs_move_dir,fs_move_obj,fs_rmdir,SearchText,getmicrotime MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/local/ssl/share/perl5/vendor_perl/CPANPLUS/Internals/Source/SQLite/ |
Upload File : |
package CPANPLUS::Internals::Source::SQLite::Tie; use strict; use warnings; use CPANPLUS::Error; use CPANPLUS::Module; use CPANPLUS::Module::Fake; use CPANPLUS::Module::Author::Fake; use CPANPLUS::Internals::Constants; use Params::Check qw[check]; use Module::Load::Conditional qw[can_load]; use Locale::Maketext::Simple Class => 'CPANPLUS', Style => 'gettext'; use vars qw[@ISA $VERSION]; $VERSION = "0.9138"; require Tie::Hash; push @ISA, 'Tie::StdHash'; sub TIEHASH { my $class = shift; my %hash = @_; my $tmpl = { dbh => { required => 1 }, table => { required => 1 }, key => { required => 1 }, cb => { required => 1 }, offset => { default => 0 }, }; my $args = check( $tmpl, \%hash ) or return; my $obj = bless { %$args, store => {} } , $class; return $obj; } sub FETCH { my $self = shift; my $key = shift or return; my $dbh = $self->{dbh}; my $cb = $self->{cb}; my $table = $self->{table}; ### did we look this one up before? if( my $obj = $self->{store}->{$key} ) { return $obj; } my $res = $dbh->query( "SELECT * from $table where $self->{key} = ?", $key ) or do { error( $dbh->error ); return; }; my $href = $res->hash; ### get rid of the primary key delete $href->{'id'}; ### no results? return unless keys %$href; ### expand author if needed ### XXX no longer generic :( if( $table eq 'module' ) { $href->{author} = $cb->author_tree( $href->{author } ) or return; } my $class = { module => 'CPANPLUS::Module', author => 'CPANPLUS::Module::Author', }->{ $table }; my $obj = $self->{store}->{$key} = $class->new( %$href, _id => $cb->_id ); return $obj; } sub STORE { my $self = shift; my $key = shift; my $val = shift; $self->{store}->{$key} = $val; } 1; sub FIRSTKEY { my $self = shift; my $dbh = $self->{'dbh'}; my $res = $dbh->query( "select $self->{key} from $self->{table} order by $self->{key} limit 1" ); $self->{offset} = 0; my $key = $res->flat->[0]; return $key; } sub NEXTKEY { my $self = shift; my $dbh = $self->{'dbh'}; my $res = $dbh->query( "select $self->{key} from $self->{table} ". "order by $self->{key} limit 1 offset $self->{offset}" ); $self->{offset} +=1; my $key = $res->flat->[0]; my $val = $self->FETCH( $key ); ### use each() semantics return wantarray ? ( $key, $val ) : $key; } sub EXISTS { !!$_[0]->FETCH( $_[1] ) } sub SCALAR { my $self = shift; my $dbh = $self->{'dbh'}; my $res = $dbh->query( "select count(*) from $self->{table}" ); return $res->flat; } ### intentionally left blank sub DELETE { } sub CLEAR { }